Skip to content

Commit 4eeac66

Browse files
OskarStarknicolas-grekas
authored andcommitted
[Tests] Streamline
1 parent 896ce66 commit 4eeac66

14 files changed

+30
-20
lines changed

Tests/CacheWarmer/SerializerCacheWarmerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function testWarmUp(array $loaders)
4040
$this->assertTrue($arrayPool->getItem('Symfony_Bundle_FrameworkBundle_Tests_Fixtures_Serialization_Author')->isHit());
4141
}
4242

43-
public static function loaderProvider()
43+
public static function loaderProvider(): array
4444
{
4545
return [
4646
[

Tests/Command/CachePoolClearCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function testComplete(array $input, array $expectedSuggestions)
4444
$this->assertSame($expectedSuggestions, $suggestions);
4545
}
4646

47-
public static function provideCompletionSuggestions()
47+
public static function provideCompletionSuggestions(): iterable
4848
{
4949
yield 'pool_name' => [
5050
['f'],

Tests/Command/CachePoolDeleteCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function testComplete(array $input, array $expectedSuggestions)
9898
$this->assertSame($expectedSuggestions, $suggestions);
9999
}
100100

101-
public static function provideCompletionSuggestions()
101+
public static function provideCompletionSuggestions(): iterable
102102
{
103103
yield 'pool_name' => [
104104
['f'],

Tests/Command/EventDispatcherDebugCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function testComplete(array $input, array $expectedSuggestions)
3131
$this->assertSame($expectedSuggestions, $suggestions);
3232
}
3333

34-
public static function provideCompletionSuggestions()
34+
public static function provideCompletionSuggestions(): iterable
3535
{
3636
yield 'event' => [[''], ['Symfony\Component\Mailer\Event\MessageEvent', 'console.command']];
3737
yield 'event for other dispatcher' => [['--dispatcher', 'other_event_dispatcher', ''], ['other_event', 'App\OtherEvent']];

Tests/Command/SecretsRemoveCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function testComplete(bool $withLocalVault, array $input, array $expected
3737
$this->assertSame($expectedSuggestions, $suggestions);
3838
}
3939

40-
public static function provideCompletionSuggestions()
40+
public static function provideCompletionSuggestions(): iterable
4141
{
4242
yield 'name' => [true, [''], ['SECRET', 'OTHER_SECRET']];
4343
yield '--local name (with local vault)' => [true, ['--local', ''], ['SECRET']];

Tests/Command/SecretsSetCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function testComplete(array $input, array $expectedSuggestions)
3232
$this->assertSame($expectedSuggestions, $suggestions);
3333
}
3434

35-
public static function provideCompletionSuggestions()
35+
public static function provideCompletionSuggestions(): iterable
3636
{
3737
yield 'name' => [[''], ['SECRET', 'OTHER_SECRET']];
3838
yield '--local name (with local vault)' => [['--local', ''], ['SECRET', 'OTHER_SECRET']];

Tests/Command/TranslationDebugCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ function ($path, $catalogue) use ($extractedMessagesWithDomains) {
269269
$this->assertSame($expectedSuggestions, $suggestions);
270270
}
271271

272-
public static function provideCompletionSuggestions()
272+
public static function provideCompletionSuggestions(): iterable
273273
{
274274
yield 'locale' => [
275275
[''],

Tests/Command/TranslationUpdateCommandCompletionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function testComplete(array $input, array $expectedSuggestions)
4242
$this->assertSame($expectedSuggestions, $suggestions);
4343
}
4444

45-
public static function provideCompletionSuggestions()
45+
public static function provideCompletionSuggestions(): iterable
4646
{
4747
$bundle = new ExtensionPresentBundle();
4848

Tests/Controller/AbstractControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ public function testdenyAccessUnlessGrantedSetsAttributesAsArray($attribute, $ex
409409
}
410410
}
411411

412-
public static function provideDenyAccessUnlessGrantedSetsAttributesAsArray()
412+
public static function provideDenyAccessUnlessGrantedSetsAttributesAsArray(): array
413413
{
414414
$obj = new \stdClass();
415415
$obj->foo = 'bar';

Tests/Controller/RedirectControllerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function testRoute($permanent, $keepRequestMethod, $keepQueryParams, $ign
103103
$this->assertEquals($expectedCode, $returnResponse->getStatusCode());
104104
}
105105

106-
public static function provider()
106+
public static function provider(): array
107107
{
108108
return [
109109
[true, false, false, false, 301, ['additional-parameter' => 'value']],
@@ -210,7 +210,7 @@ public function testUrlRedirectDefaultPorts()
210210
$this->assertRedirectUrl($returnValue, $expectedUrl);
211211
}
212212

213-
public static function urlRedirectProvider()
213+
public static function urlRedirectProvider(): array
214214
{
215215
return [
216216
// Standard ports
@@ -262,7 +262,7 @@ public function testUrlRedirect($scheme, $httpPort, $httpsPort, $requestScheme,
262262
$this->assertRedirectUrl($returnValue, $expectedUrl);
263263
}
264264

265-
public static function pathQueryParamsProvider()
265+
public static function pathQueryParamsProvider(): array
266266
{
267267
return [
268268
['http://www.example.com/base/redirect-path', '/redirect-path', ''],

Tests/Controller/TemplateControllerTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,23 @@ public function testTwig()
3232
$this->assertEquals('bar', $controller('mytemplate')->getContent());
3333
}
3434

35-
public function testNoTwig()
35+
public function testNoTwigTemplateActionMethod()
3636
{
37+
$controller = new TemplateController();
38+
3739
$this->expectException(\LogicException::class);
3840
$this->expectExceptionMessage('You cannot use the TemplateController if the Twig Bundle is not available.');
39-
$controller = new TemplateController();
4041

4142
$controller->templateAction('mytemplate')->getContent();
43+
}
44+
45+
public function testNoTwigInvokeMethod()
46+
{
47+
$controller = new TemplateController();
48+
49+
$this->expectException(\LogicException::class);
50+
$this->expectExceptionMessage('You cannot use the TemplateController if the Twig Bundle is not available.');
51+
4252
$controller('mytemplate')->getContent();
4353
}
4454

Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function testValidAssetsPackageNameConfiguration($packageName)
113113
$this->assertArrayHasKey($packageName, $config['assets']['packages']);
114114
}
115115

116-
public static function provideValidAssetsPackageNameConfigurationTests()
116+
public static function provideValidAssetsPackageNameConfigurationTests(): array
117117
{
118118
return [
119119
['foobar'],
@@ -139,7 +139,7 @@ public function testInvalidAssetsConfiguration(array $assetConfig, $expectedMess
139139
]);
140140
}
141141

142-
public static function provideInvalidAssetConfigurationTests()
142+
public static function provideInvalidAssetConfigurationTests(): iterable
143143
{
144144
// helper to turn config into embedded package config
145145
$createPackageConfig = function (array $packageConfig) {
@@ -192,7 +192,7 @@ public function testValidLockConfiguration($lockConfig, $processedConfig)
192192
$this->assertEquals($processedConfig, $config['lock']);
193193
}
194194

195-
public static function provideValidLockConfigurationTests()
195+
public static function provideValidLockConfigurationTests(): iterable
196196
{
197197
yield [null, ['enabled' => true, 'resources' => ['default' => [class_exists(SemaphoreStore::class) && SemaphoreStore::isSupported() ? 'semaphore' : 'flock']]]];
198198

Tests/Functional/ContainerDebugCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public function testGetDeprecationNoFile()
204204
$this->assertStringContainsString('[WARNING] The deprecation file does not exist', $tester->getDisplay());
205205
}
206206

207-
public static function provideIgnoreBackslashWhenFindingService()
207+
public static function provideIgnoreBackslashWhenFindingService(): array
208208
{
209209
return [
210210
[BackslashClass::class],
@@ -232,7 +232,7 @@ public function testComplete(array $input, array $expectedSuggestions, array $no
232232
}
233233
}
234234

235-
public static function provideCompletionSuggestions()
235+
public static function provideCompletionSuggestions(): iterable
236236
{
237237
$serviceId = 'console.command.container_debug';
238238
$hiddenServiceId = '.console.command.container_debug.lazy';

Tests/Functional/RouterDebugCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function testComplete(array $input, array $expectedSuggestions)
100100
$this->assertSame($expectedSuggestions, $tester->complete($input));
101101
}
102102

103-
public static function provideCompletionSuggestions()
103+
public static function provideCompletionSuggestions(): iterable
104104
{
105105
yield 'option --format' => [
106106
['--format', ''],

0 commit comments

Comments
 (0)