Skip to content

Commit

Permalink
Merge pull request #864 from dunglas/fix_tests
Browse files Browse the repository at this point in the history
Symfony 3.2 compatibility
  • Loading branch information
dunglas committed Dec 1, 2016
2 parents ea3f2fc + a66bfd7 commit 49f1b02
Show file tree
Hide file tree
Showing 25 changed files with 22 additions and 18 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Expand Up @@ -16,7 +16,6 @@ matrix:

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

script:
- if [[ $coverage = 1 ]]; then phpdbg -qrr -dmemory_limit=-1 "$(phpenv which phpunit)" --coverage-php build/cov/coverage-phpunit.cov; else phpunit; fi
- if [[ $coverage = 1 ]]; then phpdbg -qrr vendor/bin/behat --profile coverage; else vendor/bin/behat; fi
- if [[ $coverage = 1 ]]; then phpdbg -qrr -dmemory_limit=-1 vendor/bin/phpunit --coverage-php build/cov/coverage-phpunit.cov; else vendor/bin/phpunit; fi
- 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
- if [[ $coverage = 1 ]]; then phpdbg -qrr phpcov.phar merge --clover build/logs/clover.xml build/cov; fi
- tests/Fixtures/app/console api:swagger:export > swagger.json && swagger validate swagger.json && rm swagger.json
- if [[ $lint = 1 ]]; then php php-cs-fixer.phar fix --dry-run --diff; fi
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Expand Up @@ -9,7 +9,7 @@ init:
- SET PATH=c:\tools\php;%PATH%

install:
- cinst -y php
- 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
- cd c:\tools\php
- copy php.ini-production php.ini /Y
- echo date.timezone="UTC" >> php.ini
Expand Down
6 changes: 5 additions & 1 deletion composer.json
Expand Up @@ -37,13 +37,17 @@
"nelmio/api-doc-bundle": "^2.11.2",
"php-mock/php-mock-phpunit": "^1.1",
"phpdocumentor/reflection-docblock": "^3.0",
"phpdocumentor/type-resolver": "^0.2",
"phpunit/phpunit": "^5.6",
"psr/log": "^1.0",
"symfony/asset": "^2.7 || ^3.0",
"symfony/cache": "^3.1",
"symfony/config": "^2.7",
"symfony/config": "^2.7 || ^3.0",
"symfony/dependency-injection": "^2.7 || ^3.0",
"symfony/doctrine-bridge": "^2.8 || ^3.0",
"symfony/phpunit-bridge": "^2.7 || ^3.0",
"symfony/security": "^2.7 || ^3.0",
"symfony/templating": "^2.7 || ^3.0",
"symfony/validator": "^2.7 || ^3.0",
"symfony/finder": "^2.7 || ^3.0",
"symfony/framework-bundle": "^3.1",
Expand Down
11 changes: 3 additions & 8 deletions features/bootstrap/CoverageContext.php
Expand Up @@ -44,21 +44,16 @@ public static function setup()
*/
public static function tearDown()
{
$writer = new PHP();
$writer->process(self::$coverage, __DIR__.'/../../build/cov/coverage-behat.cov');
}

private function getCoverageKeyFromScope(BeforeScenarioScope $scope): string
{
return sprintf('%s::%s', $scope->getFeature()->getTitle(), $scope->getScenario()->getTitle());
$feature = getenv('FEATURE') ?: 'behat';
(new PHP())->process(self::$coverage, __DIR__."/../../build/cov/coverage-$feature.cov");
}

/**
* @BeforeScenario
*/
public function startCoverage(BeforeScenarioScope $scope)
{
self::$coverage->start($this->getCoverageKeyFromScope($scope));
self::$coverage->start("{$scope->getFeature()->getTitle()}::{$scope->getScenario()->getTitle()}");
}

/**
Expand Down
14 changes: 11 additions & 3 deletions features/bootstrap/FeatureContext.php
Expand Up @@ -28,16 +28,23 @@
*/
class FeatureContext implements Context, SnippetAcceptingContext
{
/**
* @var ManagerRegistry
*/
private $doctrine;

/**
* @var \Doctrine\Common\Persistence\ObjectManager
*/
private $manager;

/**
* @var SchemaTool
*/
private $schemaTool;

/**
* @var array
*/
private $classes;

/**
* @var Request
*/
Expand Down Expand Up @@ -83,6 +90,7 @@ public function createDatabase()
public function dropDatabase()
{
$this->schemaTool->dropSchema($this->classes);
$this->doctrine->getManager()->clear();
}

/**
Expand Down
1 change: 0 additions & 1 deletion features/doctrine/range_filter.feature
@@ -1,4 +1,3 @@
@rangeFilter
Feature: Range filter on collections
In order to filter results from large collections of resources
As a client software developer
Expand Down
1 change: 0 additions & 1 deletion features/doctrine/search_filter.feature
@@ -1,4 +1,3 @@
@searchFilter
Feature: Search filter on collections
In order to get specific result from a large collections of resources
As a client software developer
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 49f1b02

Please sign in to comment.