Skip to content

Commit 45d1d62

Browse files
committed
Fixed tests
1 parent 608ef63 commit 45d1d62

File tree

4 files changed

+18
-53
lines changed

4 files changed

+18
-53
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ class ResultFormatterHelperSpec extends ObjectBehavior
2020
{
2121
public function let(
2222
TextHelper $textHelper,
23-
TableHelper $tableHelper,
2423
Config $config
2524
)
2625
{
27-
$this->beConstructedWith($textHelper, $tableHelper, $config);
26+
$this->beConstructedWith($textHelper, $config);
2827
}
2928

3029
public function it_is_initializable()

tests/PHPCR/Shell/Application/SessionApplicationTest.php

Lines changed: 0 additions & 29 deletions
This file was deleted.

tests/PHPCR/Shell/Helper/NodeHelperTest.php

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,19 @@
1111

1212
namespace PHPCR\Shell\Console\Helper;
1313

14+
use PHPCR\NodeInterface;
15+
1416
class NodeHelperTest extends \PHPUnit_Framework_TestCase
1517
{
1618
protected $nodeHelper;
1719

1820
public function setUp()
1921
{
20-
$this->session = $this->getMock('PHPCR\SessionInterface');
21-
$this->helper = new NodeHelper($this->session);
22-
$this->node = $this->getMockBuilder('Jackalope\Node')
23-
->disableOriginalConstructor()->getMock();
22+
$this->session = $this->prophesize('PHPCR\SessionInterface');
23+
$this->helper = new NodeHelper($this->session->reveal());
24+
$this->node = $this->prophesize(NodeInterface::class);
2425

25-
$this->nodeType1 = $this->getMock('PHPCR\NodeType\NodeTypeInterface');
26+
$this->nodeType1 = $this->prophesize('PHPCR\NodeType\NodeTypeInterface');
2627
}
2728

2829
public function provideAssertNodeIsVersionable()
@@ -38,21 +39,18 @@ public function provideAssertNodeIsVersionable()
3839
*/
3940
public function testAssertNodeIsVersionable($isVersionable)
4041
{
41-
$this->node->expects($this->once())
42-
->method('getMixinNodeTypes')
43-
->will($this->returnValue(array(
44-
$this->nodeType1,
45-
)));
42+
$this->node->getMixinNodeTypes()->willReturn([
43+
$this->nodeType1->reveal()
44+
]);
45+
$this->node->getPath()->willReturn('/');
4646

4747
$nodeTypeName = $isVersionable ? 'mix:versionable' : 'nt:foobar';
4848

49-
$this->nodeType1->expects($this->once())
50-
->method('getName')
51-
->will($this->returnValue($nodeTypeName));
49+
$this->nodeType1->getName()->willReturn($nodeTypeName);
5250

5351
if (false == $isVersionable) {
5452
$this->setExpectedException('\OutOfBoundsException', 'is not versionable');
5553
}
56-
$this->helper->assertNodeIsVersionable($this->node);
54+
$this->helper->assertNodeIsVersionable($this->node->reveal());
5755
}
5856
}

tests/PHPCR/Shell/Phpcr/PhpcrSessionTest.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ class PhpcrSessionTest extends \Phpunit_Framework_TestCase
1818
{
1919
public function setUp()
2020
{
21-
$this->phpcr = $this->getMock('PHPCR\SessionInterface');
22-
$this->session = new PhpcrSession($this->phpcr);
21+
$this->phpcr = $this->prophesize('PHPCR\SessionInterface');
22+
$this->session = new PhpcrSession($this->phpcr->reveal());
2323
}
2424

2525
public function provideChdir()
@@ -80,12 +80,9 @@ public function provideMv()
8080
*/
8181
public function testMv($cwd, $relSrc, $relTar, $expSrc, $expTar)
8282
{
83-
$this->phpcr->expects($this->once())
84-
->method('move')
85-
->with($expSrc, $expTar);
86-
$this->phpcr->expects($this->once())
87-
->method('getNode')
88-
->will($this->throwException(new PathNotFoundException()));
83+
$this->phpcr->move($expSrc, $expTar)->shouldBeCalled();
84+
85+
$this->phpcr->getNode('/bar', -1)->willThrow(new PathNotFoundException());
8986
$this->session->setCwd($cwd);
9087
$this->session->move($relSrc, $relTar);
9188
}

0 commit comments

Comments
 (0)