-
-
Notifications
You must be signed in to change notification settings - Fork 937
fix(symfony): implement checkContainerIsBooted for bc-layer #7002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,7 +36,11 @@ abstract class ApiTestCase extends KernelTestCase | |
| */ | ||
| protected static function createClient(array $kernelOptions = [], array $defaultOptions = []): Client | ||
| { | ||
| if (!static::$booted) { | ||
| if (null === ($alwaysBootKernel = $kernelOptions['alwaysBootKernel'] ?? static::alwaysBootKernel())) { | ||
| trigger_deprecation('api-platform/symfony', '5.0', \sprintf('We will not boot the kernel if it is booted already. Define the kernelOptions "alwaysBootKernel" or override "%s::alwaysBootKernel" to return "true" if you want to keep the old behavior.', static::class)); | ||
| } | ||
|
|
||
| if ($alwaysBootKernel ? true : !static::$booted) { | ||
| static::bootKernel($kernelOptions); | ||
| } | ||
|
|
||
|
|
@@ -99,4 +103,12 @@ protected function getIriFromResource(object $resource): ?string | |
|
|
||
| return $iriConverter->getIriFromResource($resource); | ||
| } | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It depends on how we name the method. When using BTW, I proposed #7007 for this bug fix if you want to adapt yours accordingly. |
||
| /** | ||
| * When using Alice we recommend to use "true" | ||
| */ | ||
| protected static function alwaysBootKernel(): ?bool | ||
| { | ||
| return null; | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!static::$bootedif we want to keep exactly the same behaviour as before.if ($checkContainerIsBooted)because it's a booleanThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overrideinstead ofimplements