Skip to content

Commit 649c2b1

Browse files
Fix phpunit compatibility
1 parent 2cda2db commit 649c2b1

8 files changed

+20
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ composer.lock
22
vendor
33
tests/data
44
tests/migrations
5+
.phpunit.result.cache

phpunit.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
>
88
<php>
99
<env name="SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT" value="1"/>
10+
<env name="SYMFONY_PHPUNIT_REMOVE" value="symfony/yaml"/>
1011
</php>
1112

1213
<testsuites>

tests/BaseTestCase.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313

1414
use Jackalope\RepositoryFactoryFilesystem;
1515
use PHPCR\SimpleCredentials;
16+
use PHPUnit\Framework\TestCase;
1617
use Symfony\Component\Filesystem\Filesystem;
1718

18-
class BaseTestCase extends \PHPUnit_Framework_TestCase
19+
class BaseTestCase extends TestCase
1920
{
2021
protected $session;
2122

tests/Functional/MigrationTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace PHPCR\Migrations\tests\Functional;
1313

1414
use PHPCR\Migrations\BaseTestCase;
15+
use PHPCR\Migrations\Exception\MigratorException;
1516
use PHPCR\Migrations\Migrator;
1617
use PHPCR\Migrations\VersionFinder;
1718
use PHPCR\Migrations\VersionStorage;
@@ -161,15 +162,16 @@ public function testInitialize()
161162

162163
/**
163164
* It should throw an exception if trying to reiniitialize.
164-
*
165-
* @expectedException PHPCR\Migrations\Exception\MigratorException
166-
* @expectedExceptionMessage Will not re-initialize
167165
*/
168166
public function testReinitialize()
169167
{
170168
$this->addVersion(self::VERSION1);
171169
$this->addVersion(self::VERSION2);
170+
172171
$this->getMigrator()->initialize();
172+
173+
$this->expectException(MigratorException::class);
174+
$this->expectExceptionMessage('Will not re-initialize');
173175
$this->getMigrator()->initialize();
174176
}
175177

tests/Unit/MigratorFactoryTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
use PHPCR\Migrations\VersionFinder;
1818
use PHPCR\Migrations\VersionStorage;
1919
use PHPCR\SessionInterface;
20+
use PHPUnit\Framework\TestCase;
2021

21-
class MigratorFactoryTest extends \PHPUnit_Framework_TestCase
22+
class MigratorFactoryTest extends TestCase
2223
{
2324
public function testFactory()
2425
{

tests/Unit/MigratorUtilTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
namespace PHPCR\Migrations\tests\Unit;
1313

1414
use PHPCR\Migrations\MigratorUtil;
15+
use PHPUnit\Framework\TestCase;
1516

16-
class MigratorUtilTest extends \PHPUnit_Framework_TestCase
17+
class MigratorUtilTest extends TestCase
1718
{
1819
/**
1920
* It should return the classname of a file.

tests/Unit/VersionCollectionTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313

1414
use PHPCR\Migrations\VersionCollection;
1515
use PHPCR\Migrations\VersionInterface;
16+
use PHPUnit\Framework\TestCase;
1617

17-
class VersionCollectionTest extends \PHPUnit_Framework_TestCase
18+
class VersionCollectionTest extends TestCase
1819
{
1920
const VERSION1 = '201501010000';
2021
const VERSION2 = '201501020000';

tests/Unit/VersionFinderTest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313

1414
use PHPCR\Migrations\VersionCollection;
1515
use PHPCR\Migrations\VersionFinder;
16+
use PHPUnit\Framework\TestCase;
1617

17-
class VersionFinderTest extends \PHPUnit_Framework_TestCase
18+
class VersionFinderTest extends TestCase
1819
{
1920
public function setUp()
2021
{
@@ -38,13 +39,11 @@ public function testGetCollection()
3839

3940
/**
4041
* It should do nothing if no migrations paths are given.
41-
*
42-
* @expectedException \RuntimeException
43-
* @expectedExceptionMessage No paths were provided
4442
*/
4543
public function testNoMigrationPaths()
4644
{
47-
$collection = (new VersionFinder(array()))->getCollection();
48-
$versions = $collection->getAllVersions();
45+
$this->expectException(\RuntimeException::class);
46+
$this->expectExceptionMessage('No paths were provided');
47+
$versionFinder = new VersionFinder(array());
4948
}
5049
}

0 commit comments

Comments
 (0)