public function testDebugResult() { $data = (object) ['prop' => ['sub' => ['resource' => fopen(__FILE__, 'r')], 'test' => null], 'test' => false, 'closure' => function () { }]; $SUT = $this->debugger->debug($data); $actual = $SUT->getItems(); $expected = [new ResultItem($data, new ObjectType()), new ResultItem($data->prop, new ArrayType(), ['{root}->prop']), new ResultItem($data->test, new PrimitiveType(), ['{root}->test']), new ResultItem($data->closure, new ClosureType(), ['{root}->closure']), new ResultItem($data->prop['sub'], new ArrayType(), ['{root}->prop[sub]']), new ResultItem($data->prop['test'], new PrimitiveType(), ['{root}->prop[test]']), new ResultItem($data->prop['sub']['resource'], new ResourceType(), ['{root}->prop[sub][resource]'])]; $this->assertEquals($expected, $actual); }
public function testItHandlesCircularReferencesCorrectly() { $a = new stdClass(); $b = new stdClass(); $a->bRef = $b; $b->aRef = $a; $nodes = $this->SUT->debug($a)->getRawNodes(); $this->assertCount(2, $nodes); $this->assertCount(1, $nodes[0]->getChildNodes()); $this->assertCount(1, $nodes[1]->getChildNodes()); $this->assertSame($nodes[1], $nodes[0]->getChildNodes()['bRef']); $this->assertSame($nodes[0], $nodes[1]->getChildNodes()['aRef']); }