Skip to content

Commit

Permalink
Merge pull request #602 from chalasr/sf5
Browse files Browse the repository at this point in the history
Fix symfony 5 compatibility
  • Loading branch information
alcaeus authored Nov 26, 2019
2 parents 36620c2 + 8fcefac commit e105f23
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 37 deletions.
74 changes: 51 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,71 @@ 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
- pecl install -f mongodb-${DRIVER_VERSION}
- 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
2 changes: 2 additions & 0 deletions Command/InfoDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->write('', true);
}
}

return 0;
}
}
4 changes: 3 additions & 1 deletion Command/LoadDataFixturesDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -118,5 +118,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln(sprintf(' <comment>></comment> <info>%s</info>', $message));
});
$executor->execute($fixtures, $input->getOption('append'));

return 0;
}
}
2 changes: 2 additions & 0 deletions Command/TailCursorDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ protected function execute(InputInterface $input, OutputInterface $output)

$dm->clear();
}

return 0;
}

/**
Expand Down
5 changes: 5 additions & 0 deletions DependencyInjection/DoctrineMongoDBExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 2 additions & 2 deletions Tests/Form/Type/DocumentTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class DocumentTypeTest extends TypeTestCase

private $typeFQCN;

public function setUp()
public function setUp() : void
{
$this->typeFQCN = method_exists(AbstractType::class, 'getBlockPrefix');

Expand All @@ -42,7 +42,7 @@ public function setUp()
parent::setUp();
}

protected function tearDown()
protected function tearDown() : void
{
$documentClasses = [
Document::class,
Expand Down
4 changes: 2 additions & 2 deletions Tests/Form/Type/TypeGuesserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class TypeGuesserTest extends TypeTestCase

private $typeFQCN;

public function setUp()
public function setUp() : void
{
$this->typeFQCN = method_exists(AbstractType::class, 'getBlockPrefix');

Expand All @@ -39,7 +39,7 @@ public function setUp()
parent::setUp();
}

protected function tearDown()
protected function tearDown() : void
{
$documentClasses = [
Document::class,
Expand Down
19 changes: 10 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"keywords": ["persistence", "mongodb", "symfony"],
"homepage": "http://www.doctrine-project.org",
"license": "MIT",
"minimum-stability": "dev",
"authors": [
{"name": "Bulat Shakirzyanov", "email": "[email protected]"},
{"name": "Kris Wallsmith", "email": "[email protected]"},
Expand All @@ -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"
Expand Down

0 comments on commit e105f23

Please sign in to comment.