Skip to content

Commit 3a3c7d6

Browse files
nikophilkbond
authored andcommitted
bot: fix cs [skip ci]
1 parent 2014ed9 commit 3a3c7d6

File tree

4 files changed

+43
-45
lines changed

4 files changed

+43
-45
lines changed

src/PHPUnit/BootFoundryOnDataProviderMethodCalled.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ final class BootFoundryOnDataProviderMethodCalled implements Event\Test\DataProv
2323
{
2424
public function notify(Event\Test\DataProviderMethodCalled $event): void
2525
{
26-
if (method_exists($event->testMethod()->className(), '_bootForDataProvider')) {
27-
call_user_func([$event->testMethod()->className(), '_bootForDataProvider']);
26+
if (\method_exists($event->testMethod()->className(), '_bootForDataProvider')) {
27+
\call_user_func([$event->testMethod()->className(), '_bootForDataProvider']);
2828
}
2929
}
3030
}

src/PHPUnit/FoundryExtension.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ public function bootstrap(
3232
Runner\Extension\ParameterCollection $parameters,
3333
): void {
3434
if (!ConstraintRequirement::from(self::MIN_PHPUNIT_VERSION)->isSatisfiedBy(Runner\Version::id())) {
35-
throw new \LogicException(
36-
\sprintf('Your PHPUnit version (%s) is not compatible with the minimum version (%s) needed to use this extension.', Runner\Version::id(), self::MIN_PHPUNIT_VERSION)
37-
);
35+
throw new \LogicException(\sprintf('Your PHPUnit version (%s) is not compatible with the minimum version (%s) needed to use this extension.', Runner\Version::id(), self::MIN_PHPUNIT_VERSION));
3836
}
3937

4038
// shutdown Foundry if for some reason it has been booted before

src/PHPUnit/ShutdownFoundryOnDataProviderMethodFinished.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ final class ShutdownFoundryOnDataProviderMethodFinished implements Event\Test\Da
2323
{
2424
public function notify(Event\Test\DataProviderMethodFinished $event): void
2525
{
26-
if (method_exists($event->testMethod()->className(), '_shutdownAfterDataProvider')) {
27-
call_user_func([$event->testMethod()->className(), '_shutdownAfterDataProvider']);
26+
if (\method_exists($event->testMethod()->className(), '_shutdownAfterDataProvider')) {
27+
\call_user_func([$event->testMethod()->className(), '_shutdownAfterDataProvider']);
2828
}
2929
}
3030
}

src/Test/Factories.php

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,44 @@ public static function _shutdownFoundry(): void
4444
Configuration::shutdown();
4545
}
4646

47+
/**
48+
* @see \Zenstruck\Foundry\PHPUnit\BootFoundryOnDataProviderMethodCalled
49+
* @internal
50+
*/
51+
public static function _bootForDataProvider(): void
52+
{
53+
if (!\is_subclass_of(static::class, KernelTestCase::class)) { // @phpstan-ignore function.impossibleType
54+
// unit test
55+
Configuration::bootForDataProvider(UnitTestConfig::build());
56+
57+
return;
58+
}
59+
60+
// integration test
61+
Configuration::bootForDataProvider(static function() {
62+
if (!static::getContainer()->has('.zenstruck_foundry.configuration')) { // @phpstan-ignore staticMethod.notFound
63+
throw new \LogicException('ZenstruckFoundryBundle is not enabled. Ensure it is added to your config/bundles.php.');
64+
}
65+
66+
return static::getContainer()->get('.zenstruck_foundry.configuration'); // @phpstan-ignore staticMethod.notFound
67+
});
68+
}
69+
70+
/**
71+
* @internal
72+
* @see \Zenstruck\Foundry\PHPUnit\ShutdownFoundryOnDataProviderMethodFinished
73+
*/
74+
public static function _shutdownAfterDataProvider(): void
75+
{
76+
if (\is_subclass_of(static::class, KernelTestCase::class)) { // @phpstan-ignore function.impossibleType
77+
self::ensureKernelShutdown(); // @phpstan-ignore staticMethod.notFound
78+
static::$class = null; // @phpstan-ignore staticProperty.notFound
79+
static::$kernel = null; // @phpstan-ignore staticProperty.notFound
80+
static::$booted = false; // @phpstan-ignore staticProperty.notFound
81+
}
82+
Configuration::shutdown();
83+
}
84+
4785
/**
4886
* @internal
4987
*/
@@ -98,42 +136,4 @@ private function _loadDataProvidedProxies(): void
98136

99137
initialize_proxy_object($providedData);
100138
}
101-
102-
/**
103-
* @see \Zenstruck\Foundry\PHPUnit\BootFoundryOnDataProviderMethodCalled
104-
* @internal
105-
*/
106-
public static function _bootForDataProvider(): void
107-
{
108-
if (!\is_subclass_of(static::class, KernelTestCase::class)) { // @phpstan-ignore function.impossibleType
109-
// unit test
110-
Configuration::bootForDataProvider(UnitTestConfig::build());
111-
112-
return;
113-
}
114-
115-
// integration test
116-
Configuration::bootForDataProvider(static function() {
117-
if (!static::getContainer()->has('.zenstruck_foundry.configuration')) { // @phpstan-ignore staticMethod.notFound
118-
throw new \LogicException('ZenstruckFoundryBundle is not enabled. Ensure it is added to your config/bundles.php.');
119-
}
120-
121-
return static::getContainer()->get('.zenstruck_foundry.configuration'); // @phpstan-ignore staticMethod.notFound
122-
});
123-
}
124-
125-
/**
126-
* @internal
127-
* @see \Zenstruck\Foundry\PHPUnit\ShutdownFoundryOnDataProviderMethodFinished
128-
*/
129-
public static function _shutdownAfterDataProvider(): void
130-
{
131-
if (\is_subclass_of(static::class, KernelTestCase::class)) { // @phpstan-ignore function.impossibleType
132-
self::ensureKernelShutdown(); // @phpstan-ignore staticMethod.notFound
133-
static::$class = null; // @phpstan-ignore staticProperty.notFound
134-
static::$kernel = null; // @phpstan-ignore staticProperty.notFound
135-
static::$booted = false; // @phpstan-ignore staticProperty.notFound
136-
}
137-
Configuration::shutdown();
138-
}
139139
}

0 commit comments

Comments
 (0)