8000 minor #58362 [HttpKernel] do not use the Test suffix for non test cla… · symfony/symfony@81da0f2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 81da0f2

Browse files
committed
minor #58362 [HttpKernel] do not use the Test suffix for non test classes (xabbuh)
This PR was merged into the 7.2 branch. Discussion ---------- [HttpKernel] do not use the Test suffix for non test classes | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT Commits ------- 7ad8ed8 do not use the Test suffix for non test classes
2 parents d1e909a + 7ad8ed8 commit 81da0f2

File tree

6 files changed

+55
-85
lines changed

6 files changed

+55
-85
lines changed

src/Symfony/Component/Form/Test/FormPerformanceTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Component\Form\Test;
1313

14-
use Symfony\Component\Form\Tests\VersionAwareTest;
14+
use Symfony\Component\Form\Tests\VersionAwareTestTrait;
1515

1616
/**
1717
* Base class for performance tests.
@@ -23,7 +23,7 @@
2323
*/
2424
abstract class FormPerformanceTestCase extends FormIntegrationTestCase
2525
{
26-
use VersionAwareTest;
26+
use VersionAwareTestTrait;
2727

2828
protected int $maxRunningTime = 0;
2929

src/Symfony/Component/Form/Tests/Extension/Core/Type/BaseTypeTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
1313

1414
use Symfony\Component\Form\Test\TypeTestCase;
15-
use Symfony\Component\Form\Tests\VersionAwareTest;
15+
use Symfony\Component\Form\Tests\VersionAwareTestTrait;
1616

1717
/**
1818
* @author Bernhard Schussek <bschussek@gmail.com>
1919
*/
2020
abstract class BaseTypeTestCase extends TypeTestCase
2121
{
22-
use VersionAwareTest;
22+
use VersionAwareTestTrait;
2323

2424
public const TESTED_TYPE = '';
2525

src/Symfony/Component/Form/Tests/VersionAwareTest.php renamed to src/Symfony/Component/Form/Tests/VersionAwareTestTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
/**
1515
* @deprecated since Symfony 7.2, use feature detection instead.
1616
*/
17-
trait VersionAwareTest
17+
trait VersionAwareTestTrait
1818
{
1919
protected static int $supportedFeatureSetVersion = 404;
2020

@@ -23,7 +23,7 @@ trait VersionAwareTest
2323
*/
2424
protected function requiresFeatureSet(int $requiredFeatureSetVersion)
2525
{
26-
trigger_deprecation('symfony/form', '7.2', 'The "%s" trait is deprecated, use feature detection instead.', VersionAwareTest::class);
26+
trigger_deprecation('symfony/form', '7.2', 'The "%s" trait is deprecated, use feature detection instead.', VersionAwareTestTrait::class);
2727

2828
if ($requiredFeatureSetVersion > static::$supportedFeatureSetVersion) {
2929
$this->markTestSkipped(\sprintf('Test requires features from symfony/form %.2f but only version %.2f is supported.', $requiredFeatureSetVersion / 100, static::$supportedFeatureSetVersion / 100));

src/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForTest.php

Lines changed: 0 additions & 57 deletions
This file was deleted.

src/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForTestWithLoadClassCache.php

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/Symfony/Component/HttpKernel/Tests/KernelTest.php

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
use Symfony\Component\HttpKernel\HttpKernel;
3030
use Symfony\Component\HttpKernel\HttpKernelInterface;
3131
use Symfony\Component\HttpKernel\Kernel;
32-
use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest;
33-
use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTestWithLoadClassCache;
3432
use Symfony\Component\HttpKernel\Tests\Fixtures\KernelWithoutBundles;
3533
use Symfony\Component\HttpKernel\Tests\Fixtures\ResettableService;
3634

@@ -247,7 +245,7 @@ public function testSerialize()
247245
$env = 'test_env';
248246
$debug = true;
249247
$kernel = new KernelForTest($env, $debug);
250-
$expected = "O:57:\"Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest\":2:{s:14:\"\0*\0environment\";s:8:\"test_env\";s:8:\"\0*\0debug\";b:1;}";
248+
6DB6 $expected = \sprintf("O:48:\"%s\":2:{s:14:\"\0*\0environment\";s:8:\"test_env\";s:8:\"\0*\0debug\";b:1;}", KernelForTest::class);
251249
$this->assertEquals($expected, serialize($kernel));
252250
}
253251

@@ -680,3 +678,51 @@ public function process(ContainerBuilder $container): void
680678
$container->setParameter('test.processed', true);
681679
}
682680
}
681+
682+
class KernelForTest extends Kernel
683+
{
684+
public function __construct(string $environment, bool $debug, private readonly bool $fakeContainer = true)
685+
{
686+
parent::__construct($environment, $debug);
687+
}
688+
689+
public function getBundleMap(): array
690+
{
691+
return [];
692+
}
693+
694+
public function registerBundles(): iterable
695+
{
696+
return [];
697+
}
698+
699+
public function registerContainerConfiguration(LoaderInterface $loader): void
700+
{
701+
}
702+
703+
public function isBooted(): bool
704+
{
705+
return $this->booted;
706+
}
707+
708+
public function getProjectDir(): string
709+
{
710+
return __DIR__;
711+
}
712+
713+
protected function initializeContainer(): void
714+
{
715+
if ($this->fakeContainer) {
716+
$this->container = new ContainerBuilder();
717+
} else {
718+
parent::initializeContainer();
719+
}
720+
}
721+
}
722+
723+
class KernelForTestWithLoadClassCache extends KernelForTest
724+
{
725+
public function doLoadClassCache(): void
726+
{
727+
}
728+
}

0 commit comments

Comments
 (0)
0