Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switching data providers to static #1061

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ clover.xml
###> custom ###
.stylelintcache
###< custom ###

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this change.
Specific files/dirs to ignore should be placed in a global .gitignore file, not a project one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gentle bump

.idea/
2 changes: 1 addition & 1 deletion tests/Badge/Model/BadgeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function testShouldThrowExceptionForInvalidColors(string $color): void
/**
* @return \Generator<array<string>>
*/
public function invalidColorProvider(): \Generator
public static function invalidColorProvider(): \Generator
{
yield [''];
yield ['null'];
Expand Down
40 changes: 19 additions & 21 deletions tests/Badge/Model/ParseStabilityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,27 @@ public function testParseStability(string $version, string $stable): void
}

/**
* @return array<int, array<int, string>>
* @return \Generator<array<int, string>>
*/
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'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see much benefit in converting this to a Generator.
There's not performance gain, since PHPUnit needs to get all values in advance

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'];
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Badge/Model/UseCase/CreateCircleCiBadgeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function testShouldCreateCircleCiBadge(string $status, string $expected):
/**
* @return array<int, array<int, string>>
*/
public function shouldCreateCircleCiBadgeProvider(): array
public static function shouldCreateCircleCiBadgeProvider(): array
{
return [
['success', 'passing'],
Expand Down
2 changes: 1 addition & 1 deletion tests/Badge/Model/UseCase/CreateComposerLockBadgeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function testShouldCreateDefaultBadgeOnError(): void
/**
* @return array<int, array<int, int|string>>
*/
public function shouldCreateComposerLockBadgeProvider(): array
public static function shouldCreateComposerLockBadgeProvider(): array
{
return [
[200, 'committed'],
Expand Down
4 changes: 2 additions & 2 deletions tests/Badge/ValueObject/RepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -95,7 +95,7 @@ public function testItDetectGitLabAsSourceProvider(): void
/**
* @return \Generator<array<string>>
*/
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'];
Expand Down
2 changes: 1 addition & 1 deletion tests/Controller/HomeControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testHome(string $path): void
/**
* @return array<int, array<int, string>>
*/
public function provider(): array
public static function provider(): array
{
return [
['/'],
Expand Down
Loading