From 002f55f03bae92f8e37c655a3ae032f85bbe9ffb Mon Sep 17 00:00:00 2001 From: Gipi Scioni Date: Thu, 3 Aug 2023 19:38:41 +0200 Subject: [PATCH] chore(tests): switching data providers to static --- .gitignore | 2 + tests/Badge/Model/BadgeTest.php | 2 +- tests/Badge/Model/ParseStabilityTest.php | 40 +++++++++---------- .../Model/UseCase/CreateCircleCiBadgeTest.php | 2 +- .../UseCase/CreateComposerLockBadgeTest.php | 2 +- tests/Badge/ValueObject/RepositoryTest.php | 4 +- tests/Controller/HomeControllerTest.php | 2 +- 7 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index ffba9045..7a89e692 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,5 @@ clover.xml ###> custom ### .stylelintcache ###< custom ### + +.idea/ diff --git a/tests/Badge/Model/BadgeTest.php b/tests/Badge/Model/BadgeTest.php index df93cf22..221656dd 100644 --- a/tests/Badge/Model/BadgeTest.php +++ b/tests/Badge/Model/BadgeTest.php @@ -47,7 +47,7 @@ public function testShouldThrowExceptionForInvalidColors(string $color): void /** * @return \Generator> */ - public function invalidColorProvider(): \Generator + public static function invalidColorProvider(): \Generator { yield ['']; yield ['null']; diff --git a/tests/Badge/Model/ParseStabilityTest.php b/tests/Badge/Model/ParseStabilityTest.php index 06ec6bb9..18627721 100644 --- a/tests/Badge/Model/ParseStabilityTest.php +++ b/tests/Badge/Model/ParseStabilityTest.php @@ -17,29 +17,27 @@ public function testParseStability(string $version, string $stable): void } /** - * @return array> + * @return \Generator> */ - public static function getVersionAndStability(): array + public static function getVersionAndStability(): \Generator { - return [ - ['1.0.0', 'stable'], - ['1.1.0', 'stable'], - ['2.0.0', 'stable'], - ['3.0.x-dev', 'dev'], - ['v3.0.0-RC1', 'RC'], - ['2.3.x-dev', 'dev'], - ['2.2.x-dev', 'dev'], - ['dev-master', 'dev'], - ['2.1.x-dev', 'dev'], - ['2.0.x-dev', 'dev'], - ['v2.3.0-rc2', 'RC'], - ['v2.3.0-RC1', 'RC'], - ['v2.3.0-BETA2', 'beta'], - ['v2.1.10', 'stable'], - ['v2.2.1', 'stable'], - ['0.1.0-alpha1', 'alpha'], - ['0.1.0-alpha', 'alpha'], - ]; + yield ['1.0.0', 'stable']; + yield ['1.1.0', 'stable']; + yield ['2.0.0', 'stable']; + yield ['3.0.x-dev', 'dev']; + yield ['v3.0.0-RC1', 'RC']; + yield ['2.3.x-dev', 'dev']; + yield ['2.2.x-dev', 'dev']; + yield ['dev-master', 'dev']; + yield ['2.1.x-dev', 'dev']; + yield ['2.0.x-dev', 'dev']; + yield ['v2.3.0-rc2', 'RC']; + yield ['v2.3.0-RC1', 'RC']; + yield ['v2.3.0-BETA2', 'beta']; + yield ['v2.1.10', 'stable']; + yield ['v2.2.1', 'stable']; + yield ['0.1.0-alpha1', 'alpha']; + yield ['0.1.0-alpha', 'alpha']; } /** diff --git a/tests/Badge/Model/UseCase/CreateCircleCiBadgeTest.php b/tests/Badge/Model/UseCase/CreateCircleCiBadgeTest.php index 57458f77..3f605557 100644 --- a/tests/Badge/Model/UseCase/CreateCircleCiBadgeTest.php +++ b/tests/Badge/Model/UseCase/CreateCircleCiBadgeTest.php @@ -86,7 +86,7 @@ public function testShouldCreateCircleCiBadge(string $status, string $expected): /** * @return array> */ - public function shouldCreateCircleCiBadgeProvider(): array + public static function shouldCreateCircleCiBadgeProvider(): array { return [ ['success', 'passing'], diff --git a/tests/Badge/Model/UseCase/CreateComposerLockBadgeTest.php b/tests/Badge/Model/UseCase/CreateComposerLockBadgeTest.php index 987f760c..6474a389 100644 --- a/tests/Badge/Model/UseCase/CreateComposerLockBadgeTest.php +++ b/tests/Badge/Model/UseCase/CreateComposerLockBadgeTest.php @@ -142,7 +142,7 @@ public function testShouldCreateDefaultBadgeOnError(): void /** * @return array> */ - public function shouldCreateComposerLockBadgeProvider(): array + public static function shouldCreateComposerLockBadgeProvider(): array { return [ [200, 'committed'], diff --git a/tests/Badge/ValueObject/RepositoryTest.php b/tests/Badge/ValueObject/RepositoryTest.php index 1f39dc95..d3cd4862 100644 --- a/tests/Badge/ValueObject/RepositoryTest.php +++ b/tests/Badge/ValueObject/RepositoryTest.php @@ -77,7 +77,7 @@ public function testItSupportBitbucketAsSourceProvider(): void self::assertTrue($repository->isSupported()); } - /** @dataProvider unsupportedRepositrySourceProvider */ + /** @dataProvider unsupportedRepositorySourceProvider */ public function testItDetectUnsupportedSourceProvider(string $sourceProviderUrl): void { $repository = Repository::createFromRepositoryUrl($sourceProviderUrl); @@ -95,7 +95,7 @@ public function testItDetectGitLabAsSourceProvider(): void /** * @return \Generator> */ - public function unsupportedRepositrySourceProvider(): \Generator + public static function unsupportedRepositorySourceProvider(): \Generator { yield ['https://www.gitlab.com/username/repository']; yield ['https://www.my-self-hosted-git.com/acme/foo']; diff --git a/tests/Controller/HomeControllerTest.php b/tests/Controller/HomeControllerTest.php index 90ef0a4b..f05bb3fe 100644 --- a/tests/Controller/HomeControllerTest.php +++ b/tests/Controller/HomeControllerTest.php @@ -19,7 +19,7 @@ public function testHome(string $path): void /** * @return array> */ - public function provider(): array + public static function provider(): array { return [ ['/'],