Skip to content

Commit e228624

Browse files
committed
Added abstract node to workaround phpunit pb. ther minor fixes
1 parent 8f78d09 commit e228624

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

src/PHPCR/Util/Console/Command/WorkspacePurgeCommand.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8484

8585
$output->writeln(sprintf('<info>Purging workspace:</info> %s', $workspaceName));
8686

87-
// Note that this is bad for testing purposes, we HAVE to
88-
// use the concrete implementation of NodeHelper and mocking it
89-
// is spreading behvioral dependencies. Even if we move it to
90-
// the CommandHelper class, we need to test that class and have
91-
// the same problem again.
87+
// Using the static NodeHelper is bad for testing as we cannot mock it.
9288
NodeHelper::purgeWorkspace($session);
9389
$session->save();
9490

tests/PHPCR/Tests/Util/Console/Command/BaseCommandTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
use Symfony\Component\Console\Helper\HelperSet;
99
use PHPCR\Util\Console\Helper\PhpcrHelper;
1010

11+
require_once(__DIR__.'/Stubb/AbstractNode.php');
12+
1113
abstract class BaseCommandTest extends \PHPUnit_Framework_TestCase
1214
{
1315
public function setUp()
@@ -16,9 +18,7 @@ public function setUp()
1618
$this->workspace = $this->getMock('PHPCR\WorkspaceInterface');
1719
$this->repository = $this->getMock('PHPCR\RepositoryInterface');
1820

19-
$this->node1 = $this->getMockBuilder('Jackalope\Node')
20-
->disableOriginalConstructor()
21-
->getMock();
21+
$this->node1 = $this->getMock('PHPCR\Tests\Util\Console\Command\Stubb\AbstractNode');
2222

2323
$this->dumperHelper = $this->getMockBuilder(
2424
'PHPCR\Util\Console\Helper\PhpcrConsoleDumperHelper'

tests/PHPCR/Tests/Util/Console/Command/NodeMoveCommandTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ public function provideCommand()
1515
}
1616

1717
/**
18-
* Note that this test isn't very conclusive. This should
19-
* be a functional test.
20-
*
2118
* @dataProvider provideCommand
2219
*/
2320
public function testCommand($args)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace PHPCR\Tests\Util\Console\Command\Stubb;
4+
5+
use PHPCR\NodeInterface;
6+
7+
abstract class AbstractNode implements \Iterator, NodeInterface
8+
{
9+
}

0 commit comments

Comments
 (0)