Skip to content

Commit

Permalink
Add support for Symfony 6.0 (#239)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
artoroz and Arto Rozenga authored Jan 7, 2022
1 parent 4cbc129 commit a4df405
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 32 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@ jobs:
- 7.3
- 7.4
- 8.0
phpunit: [8.5]
- 8.1
dependencies: [highest]
include:
- php-version: 7.1
phpunit: 7.5
dependencies: lowest

steps:
- name: Checkout
Expand All @@ -41,4 +37,4 @@ jobs:
composer-options: --prefer-dist

- name: Run Tests
run: SYMFONY_PHPUNIT_VERSION=${{ matrix.phpunit }} vendor/bin/simple-phpunit
run: vendor/bin/simple-phpunit
30 changes: 15 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@
"php": "^7.1|^8.0",
"ext-zip": "*",
"ext-json": "*",
"symfony/asset": "^4.4 || ^5.0",
"symfony/config": "^4.4 || ^5.0",
"symfony/dependency-injection": "^4.4 || ^5.0",
"symfony/expression-language": "^4.4 || ^5.0",
"symfony/form": "^4.4 || ^5.0",
"symfony/framework-bundle": "^4.4 || ^5.0",
"symfony/http-foundation": "^4.4 || ^5.0",
"symfony/http-kernel": "^4.4 || ^5.0",
"symfony/options-resolver": "^4.4 || ^5.0",
"symfony/property-access": "^4.4 || ^5.0",
"symfony/routing": "^4.4 || ^5.0",
"symfony/twig-bundle": "^4.4 || ^5.0",
"symfony/asset": "^4.4 || ^5.0 || ^6.0",
"symfony/config": "^4.4 || ^5.0 || ^6.0",
"symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0",
"symfony/expression-language": "^4.4 || ^5.0 || ^6.0",
"symfony/form": "^4.4 || ^5.0 || ^6.0",
"symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0",
"symfony/http-foundation": "^4.4 || ^5.0 || ^6.0",
"symfony/http-kernel": "^4.4 || ^5.0 || ^6.0",
"symfony/options-resolver": "^4.4 || ^5.0 || ^6.0",
"symfony/property-access": "^4.4 || ^5.0 || ^6.0",
"symfony/routing": "^4.4 || ^5.0 || ^6.0",
"symfony/twig-bundle": "^4.4 || ^5.0 || ^6.0",
"twig/twig": "^2.4 || ^3.0"
},
"conflict": {
Expand All @@ -41,9 +41,9 @@
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.0",
"matthiasnoback/symfony-dependency-injection-test": "^3.0 || ^4.0",
"symfony/console": "^4.4 || ^5.0",
"symfony/phpunit-bridge": "^4.4 || ^5.0",
"symfony/yaml": "^4.4 || ^5.0"
"symfony/console": "^4.4 || ^5.0 || ^6.0",
"symfony/phpunit-bridge": "^4.4 || ^5.0 || ^6.0",
"symfony/yaml": "^4.4 || ^5.0 || ^6.0"
},
"suggest": {
"egeloen/form-extra-bundle": "Allows to load CKEditor asynchronously"
Expand Down
6 changes: 1 addition & 5 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.0/phpunit.xsd"
colors="true"
bootstrap="tests/autoload.php">

<php>
<server name="SYMFONY_PHPUNIT_VERSION" value="8.5" />
</php>


<testsuites>
<testsuite name="FOSCKEditorBundle Test Suite">
<directory>./tests</directory>
Expand Down
2 changes: 1 addition & 1 deletion src/Renderer/CKEditorRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ private function getLanguage(): ?string
{
$request = $this->requestStack->getCurrentRequest();

if (null !== $request) {
if (null !== $request && '' !== $request->getLocale()) {
return $request->getLocale();
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Installer/CKEditorInstallerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ public function testInstallWithCustomBuild(): void
public function testInstallWithCustomBuildWithInvalidVersion(): void
{
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessageRegExp('/Specifying version for custom build is not supported/');
$this->expectExceptionMessageMatches('/Specifying version for custom build is not supported/');

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

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

$this->installer->install($options = ['release' => CKEditorInstaller::RELEASE_CUSTOM]);
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Renderer/CKEditorRendererTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function testRenderJsPath(): void
public function testRenderWidgetWithLocaleRequest(string $symfonyLocale, string $ckEditorLocale): void
{
$this->request
->expects($this->once())
->expects($this->exactly(2))
->method('getLocale')
->will($this->returnValue($symfonyLocale));

Expand All @@ -133,7 +133,7 @@ public function testRenderWidgetWithLocaleRequest(string $symfonyLocale, string
*/
public function testRenderWidgetWithLocaleParameter(string $symfonyLocale, string $ckEditorLocale): void
{
$this->request->expects($this->once())->method('getLocale')->will($this->returnValue($symfonyLocale));
$this->request->expects($this->exactly(2))->method('getLocale')->will($this->returnValue($symfonyLocale));
$this->assertSame(
'CKEDITOR.replace("foo", {"language":"'.$ckEditorLocale.'"});',
$this->renderer->renderWidget('foo', [])
Expand All @@ -156,7 +156,7 @@ public function testRenderWidgetWithoutLocale(): void
$this->request
->expects($this->once())
->method('getLocale')
->will($this->returnValue(null));
->will($this->returnValue(''));

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

0 comments on commit a4df405

Please sign in to comment.