Skip to content

Commit 09e8006

Browse files
authored
Merge pull request #2703 from Toflar/optional-mongodb-tests
Removed hard dependencies on doctrine odm to run the tests
2 parents f254e14 + 8aaad92 commit 09e8006

31 files changed

+316
-174
lines changed

.circleci/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ reusable-steps:
1313
run:
1414
name: Disable Xdebug PHP extension
1515
command: sudo rm /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
16+
- &install-doctrine-mongodb-odm
17+
run:
18+
name: Install Doctrine MongoDB ODM
19+
command: composer require --prefer-dist --no-progress --no-suggest --no-update --ansi doctrine/mongodb-odm:^2.0.0@beta doctrine/mongodb-odm-bundle:^4.0.0@beta
1620
- &install-php-extensions
1721
run:
1822
name: Install PHP extensions
@@ -134,6 +138,7 @@ jobs:
134138
- *disable-php-memory-limit
135139
- *install-php-extensions
136140
- *update-composer
141+
- *install-doctrine-mongodb-odm
137142
- *update-project-dependencies
138143
- *save-composer-cache-by-revision
139144
- *save-composer-cache-by-branch

.travis.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ cache:
88
jobs:
99
include:
1010
- php: '7.1'
11-
env: NO_UNIT_TESTS=true
12-
before_install:
13-
- composer remove --dev ext-mongodb doctrine/mongodb-odm doctrine/mongodb-odm-bundle
14-
- sed -i '33,39d' tests/Fixtures/app/config/config_common.yml
1511
- php: '7.2'
1612
- php: '7.3'
1713
- php: '7.3'
@@ -46,12 +42,15 @@ before_install:
4642
- if [[ $APP_ENV = 'elasticsearch' ]]; then
4743
curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.5.0.deb && sudo dpkg -i --force-confnew elasticsearch-6.5.0.deb && sudo service elasticsearch restart;
4844
fi
49-
- phpenv config-rm xdebug.ini || echo "xdebug not available"
5045
- echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
51-
- echo "extension=mongodb.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
46+
- if [[ $APP_ENV = 'mongodb' ]]; then
47+
echo "extension=mongodb.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/mongodb.ini;
48+
fi
49+
- phpenv config-rm xdebug.ini || echo "xdebug not available"
5250
- export PATH="$PATH:$HOME/.composer/vendor/bin"
5351

5452
install:
53+
- if [[ $APP_ENV = 'mongodb' ]]; then composer require --prefer-dist --no-progress --no-suggest --no-update --ansi doctrine/mongodb-odm:^2.0.0@beta doctrine/mongodb-odm-bundle:^4.0.0@beta; fi
5554
- if [[ $deps = 'low' ]]; then
5655
composer update --prefer-dist --no-progress --no-suggest --prefer-stable --prefer-lowest --ansi;
5756
else
@@ -60,11 +59,10 @@ install:
6059

6160
script:
6261
- tests/Fixtures/app/console cache:clear
63-
- if [[ $NO_UNIT_TESTS != true ]]; then
64-
vendor/bin/phpunit;
65-
fi
6662
- if [[ $APP_ENV = 'mongodb' ]]; then
6763
vendor/bin/phpunit -c phpunit.mongo.xml;
64+
else
65+
vendor/bin/phpunit;
6866
fi
6967
- tests/Fixtures/app/console cache:clear
7068
- if [[ $APP_ENV = 'postgres' ]]; then

composer.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
"doctrine/annotations": "^1.2",
3636
"doctrine/doctrine-bundle": "^1.8",
3737
"doctrine/doctrine-cache-bundle": "^1.3.5",
38-
"doctrine/mongodb-odm": "^2.0.0@beta",
39-
"doctrine/mongodb-odm-bundle": "^4.0.0@beta",
4038
"doctrine/orm": "^2.6.3",
4139
"elasticsearch/elasticsearch": "^6.0",
4240
"friendsofsymfony/user-bundle": "^2.2@dev",

phpunit.mongo.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak_vendors" />
1414
<server name="KERNEL_DIR" value="tests/Fixtures/app/" />
1515
<server name="KERNEL_CLASS" value="AppKernel" />
16-
<server name="APP_ENV" value="test_mongodb" />
16+
<server name="APP_ENV" value="mongodb" />
1717
<server name="LEGACY" value="0" />
1818
</php>
1919

phpunit.xml.dist

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,10 @@
3737
<listeners>
3838
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
3939
</listeners>
40+
41+
<groups>
42+
<exclude>
43+
<group>mongodb</group>
44+
</exclude>
45+
</groups>
4046
</phpunit>

tests/Bridge/Doctrine/Common/Util/IdentifierManagerTraitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public function testSingleIdentifier()
7070

7171
/**
7272
* @group legacy
73+
* @group mongodb
7374
*/
7475
public function testSingleDocumentIdentifier()
7576
{

tests/Bridge/Doctrine/MongoDbOdm/CollectionDataProviderTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
use PHPUnit\Framework\TestCase;
2828

2929
/**
30+
* @group mongodb
31+
*
3032
* @author Alan Poulain <[email protected]>
3133
*/
3234
class CollectionDataProviderTest extends TestCase

tests/Bridge/Doctrine/MongoDbOdm/Extension/FilterExtensionTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
use Psr\Container\ContainerInterface;
2525

2626
/**
27+
* @group mongodb
28+
*
2729
* @author Alan Poulain <[email protected]>
2830
*/
2931
class FilterExtensionTest extends TestCase

tests/Bridge/Doctrine/MongoDbOdm/Extension/OrderExtensionTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
use PHPUnit\Framework\TestCase;
2626

2727
/**
28+
* @group mongodb
29+
*
2830
* @author Alan Poulain <[email protected]>
2931
*/
3032
class OrderExtensionTest extends TestCase

tests/Bridge/Doctrine/MongoDbOdm/Extension/PaginationExtensionTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
use PHPUnit\Framework\TestCase;
3535

3636
/**
37+
* @group mongodb
38+
*
3739
* @author Alan Poulain <[email protected]>
3840
*/
3941
class PaginationExtensionTest extends TestCase

0 commit comments

Comments
 (0)