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

Normalize data provider names #7656

Merged
Merged
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
4 changes: 4 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
]);

$overrides = [
'php_unit_data_provider_name' => [
'prefix' => 'provide',
'suffix' => '',
],
'php_unit_data_provider_return_type' => true,
'no_extra_blank_lines' => [
'tokens' => [
Expand Down
4 changes: 4 additions & 0 deletions .php-cs-fixer.no-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
]);

$overrides = [
'php_unit_data_provider_name' => [
'prefix' => 'provide',
'suffix' => '',
],
'php_unit_data_provider_return_type' => true,
'no_extra_blank_lines' => [
'tokens' => [
Expand Down
4 changes: 4 additions & 0 deletions .php-cs-fixer.user-guide.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
'use',
],
],
'php_unit_data_provider_name' => [
'prefix' => 'provide',
'suffix' => '',
],
];

$options = [
Expand Down
4 changes: 2 additions & 2 deletions tests/system/AutoReview/FrameworkCodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ final class FrameworkCodeTest extends TestCase
];

/**
* @dataProvider provideTestClassCases
* @dataProvider provideEachTestClassHasCorrectGroupAnnotation
*
* @phpstan-param class-string $class
*/
Expand Down Expand Up @@ -73,7 +73,7 @@ public function testEachTestClassHasCorrectGroupAnnotation(string $class): void
));
}

public function provideTestClassCases(): iterable
public function provideEachTestClassHasCorrectGroupAnnotation(): iterable
{
foreach ($this->getTestClasses() as $class) {
yield $class => [$class];
Expand Down
4 changes: 2 additions & 2 deletions tests/system/CLI/CLITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ public function testWindow(): void
}

/**
* @dataProvider tableProvider
* @dataProvider provideTable
*
* @param array $tbody
* @param array $thead
Expand All @@ -463,7 +463,7 @@ public function testTable($tbody, $thead, $expected): void
$this->assertSame($this->getStreamFilterBuffer(), $expected);
}

public function tableProvider(): iterable
public function provideTable(): iterable
{
$head = [
'ID',
Expand Down
4 changes: 2 additions & 2 deletions tests/system/Cache/Handlers/BaseHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
final class BaseHandlerTest extends CIUnitTestCase
{
/**
* @dataProvider invalidTypeProvider
* @dataProvider provideValidateKeyInvalidType
*
* @param mixed $input
*/
Expand All @@ -35,7 +35,7 @@ public function testValidateKeyInvalidType($input): void
BaseHandler::validateKey($input);
}

public function invalidTypeProvider(): iterable
public function provideValidateKeyInvalidType(): iterable
{
return [
[true],
Expand Down
4 changes: 2 additions & 2 deletions tests/system/Cache/Handlers/FileHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public function testIsSupported(): void
}

/**
* @dataProvider modeProvider
* @dataProvider provideSaveMode
*
* permissions given on Windows are fixed to `0666`
*
Expand All @@ -296,7 +296,7 @@ public function testSaveMode(int $int, string $string): void
$this->assertSame($string, $mode);
}

public function modeProvider(): iterable
public function provideSaveMode(): iterable
{
return [
[
Expand Down
4 changes: 2 additions & 2 deletions tests/system/CodeIgniterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ public function testPageCacheSendSecureHeaders(): void
/**
* @param array|bool $cacheQueryStringValue
*
* @dataProvider cacheQueryStringProvider
* @dataProvider providePageCacheWithCacheQueryString
*
* @see https://github.com/codeigniter4/CodeIgniter4/pull/6410
*/
Expand Down Expand Up @@ -789,7 +789,7 @@ public function testPageCacheWithCacheQueryString($cacheQueryStringValue, int $e
CITestStreamFilter::removeErrorFilter();
}

public function cacheQueryStringProvider(): iterable
public function providePageCacheWithCacheQueryString(): iterable
{
$testingUrls = [
'test', // URL #1
Expand Down
4 changes: 2 additions & 2 deletions tests/system/Commands/CommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function testInexistentCommandsButWithManyAlternatives(): void
}

/**
* @dataProvider commandArgsProvider
* @dataProvider provideCommandParsesArgsCorrectly
*/
public function testCommandParsesArgsCorrectly(string $input, array $expected): void
{
Expand All @@ -138,7 +138,7 @@ public function testCommandParsesArgsCorrectly(string $input, array $expected):
$this->assertSame($expected, ParamsReveal::$args);
}

public function commandArgsProvider(): iterable
public function provideCommandParsesArgsCorrectly(): iterable
{
return [
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
final class SampleURIGeneratorTest extends CIUnitTestCase
{
/**
* @dataProvider routeKeyProvider
* @dataProvider provideGet
*/
public function testGet(string $routeKey, string $expected): void
{
Expand All @@ -33,7 +33,7 @@ public function testGet(string $routeKey, string $expected): void
$this->assertSame($expected, $uri);
}

public function routeKeyProvider(): iterable
public function provideGet(): iterable
{
yield from [
'root' => ['/', '/'],
Expand Down
4 changes: 2 additions & 2 deletions tests/system/CommonFunctionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ public function testForceHttpsNullRequestAndResponse(): void
}

/**
* @dataProvider dirtyPathsProvider
* @dataProvider provideCleanPathActuallyCleaningThePaths
*
* @param mixed $input
* @param mixed $expected
Expand All @@ -604,7 +604,7 @@ public function testCleanPathActuallyCleaningThePaths($input, $expected): void
$this->assertSame($expected, clean_path($input));
}

public function dirtyPathsProvider(): iterable
public function provideCleanPathActuallyCleaningThePaths(): iterable
{
$ds = DIRECTORY_SEPARATOR;

Expand Down
6 changes: 3 additions & 3 deletions tests/system/CommonSingleServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
final class CommonSingleServiceTest extends CIUnitTestCase
{
/**
* @dataProvider serviceNamesProvider
* @dataProvider provideServiceNames
*/
public function testSingleServiceWithNoParamsSupplied(string $service): void
{
Expand All @@ -43,7 +43,7 @@ public function testSingleServiceWithNoParamsSupplied(string $service): void
}

/**
* @dataProvider serviceNamesProvider
* @dataProvider provideServiceNames
*/
public function testSingleServiceWithAtLeastOneParamSupplied(string $service): void
{
Expand Down Expand Up @@ -99,7 +99,7 @@ public function testSingleServiceWithGibberishGiven(): void
$this->assertNull(single_service('timers'));
}

public static function serviceNamesProvider(): iterable
public static function provideServiceNames(): iterable
{
static $services = [];
static $excl = [
Expand Down
4 changes: 2 additions & 2 deletions tests/system/Config/DotEnvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function testReturnsFalseIfCannotFindFile(): void
}

/**
* @dataProvider provideLoadVars
* @dataProvider provideLoadsVars
*/
public function testLoadsVars(string $expected, string $varname): void
{
Expand All @@ -66,7 +66,7 @@ public function testLoadsVars(string $expected, string $varname): void
$this->assertSame($expected, getenv($varname));
}

public function provideLoadVars(): iterable
public function provideLoadsVars(): iterable
{
yield from [
['bar', 'FOO'],
Expand Down
8 changes: 4 additions & 4 deletions tests/system/Config/MimesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
final class MimesTest extends CIUnitTestCase
{
public function extensionsList(): iterable
public function provideGuessExtensionFromType(): iterable
{
return [
'null' => [
Expand All @@ -48,14 +48,14 @@ public function extensionsList(): iterable
}

/**
* @dataProvider extensionsList
* @dataProvider provideGuessExtensionFromType
*/
public function testGuessExtensionFromType(?string $expected, string $mime): void
{
$this->assertSame($expected, Mimes::guessExtensionFromType($mime));
}

public function mimesList(): iterable
public function provideGuessTypeFromExtension(): iterable
{
return [
'null' => [
Expand All @@ -82,7 +82,7 @@ public function mimesList(): iterable
}

/**
* @dataProvider mimesList
* @dataProvider provideGuessTypeFromExtension
*/
public function testGuessTypeFromExtension(?string $expected, string $ext): void
{
Expand Down
12 changes: 6 additions & 6 deletions tests/system/Cookie/CookieTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function testConfigInjectionForDefaults(): void
}

/**
* @dataProvider prefixProvider
* @dataProvider provideConfigPrefix
*/
public function testConfigPrefix(string $configPrefix, string $optionPrefix, string $expected): void
{
Expand All @@ -98,7 +98,7 @@ public function testConfigPrefix(string $configPrefix, string $optionPrefix, str
$this->assertSame($expected, $cookie->getPrefixedName());
}

public function prefixProvider(): iterable
public function provideConfigPrefix(): iterable
{
yield from [
['prefix_', '', 'prefix_test'],
Expand Down Expand Up @@ -165,7 +165,7 @@ public function testExpirationTime(): void
}

/**
* @dataProvider invalidExpiresProvider
* @dataProvider provideInvalidExpires
*
* @param bool|float|string $expires
*/
Expand All @@ -175,7 +175,7 @@ public function testInvalidExpires($expires): void
new Cookie('test', 'value', ['expires' => $expires]);
}

public static function invalidExpiresProvider(): iterable
public static function provideInvalidExpires(): iterable
{
$cases = [
'non-numeric-string' => ['yes'],
Expand All @@ -189,7 +189,7 @@ public static function invalidExpiresProvider(): iterable
}

/**
* @dataProvider setCookieHeaderProvider
* @dataProvider provideSetCookieHeaderCreation
*/
public function testSetCookieHeaderCreation(string $header, array $changed): void
{
Expand All @@ -198,7 +198,7 @@ public function testSetCookieHeaderCreation(string $header, array $changed): voi
$this->assertSame(array_merge($cookie, $changed), $cookie);
}

public static function setCookieHeaderProvider(): iterable
public static function provideSetCookieHeaderCreation(): iterable
{
yield 'basic' => [
'test=value',
Expand Down
4 changes: 2 additions & 2 deletions tests/system/Database/BaseConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function testMagicGetMissing(): void
* These tests are intended to confirm the current behavior.
* We do not know if all of these are the correct behavior.
*
* @dataProvider identifiersProvider
* @dataProvider provideProtectIdentifiers
*/
public function testProtectIdentifiers(
bool $prefixSingle,
Expand All @@ -183,7 +183,7 @@ public function testProtectIdentifiers(
$this->assertSame($expected, $return);
}

public function identifiersProvider(): iterable
public function provideProtectIdentifiers(): iterable
{
yield from [
// $prefixSingle, $protectIdentifiers, $fieldExists, $item, $expected
Expand Down
8 changes: 4 additions & 4 deletions tests/system/Database/BaseQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function testSwapPrefix(): void
$this->assertSame($newSQL, $query->getQuery());
}

public function queryTypes(): iterable
public function provideIsWriteType(): iterable
{
return [
'select' => [
Expand Down Expand Up @@ -183,7 +183,7 @@ public function queryTypes(): iterable
}

/**
* @dataProvider queryTypes
* @dataProvider provideIsWriteType
*
* @param mixed $expected
* @param mixed $sql
Expand Down Expand Up @@ -577,7 +577,7 @@ public function testSwapPrefixAfterGetQuery(): void
$this->assertSame($expected, $query->getQuery());
}

public function queryKeywords(): iterable
public function provideHighlightQueryKeywords(): iterable
{
return [
'highlightKeyWords' => [
Expand All @@ -596,7 +596,7 @@ public function queryKeywords(): iterable
}

/**
* @dataProvider queryKeywords
* @dataProvider provideHighlightQueryKeywords
*
* @param mixed $expected
* @param mixed $sql
Expand Down
Loading