diff --git a/.github/workflows/test-application.yaml b/.github/workflows/test-application.yaml
index 64ab2b95..c8d8261d 100644
--- a/.github/workflows/test-application.yaml
+++ b/.github/workflows/test-application.yaml
@@ -20,6 +20,7 @@ jobs:
database: postgres
dependency-versions: 'lowest'
tools: 'composer:v2'
+ phpunit-config: 'phpunit-9.xml.dist'
env:
SYMFONY_DEPRECATIONS_HELPER: disabled
DATABASE_URL: postgres://postgres:postgres@127.0.0.1/sulu_form_test?serverVersion=12.5
@@ -30,6 +31,7 @@ jobs:
database: mysql
dependency-versions: 'highest'
tools: 'composer:v2'
+ phpunit-config: 'phpunit-9.xml.dist'
env:
SYMFONY_DEPRECATIONS_HELPER: weak
DATABASE_URL: mysql://root:root@127.0.0.1/sulu_form_test?serverVersion=5.7
@@ -57,6 +59,16 @@ jobs:
DATABASE_COLLATE: utf8mb4_unicode_ci
- php-version: '8.2'
+ database: postgres
+ dependency-versions: 'highest'
+ tools: 'composer:v2'
+ env:
+ SYMFONY_DEPRECATIONS_HELPER: weak
+ DATABASE_URL: postgres://postgres:postgres@127.0.0.1/sulu_form_test?serverVersion=12.5
+ DATABASE_CHARSET: UTF8
+ DATABASE_COLLATE:
+
+ - php-version: '8.3'
database: mysql
dependency-versions: 'highest'
tools: 'composer:v2'
@@ -66,10 +78,11 @@ jobs:
DATABASE_CHARSET: utf8mb4
DATABASE_COLLATE: utf8mb4_unicode_ci
- - php-version: '8.3'
+ - php-version: '8.4'
database: mysql
dependency-versions: 'highest'
tools: 'composer:v2'
+ composer-options: '--ignore-platform-reqs'
env:
SYMFONY_DEPRECATIONS_HELPER: weak
DATABASE_URL: mysql://root:root@127.0.0.1/sulu_form_test?serverVersion=5.7
@@ -96,7 +109,7 @@ jobs:
steps:
- name: Checkout project
- uses: actions/checkout@v2
+ uses: actions/checkout@v4
- name: Install and configure PHP
uses: shivammathur/setup-php@v2
@@ -106,11 +119,13 @@ jobs:
tools: ${{ matrix.tools }}
coverage: none
- - name: Remove not required tooling for tests
- run: composer remove php-cs-fixer/shim "*phpstan*" --dev --no-update
+ - name: Remove Lint Tools
+ # These tools are not required to run tests, so we are removing them to improve dependency resolving and
+ # testing lowest versions.
+ run: composer remove "*php-cs-fixer*" "*phpstan*" "*rector*" --dev --no-update
- name: Install composer dependencies
- uses: ramsey/composer-install@v1
+ uses: ramsey/composer-install@v2
with:
dependency-versions: ${{matrix.dependency-versions}}
composer-options: ${{ matrix.composer-options }}
@@ -120,7 +135,7 @@ jobs:
env: ${{ matrix.env }}
- name: Execute test cases
- run: time composer test
+ run: time composer test -- --config ${{ matrix.phpunit-config || 'phpunit.xml.dist' }}
env: ${{ matrix.env }}
lint:
@@ -131,18 +146,18 @@ jobs:
steps:
- name: Checkout project
- uses: actions/checkout@v2
+ uses: actions/checkout@v4
- name: Install and configure PHP
uses: shivammathur/setup-php@v2
with:
- php-version: 8.1
+ php-version: 8.3
extensions: 'imagick'
tools: 'composer:v2'
coverage: none
- name: Install composer dependencies
- uses: ramsey/composer-install@v1
+ uses: ramsey/composer-install@v2
with:
dependency-versions: ${{matrix.dependency-versions}}
composer-options: ${{ matrix.composer-options }}
diff --git a/Command/FormGeneratorCommand.php b/Command/FormGeneratorCommand.php
index 924e3c81..92983ddf 100644
--- a/Command/FormGeneratorCommand.php
+++ b/Command/FormGeneratorCommand.php
@@ -22,8 +22,6 @@
class FormGeneratorCommand extends Command
{
- protected static $defaultName = 'sulu:form:generate-form';
-
/**
* @var EntityManagerInterface
*/
@@ -38,7 +36,7 @@ public function __construct(
EntityManagerInterface $entityManager,
WebspaceManagerInterface $webspaceManager
) {
- parent::__construct(static::$defaultName);
+ parent::__construct('sulu:form:generate-form');
$this->entityManager = $entityManager;
$this->webspaceManager = $webspaceManager;
}
diff --git a/Tests/Application/config/bootstrap.php b/Tests/Application/config/bootstrap.php
index 7314acf9..30707549 100644
--- a/Tests/Application/config/bootstrap.php
+++ b/Tests/Application/config/bootstrap.php
@@ -21,6 +21,10 @@
require $file;
+if (!\trait_exists(Prophecy\PhpUnit\ProphecyTrait::class)) { // backwards compatibility layer for < PHP 7.3
+ require __DIR__ . '/../../prophecy-trait-bc-layer.php';
+}
+
// Load cached env vars if the .env.local.php file exists
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
if (\is_array($env = @include \dirname(__DIR__) . '/.env.local.php')) {
diff --git a/Tests/Functional/Mail/HelperTestCase.php b/Tests/Functional/Mail/HelperTestCase.php
index 84da9504..a6ab71f6 100644
--- a/Tests/Functional/Mail/HelperTestCase.php
+++ b/Tests/Functional/Mail/HelperTestCase.php
@@ -33,8 +33,6 @@ class HelperTestCase extends SuluTestCase
protected function setUp(): void
{
- static::$kernel = null; // requires as Symfony 4.4 does not unset on tearDown
-
$this->client = $this->createWebsiteClient();
$this->purgeDatabase();
$this->initPhpcr();
diff --git a/Tests/Functional/Metadata/DynamicFormMetadataLoaderTest.php b/Tests/Functional/Metadata/DynamicFormMetadataLoaderTest.php
index 39f800f2..78e2b60d 100644
--- a/Tests/Functional/Metadata/DynamicFormMetadataLoaderTest.php
+++ b/Tests/Functional/Metadata/DynamicFormMetadataLoaderTest.php
@@ -238,8 +238,8 @@ public function testGetMetadataAttachmentEnglish(): void
$this->assertEquals('number', $attachment->getItems()['options/max']->getType());
$this->assertEquals(6, $attachment->getItems()['options/max']->getColspan());
- $this->assertObjectHasAttribute('schema', $attachment);
- $this->assertObjectHasAttribute('key', $attachment);
+ $this->assertTrue(\property_exists($attachment, 'schema'));
+ $this->assertTrue(\property_exists($attachment, 'key'));
}
public function testGetMetadataAttachmentGerman(): void
diff --git a/Tests/Unit/Configuration/FormConfigurationFactoryTest.php b/Tests/Unit/Configuration/FormConfigurationFactoryTest.php
index ce791041..a1d62196 100644
--- a/Tests/Unit/Configuration/FormConfigurationFactoryTest.php
+++ b/Tests/Unit/Configuration/FormConfigurationFactoryTest.php
@@ -12,6 +12,7 @@
namespace Sulu\Bundle\FormBundle\Tests\Unit\Configuration;
use PHPUnit\Framework\TestCase;
+use Prophecy\PhpUnit\ProphecyTrait;
use Sulu\Bundle\FormBundle\Configuration\FormConfigurationFactory;
use Sulu\Bundle\FormBundle\Configuration\MailConfigurationInterface;
use Sulu\Bundle\FormBundle\Entity\Dynamic;
@@ -26,6 +27,8 @@
*/
class FormConfigurationFactoryTest extends TestCase
{
+ use ProphecyTrait;
+
public function testBuildByDynamic(): void
{
$dynamic = $this->createDynamic();
diff --git a/Tests/Unit/Event/ProtectedMediaSubscriberTest.php b/Tests/Unit/Event/ProtectedMediaSubscriberTest.php
index ca65f7ae..eb8ac205 100644
--- a/Tests/Unit/Event/ProtectedMediaSubscriberTest.php
+++ b/Tests/Unit/Event/ProtectedMediaSubscriberTest.php
@@ -15,6 +15,7 @@
use Doctrine\ORM\QueryBuilder;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
+use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use Sulu\Bundle\FormBundle\Event\ProtectedMediaSubscriber;
use Sulu\Bundle\FormBundle\Tests\Application\Kernel;
@@ -29,6 +30,8 @@
class ProtectedMediaSubscriberTest extends TestCase
{
+ use ProphecyTrait;
+
/**
* @var EntityManagerInterface|ObjectProphecy
*/
diff --git a/Tests/Unit/Event/SendinblueListSubscriberTest.php b/Tests/Unit/Event/SendinblueListSubscriberTest.php
index 55aff833..77dfebd6 100644
--- a/Tests/Unit/Event/SendinblueListSubscriberTest.php
+++ b/Tests/Unit/Event/SendinblueListSubscriberTest.php
@@ -15,6 +15,7 @@
use GuzzleHttp\Psr7\Response;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
+use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use Psr\Http\Message\RequestInterface;
use Sulu\Bundle\FormBundle\Configuration\FormConfiguration;
@@ -33,6 +34,8 @@
class SendinblueListSubscriberTest extends TestCase
{
+ use ProphecyTrait;
+
/**
* @var RequestStack
*/
diff --git a/Tests/Unit/Mail/MailerHelperTest.php b/Tests/Unit/Mail/MailerHelperTest.php
index ae730026..54962a03 100644
--- a/Tests/Unit/Mail/MailerHelperTest.php
+++ b/Tests/Unit/Mail/MailerHelperTest.php
@@ -12,6 +12,7 @@
namespace Sulu\Bundle\FormBundle\Tests\Unit\Mail;
use PHPUnit\Framework\TestCase;
+use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use Psr\Log\LoggerInterface;
use Sulu\Bundle\FormBundle\Mail\MailerHelper;
@@ -27,6 +28,8 @@
*/
class MailerHelperTest extends TestCase
{
+ use ProphecyTrait;
+
/**
* @var MailerHelper
*/
diff --git a/Tests/prophecy-trait-bc-layer.php b/Tests/prophecy-trait-bc-layer.php
new file mode 100644
index 00000000..55757afb
--- /dev/null
+++ b/Tests/prophecy-trait-bc-layer.php
@@ -0,0 +1,19 @@
+
+
+
+
+ ./Tests
+
+
+
+
+
+ .
+
+ Resources/
+ Tests/
+ vendor/
+
+
+
+
+
+
+
+
+
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index bbaf9804..f355e585 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -1,25 +1,24 @@
-
+
./Tests
-
-
- .
-
- Resources/
- Tests/
- vendor/
-
-
-
-
-
+
+