Skip to content

Commit dc7f6f5

Browse files
authored
Merge pull request #197 from symfony-cmf/alexander-schranz-enhancement/symfony-5-support
Add support for symfony 5
2 parents 2a310c4 + e0186d5 commit dc7f6f5

File tree

4 files changed

+45
-19
lines changed

4 files changed

+45
-19
lines changed

.travis.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,18 @@ matrix:
3838
env: COMPOSER_FLAGS="--prefer-lowest --prefer-stable" SYMFONY_REQUIRE=3.4.* SYMFONY_PHPUNIT_VERSION=6 SYMFONY_DEPRECATIONS_HELPER=weak
3939
- php: 7.4
4040
env: SYMFONY_REQUIRE=4.3.*
41+
- php: 7.4
42+
env: SYMFONY_REQUIRE=4.4.* SYMFONY_PHPUNIT_VERSION=7
4143
- php: 7.4
4244
env: SYMFONY_REQUIRE=4.4.*
4345
- php: 7.4
44-
env: SYMFONY_REQUIRE=4.4.* SYMFONY_PHPUNIT_VERSION=7
46+
env: SYMFONY_REQUIRE=5.0.*
4547
- php: 7.4
46-
env: STABILITY="dev" SYMFONY_VERSION=4.4.*
48+
env: STABILITY="dev"
4749
fast_finish: true
4850
allow_failures:
4951
- php: 7.4
50-
env: STABILITY="dev" SYMFONY_REQUIRE=4.4.*
52+
env: STABILITY="dev"
5153

5254
before_install:
5355
- phpenv config-rm xdebug.ini || true

composer.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@
1818
"friendsofsymfony/jsrouting-bundle": "^1.1 || ^2.1",
1919
"jackalope/jackalope": "^1.3",
2020
"jackalope/jackalope-doctrine-dbal": "^1.3",
21-
"symfony/browser-kit": "^3.4.22 || ^4.1",
22-
"symfony/console": "^3.4.22 || ^4.1",
23-
"symfony/css-selector": "^3.4.22 || ^4.1",
24-
"symfony/debug": "^3.4.22 || ^4.1",
25-
"symfony/dependency-injection": "^3.4.22 || ^4.1",
26-
"symfony/doctrine-bridge": "^3.4.22 || ^4.1",
27-
"symfony/framework-bundle": "^3.4.22 || ^4.1",
28-
"symfony/http-foundation": "^3.4.22 || ^4.1",
29-
"symfony/http-kernel": "^3.4.22 || ^4.1",
30-
"symfony/monolog-bundle": "~3.1",
31-
"symfony/process": "^3.4.22 || ^4.1",
32-
"symfony/security-bundle": "^3.4.22 || ^4.1",
33-
"symfony/twig-bundle": "^3.4.22 || ^4.1",
21+
"symfony/browser-kit": "^3.4.22 || ^4.1 || ^5.0",
22+
"symfony/console": "^3.4.22 || ^4.1 || ^5.0",
23+
"symfony/css-selector": "^3.4.22 || ^4.1 || ^5.0",
24+
"symfony/debug": "^3.4.22 || ^4.1 || ^5.0",
25+
"symfony/dependency-injection": "^3.4.22 || ^4.1 || ^5.0",
26+
"symfony/doctrine-bridge": "^3.4.22 || ^4.1 || ^5.0",
27+
"symfony/framework-bundle": "^3.4.22 || ^4.1 || ^5.0",
28+
"symfony/http-foundation": "^3.4.22 || ^4.1 || ^5.0",
29+
"symfony/http-kernel": "^3.4.22 || ^4.1 || ^5.0",
30+
"symfony/monolog-bundle": "~3.1 || ^5.0",
31+
"symfony/process": "^3.4.22 || ^4.1 || ^5.0",
32+
"symfony/security-bundle": "^3.4.22 || ^4.1 || ^5.0",
33+
"symfony/twig-bundle": "^3.4.22 || ^4.1 || ^5.0",
3434
"symfony/phpunit-bridge": "^4.2.2"
3535
},
3636
"autoload": {

src/Functional/BaseTestCase.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Doctrine\Bundle\PHPCRBundle\Test\RepositoryManager;
1515
use Symfony\Bundle\FrameworkBundle\Client;
16+
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
1617
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
1718
use Symfony\Cmf\Component\Testing\Functional\DbManager\PhpcrDecorator;
1819
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -52,7 +53,10 @@ protected function getKernelConfiguration(): array
5253
return [];
5354
}
5455

55-
public function getFrameworkBundleClient(): Client
56+
/**
57+
* @return Client|KernelBrowser
58+
*/
59+
public function getFrameworkBundleClient()
5660
{
5761
if (null === $this->client) {
5862
// property does not exist in all symfony versions

tests/Functional/BaseTestCaseTest.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,35 @@
1212
namespace Symfony\Cmf\Component\Testing\Tests\Functional;
1313

1414
use Doctrine\Bundle\PHPCRBundle\Test\RepositoryManager;
15+
use PHPUnit\Framework\MockObject\MockObject;
1516
use PHPUnit\Framework\TestCase;
1617
use Symfony\Bundle\FrameworkBundle\Client;
18+
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
1719
use Symfony\Cmf\Component\Testing\Functional\DbManager\PHPCR;
1820
use Symfony\Cmf\Component\Testing\Tests\Fixtures\TestTestCase;
1921
use Symfony\Component\DependencyInjection\ContainerInterface;
2022
use Symfony\Component\HttpKernel\KernelInterface;
2123

2224
class BaseTestCaseTest extends TestCase
2325
{
26+
/**
27+
* @var ContainerInterface|MockObject
28+
*/
2429
private $container;
2530

31+
/**
32+
* @var KernelInterface|MockObject
33+
*/
2634
private $kernel;
2735

2836
/**
2937
* @var TestTestCase
3038
*/
3139
private $testCase;
3240

41+
/**
42+
* @var KernelBrowser|Client|MockObject
43+
*/
3344
private $client;
3445

3546
protected function setUp(): void
@@ -51,7 +62,12 @@ protected function setUp(): void
5162
$this->testCase = new TestTestCase();
5263
$this->testCase->setKernel($this->kernel);
5364

54-
$this->client = $this->createMock(Client::class);
65+
if (class_exists(KernelBrowser::class)) {
66+
$this->client = $this->createMock(KernelBrowser::class);
67+
} else {
68+
$this->client = $this->createMock(Client::class);
69+
}
70+
5571
$this->client->expects($this->any())
5672
->method('getContainer')
5773
->willReturn($this->container);
@@ -79,7 +95,11 @@ public function provideTestDb()
7995

8096
public function testItCanProvideAFrameworkBundleClient()
8197
{
82-
$this->assertInstanceOf(Client::class, $this->testCase->getFrameworkBundleClient());
98+
if (class_exists(KernelBrowser::class)) {
99+
$this->assertInstanceOf(KernelBrowser::class, $this->testCase->getFrameworkBundleClient());
100+
} else {
101+
$this->assertInstanceOf(Client::class, $this->testCase->getFrameworkBundleClient());
102+
}
83103
}
84104

85105
/**

0 commit comments

Comments
 (0)