Skip to content

Commit

Permalink
Added two extra test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed Feb 15, 2015
1 parent bdba3ad commit bcf84ae
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 1 deletion.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/bug01105.phpt → tests/bug01105-001.phpt
Expand Up @@ -3,7 +3,7 @@ Test for bug #1105: Setting properties without specifying a type only works in t
--FILE--
<?php
require 'dbgp/dbgpclient.php';
$data = file_get_contents(dirname(__FILE__) . '/bug01105.inc');
$data = file_get_contents(dirname(__FILE__) . '/bug01105-001.inc');

$commands = array(
'step_into',
Expand Down
21 changes: 21 additions & 0 deletions tests/bug01105-002.inc
@@ -0,0 +1,21 @@
<?php
class foo {
static function scope0() {
$var = 'scope0';
$break = null;
}

static function scope1() {
$var = 'scope1';
self::scope0();
}

static function scope2() {
$var = 'scope2';
self::scope1();
}
}

foo::scope2();

?>
65 changes: 65 additions & 0 deletions tests/bug01105-002.phpt
@@ -0,0 +1,65 @@
--TEST--
Test for bug #1105: Setting properties without specifying a type only works in topmost frame
--FILE--
<?php
require 'dbgp/dbgpclient.php';
$data = file_get_contents(dirname(__FILE__) . '/bug01105-002.inc');

$commands = array(
'step_into',
'breakpoint_set -t line -n 5',
'run',
'property_set -n $var -d 0 -- ' . base64_encode('"scope0-modified"'),
'property_set -n $var -d 1 -- ' . base64_encode('"scope1-modified"'),
'property_set -n $var -d 2 -- ' . base64_encode('"scope2-modified"'),
'property_get -n $var -d 0',
'property_get -n $var -d 1',
'property_get -n $var -d 2',
'detach',
);

dbgpRun( $data, $commands );
?>
--EXPECTF--
<?xml version="1.0" encoding="iso-8859-1"?>
<init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///tmp/xdebug-dbgp-test.php" language="PHP" protocol_version="1.0" appid="" idekey=""><engine version=""><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2099 by Derick Rethans]]></copyright></init>

-> step_into -i 1
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="1" status="break" reason="ok"><xdebug:message filename="file:///tmp/xdebug-dbgp-test.php" lineno="2"></xdebug:message></response>

-> breakpoint_set -i 2 -t line -n 5
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="2" id=""></response>

-> run -i 3
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="3" status="break" reason="ok"><xdebug:message filename="file:///tmp/xdebug-dbgp-test.php" lineno="5"></xdebug:message></response>

-> property_set -i 4 -n $var -d 0 -- InNjb3BlMC1tb2RpZmllZCI=
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="property_set" transaction_id="4" success="1"></response>

-> property_set -i 5 -n $var -d 1 -- InNjb3BlMS1tb2RpZmllZCI=
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="property_set" transaction_id="5" success="1"></response>

-> property_set -i 6 -n $var -d 2 -- InNjb3BlMi1tb2RpZmllZCI=
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="property_set" transaction_id="6" success="1"></response>

-> property_get -i 7 -n $var -d 0
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="property_get" transaction_id="7"><property name="$var" fullname="$var" address="" type="string" size="15" encoding="base64"><![CDATA[c2NvcGUwLW1vZGlmaWVk]]></property></response>

-> property_get -i 8 -n $var -d 1
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="property_get" transaction_id="8"><property name="$var" fullname="$var" address="" type="string" size="15" encoding="base64"><![CDATA[c2NvcGUxLW1vZGlmaWVk]]></property></response>

-> property_get -i 9 -n $var -d 2
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="property_get" transaction_id="9"><property name="$var" fullname="$var" address="" type="string" size="15" encoding="base64"><![CDATA[c2NvcGUyLW1vZGlmaWVk]]></property></response>

-> detach -i 10
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="detach" transaction_id="10" status="stopping" reason="ok"></response>
22 changes: 22 additions & 0 deletions tests/bug01105-003.inc
@@ -0,0 +1,22 @@
<?php
class foo {
function scope0() {
$var = 'scope0';
$break = null;
}

function scope1() {
$var = 'scope1';
$this->scope0();
}

function scope2() {
$var = 'scope2';
$this->scope1();
}
}

$f = new foo;
$f->scope2();

?>
65 changes: 65 additions & 0 deletions tests/bug01105-003.phpt
@@ -0,0 +1,65 @@
--TEST--
Test for bug #1105: Setting properties without specifying a type only works in topmost frame
--FILE--
<?php
require 'dbgp/dbgpclient.php';
$data = file_get_contents(dirname(__FILE__) . '/bug01105-003.inc');

$commands = array(
'step_into',
'breakpoint_set -t line -n 5',
'run',
'property_set -n $var -d 0 -- ' . base64_encode('"scope0-modified"'),
'property_set -n $var -d 1 -- ' . base64_encode('"scope1-modified"'),
'property_set -n $var -d 2 -- ' . base64_encode('"scope2-modified"'),
'property_get -n $var -d 0',
'property_get -n $var -d 1',
'property_get -n $var -d 2',
'detach',
);

dbgpRun( $data, $commands );
?>
--EXPECTF--
<?xml version="1.0" encoding="iso-8859-1"?>
<init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///tmp/xdebug-dbgp-test.php" language="PHP" protocol_version="1.0" appid="" idekey=""><engine version=""><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2099 by Derick Rethans]]></copyright></init>

-> step_into -i 1
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="1" status="break" reason="ok"><xdebug:message filename="file:///tmp/xdebug-dbgp-test.php" lineno="2"></xdebug:message></response>

-> breakpoint_set -i 2 -t line -n 5
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="2" id=""></response>

-> run -i 3
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="3" status="break" reason="ok"><xdebug:message filename="file:///tmp/xdebug-dbgp-test.php" lineno="5"></xdebug:message></response>

-> property_set -i 4 -n $var -d 0 -- InNjb3BlMC1tb2RpZmllZCI=
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="property_set" transaction_id="4" success="1"></response>

-> property_set -i 5 -n $var -d 1 -- InNjb3BlMS1tb2RpZmllZCI=
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="property_set" transaction_id="5" success="1"></response>

-> property_set -i 6 -n $var -d 2 -- InNjb3BlMi1tb2RpZmllZCI=
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="property_set" transaction_id="6" success="1"></response>

-> property_get -i 7 -n $var -d 0
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="property_get" transaction_id="7"><property name="$var" fullname="$var" address="" type="string" size="15" encoding="base64"><![CDATA[c2NvcGUwLW1vZGlmaWVk]]></property></response>

-> property_get -i 8 -n $var -d 1
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="property_get" transaction_id="8"><property name="$var" fullname="$var" address="" type="string" size="15" encoding="base64"><![CDATA[c2NvcGUxLW1vZGlmaWVk]]></property></response>

-> property_get -i 9 -n $var -d 2
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="property_get" transaction_id="9"><property name="$var" fullname="$var" address="" type="string" size="15" encoding="base64"><![CDATA[c2NvcGUyLW1vZGlmaWVk]]></property></response>

-> detach -i 10
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="detach" transaction_id="10" status="stopping" reason="ok"></response>

0 comments on commit bcf84ae

Please sign in to comment.