Skip to content

Commit

Permalink
Don't try to mock UnitOfWork as it's final
Browse files Browse the repository at this point in the history
  • Loading branch information
teohhanhui committed Jun 6, 2019
1 parent a5f9f61 commit 2e0dced
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 75 deletions.
51 changes: 22 additions & 29 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,12 @@ commands:
- run:
name: Disable Xdebug PHP extension
command: sudo rm /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
install-doctrine-mongodb-odm:
steps:
- run:
name: Install Doctrine MongoDB ODM
command: |
composer require --prefer-dist --no-progress --no-suggest --no-update --ansi \
doctrine/mongodb-odm:^2.0@beta \
doctrine/mongodb-odm-bundle:^4.0@beta \
install-mongodb-php-extension:
steps:
- run:
name: Install mongodb PHP extension
command: |
sudo pecl install mongodb
sudo pecl install mongodb-1.5.4
sudo docker-php-ext-enable mongodb
merge-code-coverage-reports:
parameters:
Expand Down Expand Up @@ -274,17 +266,18 @@ jobs:
working_directory: ~/api-platform/core
steps:
- checkout
- restore-composer-cache
- restore-php-cs-fixer-cache
- install-mongodb-php-extension
- disable-xdebug-php-extension
- disable-php-memory-limit
- update-composer
- restore-composer-cache
- run:
name: Install PHP-CS-Fixer
command: |
composer global require --prefer-dist --no-progress --no-suggest --ansi \
friendsofphp/php-cs-fixer:^2.14
- save-composer-cache
- restore-php-cs-fixer-cache
- run:
name: Run PHP-CS-Fixer
command: |
Expand All @@ -300,16 +293,15 @@ jobs:
working_directory: ~/api-platform/core
steps:
- checkout
- restore-composer-cache
- restore-phpstan-cache
- install-mongodb-php-extension
- disable-xdebug-php-extension
- disable-php-memory-limit
- install-mongodb-php-extension
- update-composer
- install-doctrine-mongodb-odm
- restore-composer-cache
- update-project-dependencies
- save-composer-cache
- clear-test-app-cache
- restore-phpstan-cache
- run:
name: Run PHPStan
command: vendor/bin/phpstan analyse --ansi
Expand All @@ -321,11 +313,11 @@ jobs:
working_directory: ~/api-platform/core
steps:
- checkout
- restore-composer-cache
- restore-npm-cache
- install-mongodb-php-extension
- disable-xdebug-php-extension
- disable-php-memory-limit
- update-composer
- restore-composer-cache
- update-project-dependencies
- save-composer-cache
- clear-test-app-cache
Expand All @@ -337,6 +329,7 @@ jobs:
export PARALLEL='-j10% --joblog build/logs/parallel.log --rpl {_}\ s/\\//_/g;'
phpunit_cmd='phpdbg -qrr vendor/bin/phpunit --coverage-php build/coverage/coverage-{_}.cov --log-junit build/logs/phpunit/{_}.xml --exclude-group mongodb,resource-hog --colors=always {}'
echo "$split_tests" | parallel "$phpunit_cmd" || echo "$split_tests" | parallel --retry-failed "$phpunit_cmd"
- restore-npm-cache
- merge-test-reports:
dir: build/logs/phpunit
out: build/logs/phpunit/junit.xml
Expand Down Expand Up @@ -367,11 +360,11 @@ jobs:
working_directory: ~/api-platform/core
steps:
- checkout
- restore-composer-cache
- restore-npm-cache
- install-mongodb-php-extension
- disable-xdebug-php-extension
- disable-php-memory-limit
- update-composer
- restore-composer-cache
- update-project-dependencies
- save-composer-cache
- clear-test-app-cache
Expand All @@ -383,6 +376,7 @@ jobs:
_f=$(echo "$f" | tr / _)
FEATURE="${_f}" phpdbg -qrr vendor/bin/behat --format=progress --out=std --format=junit --out=build/logs/behat/"${_f}" --profile=default-coverage --no-interaction "$f"
done
- restore-npm-cache
- merge-test-reports:
dir: build/logs/behat
out: build/logs/behat/junit.xml
Expand Down Expand Up @@ -411,13 +405,11 @@ jobs:
working_directory: ~/api-platform/core
steps:
- checkout
- restore-composer-cache
- restore-npm-cache
- install-mongodb-php-extension
- disable-xdebug-php-extension
- disable-php-memory-limit
- install-mongodb-php-extension
- update-composer
- install-doctrine-mongodb-odm
- restore-composer-cache
- update-project-dependencies
- save-composer-cache
- clear-test-app-cache
Expand All @@ -435,6 +427,7 @@ jobs:
- store_artifacts:
path: build/logs/clover.xml
destination: build/logs/clover.xml
- restore-npm-cache
- codecov/upload:
file: build/logs/clover.xml
flags: phpunit_mongodb
Expand All @@ -449,13 +442,11 @@ jobs:
working_directory: ~/api-platform/core
steps:
- checkout
- restore-composer-cache
- restore-npm-cache
- install-mongodb-php-extension
- disable-xdebug-php-extension
- disable-php-memory-limit
- install-mongodb-php-extension
- update-composer
- install-doctrine-mongodb-odm
- restore-composer-cache
- update-project-dependencies
- save-composer-cache
- clear-test-app-cache
Expand All @@ -465,6 +456,7 @@ jobs:
command: |
mkdir -p build/logs/behat
phpdbg -qrr vendor/bin/behat --format=progress --out=std --format=junit --out=build/logs/behat --profile=mongodb-coverage --no-interaction
- restore-npm-cache
- merge-test-reports:
dir: build/logs/behat
out: build/logs/behat/junit.xml
Expand Down Expand Up @@ -493,11 +485,11 @@ jobs:
working_directory: ~/api-platform/core
steps:
- checkout
- restore-composer-cache
- restore-npm-cache
- install-mongodb-php-extension
- disable-xdebug-php-extension
- disable-php-memory-limit
- update-composer
- restore-composer-cache
- update-project-dependencies
- save-composer-cache
- clear-test-app-cache
Expand All @@ -507,6 +499,7 @@ jobs:
command: |
mkdir -p build/logs/behat
phpdbg -qrr vendor/bin/behat --format=progress --out=std --format=junit --out=build/logs/behat --profile=elasticsearch-coverage --no-interaction
- restore-npm-cache
- merge-test-reports:
dir: build/logs/behat
out: build/logs/behat/junit.xml
Expand Down
36 changes: 22 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ cache:
echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- &disable-xdebug-php-extension |
phpenv config-rm xdebug.ini || echo "xdebug not available"
- &install-doctrine-mongodb-odm |
composer require --prefer-dist --no-progress --no-suggest --no-update --ansi \
doctrine/mongodb-odm:^2.0@beta \
doctrine/mongodb-odm-bundle:^4.0@beta \
- &install-mongodb-php-extension |
echo "extension=mongodb.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/mongodb.ini
- &run-behat-tests |
Expand All @@ -39,10 +35,16 @@ jobs:
include:
- php: '7.1'
before_install:
- *disable-php-memory-limit
- *install-mongodb-php-extension
- *disable-xdebug-php-extension
- *disable-php-memory-limit
- *add-composer-bin-dir-to-path
install:
- |
composer remove --dev --no-progress --no-update --ansi \
doctrine/mongodb-odm \
doctrine/mongodb-odm-bundle \
- sed -i '33,39d' tests/Fixtures/app/config/config_common.yml
- *update-project-dependencies
before_script:
- *clear-test-app-cache
Expand All @@ -57,8 +59,9 @@ jobs:

- php: '7.2'
before_install:
- *disable-php-memory-limit
- *install-mongodb-php-extension
- *disable-xdebug-php-extension
- *disable-php-memory-limit
- *add-composer-bin-dir-to-path
install:
- *update-project-dependencies
Expand All @@ -75,8 +78,9 @@ jobs:

- php: '7.3'
before_install:
- *disable-php-memory-limit
- *install-mongodb-php-extension
- *disable-xdebug-php-extension
- *disable-php-memory-limit
- *add-composer-bin-dir-to-path
install:
- *update-project-dependencies
Expand All @@ -94,8 +98,9 @@ jobs:
- php: '7.3'
env: deps=low
before_install:
- *disable-php-memory-limit
- *install-mongodb-php-extension
- *disable-xdebug-php-extension
- *disable-php-memory-limit
- *add-composer-bin-dir-to-path
install:
- composer update --prefer-dist --no-progress --no-suggest --prefer-stable --prefer-lowest --ansi
Expand All @@ -115,8 +120,9 @@ jobs:
services:
- postgresql
before_install:
- *disable-php-memory-limit
- *install-mongodb-php-extension
- *disable-xdebug-php-extension
- *disable-php-memory-limit
- *add-composer-bin-dir-to-path
install:
- *update-project-dependencies
Expand All @@ -137,8 +143,9 @@ jobs:
services:
- mysql
before_install:
- *disable-php-memory-limit
- *install-mongodb-php-extension
- *disable-xdebug-php-extension
- *disable-php-memory-limit
- *add-composer-bin-dir-to-path
install:
- *update-project-dependencies
Expand All @@ -159,12 +166,11 @@ jobs:
services:
- mongodb
before_install:
- *disable-php-memory-limit
- *install-mongodb-php-extension
- *disable-xdebug-php-extension
- *disable-php-memory-limit
- *add-composer-bin-dir-to-path
install:
- *install-doctrine-mongodb-odm
- *update-project-dependencies
before_script:
- *clear-test-app-cache
Expand All @@ -186,8 +192,9 @@ jobs:
- sudo apt-get update
- sudo apt-get install elasticsearch
- sudo service elasticsearch start
- *disable-php-memory-limit
- *install-mongodb-php-extension
- *disable-xdebug-php-extension
- *disable-php-memory-limit
- *add-composer-bin-dir-to-path
install:
- *update-project-dependencies
Expand All @@ -205,8 +212,9 @@ jobs:
- php: '7.3'
env: SYMFONY_DEPRECATIONS_HELPER=0
before_install:
- *disable-php-memory-limit
- *install-mongodb-php-extension
- *disable-xdebug-php-extension
- *disable-php-memory-limit
- *add-composer-bin-dir-to-path
install:
- *update-project-dependencies
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ install:
- echo extension=php_mongodb.dll >> php.ini
- echo memory_limit=3G >> php.ini
- cd %APPVEYOR_BUILD_FOLDER%
- composer install --no-interaction --no-progress --no-suggest --ignore-platform-reqs
- composer install --no-progress --no-suggest --no-interaction

services:
- mongodb
Expand Down
11 changes: 9 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@
"behat/symfony2-extension": "^2.1.1",
"behatch/contexts": "3.1.0",
"doctrine/annotations": "^1.2",
"doctrine/data-fixtures": "^1.2.2",
"doctrine/doctrine-bundle": "^1.8",
"doctrine/doctrine-cache-bundle": "^1.3.5",
"doctrine/mongodb-odm": "^2.0@beta",
"doctrine/mongodb-odm-bundle": "^4.0@beta",
"doctrine/orm": "^2.6.3",
"elasticsearch/elasticsearch": "^6.0",
"friendsofsymfony/user-bundle": "^2.2@dev",
Expand Down Expand Up @@ -102,10 +105,14 @@
"webonyx/graphql-php": "To support GraphQL."
},
"autoload": {
"psr-4": { "ApiPlatform\\Core\\": "src/" }
"psr-4": {
"ApiPlatform\\Core\\": "src/"
}
},
"autoload-dev": {
"psr-4": { "ApiPlatform\\Core\\Tests\\": "tests/" }
"psr-4": {
"ApiPlatform\\Core\\Tests\\": "tests/"
}
},
"extra": {
"branch-alias": {
Expand Down
Loading

0 comments on commit 2e0dced

Please sign in to comment.