Skip to content

Commit 9360d81

Browse files
committed
Merge pull request #69 from dantleech/show_props_test
Added test for show_props
2 parents 4c27826 + e358db4 commit 9360d81

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

tests/PHPCR/Tests/Util/Console/Helper/PhpcrConsoleDumperHelperTest.php

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,46 @@ public function setUp()
1010
$this->helper = new PhpcrConsoleDumperHelper;
1111
}
1212

13-
public function testHelper()
13+
public function provideHelper()
1414
{
15-
$tw = $this->helper->getTreeWalker($this->output, array());
15+
return array(
16+
array(array()),
17+
array(array(
18+
'show_props' => true,
19+
)),
20+
);
21+
}
22+
23+
/**
24+
* @dataProvider provideHelper
25+
*/
26+
public function testGetTreeWalker($options)
27+
{
28+
$options = array_merge(array(
29+
'dump_uuids' => false,
30+
'ref_format' => 'uuid',
31+
'show_props' => false,
32+
'show_sys_nodes' => false,
33+
), $options);
34+
35+
$tw = $this->helper->getTreeWalker($this->output, $options);
1636
$this->assertInstanceOf(
1737
'PHPCR\Util\TreeWalker',
1838
$tw
1939
);
40+
41+
$refl = new \ReflectionClass($tw);
42+
$propVisitorProp = $refl->getProperty('propertyVisitor');
43+
$propVisitorProp->setAccessible(true);
44+
$propVisitor = $propVisitorProp->getValue($tw);
45+
46+
if ($options['show_props'] === true) {
47+
$this->assertInstanceOf(
48+
'PHPCR\Util\Console\Helper\TreeDumper\ConsoleDumperPropertyVisitor',
49+
$propVisitor
50+
);
51+
} else {
52+
$this->assertNull($propVisitor);
53+
}
2054
}
2155
}

0 commit comments

Comments
 (0)