Skip to content

Commit 83b42b2

Browse files
middlebrainRonald Appelfelder
authored and
Ronald Appelfelder
committed
Fix failing phpunit and behat tests
Refactor tests after fixing bug in the Console\Helper\NodeHelper::nodeHasMixinType function
1 parent 23c1a11 commit 83b42b2

File tree

2 files changed

+7
-31
lines changed

2 files changed

+7
-31
lines changed

spec/PHPCR/Shell/Console/Helper/NodeHelperSpec.php

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,37 +24,19 @@ public function it_is_initializable()
2424
}
2525

2626
public function it_should_provide_a_method_to_determine_if_a_node_has_a_given_mixin(
27-
NodeInterface $node,
28-
NodeTypeInterface $mixin1,
29-
NodeTypeInterface $mixin2,
30-
NodeTypeInterface $mixin3
27+
NodeInterface $node
3128
) {
32-
$node->getMixinNodeTypes()->willReturn([
33-
$mixin1, $mixin2, $mixin3,
34-
]);
35-
36-
$mixin1->getName()->willReturn('mixin1');
37-
$mixin2->getName()->willReturn('mixin1');
38-
$mixin3->getName()->willReturn('mixin3');
39-
40-
$this->nodeHasMixinType($node, 'mixin1')->shouldReturn(true);
41-
$this->nodeHasMixinType($node, 'mixin5')->shouldReturn(false);
29+
$node->isNodeType('mixin1')->willReturn(true);
30+
$node->isNodeType('mixin2')->willReturn(false);
4231
}
4332

4433
public function it_should_provide_a_method_to_determine_if_a_node_is_versionable(
4534
NodeInterface $nodeVersionable,
46-
NodeInterface $nodeNotVersionable,
47-
NodeTypeInterface $mixin1,
48-
NodeTypeInterface $mixin2
35+
NodeInterface $nodeNotVersionable
4936
) {
50-
$nodeVersionable->getMixinNodeTypes()->willReturn([
51-
$mixin1, $mixin2,
52-
]);
53-
$nodeNotVersionable->getMixinNodeTypes()->willReturn([
54-
$mixin2,
55-
]);
5637
$nodeNotVersionable->getPath()->willReturn('foobar');
57-
$mixin1->getName()->willReturn('mix:versionable');
38+
$nodeVersionable->isNodeType('mix:versionable')->willReturn(true);
39+
$nodeNotVersionable->isNodeType('mix:versionable')->willReturn(false);
5840
$this->assertNodeIsVersionable($nodeVersionable)->shouldReturn(null);
5941

6042
try {

tests/PHPCR/Shell/Helper/NodeHelperTest.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,8 @@ public function provideAssertNodeIsVersionable()
4040
*/
4141
public function testAssertNodeIsVersionable($isVersionable)
4242
{
43-
$this->node->getMixinNodeTypes()->willReturn([
44-
$this->nodeType1->reveal(),
45-
]);
4643
$this->node->getPath()->willReturn('/');
47-
48-
$nodeTypeName = $isVersionable ? 'mix:versionable' : 'nt:foobar';
49-
50-
$this->nodeType1->getName()->willReturn($nodeTypeName);
44+
$this->node->isNodeType('mix:versionable')->willReturn($isVersionable);
5145

5246
if (false == $isVersionable) {
5347
$this->setExpectedException('\OutOfBoundsException', 'is not versionable');

0 commit comments

Comments
 (0)