8000 [HttpKernel] do not use the Test suffix for non test classes by xabbuh · Pull Request #58362 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[HttpKernel] do not use the Test suffix for non test classes #58362

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
merged 1 commit into from
Sep 27, 2024

Conversation

xabbuh
Copy link
Member
@xabbuh xabbuh commented Sep 23, 2024
Q A
Branch? 7.2
Bug fix? no
New feature? no
Deprecations? no
Issues
License MIT

@xabbuh xabbuh force-pushed the phpunit-test-suffix branch from d04d1f4 to 7ad8ed8 Compare September 23, 2024 13:05
@@ -661,3 +659,51 @@ public function process(ContainerBuilder $container): void
$container->setParameter('test.processed', true);
}
}

class KernelForTest extends Kernel
Copy link
Member

Choose a reason for hiding this comment

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

Don't we still have the issue as we still have the Test suffix here ?

Copy link
Member Author

Choose a reason for hiding this comment

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

That doesn't matter as the file is named KernelTest.php. Thus PHPUnit searches for a test named KernelTest.

Here is how it looks in practice without the changes with PHPUnit 11:

PHPUnit 11.3.5 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.9
Configuration: /Users/christianflothmann/symfony/phpunit.xml.dist

.............................................................   61 / 1293 (  4%)
.............................................................  122 / 1293 (  9%)
.............................................................  183 / 1293 ( 14%)
.............................................................  244 / 1293 ( 18%)
.............................................................  305 / 1293 ( 23%)
.............................................................  366 / 1293 ( 28%)
.............................................................  427 / 1293 ( 33%)
.............................................................  488 / 1293 ( 37%)
.............................................................  549 / 1293 ( 42%)
..................................................R..........  610 / 1293 ( 47%)
.............................................................  671 / 1293 ( 51%)
.............................................................  732 / 1293 ( 56%)
.............................................................  793 / 1293 ( 61%)
.............................................................  854 / 1293 ( 66%)
.............................................................  915 / 1293 ( 70%)
.............................................................  976 / 1293 ( 75%)
............................................................. 1037 / 1293 ( 80%)
............................................................. 1098 / 1293 ( 84%)
............................................................. 1159 / 1293 ( 89%)
............................................................. 1220 / 1293 ( 94%)
............................................................. 1281 / 1293 ( 99%)
............                                                  1293 / 1293 (100%)

Time: 00:05.271, Memory: 87.27 MB

There was 1 PHPUnit test runner warning:

1) Class Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest declared in /Users/christianflothmann/symfony/src/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForTest.php does not extend PHPUnit\Framework\TestCase

--

There was 1 risky test:

1) Symfony\Component\HttpKernel\Tests\EventListener\RouterListenerTest::testWithBadRequest
Test code or tested code did not remove its own exception handlers

And this is how it is with the changes being done here:

PHPUnit 11.3.5 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.9
Configuration: /Users/christianflothmann/symfony/phpunit.xml.dist

.............................................................   61 / 1293 (  4%)
.............................................................  122 / 1293 (  9%)
.............................................................  183 / 1293 ( 14%)
.............................................................  244 / 1293 ( 18%)
.............................................................  305 / 1293 ( 23%)
.............................................................  366 / 1293 ( 28%)
.............................................................  427 / 1293 ( 33%)
.............................................................  488 / 1293 ( 37%)
.............................................................  549 / 1293 ( 42%)
..................................................R..........  610 / 1293 ( 47%)
.............................................................  671 / 1293 ( 51%)
.............................................................  732 / 1293 ( 56%)
.............................................................  793 / 1293 ( 61%)
.............................................................  854 / 1293 ( 66%)
.............................................................  915 / 1293 ( 70%)
.............................................................  976 / 1293 ( 75%)
............................................................. 1037 / 1293 ( 80%)
............................................................. 1098 / 1293 ( 84%)
............................................................. 1159 / 1293 ( 89%)
............................................................. 1220 / 1293 ( 94%)
............................................................. 1281 / 1293 ( 99%)
............                                                  1293 / 1293 (100%)

Time: 00:05.250, Memory: 87.27 MB

There was 1 risky test:

1) Symfony\Component\HttpKernel\Tests\EventListener\RouterListenerTest::testWithBadRequest
Test code or tested code did not remove its own exception handlers

@fabpot
Copy link
Member
fabpot commented Sep 27, 2024

Thank you @xabbuh.

@fabpot fabpot merged commit 81da0f2 into symfony:7.2 Sep 27, 2024
10 checks passed
@xabbuh xabbuh deleted the phpunit-test-suffix branch September 27, 2024 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0