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 <arto@pxlwidgets.com>
This commit is contained in:
Arto Rozenga
2022-01-07 13:34:18 +01:00
committed by GitHub
parent 4cbc129595
commit a4df4056b2
6 changed files with 24 additions and 32 deletions

View File

@@ -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
@@ -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

View File

@@ -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": {
@@ -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"

View File

@@ -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>

View File

@@ -278,7 +278,7 @@ final class CKEditorRenderer implements CKEditorRendererInterface
{
$request = $this->requestStack->getCurrentRequest();
if (null !== $request) {
if (null !== $request && '' !== $request->getLocale()) {
return $request->getLocale();
}

View File

@@ -84,7 +84,7 @@ class CKEditorInstallerTest extends TestCase
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']);
}
@@ -92,7 +92,7 @@ class CKEditorInstallerTest extends TestCase
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]);
}

View File

@@ -118,7 +118,7 @@ class CKEditorRendererTest extends TestCase
public function testRenderWidgetWithLocaleRequest(string $symfonyLocale, string $ckEditorLocale): void
{
$this->request
->expects($this->once())
->expects($this->exactly(2))
->method('getLocale')
->will($this->returnValue($symfonyLocale));
@@ -133,7 +133,7 @@ class CKEditorRendererTest extends TestCase
*/
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', [])
@@ -156,7 +156,7 @@ class CKEditorRendererTest extends TestCase
$this->request
->expects($this->once())
->method('getLocale')
->will($this->returnValue(null));
->will($this->returnValue(''));
$this->assertSame(
'CKEDITOR.replace("foo", []);',