Skip to content

Commit

Permalink
Update dependencies (#55)
Browse files Browse the repository at this point in the history
- Update dependencies
- Upgrade to nelmio/alice 3.1.0
- Deprecate `MultiPassLoader`
  • Loading branch information
theofidry authored Oct 22, 2017
1 parent fb67e9f commit e0f5ed2
Show file tree
Hide file tree
Showing 43 changed files with 150 additions and 256 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/vendor/
/composer.lock
/coverage.xml
/fixtures/Bridge/Symfony/SymfonyApp/cache/*
/phpunit.xml
/.php_cs.cache
/.phar/
Expand Down
12 changes: 4 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,14 @@ matrix:
- COVERAGE='true'
- COMPOSER_FLAGS='--prefer-lowest'

- php: '7.0'
env: SYMFONY_VERSION='~2.7.0'
- php: '7.0'
env: SYMFONY_VERSION='~2.8.0'
- php: '7.0'
env: SYMFONY_VERSION='~3.2.0'
- php: '7.0'
- php: '7.1'
env: SYMFONY_VERSION='~3.3.0'
- php: '7.1'
env: SYMFONY_VERSION='~3.4.0@dev'

allow_failures:
- php: nightly
- php: '7.1'
- env: SYMFONY_VERSION='~3.4.0@dev'

before_install:
- set -eo pipefail
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,12 @@ $files = [
'path/to/src/AppBundle/Resources/fixtures/related_dummy.yml',
];
$loader = $container->get('fidry_alice_data_fixtures.doctrine.persister_loader'); // For Doctrine ORM
$loader = $container->get('fidry_alice_data_fixtures.doctrine_mongodb.persister_loader'); // For Doctrine MongoDB ODM
$loader = $container->get('fidry_alice_data_fixtures.doctrine_phpcr.persister_loader'); // For Doctrine PHPCR
$loader = $container->get('fidry_alice_data_fixtures.eloquent.persister_loader'); // For Eloquent ORM
// Choose your loader
$loader = $container->get('fidry_alice_data_fixtures.doctrine.loader'); // For Doctrine ORM
$loader = $container->get('fidry_alice_data_fixtures.doctrine_mongodb.loader'); // For Doctrine MongoDB ODM
$loader = $container->get('fidry_alice_data_fixtures.doctrine_phpcr.loader'); // For Doctrine PHPCR
$loader = $container->get('fidry_alice_data_fixtures.eloquent.loader'); // For Eloquent ORM
$objects = $loader->load($files);
// $objects is now an array of persisted `Dummy` and `RelatedDummy`
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
],
"require": {
"php": "^7.0.0",
"nelmio/alice": "^3.0-rc1@rc"
"nelmio/alice": "^3.1"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.0",
Expand Down
3 changes: 2 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
-->

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.0/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutTestsThatDoNotTestAnything="false"
stopOnFailure="true"
verbose="true">

Expand Down
3 changes: 2 additions & 1 deletion phpunit_doctrine.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
-->

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.0/phpunit.xsd"
bootstrap="tests/Bridge/Doctrine/autoload.php"
colors="true"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutTestsThatDoNotTestAnything="false"
stopOnFailure="true"
verbose="true">

Expand Down
3 changes: 2 additions & 1 deletion phpunit_doctrine_mongodb.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
-->

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.0/phpunit.xsd"
bootstrap="tests/Bridge/DoctrineMongoDB/autoload.php"
colors="true"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutTestsThatDoNotTestAnything="false"
stopOnFailure="true"
verbose="true">

Expand Down
3 changes: 2 additions & 1 deletion phpunit_doctrine_phpcr.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
-->

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.0/phpunit.xsd"
bootstrap="tests/Bridge/DoctrinePhpCr/autoload.php"
colors="true"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutTestsThatDoNotTestAnything="false"
stopOnFailure="true"
backupGlobals="false"
verbose="true">
Expand Down
3 changes: 2 additions & 1 deletion phpunit_eloquent.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
-->

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.0/phpunit.xsd"
bootstrap="tests/Bridge/Eloquent/autoload.php"
colors="true"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutTestsThatDoNotTestAnything="false"
stopOnFailure="true"
verbose="true">

Expand Down
7 changes: 6 additions & 1 deletion phpunit_symfony.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@
-->

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.0/phpunit.xsd"
bootstrap="vendor-bin/symfony/vendor/autoload.php"
colors="true"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutTestsThatDoNotTestAnything="false"
stopOnFailure="true"
verbose="true">

<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="0" />
</php>

<testsuites>
<testsuite name="Test Suite">
<directory>tests/Bridge/Symfony</directory>
Expand Down
7 changes: 6 additions & 1 deletion phpunit_symfony_doctrine.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@
-->

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.0/phpunit.xsd"
bootstrap="vendor-bin/symfony/vendor/autoload.php"
colors="true"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutTestsThatDoNotTestAnything="false"
stopOnFailure="true"
verbose="true">

<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="0" />
</php>

<testsuites>
<testsuite name="Test Suite">
<directory>tests/Bridge/Symfony/Doctrine</directory>
Expand Down
7 changes: 6 additions & 1 deletion phpunit_symfony_eloquent.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@
-->

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.0/phpunit.xsd"
bootstrap="vendor-bin/symfony/vendor/autoload.php"
colors="true"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutTestsThatDoNotTestAnything="false"
stopOnFailure="true"
verbose="true">

<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="0" />
</php>

<testsuites>
<testsuite name="Test Suite">
<directory>tests/Bridge/Symfony/Eloquent</directory>
Expand Down
7 changes: 6 additions & 1 deletion phpunit_symfony_proxy_manager_with_doctrine.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@
-->

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.0/phpunit.xsd"
bootstrap="vendor-bin/proxy-manager/vendor/autoload.php"
colors="true"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutTestsThatDoNotTestAnything="false"
stopOnFailure="true"
verbose="true">

<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="0" />
</php>

<testsuites>
<testsuite name="Test Suite">
<directory>tests/Bridge/Symfony/Doctrine</directory>
Expand Down
7 changes: 6 additions & 1 deletion phpunit_symfony_proxy_manager_with_eloquent.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@
-->

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.0/phpunit.xsd"
bootstrap="vendor-bin/proxy-manager/vendor/autoload.php"
colors="true"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutTestsThatDoNotTestAnything="false"
stopOnFailure="true"
verbose="true">

<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="0" />
</php>

<testsuites>
<testsuite name="Test Suite">
<directory>tests/Bridge/Symfony/Eloquent</directory>
Expand Down
7 changes: 4 additions & 3 deletions src/Bridge/Doctrine/Purger/Purger.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Fidry\AliceDataFixtures\Persistence\PurgeMode;
use Fidry\AliceDataFixtures\Persistence\PurgerFactoryInterface;
use Fidry\AliceDataFixtures\Persistence\PurgerInterface;
use InvalidArgumentException;
use Nelmio\Alice\IsAServiceTrait;

/**
Expand Down Expand Up @@ -70,7 +71,7 @@ public function create(PurgeMode $mode, PurgerInterface $purger = null): PurgerI
} elseif ($purger instanceof self) {
$manager = $purger->manager;
} else {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
sprintf(
'Expected purger to be either and instance of "%s" or "%s". Got "%s".',
DoctrinePurgerInterface::class,
Expand All @@ -80,7 +81,7 @@ public function create(PurgeMode $mode, PurgerInterface $purger = null): PurgerI
}

if (null === $manager) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
sprintf(
'Expected purger "%s" to have an object manager, got "null" instead.',
get_class($purger)
Expand Down Expand Up @@ -113,7 +114,7 @@ private static function createPurger(ObjectManager $manager): DoctrinePurgerInte
return new DoctrineMongoDBPurger($manager);
}

throw new \InvalidArgumentException(
throw new InvalidArgumentException(
sprintf(
'Cannot create a purger for ObjectManager of class %s',
get_class($manager)
Expand Down
3 changes: 2 additions & 1 deletion src/Bridge/Eloquent/Persister/ModelPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Fidry\AliceDataFixtures\Persistence\PersisterInterface;
use Illuminate\Database\DatabaseManager;
use Illuminate\Database\Eloquent\Model;
use InvalidArgumentException;
use Nelmio\Alice\IsAServiceTrait;

/**
Expand Down Expand Up @@ -48,7 +49,7 @@ public function __construct(DatabaseManager $databaseManager)
public function persist($object)
{
if (false === $object instanceof Model) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
sprintf(
'Expected object to be an instance of "%s", got "%s" instead.',
Model::class,
Expand Down
3 changes: 2 additions & 1 deletion src/Bridge/Eloquent/Purger/ModelPurger.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Fidry\AliceDataFixtures\Persistence\PurgerInterface;
use Illuminate\Database\Migrations\MigrationRepositoryInterface;
use Illuminate\Database\Migrations\Migrator;
use InvalidArgumentException;
use Nelmio\Alice\IsAServiceTrait;

/**
Expand Down Expand Up @@ -57,7 +58,7 @@ public function __construct(MigrationRepositoryInterface $repository, string $mi
public function create(PurgeMode $mode, PurgerInterface $purger = null): PurgerInterface
{
if (PurgeMode::createTruncateMode() == $mode) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
sprintf(
'Cannot purge database in truncate mode with "%s" (not supported).',
__CLASS__
Expand Down
7 changes: 6 additions & 1 deletion src/Bridge/Symfony/Resources/config/doctrine_mongodb_odm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="fidry_alice_data_fixtures.doctrine_mongodb.loader"
alias="fidry_alice_data_fixtures.doctrine_mongodb.persister_loader"
public="true" />


<service id="fidry_alice_data_fixtures.persistence.purger.doctrine_mongodb.odm_purger"
class="Fidry\AliceDataFixtures\Bridge\Doctrine\Purger\Purger"
lazy="true">
Expand All @@ -27,7 +32,7 @@
<service id="fidry_alice_data_fixtures.doctrine_mongodb.persister_loader"
class="Fidry\AliceDataFixtures\Loader\PersisterLoader"
lazy="true" >
<argument type="service" id="fidry_alice_data_fixtures.loader.multipass_file" />
<argument type="service" id="fidry_alice_data_fixtures.loader.simple" />
<argument type="service" id="fidry_alice_data_fixtures.persistence.persister.doctrine_mongodb.object_manager_persister" />
<!-- Processors are injected via a Compiler pass -->
</service>
Expand Down
7 changes: 6 additions & 1 deletion src/Bridge/Symfony/Resources/config/doctrine_orm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@

<services>

<service id="fidry_alice_data_fixtures.doctrine.loader"
alias="fidry_alice_data_fixtures.doctrine.persister_loader"
public="true" />


<service id="fidry_alice_data_fixtures.persistence.purger_mode"
class="Fidry\AliceDataFixtures\Persistence\PurgeMode"
public="false">
Expand All @@ -35,7 +40,7 @@
<service id="fidry_alice_data_fixtures.doctrine.persister_loader"
class="Fidry\AliceDataFixtures\Loader\PersisterLoader"
lazy="true" >
<argument type="service" id="fidry_alice_data_fixtures.loader.multipass_file" />
<argument type="service" id="fidry_alice_data_fixtures.loader.simple" />
<argument type="service" id="fidry_alice_data_fixtures.persistence.persister.doctrine.object_manager_persister" />
<!-- Processors are injected via a Compiler pass -->
</service>
Expand Down
7 changes: 6 additions & 1 deletion src/Bridge/Symfony/Resources/config/doctrine_phpcr_odm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="fidry_alice_data_fixtures.doctrine_phpcr.loader"
alias="fidry_alice_data_fixtures.doctrine_phpcr.persister_loader"
public="true" />


<service id="fidry_alice_data_fixtures.persistence.purger.doctrine_phpcr.odm_purger"
class="Fidry\AliceDataFixtures\Bridge\Doctrine\Purger\Purger"
lazy="true">
Expand All @@ -27,7 +32,7 @@
<service id="fidry_alice_data_fixtures.doctrine_phpcr.persister_loader"
class="Fidry\AliceDataFixtures\Loader\PersisterLoader"
lazy="true" >
<argument type="service" id="fidry_alice_data_fixtures.loader.multipass_file" />
<argument type="service" id="fidry_alice_data_fixtures.loader.simple" />
<argument type="service" id="fidry_alice_data_fixtures.persistence.persister.doctrine_phpcr.object_manager_persister" />
<!-- Processors are injected via a Compiler pass -->
</service>
Expand Down
7 changes: 6 additions & 1 deletion src/Bridge/Symfony/Resources/config/eloquent_orm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@

<services>

<service id="fidry_alice_data_fixtures.eloquent.loader"
alias="fidry_alice_data_fixtures.eloquent.persister_loader"
public="true" />


<service id="fidry_alice_data_fixtures.persistence.purger_mode"
class="Fidry\AliceDataFixtures\Persistence\PurgeMode"
public="false">
Expand All @@ -40,7 +45,7 @@
<service id="fidry_alice_data_fixtures.eloquent.persister_loader"
class="Fidry\AliceDataFixtures\Loader\PersisterLoader"
lazy="true" >
<argument type="service" id="fidry_alice_data_fixtures.loader.multipass_file" />
<argument type="service" id="fidry_alice_data_fixtures.loader.simple" />
<argument type="service" id="fidry_alice_data_fixtures.persistence.persister.eloquent.model_persister" />
<!-- Processors are injected via a Compiler pass -->
</service>
Expand Down
Loading

0 comments on commit e0f5ed2

Please sign in to comment.