Skip to content

Commit 934dd9f

Browse files
OskarStarknicolas-grekas
authored andcommitted
Migrate to static data providers using rector/rector
1 parent 2626c82 commit 934dd9f

20 files changed

+27
-27
lines changed

Tests/Controller/ContainerControllerResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public function testInstantiateControllerWhenControllerStartsWithABackslash($con
149149
$this->assertSame('action', $controller[1]);
150150
}
151151

152-
public function getControllers()
152+
public static function getControllers()
153153
{
154154
return [
155155
['\\'.ControllerTestService::class.'::action'],

Tests/Controller/ControllerResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function testGetControllerWithStaticController($staticController, $return
141141
$this->assertSame($returnValue, $controller());
142142
}
143143

144-
public function getStaticControllers()
144+
public static function getStaticControllers()
145145
{
146146
return [
147147
[TestAbstractController::class.'::staticAction', 'foo'],

Tests/Controller/ErrorControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function testInvokeController(Request $request, \Exception $exception, in
3636
self::assertStringContainsString($content, strtr($response->getContent(), ["\n" => '', ' ' => '']));
3737
}
3838

39-
public function getInvokeControllerDataProvider()
39+
public static function getInvokeControllerDataProvider()
4040
{
4141
yield 'default status code and HTML format' => [
4242
new Request(),

Tests/DataCollector/LoggerDataCollectorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public function testReset()
179179
$c->reset();
180180
}
181181

182-
public function getCollectTestData()
182+
public static function getCollectTestData()
183183
{
184184
yield 'simple log' => [
185185
1,

Tests/DataCollector/MemoryDataCollectorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function testBytesConversion($limit, $bytes)
3737
$this->assertEquals($bytes, $method->invoke($collector, $limit));
3838
}
3939

40-
public function getBytesConversionTestData()
40+
public static function getBytesConversionTestData()
4141
{
4242
return [
4343
['2k', 2048],

Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ public function testBindings($bindingName)
308308
$this->assertEquals($expected, $locator->getArgument(0));
309309
}
310310

311-
public function provideBindings()
311+
public static function provideBindings()
312312
{
313313
return [
314314
[ControllerDummy::class.'$bar'],
@@ -343,7 +343,7 @@ public function testBindScalarValueToControllerArgument($bindingKey)
343343
$this->assertSame('foo_val', $locator->get('foo::fooAction')->get('someArg'));
344344
}
345345

346-
public function provideBindScalarValueToControllerArgument()
346+
public static function provideBindScalarValueToControllerArgument()
347347
{
348348
yield ['$someArg'];
349349
yield ['string $someArg'];

Tests/EventListener/DebugHandlersListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public function testReplaceExistingExceptionHandler()
157157
$this->assertSame($userHandler, $eHandler->setExceptionHandler('var_dump'));
158158
}
159159

160-
public function provideLevelsAssignedToLoggers(): array
160+
public static function provideLevelsAssignedToLoggers(): array
161161
{
162162
return [
163163
[false, false, '0', null, null],

Tests/EventListener/DisallowRobotsIndexingListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function testInvoke(?string $expected, array $responseArgs)
3636
$this->assertSame($expected, $response->headers->get('X-Robots-Tag'), 'Header doesn\'t match expectations');
3737
}
3838

39-
public function provideResponses(): iterable
39+
public static function provideResponses(): iterable
4040
{
4141
yield 'No header' => ['noindex', []];
4242

Tests/EventListener/ErrorListenerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function testHandleWithLoggerAndCustomConfiguration()
119119
$this->assertCount(1, $logger->getLogs('warning'));
120120
}
121121

122-
public function provider()
122+
public static function provider()
123123
{
124124
if (!class_exists(Request::class)) {
125125
return [[null, null]];
@@ -202,7 +202,7 @@ public function testOnControllerArguments(callable $controller)
202202
$this->assertSame('OK: foo', $event->getResponse()->getContent());
203203
}
204204

205-
public function controllerProvider()
205+
public static function controllerProvider()
206206
{
207207
yield [function (FlattenException $exception) {
208208
return new Response('OK: '.$exception->getMessage());

Tests/EventListener/ProfilerListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function testCollectParameter(Request $request, ?bool $enable)
8787
$listener->onKernelResponse(new ResponseEvent($kernel, $request, Kernel::MAIN_REQUEST, $response));
8888
}
8989

90-
public function collectRequestProvider(): iterable
90+
public static function collectRequestProvider(): iterable
9191
{
9292
yield [Request::create('/'), null];
9393
yield [Request::create('/', 'GET', ['profile' => '1']), true];

Tests/EventListener/RouterListenerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function testPort($defaultHttpPort, $defaultHttpsPort, $uri, $expectedHtt
6767
$this->assertEquals(str_starts_with($uri, 'https') ? 'https' : 'http', $context->getScheme());
6868
}
6969

70-
public function getPortData()
70+
public static function getPortData()
7171
{
7272
return [
7373
[80, 443, 'http://localhost/', 80, 443],
@@ -157,7 +157,7 @@ public function testLoggingParameter($parameter, $log, $parameters)
157157
$listener->onKernelRequest(new RequestEvent($kernel, $request, HttpKernelInterface::MAIN_REQUEST));
158158
}
159159

160-
public function getLoggingParameterData()
160+
public static function getLoggingParameterData()
161161
{
162162
return [
163163
[['_route' => 'foo'], 'Matched route "{route}".', ['route' => 'foo', 'route_parameters' => ['_route' => 'foo'], 'request_uri' => 'http://localhost/', 'method' => 'GET']],

Tests/EventListener/SessionListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function testSessionCookieOptions(array $phpSessionOptions, array $sessio
8282
}
8383
}
8484

85-
public function provideSessionOptions(): \Generator
85+
public static function provideSessionOptions(): \Generator
8686
{
8787
if (\PHP_VERSION_ID > 70300) {
8888
yield 'set_samesite_by_php' => [

Tests/EventListener/TestSessionListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function testSessionWithNewSessionIdAndNewCookieDoesNotSendAnotherCookie(
130130
$this->assertSame($expected, $response->headers->all()['set-cookie']);
131131
}
132132

133-
public function anotherCookieProvider()
133+
public static function anotherCookieProvider()
134134
{
135135
return [
136136
'same' => ['MOCKSESSID=789; path=/', ['MOCKSESSID=789; path=/']],

Tests/Exception/HttpExceptionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
class HttpExceptionTest extends TestCase
1818
{
19-
public function headerDataProvider()
19+
public static function headerDataProvider()
2020
{
2121
return [
2222
[['X-Test' => 'Test']],

Tests/Fragment/RoutableFragmentRendererTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function testGenerateAbsoluteFragmentUri($uri, $controller)
3434
$this->assertEquals('http://localhost'.$uri, $this->callGenerateFragmentUriMethod($controller, Request::create('/'), true));
3535
}
3636

37-
public function getGenerateFragmentUriData()
37+
public static function getGenerateFragmentUriData()
3838
{
3939
return [
4040
['/_fragment?_path=_format%3Dhtml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', [], [])],
@@ -65,7 +65,7 @@ public function testGenerateFragmentUriWithNonScalar($controller)
6565
$this->callGenerateFragmentUriMethod($controller, Request::create('/'));
6666
}
6767

68-
public function getGenerateFragmentUriDataWithNonScalar()
68+
public static function getGenerateFragmentUriDataWithNonScalar()
6969
{
7070
return [
7171
[new ControllerReference('controller', ['foo' => new Foo(), 'bar' => 'bar'], [])],

Tests/HttpCache/HttpCacheTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,7 +1378,7 @@ public function testHttpCacheIsSetAsATrustedProxy(array $existing)
13781378
Request::setTrustedProxies([], -1);
13791379
}
13801380

1381-
public function getTrustedProxyData()
1381+
public static function getTrustedProxyData()
13821382
{
13831383
return [
13841384
[[]],
@@ -1407,7 +1407,7 @@ public function testForwarderHeaderForForwardedRequests($forwarded, $expected)
14071407
Request::setTrustedProxies([], -1);
14081408
}
14091409

1410-
public function getForwardedData()
1410+
public static function getForwardedData()
14111411
{
14121412
return [
14131413
[null, 'for="10.0.0.1";host="localhost";proto=http'],
@@ -1599,7 +1599,7 @@ public function testResponsesThatMayBeUsedStaleIfError($responseHeaders, $sleepB
15991599
$this->assertTraceContains('stale-if-error');
16001600
}
16011601

1602-
public function getResponseDataThatMayBeServedStaleIfError()
1602+
public static function getResponseDataThatMayBeServedStaleIfError()
16031603
{
16041604
// All data sets assume that a 10s stale-if-error grace period has been configured
16051605
yield 'public, max-age expired' => [['Cache-Control' => 'public, max-age=60'], 65];
@@ -1641,7 +1641,7 @@ public function testResponsesThatMustNotBeUsedStaleIfError($responseHeaders, $sl
16411641
$this->assertEquals(500, $this->response->getStatusCode());
16421642
}
16431643

1644-
public function getResponseDataThatMustNotBeServedStaleIfError()
1644+
public static function getResponseDataThatMustNotBeServedStaleIfError()
16451645
{
16461646
// All data sets assume that a 10s stale-if-error grace period has been configured
16471647
yield 'public, no TTL but beyond grace period' => [['Cache-Control' => 'public'], 15];

Tests/HttpCache/ResponseCacheStrategyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ public function testCacheControlMerging(array $expects, array $master, array $su
309309
}
310310
}
311311

312-
public function cacheControlMergingProvider()
312+
public static function cacheControlMergingProvider()
313313
{
314314
yield 'result is public if all responses are public' => [
315315
['private' => false, 'public' => true],

Tests/HttpKernelTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function testHandleWhenAnExceptionIsHandledWithASpecificStatusCode($expec
175175
$this->assertEquals($expectedStatusCode, $response->getStatusCode());
176176
}
177177

178-
public function getSpecificStatusCodes()
178+
public static function getSpecificStatusCodes()
179179
{
180180
return [
181181
[200],

Tests/KernelTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ public function testStripComments(string $source, string $expected)
256256
$this->assertEquals($expected, $output);
257257
}
258258

259-
public function getStripCommentsCodes(): array
259+
public static function getStripCommentsCodes(): array
260260
{
261261
return [
262262
['<?php echo foo();', '<?php echo foo();'],

Tests/Log/LoggerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function testLogsAtAllLevels($level, $message)
8282
$this->assertLogsMatch($expected, $this->getLogs());
8383
}
8484

85-
public function provideLevelsAndMessages()
85+
public static function provideLevelsAndMessages()
8686
{
8787
return [
8888
LogLevel::EMERGENCY => [LogLevel::EMERGENCY, 'message of level emergency with context: {user}'],

0 commit comments

Comments
 (0)