Skip to content

Commit 49f1b02

Browse files
authored
Merge pull request #864 from dunglas/fix_tests
Symfony 3.2 compatibility
2 parents ea3f2fc + a66bfd7 commit 49f1b02

25 files changed

+22
-18
lines changed

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ matrix:
1616

1717
before_install:
1818
- phpenv config-rm xdebug.ini || echo "xdebug not available"
19-
- phpunit --self-update
2019
- npm install -g swagger-cli
2120
- if [[ $coverage = 1 ]]; then mkdir -p build/logs build/cov; fi
2221
- if [[ $coverage = 1 ]]; then wget https://phar.phpunit.de/phpcov.phar; fi
@@ -30,8 +29,8 @@ install:
3029
- if [[ $deps = 'low' ]]; then composer update --prefer-dist --no-progress --no-suggest --prefer-stable --prefer-lowest --ansi; fi
3130

3231
script:
33-
- if [[ $coverage = 1 ]]; then phpdbg -qrr -dmemory_limit=-1 "$(phpenv which phpunit)" --coverage-php build/cov/coverage-phpunit.cov; else phpunit; fi
34-
- if [[ $coverage = 1 ]]; then phpdbg -qrr vendor/bin/behat --profile coverage; else vendor/bin/behat; fi
32+
- if [[ $coverage = 1 ]]; then phpdbg -qrr -dmemory_limit=-1 vendor/bin/phpunit --coverage-php build/cov/coverage-phpunit.cov; else vendor/bin/phpunit; fi
33+
- if [[ $coverage = 1 ]]; then for feature in $(ls -d features/*/ | cut -f2 -d'/' | grep -v bootstrap); do FEATURE=$feature phpdbg -qrr vendor/bin/behat --profile coverage features/$feature; done; else vendor/bin/behat; fi
3534
- if [[ $coverage = 1 ]]; then phpdbg -qrr phpcov.phar merge --clover build/logs/clover.xml build/cov; fi
3635
- tests/Fixtures/app/console api:swagger:export > swagger.json && swagger validate swagger.json && rm swagger.json
3736
- if [[ $lint = 1 ]]; then php php-cs-fixer.phar fix --dry-run --diff; fi

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ init:
99
- SET PATH=c:\tools\php;%PATH%
1010

1111
install:
12-
- cinst -y php
12+
- cinst -y php --version 7.0.9 # Force the PHP version: http://help.appveyor.com/discussions/problems/5616-not-able-to-build-due-to-problem-in-chocolateyinstallps1
1313
- cd c:\tools\php
1414
- copy php.ini-production php.ini /Y
1515
- echo date.timezone="UTC" >> php.ini

composer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,17 @@
3737
"nelmio/api-doc-bundle": "^2.11.2",
3838
"php-mock/php-mock-phpunit": "^1.1",
3939
"phpdocumentor/reflection-docblock": "^3.0",
40+
"phpdocumentor/type-resolver": "^0.2",
41+
"phpunit/phpunit": "^5.6",
4042
"psr/log": "^1.0",
43+
"symfony/asset": "^2.7 || ^3.0",
4144
"symfony/cache": "^3.1",
42-
"symfony/config": "^2.7",
45+
"symfony/config": "^2.7 || ^3.0",
4346
"symfony/dependency-injection": "^2.7 || ^3.0",
4447
"symfony/doctrine-bridge": "^2.8 || ^3.0",
4548
"symfony/phpunit-bridge": "^2.7 || ^3.0",
4649
"symfony/security": "^2.7 || ^3.0",
50+
"symfony/templating": "^2.7 || ^3.0",
4751
"symfony/validator": "^2.7 || ^3.0",
4852
"symfony/finder": "^2.7 || ^3.0",
4953
"symfony/framework-bundle": "^3.1",

features/bootstrap/CoverageContext.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,16 @@ public static function setup()
4444
*/
4545
public static function tearDown()
4646
{
47-
$writer = new PHP();
48-
$writer->process(self::$coverage, __DIR__.'/../../build/cov/coverage-behat.cov');
49-
}
50-
51-
private function getCoverageKeyFromScope(BeforeScenarioScope $scope): string
52-
{
53-
return sprintf('%s::%s', $scope->getFeature()->getTitle(), $scope->getScenario()->getTitle());
47+
$feature = getenv('FEATURE') ?: 'behat';
48+
(new PHP())->process(self::$coverage, __DIR__."/../../build/cov/coverage-$feature.cov");
5449
}
5550

5651
/**
5752
* @BeforeScenario
5853
*/
5954
public function startCoverage(BeforeScenarioScope $scope)
6055
{
61-
self::$coverage->start($this->getCoverageKeyFromScope($scope));
56+
self::$coverage->start("{$scope->getFeature()->getTitle()}::{$scope->getScenario()->getTitle()}");
6257
}
6358

6459
/**

features/bootstrap/FeatureContext.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,23 @@
2828
*/
2929
class FeatureContext implements Context, SnippetAcceptingContext
3030
{
31-
/**
32-
* @var ManagerRegistry
33-
*/
3431
private $doctrine;
3532

3633
/**
3734
* @var \Doctrine\Common\Persistence\ObjectManager
3835
*/
3936
private $manager;
4037

38+
/**
39+
* @var SchemaTool
40+
*/
41+
private $schemaTool;
42+
43+
/**
44+
* @var array
45+
*/
46+
private $classes;
47+
4148
/**
4249
* @var Request
4350
*/
@@ -83,6 +90,7 @@ public function createDatabase()
8390
public function dropDatabase()
8491
{
8592
$this->schemaTool->dropSchema($this->classes);
93+
$this->doctrine->getManager()->clear();
8694
}
8795

8896
/**

features/doctrine/range_filter.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
@rangeFilter
21
Feature: Range filter on collections
32
In order to filter results from large collections of resources
43
As a client software developer

features/doctrine/search_filter.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
@searchFilter
21
Feature: Search filter on collections
32
In order to get specific result from a large collections of resources
43
As a client software developer
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)