Skip to content

Commit a16f419

Browse files
Fix phpunit compatibility
1 parent 1453f11 commit a16f419

File tree

6 files changed

+20
-10
lines changed

6 files changed

+20
-10
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
vendor
22
composer.lock
33
phpcr.phar
4+
.phpunit.result.cache

phpunit.xml.dist

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
bootstrap="vendor/autoload.php"
77
>
88

9+
<php>
10+
<env name="SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT" value="1"/>
11+
</php>
12+
913
<testsuites>
1014
<testsuite name="PHPCR Shell Test Suite">
1115
<directory>./tests</directory>

tests/PHPCR/Shell/Helper/EditorHelperTest.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212

1313
namespace PHPCR\Shell\Console\Helper;
1414

15-
class EditorHelperTest extends \PHPUnit_Framework_TestCase
15+
use PHPUnit\Framework\TestCase;
16+
17+
class EditorHelperTest extends TestCase
1618
{
1719
protected $helper;
1820

@@ -40,11 +42,10 @@ public function testFromValue()
4042
);
4143
}
4244

43-
/**
44-
* @expectedException \RuntimeException
45-
*/
4645
public function testFromValueNoEditor()
4746
{
47+
$this->expectException(\RuntimeException::class);
48+
4849
putenv('EDITOR=');
4950
$res = $this->helper->fromString('asd');
5051
}

tests/PHPCR/Shell/Helper/NodeHelperTest.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
namespace PHPCR\Shell\Console\Helper;
1414

1515
use PHPCR\NodeInterface;
16+
use PHPUnit\Framework\TestCase;
1617

17-
class NodeHelperTest extends \PHPUnit_Framework_TestCase
18+
class NodeHelperTest extends TestCase
1819
{
1920
protected $nodeHelper;
2021

@@ -41,10 +42,10 @@ public function provideAssertNodeIsVersionable()
4142
public function testAssertNodeIsVersionable($isVersionable)
4243
{
4344
$this->node->getPath()->willReturn('/');
44-
$this->node->isNodeType('mix:versionable')->willReturn($isVersionable);
45+
$this->node->isNodeType('mix:versionable')->willReturn($isVersionable)->shouldBeCalled();
4546

4647
if (false == $isVersionable) {
47-
$this->setExpectedException('\OutOfBoundsException', 'is not versionable');
48+
$this->expectException('\OutOfBoundsException', 'is not versionable');
4849
}
4950
$this->helper->assertNodeIsVersionable($this->node->reveal());
5051
}

tests/PHPCR/Shell/Helper/TextHelperTest.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212

1313
namespace PHPCR\Shell\Console\Helper;
1414

15-
class TextHelperTest extends \PHPUnit_Framework_TestCase
15+
use PHPUnit\Framework\TestCase;
16+
17+
class TextHelperTest extends TestCase
1618
{
1719
protected $textHelper;
1820

@@ -76,7 +78,7 @@ public function provideTruncate()
7678
public function testTruncate($text, $length, $alignment, $truncateString, $expected, $expectedException = null)
7779
{
7880
if ($expectedException) {
79-
$this->setExpectedException('InvalidArgumentException', $expectedException);
81+
$this->expectException('InvalidArgumentException', $expectedException);
8082
}
8183
$res = $this->textHelper->truncate($text, $length, $alignment, $truncateString);
8284
$this->assertEquals($expected, $res);

tests/PHPCR/Shell/Phpcr/PhpcrSessionTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
namespace PHPCR\Shell\Phpcr;
1414

1515
use PHPCR\PathNotFoundException;
16+
use PHPUnit\Framework\TestCase;
1617

17-
class PhpcrSessionTest extends \Phpunit_Framework_TestCase
18+
class PhpcrSessionTest extends TestCase
1819
{
1920
public function setUp()
2021
{

0 commit comments

Comments
 (0)