diff --git a/Tests/CacheWarmer/SerializerCacheWarmerTest.php b/Tests/CacheWarmer/SerializerCacheWarmerTest.php index 85dbd8810..5feb0c8ec 100644 --- a/Tests/CacheWarmer/SerializerCacheWarmerTest.php +++ b/Tests/CacheWarmer/SerializerCacheWarmerTest.php @@ -40,7 +40,7 @@ public function testWarmUp(array $loaders) $this->assertTrue($arrayPool->getItem('Symfony_Bundle_FrameworkBundle_Tests_Fixtures_Serialization_Author')->isHit()); } - public static function loaderProvider() + public static function loaderProvider(): array { return [ [ diff --git a/Tests/Command/CachePoolClearCommandTest.php b/Tests/Command/CachePoolClearCommandTest.php index cc4573faf..08e2766d9 100644 --- a/Tests/Command/CachePoolClearCommandTest.php +++ b/Tests/Command/CachePoolClearCommandTest.php @@ -44,7 +44,7 @@ public function testComplete(array $input, array $expectedSuggestions) $this->assertSame($expectedSuggestions, $suggestions); } - public static function provideCompletionSuggestions() + public static function provideCompletionSuggestions(): iterable { yield 'pool_name' => [ ['f'], diff --git a/Tests/Command/CachePoolDeleteCommandTest.php b/Tests/Command/CachePoolDeleteCommandTest.php index 7cd236670..41f7b6643 100644 --- a/Tests/Command/CachePoolDeleteCommandTest.php +++ b/Tests/Command/CachePoolDeleteCommandTest.php @@ -98,7 +98,7 @@ public function testComplete(array $input, array $expectedSuggestions) $this->assertSame($expectedSuggestions, $suggestions); } - public static function provideCompletionSuggestions() + public static function provideCompletionSuggestions(): iterable { yield 'pool_name' => [ ['f'], diff --git a/Tests/Command/EventDispatcherDebugCommandTest.php b/Tests/Command/EventDispatcherDebugCommandTest.php index 9bc054f22..61c50a7bc 100644 --- a/Tests/Command/EventDispatcherDebugCommandTest.php +++ b/Tests/Command/EventDispatcherDebugCommandTest.php @@ -31,7 +31,7 @@ public function testComplete(array $input, array $expectedSuggestions) $this->assertSame($expectedSuggestions, $suggestions); } - public static function provideCompletionSuggestions() + public static function provideCompletionSuggestions(): iterable { yield 'event' => [[''], ['Symfony\Component\Mailer\Event\MessageEvent', 'console.command']]; yield 'event for other dispatcher' => [['--dispatcher', 'other_event_dispatcher', ''], ['other_event', 'App\OtherEvent']]; diff --git a/Tests/Command/SecretsRemoveCommandTest.php b/Tests/Command/SecretsRemoveCommandTest.php index 88c247ec6..2c12b6128 100644 --- a/Tests/Command/SecretsRemoveCommandTest.php +++ b/Tests/Command/SecretsRemoveCommandTest.php @@ -37,7 +37,7 @@ public function testComplete(bool $withLocalVault, array $input, array $expected $this->assertSame($expectedSuggestions, $suggestions); } - public static function provideCompletionSuggestions() + public static function provideCompletionSuggestions(): iterable { yield 'name' => [true, [''], ['SECRET', 'OTHER_SECRET']]; yield '--local name (with local vault)' => [true, ['--local', ''], ['SECRET']]; diff --git a/Tests/Command/SecretsSetCommandTest.php b/Tests/Command/SecretsSetCommandTest.php index 8e8e968c8..678fb417c 100644 --- a/Tests/Command/SecretsSetCommandTest.php +++ b/Tests/Command/SecretsSetCommandTest.php @@ -32,7 +32,7 @@ public function testComplete(array $input, array $expectedSuggestions) $this->assertSame($expectedSuggestions, $suggestions); } - public static function provideCompletionSuggestions() + public static function provideCompletionSuggestions(): iterable { yield 'name' => [[''], ['SECRET', 'OTHER_SECRET']]; yield '--local name (with local vault)' => [['--local', ''], ['SECRET', 'OTHER_SECRET']]; diff --git a/Tests/Command/TranslationDebugCommandTest.php b/Tests/Command/TranslationDebugCommandTest.php index 846abd445..e3ac1066a 100644 --- a/Tests/Command/TranslationDebugCommandTest.php +++ b/Tests/Command/TranslationDebugCommandTest.php @@ -269,7 +269,7 @@ function ($path, $catalogue) use ($extractedMessagesWithDomains) { $this->assertSame($expectedSuggestions, $suggestions); } - public static function provideCompletionSuggestions() + public static function provideCompletionSuggestions(): iterable { yield 'locale' => [ [''], diff --git a/Tests/Command/TranslationUpdateCommandCompletionTest.php b/Tests/Command/TranslationUpdateCommandCompletionTest.php index 91999d288..6992ade4d 100644 --- a/Tests/Command/TranslationUpdateCommandCompletionTest.php +++ b/Tests/Command/TranslationUpdateCommandCompletionTest.php @@ -42,7 +42,7 @@ public function testComplete(array $input, array $expectedSuggestions) $this->assertSame($expectedSuggestions, $suggestions); } - public static function provideCompletionSuggestions() + public static function provideCompletionSuggestions(): iterable { $bundle = new ExtensionPresentBundle(); diff --git a/Tests/Controller/AbstractControllerTest.php b/Tests/Controller/AbstractControllerTest.php index d8dc199d8..2de0f7c91 100644 --- a/Tests/Controller/AbstractControllerTest.php +++ b/Tests/Controller/AbstractControllerTest.php @@ -409,7 +409,7 @@ public function testdenyAccessUnlessGrantedSetsAttributesAsArray($attribute, $ex } } - public static function provideDenyAccessUnlessGrantedSetsAttributesAsArray() + public static function provideDenyAccessUnlessGrantedSetsAttributesAsArray(): array { $obj = new \stdClass(); $obj->foo = 'bar'; diff --git a/Tests/Controller/RedirectControllerTest.php b/Tests/Controller/RedirectControllerTest.php index de72396df..b2da9ef58 100644 --- a/Tests/Controller/RedirectControllerTest.php +++ b/Tests/Controller/RedirectControllerTest.php @@ -103,7 +103,7 @@ public function testRoute($permanent, $keepRequestMethod, $keepQueryParams, $ign $this->assertEquals($expectedCode, $returnResponse->getStatusCode()); } - public static function provider() + public static function provider(): array { return [ [true, false, false, false, 301, ['additional-parameter' => 'value']], @@ -210,7 +210,7 @@ public function testUrlRedirectDefaultPorts() $this->assertRedirectUrl($returnValue, $expectedUrl); } - public static function urlRedirectProvider() + public static function urlRedirectProvider(): array { return [ // Standard ports @@ -262,7 +262,7 @@ public function testUrlRedirect($scheme, $httpPort, $httpsPort, $requestScheme, $this->assertRedirectUrl($returnValue, $expectedUrl); } - public static function pathQueryParamsProvider() + public static function pathQueryParamsProvider(): array { return [ ['http://www.example.com/base/redirect-path', '/redirect-path', ''], diff --git a/Tests/Controller/TemplateControllerTest.php b/Tests/Controller/TemplateControllerTest.php index e567342ec..c403a4c59 100644 --- a/Tests/Controller/TemplateControllerTest.php +++ b/Tests/Controller/TemplateControllerTest.php @@ -32,13 +32,23 @@ public function testTwig() $this->assertEquals('bar', $controller('mytemplate')->getContent()); } - public function testNoTwig() + public function testNoTwigTemplateActionMethod() { + $controller = new TemplateController(); + $this->expectException(\LogicException::class); $this->expectExceptionMessage('You cannot use the TemplateController if the Twig Bundle is not available.'); - $controller = new TemplateController(); $controller->templateAction('mytemplate')->getContent(); + } + + public function testNoTwigInvokeMethod() + { + $controller = new TemplateController(); + + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('You cannot use the TemplateController if the Twig Bundle is not available.'); + $controller('mytemplate')->getContent(); } diff --git a/Tests/DependencyInjection/ConfigurationTest.php b/Tests/DependencyInjection/ConfigurationTest.php index 47b66baf3..41f3d7482 100644 --- a/Tests/DependencyInjection/ConfigurationTest.php +++ b/Tests/DependencyInjection/ConfigurationTest.php @@ -113,7 +113,7 @@ public function testValidAssetsPackageNameConfiguration($packageName) $this->assertArrayHasKey($packageName, $config['assets']['packages']); } - public static function provideValidAssetsPackageNameConfigurationTests() + public static function provideValidAssetsPackageNameConfigurationTests(): array { return [ ['foobar'], @@ -139,7 +139,7 @@ public function testInvalidAssetsConfiguration(array $assetConfig, $expectedMess ]); } - public static function provideInvalidAssetConfigurationTests() + public static function provideInvalidAssetConfigurationTests(): iterable { // helper to turn config into embedded package config $createPackageConfig = function (array $packageConfig) { @@ -192,7 +192,7 @@ public function testValidLockConfiguration($lockConfig, $processedConfig) $this->assertEquals($processedConfig, $config['lock']); } - public static function provideValidLockConfigurationTests() + public static function provideValidLockConfigurationTests(): iterable { yield [null, ['enabled' => true, 'resources' => ['default' => [class_exists(SemaphoreStore::class) && SemaphoreStore::isSupported() ? 'semaphore' : 'flock']]]]; diff --git a/Tests/Functional/ContainerDebugCommandTest.php b/Tests/Functional/ContainerDebugCommandTest.php index 63c717b7b..01d0727a2 100644 --- a/Tests/Functional/ContainerDebugCommandTest.php +++ b/Tests/Functional/ContainerDebugCommandTest.php @@ -204,7 +204,7 @@ public function testGetDeprecationNoFile() $this->assertStringContainsString('[WARNING] The deprecation file does not exist', $tester->getDisplay()); } - public static function provideIgnoreBackslashWhenFindingService() + public static function provideIgnoreBackslashWhenFindingService(): array { return [ [BackslashClass::class], @@ -232,7 +232,7 @@ public function testComplete(array $input, array $expectedSuggestions, array $no } } - public static function provideCompletionSuggestions() + public static function provideCompletionSuggestions(): iterable { $serviceId = 'console.command.container_debug'; $hiddenServiceId = '.console.command.container_debug.lazy'; diff --git a/Tests/Functional/RouterDebugCommandTest.php b/Tests/Functional/RouterDebugCommandTest.php index 6b8eb6b7f..58130ad42 100644 --- a/Tests/Functional/RouterDebugCommandTest.php +++ b/Tests/Functional/RouterDebugCommandTest.php @@ -100,7 +100,7 @@ public function testComplete(array $input, array $expectedSuggestions) $this->assertSame($expectedSuggestions, $tester->complete($input)); } - public static function provideCompletionSuggestions() + public static function provideCompletionSuggestions(): iterable { yield 'option --format' => [ ['--format', ''],