Skip to content

Commit ef694dd

Browse files
authored
Test doctrine in separate build (#147)
* Test doctrine in separate build * Added better instructions * Fixes * Syntax fix
1 parent 0fd1539 commit ef694dd

File tree

5 files changed

+32
-15
lines changed

5 files changed

+32
-15
lines changed

.travis.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ php:
1111
- 7.1
1212

1313
env:
14+
global:
15+
- TEST_COMMAND="composer test"
1416
matrix:
1517
- SYMFONY_VERSION=3.3.*
1618

@@ -21,17 +23,19 @@ matrix:
2123
env: SYMFONY_VERSION=4.0.*
2224
include:
2325
- php: 7.0
24-
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_VERSION=3.3.* TEST_COMMAND="phpunit --coverage-text --coverage-clover=build/coverage.xml" COVERAGE=true
26+
env: TEST_COMMAND="composer test-ci" COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_VERSION=3.3.* COVERAGE=true
27+
- php: 7.0
28+
env: TEST_COMMAND="phpunit" COMPOSER_FLAGS="--prefer-source" SYMFONY_VERSION="3.3.* phpunit/phpunit:^5.7"
2529
- php: 7.1
2630
env: SYMFONY_VERSION=4.0.*
2731

2832
before_script:
2933
- composer require symfony/symfony:${SYMFONY_VERSION} --no-update
3034
# This command must be run with `--prefer-source`, otherwise the `Doctrine\Tests\OrmTestCase` class won't be found.
31-
- composer update --prefer-source
35+
- composer update $COMPOSER_FLAGS
3236

3337
script:
34-
- phpunit
38+
- $TEST_COMMAND
3539

3640
after_success:
3741
- if [[ $COVERAGE = true ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi

Resources/doc/index.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,15 +264,24 @@ Testing
264264

265265
Setup the test suite using [Composer](http://getcomposer.org/):
266266

267+
267268
```bash
268-
composer install --dev --prefer-source
269+
composer update
270+
composer test
269271
```
270272

271-
**Important:** this command must be run with `--prefer-source`, otherwise the
272-
`Doctrine\Tests\OrmTestCase` class won't be found.
273+
### Doctrine test
273274

274-
Run it using PHPUnit:
275+
There is also a test that tests the doctrine integration. It runs automatically on
276+
Traivs but if you want to run it locally you must do the following.
275277

276278
```bash
277-
composer test
279+
composer require phpunit/phpunit:^5.7 --no-update
280+
composer update --prefer-source
281+
wget https://phar.phpunit.de/phpunit-5.7.phar
282+
php phpunit-5.7.phar --testsuit doctrine
278283
```
284+
285+
**Important:** this command must be run with `--prefer-source`, otherwise the
286+
`Doctrine\Tests\OrmTestCase` class won't be found.
287+

Tests/Doctrine/ORM/GeocoderListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static function setUpBeforeClass()
4444
* We check for DoctrineTestCase because it is in the same package as OrmTestCase and we want to be able to
4545
* fake OrmTestCase
4646
*/
47-
static::markTestSkipped('Doctrine\Tests\OrmTestCase was not found.');
47+
static::fail('Doctrine\Tests\OrmTestCase was not found.');
4848
}
4949
parent::setUpBeforeClass();
5050
}

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
"symfony/console": "^3.3 || ^4.0"
1919
},
2020
"require-dev": {
21-
"phpunit/phpunit": "^5.7",
21+
"phpunit/phpunit": "^6.2",
2222
"symfony/yaml": "^3.3 || ^4.0",
2323
"geoip/geoip": "~1.17",
2424
"doctrine/cache": "~1.3",
2525
"doctrine/orm": "~2.3",
2626
"php-http/message": "^1.5",
2727
"php-http/curl-client": "^1.7",
2828
"nyholm/psr7": "^0.2.2",
29-
"nyholm/symfony-bundle-test": "^1.1",
29+
"nyholm/symfony-bundle-test": "^1.2",
3030
"geocoder-php/google-maps-provider": "^4.0",
3131
"geocoder-php/cache-provider": "^4.0",
3232
"geocoder-php/arcgis-online-provider": "^4.0",
@@ -58,8 +58,8 @@
5858
}
5959
},
6060
"scripts": {
61-
"test": "vendor/bin/phpunit",
62-
"test-ci": "vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml"
61+
"test": "vendor/bin/phpunit --testsuite main",
62+
"test-ci": "vendor/bin/phpunit --testsuite main --coverage-text --coverage-clover=build/coverage.xml"
6363
},
6464
"minimum-stability": "dev",
6565
"prefer-stable": true,

phpunit.xml.dist

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@
1212
bootstrap="Tests/bootstrap.php"
1313
>
1414
<testsuites>
15-
<testsuite name="Geocoder for the Symfony Framework">
15+
<testsuite name="main">
1616
<directory>./Tests</directory>
17+
<exclude>./Tests/Doctrine</exclude>
18+
</testsuite>
19+
<testsuite name="doctrine">
20+
<directory>./Tests/Doctrine</directory>
1721
</testsuite>
1822
</testsuites>
1923

@@ -27,4 +31,4 @@
2731
</exclude>
2832
</whitelist>
2933
</filter>
30-
</phpunit>
34+
</phpunit>

0 commit comments

Comments
 (0)