Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Add visual test for comparison of private members of objects
Browse files Browse the repository at this point in the history
  • Loading branch information
dgheath committed Jul 29, 2009
1 parent bc47dd8 commit 389662f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ protected function getMembers($object) {
$members[$property->getName()] = $property->getValue($object);
} catch (ReflectionException $e) {
$members[$property->getName()] =
$property->getPrivatePropertyNoMatterWhat($property->getName(), $object);
$this->getPrivatePropertyNoMatterWhat($property->getName(), $object);
}
}
return $members;
Expand Down
28 changes: 24 additions & 4 deletions test/visual/visual_errors.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
require_once('../../shell_tester.php');
require_once('../../mock_objects.php');
require_once('../../xml.php');
require_once('../../autorun.php');
require_once(dirname(__FILE__) . '/../../shell_tester.php');
require_once(dirname(__FILE__) . '/../../mock_objects.php');
require_once(dirname(__FILE__) . '/../../xml.php');
require_once(dirname(__FILE__) . '/../../autorun.php');

class VisualTestOfErrors extends UnitTestCase {

Expand Down Expand Up @@ -62,4 +62,24 @@ function ouch() {
eval('throw new Exception("Ouch!");');
}
}

class OpaqueContainer {
private $stuff;
private $value;

public function __construct($value) {
$this->value = $value;
}
}

class VisualTestOfObjectComparison extends UnitTestCase {
function skip() {
$this->skipUnless(version_compare(phpversion(), '5') >= 0);
}

function testDifferenceBetweenPrivateMembersCanBeDescribed() {
$this->assertIdentical(new OpaqueContainer(1), new OpaqueContainer(2));
}

}
?>

0 comments on commit 389662f

Please sign in to comment.