Skip to content

[FrameworkBundle] ensureKernelShutdown in tearDownAfterClass #60564

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Bundle\FrameworkBundle\Test;

use PHPUnit\Framework\Attributes\AfterClass;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerInterface;
Expand Down Expand Up @@ -120,8 +121,11 @@

/**
* Shuts the kernel down if it was used in the test - called by the tearDown method by default.
*
* @afterClass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should also have the attribute, to be compatible with PHPUnit 10+

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I've added the attribute in addition of the annotation 👍
Is there any other change required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stof looks like the attribute is not available, Psalm fails but the tests pass... Is there anything I missed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the attribute is not available because Psalm runs with PHPUnit 9.x installed. But that's not an issue. We don't treat Psalm as a mandatory check, only as an helper tool (and each PR reports only new Psalm errors)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, thanks for the answer!

*/
protected static function ensureKernelShutdown()
#[AfterClass]

Check failure on line 127 in src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedAttributeClass

src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:127:7: UndefinedAttributeClass: Attribute class PHPUnit\Framework\Attributes\AfterClass does not exist (see https://psalm.dev/241)

Check failure on line 127 in src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedAttributeClass

src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:127:7: UndefinedAttributeClass: Attribute class PHPUnit\Framework\Attributes\AfterClass does not exist (see https://psalm.dev/241)
public static function ensureKernelShutdown()
{
if (null !== static::$kernel) {
static::$kernel->boot();
Expand Down
Loading