Skip to content

Commit

Permalink
Add Symfony 7 support (#390)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCadien authored Jul 24, 2024
1 parent 5886053 commit f5db9a5
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 25 deletions.
4 changes: 2 additions & 2 deletions Metadata/DynamicFormMetadataLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function __construct(
/**
* @param string $cacheDir
*/
public function warmUp($cacheDir)
public function warmUp($cacheDir, ?string $buildDir = null): array
{
$resource = __DIR__ . '/../Resources/config/forms/form_details.xml';
$formMetadataCollection = $this->formXmlLoader->load($resource);
Expand Down Expand Up @@ -160,7 +160,7 @@ private function loadFieldTypeMetadata(string $typeKey, FormFieldTypeInterface $
return $form;
}

public function isOptional()
public function isOptional(): bool
{
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/Mail/HelperTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class HelperTestCase extends SuluTestCase

protected function setUp(): void
{
parent::setUp();
static::$kernel = null; // requires as Symfony 4.4 does not unset on tearDown

$this->client = $this->createWebsiteClient();
$this->purgeDatabase();
Expand Down
13 changes: 11 additions & 2 deletions Tests/Functional/Mail/MailerHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,19 @@

class MailerHelperTest extends HelperTestCase
{
protected static $class = MailerKernel::class;
protected function setUp(): void
{
static::$class = MailerKernel::class;
static::$kernel = null; // requires as Symfony 4.4 does not unset on tearDown

parent::setUp();
}

public function testSendsEmailUsingMailerComponent()
{
$this->assertIsObject(static::$kernel);
$this->assertSame(MailerKernel::class, \get_class(static::$kernel));

$formTranslationRepository = $this->entityManager->getRepository(FormTranslation::class);
/** @var FormTranslation $formTranslation */
$formTranslation = $formTranslationRepository->findOneBy(['title' => 'Title', 'locale' => 'de']);
Expand All @@ -34,7 +43,7 @@ public function testSendsEmailUsingMailerComponent()
$this->assertSame(0, $mailCollector->getMessageCount());
}

// 2 messages should be send 1 to admin and 1 to email
// 2 messages should be sent 1 to admin and 1 to email
$this->assertEmailCount(2);
}
}
12 changes: 9 additions & 3 deletions Tests/Unit/Event/ProtectedMediaSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ public function testOtherRoute(): void
$event = new RequestEvent(
new Kernel('test', true, SuluKernel::CONTEXT_WEBSITE),
$request,
HttpKernelInterface::MASTER_REQUEST
\defined(HttpKernelInterface::class . '::MASTER_REQUEST')
? HttpKernelInterface::MASTER_REQUEST
: HttpKernelInterface::MAIN_REQUEST
);

$this->formatCache->analyzedMediaUrl(Argument::any())
Expand All @@ -108,7 +110,9 @@ public function testImageProxyRoute(): void
$event = new RequestEvent(
new Kernel('test', true, SuluKernel::CONTEXT_WEBSITE),
$request,
HttpKernelInterface::MASTER_REQUEST
\defined(HttpKernelInterface::class . '::MASTER_REQUEST')
? HttpKernelInterface::MASTER_REQUEST
: HttpKernelInterface::MAIN_REQUEST
);

$this->formatCache->analyzedMediaUrl(Argument::any())
Expand Down Expand Up @@ -136,7 +140,9 @@ public function testDownloadRoute(): void
$event = new RequestEvent(
new Kernel('test', true, SuluKernel::CONTEXT_WEBSITE),
$request,
HttpKernelInterface::MASTER_REQUEST
\defined(HttpKernelInterface::class . '::MASTER_REQUEST')
? HttpKernelInterface::MASTER_REQUEST
: HttpKernelInterface::MAIN_REQUEST
);

$this->mockLoadCollectionKey('sulu_form');
Expand Down
33 changes: 16 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,29 @@
],
"require": {
"php": "^7.2 || ^8.0",
"doctrine/collections": "^1.0",
"doctrine/collections": "^1.0 || ^2.0",
"doctrine/orm": "^2.5.3",
"doctrine/persistence": "^1.3 || ^2.0 || ^3.0",
"sulu/sulu": "^2.4.1 || ^2.5.0@dev",
"symfony/config": "^4.4 || ^5.0 || ^6.0",
"symfony/console": "^4.4 || ^5.0 || ^6.0",
"symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0",
"symfony/event-dispatcher": "^4.4 || ^5.0 || ^6.0",
"symfony/config": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"symfony/console": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"symfony/event-dispatcher": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"symfony/event-dispatcher-contracts": "^1.0 || ^2.0 || ^3.0",
"symfony/form": "^4.4 || ^5.0 || ^6.0",
"symfony/mailer": "^4.4 || ^5.0 || ^6.0",
"symfony/validator": "^4.4 || ^5.0 || ^6.0",
"symfony/security-csrf": "^4.4 || ^5.0 || ^6.0",
"symfony/translation": "^4.4 || ^5.0 || ^6.0",
"symfony/form": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"symfony/mailer": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"symfony/validator": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"symfony/security-csrf": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"symfony/translation": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"twig/twig": "^1.41 || ^2.0 || ^3.0"
},
"require-dev": {
"dantleech/phpcr-migrations-bundle": "^1.3",
"doctrine/data-fixtures": "^1.3.3",
"doctrine/doctrine-bundle": "^1.10 || ^2.0",
"drewm/mailchimp-api": "^2.2",
"excelwebzone/recaptcha-bundle": "^1.4.2",
"handcraftedinthealps/zendsearch": "^2.0",
"jackalope/jackalope-doctrine-dbal": "^1.3.2",
"jackalope/jackalope-doctrine-dbal": "^1.3.2 || ^2.0",
"jangregor/phpstan-prophecy": "^1.0",
"massive/search-bundle": "^2.0",
"php-cs-fixer/shim": "^3.0",
Expand All @@ -52,12 +51,12 @@
"phpstan/phpstan-symfony": "^1.0",
"phpunit/phpunit": "^8.0",
"sendinblue/api-v3-sdk": "^8.0",
"symfony/browser-kit": "^4.4 || ^5.0 || ^6.0",
"symfony/dotenv": "^4.4 || ^5.0 || ^6.0",
"symfony/mime": "^4.4 || ^5.0 || ^6.0",
"symfony/browser-kit": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"symfony/dotenv": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"symfony/mime": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"symfony/monolog-bundle": "^3.1",
"symfony/stopwatch": "^4.4 || ^5.0 || ^6.0",
"symfony/var-dumper": "^4.4 || ^5.0 || ^6.0",
"symfony/stopwatch": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"symfony/var-dumper": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"thecodingmachine/phpstan-strict-rules": "^1.0"
},
"replace": {
Expand Down

0 comments on commit f5db9a5

Please sign in to comment.