Skip to content
Permalink
Browse files

Adding test for using __debugInfo in Debugger

  • Loading branch information...
lorenzo committed Mar 8, 2014
1 parent c257263 commit f7b0912e78fcfc00d2f26a445949d68ec5ccd7ef
Showing with 32 additions and 0 deletions.
  1. +32 −0 tests/TestCase/Utility/DebuggerTest.php
@@ -28,6 +28,14 @@
class DebuggerTestCaseDebugger extends Debugger {
}
class DebuggableThing {
public function __debugInfo() {
return ['foo' => 'bar', 'inner' => new self()];
}
}
/**
* DebuggerTest class
*
@@ -623,4 +631,28 @@ public function testTraceExclude() {
));
$this->assertNotRegExp('/^Cake\\\Test\\\TestCase\\\Utility\\\DebuggerTest::testTraceExclude/', $result);
}
/**
* Tests that __debugInfo is used when available
*
* @return void
*/
public function testDebugInfo() {
$object = new DebuggableThing();
$result = Debugger::exportVar($object, 2);
$expected =<<<eos
object(Cake\Test\TestCase\Utility\DebuggableThing) {
'foo' => 'bar',
'inner' => object(Cake\Test\TestCase\Utility\DebuggableThing) {
[maximum depth reached]
}
}
eos;
$this->assertEquals($expected, $result);
}
}

0 comments on commit f7b0912

Please sign in to comment.
You can’t perform that action at this time.