Skip to content

Commit a4df405

Browse files
artorozArto Rozenga
andauthored
Add support for Symfony 6.0 (#239)
* Add support for Symfony 6.0 * Fix deprecations from PHPUnit * Don't force PHPUnit version and fix tests for Symfony 6 compatibility * Drop support for php 7.1 and add 8.1 support Co-authored-by: Arto Rozenga <[email protected]>
1 parent 4cbc129 commit a4df405

File tree

6 files changed

+24
-32
lines changed

6 files changed

+24
-32
lines changed

.github/workflows/test.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,8 @@ jobs:
1515
- 7.3
1616
- 7.4
1717
- 8.0
18-
phpunit: [8.5]
18+
- 8.1
1919
dependencies: [highest]
20-
include:
21-
- php-version: 7.1
22-
phpunit: 7.5
23-
dependencies: lowest
2420

2521
steps:
2622
- name: Checkout
@@ -41,4 +37,4 @@ jobs:
4137
composer-options: --prefer-dist
4238

4339
- name: Run Tests
44-
run: SYMFONY_PHPUNIT_VERSION=${{ matrix.phpunit }} vendor/bin/simple-phpunit
40+
run: vendor/bin/simple-phpunit

composer.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@
2020
"php": "^7.1|^8.0",
2121
"ext-zip": "*",
2222
"ext-json": "*",
23-
"symfony/asset": "^4.4 || ^5.0",
24-
"symfony/config": "^4.4 || ^5.0",
25-
"symfony/dependency-injection": "^4.4 || ^5.0",
26-
"symfony/expression-language": "^4.4 || ^5.0",
27-
"symfony/form": "^4.4 || ^5.0",
28-
"symfony/framework-bundle": "^4.4 || ^5.0",
29-
"symfony/http-foundation": "^4.4 || ^5.0",
30-
"symfony/http-kernel": "^4.4 || ^5.0",
31-
"symfony/options-resolver": "^4.4 || ^5.0",
32-
"symfony/property-access": "^4.4 || ^5.0",
33-
"symfony/routing": "^4.4 || ^5.0",
34-
"symfony/twig-bundle": "^4.4 || ^5.0",
23+
"symfony/asset": "^4.4 || ^5.0 || ^6.0",
24+
"symfony/config": "^4.4 || ^5.0 || ^6.0",
25+
"symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0",
26+
"symfony/expression-language": "^4.4 || ^5.0 || ^6.0",
27+
"symfony/form": "^4.4 || ^5.0 || ^6.0",
28+
"symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0",
29+
"symfony/http-foundation": "^4.4 || ^5.0 || ^6.0",
30+
"symfony/http-kernel": "^4.4 || ^5.0 || ^6.0",
31+
"symfony/options-resolver": "^4.4 || ^5.0 || ^6.0",
32+
"symfony/property-access": "^4.4 || ^5.0 || ^6.0",
33+
"symfony/routing": "^4.4 || ^5.0 || ^6.0",
34+
"symfony/twig-bundle": "^4.4 || ^5.0 || ^6.0",
3535
"twig/twig": "^2.4 || ^3.0"
3636
},
3737
"conflict": {
@@ -41,9 +41,9 @@
4141
"require-dev": {
4242
"friendsofphp/php-cs-fixer": "^2.0",
4343
"matthiasnoback/symfony-dependency-injection-test": "^3.0 || ^4.0",
44-
"symfony/console": "^4.4 || ^5.0",
45-
"symfony/phpunit-bridge": "^4.4 || ^5.0",
46-
"symfony/yaml": "^4.4 || ^5.0"
44+
"symfony/console": "^4.4 || ^5.0 || ^6.0",
45+
"symfony/phpunit-bridge": "^4.4 || ^5.0 || ^6.0",
46+
"symfony/yaml": "^4.4 || ^5.0 || ^6.0"
4747
},
4848
"suggest": {
4949
"egeloen/form-extra-bundle": "Allows to load CKEditor asynchronously"

phpunit.xml.dist

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.0/phpunit.xsd"
66
colors="true"
77
bootstrap="tests/autoload.php">
8-
9-
<php>
10-
<server name="SYMFONY_PHPUNIT_VERSION" value="8.5" />
11-
</php>
12-
8+
139
<testsuites>
1410
<testsuite name="FOSCKEditorBundle Test Suite">
1511
<directory>./tests</directory>

src/Renderer/CKEditorRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ private function getLanguage(): ?string
278278
{
279279
$request = $this->requestStack->getCurrentRequest();
280280

281-
if (null !== $request) {
281+
if (null !== $request && '' !== $request->getLocale()) {
282282
return $request->getLocale();
283283
}
284284

tests/Installer/CKEditorInstallerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,15 @@ public function testInstallWithCustomBuild(): void
8484
public function testInstallWithCustomBuildWithInvalidVersion(): void
8585
{
8686
$this->expectException(\RuntimeException::class);
87-
$this->expectExceptionMessageRegExp('/Specifying version for custom build is not supported/');
87+
$this->expectExceptionMessageMatches('/Specifying version for custom build is not supported/');
8888

8989
$this->installer->install($options = ['release' => CKEditorInstaller::RELEASE_CUSTOM, 'custom_build_id' => '459c358ccf2e34f083e3c8847d3af23e', 'version' => '4.11.4']);
9090
}
9191

9292
public function testInstallWithCustomBuildWithMissingId(): void
9393
{
9494
$this->expectException(\RuntimeException::class);
95-
$this->expectExceptionMessageRegExp('/Custom build ID is not specified/');
95+
$this->expectExceptionMessageMatches('/Custom build ID is not specified/');
9696

9797
$this->installer->install($options = ['release' => CKEditorInstaller::RELEASE_CUSTOM]);
9898
}

tests/Renderer/CKEditorRendererTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function testRenderJsPath(): void
118118
public function testRenderWidgetWithLocaleRequest(string $symfonyLocale, string $ckEditorLocale): void
119119
{
120120
$this->request
121-
->expects($this->once())
121+
->expects($this->exactly(2))
122122
->method('getLocale')
123123
->will($this->returnValue($symfonyLocale));
124124

@@ -133,7 +133,7 @@ public function testRenderWidgetWithLocaleRequest(string $symfonyLocale, string
133133
*/
134134
public function testRenderWidgetWithLocaleParameter(string $symfonyLocale, string $ckEditorLocale): void
135135
{
136-
$this->request->expects($this->once())->method('getLocale')->will($this->returnValue($symfonyLocale));
136+
$this->request->expects($this->exactly(2))->method('getLocale')->will($this->returnValue($symfonyLocale));
137137
$this->assertSame(
138138
'CKEDITOR.replace("foo", {"language":"'.$ckEditorLocale.'"});',
139139
$this->renderer->renderWidget('foo', [])
@@ -156,7 +156,7 @@ public function testRenderWidgetWithoutLocale(): void
156156
$this->request
157157
->expects($this->once())
158158
->method('getLocale')
159-
->will($this->returnValue(null));
159+
->will($this->returnValue(''));
160160

161161
$this->assertSame(
162162
'CKEDITOR.replace("foo", []);',

0 commit comments

Comments
 (0)