Skip to content

Commit

Permalink
Add support for symfony 5 (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz authored Feb 18, 2020
1 parent 4c40744 commit c7d4ef5
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ composer.lock
vendor
tests/data
tests/migrations
.phpunit.result.cache
9 changes: 8 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ language: php
php:
- 5.6
- 7.1
- 7.2
- 7.3

env:
- PACKAGE_VERSION=high
Expand All @@ -13,10 +15,15 @@ matrix:
include:
- php: 5.6
env: PACKAGE_VERSION=low
- php: 7.4
env:
- MINIMUM_STABILITY=dev
- PACKAGE_VERSION=high

before_script:
- composer selfupdate
- if [[ "$MINIMUM_STABILITY" ]]; then composer config minimum-stability $MINIMUM_STABILITY ; fi
- if [[ "$PACKAGE_VERSION" == "high" ]]; then composer update --prefer-dist; fi
- if [[ "$PACKAGE_VERSION" == "low" ]]; then composer update --prefer-lowest --prefer-dist; fi

script: vendor/bin/phpunit
script: vendor/bin/simple-phpunit
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
}
],
"require": {
"phpcr/phpcr": "~2.1",
"symfony/finder": "~2.8 || ~3.4 || ~4.0",
"symfony/console": "~2.8 || ~3.4 || ~4.0"
"phpcr/phpcr": "^2.1",
"symfony/finder": "^2.8 || ^3.4 || ^4.0 || ^5.0",
"symfony/console": "^2.8 || ^3.4 || ^4.0 || ^5.0"
},
"require-dev": {
"phpunit/phpunit": "~5.7",
"jackalope/jackalope-fs": "dev-master",
"zendframework/zendsearch": "@dev"
"symfony/phpunit-bridge": "^5.0.4",
"jackalope/jackalope-fs": "0.0.*",
"handcraftedinthealps/zendsearch": "^2.0"
},
"autoload": {
"psr-4": {
Expand All @@ -29,6 +29,6 @@
}
},
"extra": {
"branch-alias": {"dev-master": "1.0-dev" }
"branch-alias": {"dev-master": "1.x-dev" }
}
}
5 changes: 5 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
colors="true"
bootstrap="vendor/autoload.php"
>
<php>
<env name="SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT" value="1"/>
<env name="SYMFONY_PHPUNIT_REMOVE" value="symfony/yaml"/>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled=1"/>
</php>

<testsuites>
<testsuite name="PHPCR migrations Test Suite">
Expand Down
3 changes: 2 additions & 1 deletion tests/BaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@

use Jackalope\RepositoryFactoryFilesystem;
use PHPCR\SimpleCredentials;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Filesystem\Filesystem;

class BaseTestCase extends \PHPUnit_Framework_TestCase
class BaseTestCase extends TestCase
{
protected $session;

Expand Down
8 changes: 5 additions & 3 deletions tests/Functional/MigrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace PHPCR\Migrations\tests\Functional;

use PHPCR\Migrations\BaseTestCase;
use PHPCR\Migrations\Exception\MigratorException;
use PHPCR\Migrations\Migrator;
use PHPCR\Migrations\VersionFinder;
use PHPCR\Migrations\VersionStorage;
Expand Down Expand Up @@ -161,15 +162,16 @@ public function testInitialize()

/**
* It should throw an exception if trying to reiniitialize.
*
* @expectedException PHPCR\Migrations\Exception\MigratorException
* @expectedExceptionMessage Will not re-initialize
*/
public function testReinitialize()
{
$this->addVersion(self::VERSION1);
$this->addVersion(self::VERSION2);

$this->getMigrator()->initialize();

$this->expectException(MigratorException::class);
$this->expectExceptionMessage('Will not re-initialize');
$this->getMigrator()->initialize();
}

Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/MigratorFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
use PHPCR\Migrations\VersionFinder;
use PHPCR\Migrations\VersionStorage;
use PHPCR\SessionInterface;
use PHPUnit\Framework\TestCase;

class MigratorFactoryTest extends \PHPUnit_Framework_TestCase
class MigratorFactoryTest extends TestCase
{
public function testFactory()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/MigratorUtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
namespace PHPCR\Migrations\tests\Unit;

use PHPCR\Migrations\MigratorUtil;
use PHPUnit\Framework\TestCase;

class MigratorUtilTest extends \PHPUnit_Framework_TestCase
class MigratorUtilTest extends TestCase
{
/**
* It should return the classname of a file.
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/VersionCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@

use PHPCR\Migrations\VersionCollection;
use PHPCR\Migrations\VersionInterface;
use PHPUnit\Framework\TestCase;

class VersionCollectionTest extends \PHPUnit_Framework_TestCase
class VersionCollectionTest extends TestCase
{
const VERSION1 = '201501010000';
const VERSION2 = '201501020000';
Expand Down
11 changes: 5 additions & 6 deletions tests/Unit/VersionFinderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@

use PHPCR\Migrations\VersionCollection;
use PHPCR\Migrations\VersionFinder;
use PHPUnit\Framework\TestCase;

class VersionFinderTest extends \PHPUnit_Framework_TestCase
class VersionFinderTest extends TestCase
{
public function setUp()
{
Expand All @@ -38,13 +39,11 @@ public function testGetCollection()

/**
* It should do nothing if no migrations paths are given.
*
* @expectedException \RuntimeException
* @expectedExceptionMessage No paths were provided
*/
public function testNoMigrationPaths()
{
$collection = (new VersionFinder(array()))->getCollection();
$versions = $collection->getAllVersions();
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('No paths were provided');
$versionFinder = new VersionFinder(array());
}
}

0 comments on commit c7d4ef5

Please sign in to comment.