Skip to content

Commit

Permalink
Removed hard dependencies on doctrine odm to run the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Toflar committed Apr 8, 2019
1 parent bb04d57 commit e7f7813
Show file tree
Hide file tree
Showing 27 changed files with 212 additions and 79 deletions.
5 changes: 5 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ reusable-steps:
run:
name: Update Composer
command: sudo composer self-update
- &require-doctrine-odm
run:
name: Require doctrine/mongodb-odm an doctrine/mongodb-odm-bundle
command: composer require --no-update doctrine/mongodb-odm:^2.0.0@beta doctrine/mongodb-odm-bundle:^4.0.0@beta
- &update-project-dependencies
run:
name: Update project dependencies
Expand Down Expand Up @@ -134,6 +138,7 @@ jobs:
- *disable-php-memory-limit
- *install-php-extensions
- *update-composer
- *require-doctrine-odm
- *update-project-dependencies
- *save-composer-cache-by-revision
- *save-composer-cache-by-branch
Expand Down
16 changes: 7 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ cache:
jobs:
include:
- php: '7.1'
env: NO_UNIT_TESTS=true
before_install:
- composer remove --dev ext-mongodb doctrine/mongodb-odm doctrine/mongodb-odm-bundle
- sed -i '33,39d' tests/Fixtures/app/config/config_common.yml
- php: '7.2'
- php: '7.3'
- php: '7.3'
Expand Down Expand Up @@ -46,12 +42,15 @@ before_install:
- if [[ $APP_ENV = 'elasticsearch' ]]; then
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;
fi
- phpenv config-rm xdebug.ini || echo "xdebug not available"
- echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- echo "extension=mongodb.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- if [[ $APP_ENV = 'mongodb' ]]; then
echo "extension=mongodb.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini;
fi
- phpenv config-rm xdebug.ini || echo "xdebug not available"
- export PATH="$PATH:$HOME/.composer/vendor/bin"

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

script:
- tests/Fixtures/app/console cache:clear
- if [[ $NO_UNIT_TESTS != true ]]; then
vendor/bin/phpunit;
fi
- if [[ $APP_ENV = 'mongodb' ]]; then
vendor/bin/phpunit -c phpunit.mongo.xml;
else
vendor/bin/phpunit;
fi
- tests/Fixtures/app/console cache:clear
- if [[ $APP_ENV = 'postgres' ]]; then
Expand Down
2 changes: 0 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
"doctrine/annotations": "^1.2",
"doctrine/doctrine-bundle": "^1.8",
"doctrine/doctrine-cache-bundle": "^1.3.5",
"doctrine/mongodb-odm": "^2.0.0@beta",
"doctrine/mongodb-odm-bundle": "^4.0.0@beta",
"doctrine/orm": "^2.6.3",
"elasticsearch/elasticsearch": "^6.0",
"friendsofsymfony/user-bundle": "^2.2@dev",
Expand Down
2 changes: 1 addition & 1 deletion phpunit.mongo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak_vendors" />
<server name="KERNEL_DIR" value="tests/Fixtures/app/" />
<server name="KERNEL_CLASS" value="AppKernel" />
<server name="APP_ENV" value="test_mongodb" />
<server name="APP_ENV" value="mongodb" />
<server name="LEGACY" value="0" />
</php>

Expand Down
6 changes: 6 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,10 @@
<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>

<groups>
<exclude>
<group>mongodb</group>
</exclude>
</groups>
</phpunit>
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public function testSingleIdentifier()

/**
* @group legacy
* @group mongodb
*/
public function testSingleDocumentIdentifier()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

/**
* @author Alan Poulain <contact@alanpoulain.eu>
* @group mongodb
*/
class CollectionDataProviderTest extends TestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

/**
* @author Alan Poulain <contact@alanpoulain.eu>
* @group mongodb
*/
class FilterExtensionTest extends TestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

/**
* @author Alan Poulain <contact@alanpoulain.eu>
* @group mongodb
*/
class OrderExtensionTest extends TestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

/**
* @author Alan Poulain <contact@alanpoulain.eu>
* @group mongodb
*/
class PaginationExtensionTest extends TestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

/**
* @author Alan Poulain <contact@alanpoulain.eu>
* @group mongodb
*/
class BooleanFilterTest extends DoctrineMongoDbOdmFilterTestCase
{
Expand Down
1 change: 1 addition & 0 deletions tests/Bridge/Doctrine/MongoDbOdm/Filter/DateFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

/**
* @author Alan Poulain <contact@alanpoulain.eu>
* @group mongodb
*/
class DateFilterTest extends DoctrineMongoDbOdmFilterTestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

/**
* @author Alan Poulain <contact@alanpoulain.eu>
* @group mongodb
*/
class ExistsFilterTest extends DoctrineMongoDbOdmFilterTestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

/**
* @author Alan Poulain <contact@alanpoulain.eu>
* @group mongodb
*/
class NumericFilterTest extends DoctrineMongoDbOdmFilterTestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

/**
* @author Alan Poulain <contact@alanpoulain.eu>
* @group mongodb
*/
class OrderFilterTest extends DoctrineMongoDbOdmFilterTestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

/**
* @author Alan Poulain <contact@alanpoulain.eu>
* @group mongodb
*/
class RangeFilterTest extends DoctrineMongoDbOdmFilterTestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

/**
* @author Alan Poulain <contact@alanpoulain.eu>
* @group mongodb
*/
class SearchFilterTest extends DoctrineMongoDbOdmFilterTestCase
{
Expand Down
1 change: 1 addition & 0 deletions tests/Bridge/Doctrine/MongoDbOdm/ItemDataProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

/**
* @author Alan Poulain <contact@alanpoulain.eu>
* @group mongodb
*/
class ItemDataProviderTest extends TestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

/**
* @author Alan Poulain <contact@alanpoulain.eu>
* @group mongodb
*/
class DoctrineMongoDbOdmPropertyMetadataFactoryTest extends TestCase
{
Expand Down
3 changes: 3 additions & 0 deletions tests/Bridge/Doctrine/MongoDbOdm/PaginatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
use Doctrine\ODM\MongoDB\UnitOfWork;
use PHPUnit\Framework\TestCase;

/**
* @group mongodb
*/
class PaginatorTest extends TestCase
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
/**
* @author Kévin Dunglas <dunglas@gmail.com>
* @author Alan Poulain <contact@alanpoulain.eu>
* @group mongodb
*/
class DoctrineExtractorTest extends TestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

/**
* @author Alan Poulain <contact@alanpoulain.eu>
* @group mongodb
*/
class SubresourceDataProviderTest extends TestCase
{
Expand Down
Loading

0 comments on commit e7f7813

Please sign in to comment.