Skip to content

Commit ec89836

Browse files
authored
Merge pull request #3 from facile-it/fix-ci-and-symfony5-support
Fix ci and symfony5 support
2 parents e076409 + da0417f commit ec89836

File tree

10 files changed

+46
-81
lines changed

10 files changed

+46
-81
lines changed

.travis.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,22 @@
11
language: php
22

33
php:
4-
- 7.1
5-
- 7.2
6-
- 7.3
74
- 7.4
8-
9-
sudo: false
5+
- 7.3
6+
- 7.2
7+
- 7.1
108

119
cache:
1210
directories:
1311
- $HOME/.composer/cache
1412

15-
matrix:
16-
fast_finish: true
17-
allow_failures:
18-
- php: 7.4snapshot
19-
2013
stages:
2114
- Test
2215
- Code style & static analysis
2316

2417
before_install:
2518
- phpenv config-rm xdebug.ini || echo "Unable to remove xDebug"
26-
- if [[ $TRAVIS_PHP_VERSION != '7.1' ]]; then export SYMFONY_DEPRECATIONS_HELPER=disabled; fi
19+
- if [ "$SYMFONY_REQUIRE" != "" ]; then composer global require symfony/flex; fi
2720

2821
install:
2922
- composer update --no-interaction --no-suggest --prefer-dist --prefer-stable
@@ -39,6 +32,14 @@ jobs:
3932
SYMFONY_DEPRECATIONS_HELPER: disabled
4033
install:
4134
- composer update --prefer-lowest --no-interaction --no-suggest --prefer-dist --prefer-stable
35+
- php: 7.1
36+
env:
37+
SYMFONY_REQUIRE: 3.4
38+
SYMFONY_DEPRECATIONS_HELPER: disabled
39+
- env:
40+
SYMFONY_REQUIRE: 4.4
41+
- env:
42+
SYMFONY_REQUIRE: 5
4243
- name: Code coverage
4344
php: 7.3
4445
before_install: []

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66
## Unreleased
7+
* Fix Symfony 5 compatibility [#3](https://github.com/facile-it/symfony-functional-testcase/pull/3)
8+
* Improve CI testing [#3](https://github.com/facile-it/symfony-functional-testcase/pull/3)
79

810
## 0.1.2 [2020-02-24]
911
### Added
10-
* Adds symfony5 compatibility
12+
* Adds Symfony 5 compatibility [#2](https://github.com/facile-it/symfony-functional-testcase/pull/2)
1113

1214
## 0.1.1 [2019-03-13]
1315
### Added

composer.json

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,18 @@
2424
"symfony/framework-bundle": "^3.4|^4.0|^5.0"
2525
},
2626
"require-dev": {
27-
"symfony/symfony": "^3.4|^4.0|^5.0",
28-
"symfony/phpunit-bridge": "^5.0",
29-
"phpunit/phpunit": "^7.5|^8",
30-
"php-coveralls/php-coveralls": "^2.1",
31-
"phpstan/phpstan": "^0.11.2",
32-
"phpstan/phpstan-phpunit": "^0.11.0",
33-
"jangregor/phpstan-prophecy": "^0.3.0",
3427
"facile-it/facile-coding-standard": "^0.3.1",
35-
"symfony/monolog-bundle": "^3.0"
28+
"jangregor/phpstan-prophecy": "^0.6.2",
29+
"php-coveralls/php-coveralls": "^2.1",
30+
"phpstan/phpstan": "^0.12.18",
31+
"phpstan/phpstan-phpunit": "^0.12.6",
32+
"phpunit/phpunit": "^7.5.20|^8.5.2",
33+
"symfony/browser-kit": "^3.4|^4.0|^5.0",
34+
"symfony/monolog-bundle": "^3.0",
35+
"symfony/monolog-bridge": ">=3",
36+
"symfony/phpunit-bridge": "^5.0",
37+
"symfony/security-bundle": "^3.4|^4.0|^5.0",
38+
"symfony/security-core": "^3.4|^4.0|^5.0"
3639
},
3740
"suggest": {
3841
"facile-it/paraunit": "A PHPUnit wrapper to execute tests in parallel"
@@ -48,13 +51,15 @@
4851
}
4952
},
5053
"config": {
51-
"platform": {
52-
"php": "7.1.99"
53-
}
54+
"sort-packages": true
5455
},
5556
"extra": {
5657
"branch-alias": {
5758
"dev-master": "1.x-dev"
5859
}
60+
},
61+
"scripts": {
62+
"cs-check": "php-cs-fixer fix --dry-run --diff",
63+
"cs-fix": "php-cs-fixer fix --diff"
5964
}
6065
}

phpstan.neon

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ parameters:
33
paths:
44
- src
55
- tests
6-
includes:
7-
- vendor/jangregor/phpstan-prophecy/src/extension.neon
8-
- vendor/phpstan/phpstan-phpunit/extension.neon
6+
ignoreErrors:
7+
-
8+
message: "#^Class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Client not found\\.$#"
9+
count: 1
10+
path: src/WebTestCase.php

src/WebTestCase.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@
44

55
namespace Facile\SymfonyFunctionalTestCase;
66

7-
use Symfony\Bundle\FrameworkBundle\Client;
87
use Symfony\Bundle\FrameworkBundle\Console\Application;
8+
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
99
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase;
1010
use Symfony\Component\Console\Tester\CommandTester;
1111
use Symfony\Component\DependencyInjection\ContainerInterface;
12-
use Symfony\Component\DependencyInjection\ResettableContainerInterface;
1312
use Symfony\Component\HttpFoundation\Response;
1413

14+
if (! class_exists(KernelBrowser::class)) {
15+
\class_alias(\Symfony\Bundle\FrameworkBundle\Client::class, KernelBrowser::class);
16+
}
17+
1518
abstract class WebTestCase extends BaseWebTestCase
1619
{
1720
/** @var string */
@@ -80,23 +83,23 @@ protected function getContainer(): ContainerInterface
8083
* $client matches the expected code. If not, raises an error with more
8184
* information.
8285
*/
83-
public function assertStatusCode(int $expectedStatusCode, Client $client, string $message = ''): void
86+
public function assertStatusCode(int $expectedStatusCode, KernelBrowser $client, string $message = ''): void
8487
{
8588
$response = $client->getResponse();
8689

8790
$this->assertInstanceOf(Response::class, $response, 'Response missing from client');
8891
$this->assertSame($expectedStatusCode, $response->getStatusCode(), $message);
8992
}
9093

91-
protected function assertStatusCodeIsSuccessful(Client $client): void
94+
protected function assertStatusCodeIsSuccessful(KernelBrowser $client): void
9295
{
9396
$response = $client->getResponse();
9497

9598
$this->assertInstanceOf(Response::class, $response, 'Response missing from client');
9699
$this->assertTrue($response->isSuccessful(), 'HTTP status code not successful: ' . $response->getStatusCode());
97100
}
98101

99-
protected function assertStatusCodeIsRedirect(Client $client): void
102+
protected function assertStatusCodeIsRedirect(KernelBrowser $client): void
100103
{
101104
$response = $client->getResponse();
102105

@@ -107,7 +110,7 @@ protected function assertStatusCodeIsRedirect(Client $client): void
107110
protected function tearDown(): void
108111
{
109112
foreach ($this->containers as $container) {
110-
if ($container instanceof ResettableContainerInterface) {
113+
if (method_exists($container, 'reset')) {
111114
$container->reset();
112115
}
113116
}

tests/App/AppKernel.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Facile\SymfonyFunctionalTestCase\Tests\App;
66

77
use Symfony\Component\Config\Loader\LoaderInterface;
8-
use Symfony\Component\DependencyInjection\ContainerBuilder;
98
use Symfony\Component\HttpKernel\Kernel;
109

1110
class AppKernel extends Kernel
@@ -16,7 +15,6 @@ public function registerBundles(): array
1615
new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
1716
new \Symfony\Bundle\MonologBundle\MonologBundle(),
1817
new \Symfony\Bundle\SecurityBundle\SecurityBundle(),
19-
new \Symfony\Bundle\TwigBundle\TwigBundle(),
2018
new AcmeBundle(),
2119
];
2220

@@ -26,12 +24,6 @@ public function registerBundles(): array
2624
public function registerContainerConfiguration(LoaderInterface $loader): void
2725
{
2826
$loader->load(__DIR__ . '/config.yml');
29-
30-
$loader->load(function (ContainerBuilder $container): void {
31-
$container->loadFromExtension('framework', [
32-
'assets' => null,
33-
]);
34-
});
3527
}
3628

3729
public function getCacheDir(): string

tests/App/config.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
framework:
55
secret: secret
66
test: ~
7-
router: { resource: "%kernel.root_dir%/../App/routing.yml" }
7+
router: { resource: "%kernel.project_dir%/tests/App/routing.yml" }
88
form: false
99
validation: false
1010
csrf_protection: true
@@ -61,7 +61,3 @@ services:
6161
tags: ['console.command']
6262
Facile\SymfonyFunctionalTestCase\Tests\App\Command\TestStatusCodeCommand:
6363
tags: ['console.command']
64-
65-
twig:
66-
strict_variables: true
67-
exception_controller: ~

tests/AppConfig/AppConfigKernel.php

Lines changed: 0 additions & 23 deletions
This file was deleted.

tests/AppConfig/config.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/Command/CommandTest.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,4 @@ public function testRunCommandStatusCode(): void
5858

5959
$this->assertSame(10, $commandTester->getStatusCode());
6060
}
61-
62-
public function tearDown(): void
63-
{
64-
parent::tearDown();
65-
66-
unset($commandTester);
67-
}
6861
}

0 commit comments

Comments
 (0)