diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-08-17 11:40:35 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-08-17 14:34:39 +0200 |
commit | 6dfac457d80d2f56ee3a69a5ab69ee64389e9e64 (patch) | |
tree | 95a7c79e34693dd8fd6a53ff51570393440dd144 | |
parent | e49c62fac85ad2a2aa23023094fe81713a5a19c0 (diff) | |
download | wallabag-6dfac457d80d2f56ee3a69a5ab69ee64389e9e64.tar.gz wallabag-6dfac457d80d2f56ee3a69a5ab69ee64389e9e64.tar.zst wallabag-6dfac457d80d2f56ee3a69a5ab69ee64389e9e64.zip |
Fix tests
Ensure tests after the InstallCommand test will have a clean database.
Previous attempt failed because of a foreign key
Also, nightly on Travis seems to target PHP 7.2-dev, so I put 7.1 in requirement and moved nightly in allowed failures.
And it seems xdebug isn't shipped with PHP 7.1, so I added a workaround to avoid build to fail when trying to remove xdebug.ini file.
-rw-r--r-- | .travis.yml | 5 | ||||
-rw-r--r-- | tests/Wallabag/CoreBundle/Command/InstallCommandTest.php | 20 |
2 files changed, 22 insertions, 3 deletions
diff --git a/.travis.yml b/.travis.yml index 1a33198a..a387fc13 100644 --- a/.travis.yml +++ b/.travis.yml | |||
@@ -20,6 +20,7 @@ php: | |||
20 | - 5.5 | 20 | - 5.5 |
21 | - 5.6 | 21 | - 5.6 |
22 | - 7.0 | 22 | - 7.0 |
23 | - 7.1 | ||
23 | - nightly | 24 | - nightly |
24 | - hhvm | 25 | - hhvm |
25 | 26 | ||
@@ -38,6 +39,7 @@ matrix: | |||
38 | env: DB=pgsql # driver for PostgreSQL currently unsupported by HHVM, requires 3rd party dependency | 39 | env: DB=pgsql # driver for PostgreSQL currently unsupported by HHVM, requires 3rd party dependency |
39 | allow_failures: | 40 | allow_failures: |
40 | - php: hhvm | 41 | - php: hhvm |
42 | - php: nightly | ||
41 | 43 | ||
42 | # exclude v1 branches | 44 | # exclude v1 branches |
43 | branches: | 45 | branches: |
@@ -46,7 +48,8 @@ branches: | |||
46 | 48 | ||
47 | before_script: | 49 | before_script: |
48 | - if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi; | 50 | - if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi; |
49 | - if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then phpenv config-rm xdebug.ini; fi; | 51 | # xdebug isn't enable for PHP 7.1 |
52 | - if [[ $TRAVIS_PHP_VERSION != '7.1' && $TRAVIS_PHP_VERSION != 'hhvm' ]]; then phpenv config-rm xdebug.ini; fi | ||
50 | - composer self-update --no-progress | 53 | - composer self-update --no-progress |
51 | - if [[ "$DB" = "pgsql" ]]; then psql -c 'create database wallabag_test;' -U postgres; fi; | 54 | - if [[ "$DB" = "pgsql" ]]; then psql -c 'create database wallabag_test;' -U postgres; fi; |
52 | 55 | ||
diff --git a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php index 6c6ce087..089a1c5f 100644 --- a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php | |||
@@ -28,16 +28,32 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
28 | * | 28 | * |
29 | * http://stackoverflow.com/a/14374832/569101 | 29 | * http://stackoverflow.com/a/14374832/569101 |
30 | */ | 30 | */ |
31 | $this->markTestSkipped('PostgreSQL spotted: can find a good way to drop current database, skipping.'); | 31 | $this->markTestSkipped('PostgreSQL spotted: can\'t find a good way to drop current database, skipping.'); |
32 | } | 32 | } |
33 | } | 33 | } |
34 | 34 | ||
35 | /** | ||
36 | * Ensure next tests will have a clean database | ||
37 | */ | ||
35 | public static function tearDownAfterClass() | 38 | public static function tearDownAfterClass() |
36 | { | 39 | { |
37 | $application = new Application(static::$kernel); | 40 | $application = new Application(static::$kernel); |
38 | $application->setAutoExit(false); | 41 | $application->setAutoExit(false); |
39 | 42 | ||
40 | $code = $application->run(new ArrayInput([ | 43 | $application->run(new ArrayInput([ |
44 | 'command' => 'doctrine:schema:drop', | ||
45 | '--no-interaction' => true, | ||
46 | '--force' => true, | ||
47 | '--env' => 'test', | ||
48 | ]), new NullOutput()); | ||
49 | |||
50 | $application->run(new ArrayInput([ | ||
51 | 'command' => 'doctrine:schema:create', | ||
52 | '--no-interaction' => true, | ||
53 | '--env' => 'test', | ||
54 | ]), new NullOutput()); | ||
55 | |||
56 | $application->run(new ArrayInput([ | ||
41 | 'command' => 'doctrine:fixtures:load', | 57 | 'command' => 'doctrine:fixtures:load', |
42 | '--no-interaction' => true, | 58 | '--no-interaction' => true, |
43 | '--env' => 'test', | 59 | '--env' => 'test', |