diff --git a/.travis.yml b/.travis.yml index f2baf110..38f14377 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,34 +2,26 @@ dist: xenial language: php sudo: false +cache: + directories: + - $HOME/.composer/cache + php: - 7.2 - 7.3 - 7.4snapshot +services: mongodb + env: global: - DRIVER_VERSION="stable" - - COMPOSER_FLAGS="--prefer-dist" - -jobs: - include: - # Test against lowest dependencies with coverage - - stage: Test - php: 7.2 - env: DRIVER_VERSION="1.5.0" COMPOSER_FLAGS="--prefer-dist --prefer-lowest" PHPUNIT_FLAGS="--coverage-clover=coverage.clover" + - COMPOSER_FLAGS=" -n --prefer-dist --prefer-stable" + - COMPOSER_MEMORY_LIMIT=-1 - - stage: Code Quality - php: 7.2 - env: DRIVER_VERSION="stable" COMPOSER_FLAGS="--prefer-dist" - script: - - vendor/bin/phpcs - -cache: - directories: - - $HOME/.composer/cache - -services: mongodb +before_install: + - mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available" + - composer global require --no-update --no-progress --no-scripts --no-plugins symfony/flex dev-master install: - composer self-update @@ -37,8 +29,44 @@ install: - composer update ${COMPOSER_FLAGS} script: - - ./vendor/bin/phpunit ${PHPUNIT_FLAGS} + - ./vendor/bin/phpunit ${PHPUNIT_FLAGS} + +jobs: + include: + # Tests the lowest set of dependencies + - php: 7.2 + env: LOWEST DRIVER_VERSION="1.5.0" SYMFONY_DEPRECATIONS_HELPER=weak COMPOSER_FLAGS=" -n --prefer-lowest --prefer-stable --prefer-dist" + + # Test against latest Symfony 3.4 stable + - php: 7.3 + env: SYMFONY_REQUIRE="3.4.*" + + # Test against latest Symfony 4.3 stable + - php: 7.3 + env: SYMFONY_REQUIRE="4.3.*" + + # Test against latest Symfony 4.4 dev + - php: 7.3 + env: SYMFONY_REQUIRE="4.4.*" + + # Test against latest Symfony 5.0 dev + - php: 7.3 + env: SYMFONY_REQUIRE="5.0.*" + + # Test dev versions + - php: 7.3 + if: type = cron + env: DEV COMPOSER_FLAGS="-n --prefer-dist" + + - stage: Code Quality + env: CODING_STANDARDS + php: 7.2 + script: + - ./vendor/bin/phpcs -after_script: - - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover coverage.clover + - stage: Coverage + php: 7.3 + env: COVERAGE PHPUNIT_FLAGS="--coverage-clover=coverage.clover" + before_script: + - mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{.disabled,} + - if [[ ! $(php -m | grep -si xdebug) ]]; then echo "xdebug required for coverage"; exit 1; fi diff --git a/Command/InfoDoctrineODMCommand.php b/Command/InfoDoctrineODMCommand.php index f7a19ea4..e98f7f74 100644 --- a/Command/InfoDoctrineODMCommand.php +++ b/Command/InfoDoctrineODMCommand.php @@ -75,5 +75,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $output->write('', true); } } + + return 0; } } diff --git a/Command/LoadDataFixturesDoctrineODMCommand.php b/Command/LoadDataFixturesDoctrineODMCommand.php index 26566e01..ead652d0 100644 --- a/Command/LoadDataFixturesDoctrineODMCommand.php +++ b/Command/LoadDataFixturesDoctrineODMCommand.php @@ -90,7 +90,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $question = new ConfirmationQuestion('Careful, database will be purged. Do you want to continue (y/N) ?', false); if (! $helper->ask($input, $output, $question)) { - return; + return 0; } } @@ -118,5 +118,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $output->writeln(sprintf(' > %s', $message)); }); $executor->execute($fixtures, $input->getOption('append')); + + return 0; } } diff --git a/Command/TailCursorDoctrineODMCommand.php b/Command/TailCursorDoctrineODMCommand.php index eaaebb09..65cca98c 100644 --- a/Command/TailCursorDoctrineODMCommand.php +++ b/Command/TailCursorDoctrineODMCommand.php @@ -89,6 +89,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $dm->clear(); } + + return 0; } /** diff --git a/DependencyInjection/DoctrineMongoDBExtension.php b/DependencyInjection/DoctrineMongoDBExtension.php index 92f44433..d6bd65b7 100644 --- a/DependencyInjection/DoctrineMongoDBExtension.php +++ b/DependencyInjection/DoctrineMongoDBExtension.php @@ -420,6 +420,11 @@ protected function getMappingResourceExtension() return 'mongodb'; } + protected function getMetadataDriverClass(string $driverType) : string + { + return '%' . $this->getObjectManagerElementName('metadata.' . $driverType . '.class') . '%'; + } + public function getAlias() { return 'doctrine_mongodb'; diff --git a/Tests/Form/Type/DocumentTypeTest.php b/Tests/Form/Type/DocumentTypeTest.php index d92ec87b..8af133d7 100644 --- a/Tests/Form/Type/DocumentTypeTest.php +++ b/Tests/Form/Type/DocumentTypeTest.php @@ -30,7 +30,7 @@ class DocumentTypeTest extends TypeTestCase private $typeFQCN; - public function setUp() + public function setUp() : void { $this->typeFQCN = method_exists(AbstractType::class, 'getBlockPrefix'); @@ -42,7 +42,7 @@ public function setUp() parent::setUp(); } - protected function tearDown() + protected function tearDown() : void { $documentClasses = [ Document::class, diff --git a/Tests/Form/Type/TypeGuesserTest.php b/Tests/Form/Type/TypeGuesserTest.php index e887f38b..f656b56b 100644 --- a/Tests/Form/Type/TypeGuesserTest.php +++ b/Tests/Form/Type/TypeGuesserTest.php @@ -27,7 +27,7 @@ class TypeGuesserTest extends TypeTestCase private $typeFQCN; - public function setUp() + public function setUp() : void { $this->typeFQCN = method_exists(AbstractType::class, 'getBlockPrefix'); @@ -39,7 +39,7 @@ public function setUp() parent::setUp(); } - protected function tearDown() + protected function tearDown() : void { $documentClasses = [ Document::class, diff --git a/composer.json b/composer.json index 5a572560..a8d0b0d3 100644 --- a/composer.json +++ b/composer.json @@ -5,6 +5,7 @@ "keywords": ["persistence", "mongodb", "symfony"], "homepage": "http://www.doctrine-project.org", "license": "MIT", + "minimum-stability": "dev", "authors": [ {"name": "Bulat Shakirzyanov", "email": "mallluhuct@gmail.com"}, {"name": "Kris Wallsmith", "email": "kris@symfony.com"}, @@ -15,21 +16,21 @@ "doctrine/annotations": "^1.2", "doctrine/mongodb-odm": "^2.0.0", "psr/log": "^1.0", - "symfony/console": "^3.4 || ^4.0", - "symfony/dependency-injection": "^3.4 || ^4.0", - "symfony/doctrine-bridge": "^3.4 || ^4.0", - "symfony/config": "^3.4 || ^4.0", - "symfony/framework-bundle": "^3.4 || ^4.0", - "symfony/options-resolver": "^3.4 || ^4.0" + "symfony/console": "^3.4 || ^4.0 || ^5.0", + "symfony/dependency-injection": "^3.4 || ^4.0 || ^5.0", + "symfony/doctrine-bridge": "^3.4 || ^4.0 || ^5.0", + "symfony/config": "^3.4 || ^4.0 || ^5.0", + "symfony/framework-bundle": "^3.4 || ^4.0 || ^5.0", + "symfony/options-resolver": "^3.4 || ^4.0 || ^5.0" }, "require-dev": { "doctrine/coding-standard": "^6.0", "doctrine/data-fixtures": "^1.2.2", "phpunit/phpunit": "^7.3", "squizlabs/php_codesniffer": "^3.5", - "symfony/form": "^3.4 || ^4.0", - "symfony/phpunit-bridge": "^3.4 || ^4.0", - "symfony/yaml": "^3.4 || ^4.0" + "symfony/form": "^3.4 || ^4.0 || ^5.0", + "symfony/phpunit-bridge": "^3.4 || ^4.0 || ^5.0", + "symfony/yaml": "^3.4 || ^4.0 || ^5.0" }, "suggest": { "doctrine/data-fixtures": "Load data fixtures"