Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed hard dependencies on doctrine odm to run the tests #2703

Merged
merged 7 commits into from
May 3, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Toflar marked this conversation as resolved.
Show resolved Hide resolved
run:
name: Require doctrine/mongodb-odm an doctrine/mongodb-odm-bundle
Toflar marked this conversation as resolved.
Show resolved Hide resolved
command: composer require --no-update doctrine/mongodb-odm:^2.0.0@beta doctrine/mongodb-odm-bundle:^4.0.0@beta
Toflar marked this conversation as resolved.
Show resolved Hide resolved
- &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
Toflar marked this conversation as resolved.
Show resolved Hide resolved
- *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;
Toflar marked this conversation as resolved.
Show resolved Hide resolved
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
Toflar marked this conversation as resolved.
Show resolved Hide resolved
- 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" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, tests are green so you tell me 😄

Copy link
Contributor

@teohhanhui teohhanhui Apr 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Toflar But the config wouldn't get applied correctly. So the APP_ENV should be reverted to test_mongodb. 😄

Copy link
Contributor

@teohhanhui teohhanhui Apr 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or better, rename the config files, since we do the same for elasticsearch.

Copy link
Contributor

@teohhanhui teohhanhui Apr 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Toflar I think we should rename the config files instead, for consistency.

Copy link
Contributor

@teohhanhui teohhanhui Apr 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alanpoulain Can you advise why there is config_common.yml (imported from config_orm.yml and config_services_mongodb.yml), config_orm.yml (imported from config_test.yml) and config_mongodb.yml (I don't see where this is imported uhh, there is already a mongodb environment previously)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note https://github.com/api-platform/core/blob/v2.4.2/tests/Fixtures/app/AppKernel.php#L97

It's very confusing if we name config files the same way when it's not environment-specific.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay @Toflar, so my suggestion is that we should merge mongodb and test_mongodb environments into one mongodb environment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's what I was trying 😄 So I revert the latest commit again?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes... But we need to make sure the relevant parts of the old test_mongodb environment are merged in, e.g.:

tests/Fixtures/app/config/config_test_mongodb.yml
tests/Fixtures/app/config/config_services_mongodb.yml
tests/Fixtures/app/config/routing_test_mongodb.yml

And the old files removed.

<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
teohhanhui marked this conversation as resolved.
Show resolved Hide resolved
*/
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