From cb97e1e746fe71fb641c7a52481d5a33e8c40e92 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Thu, 6 Jul 2023 11:44:39 +0800 Subject: [PATCH 1/3] Add `php_unit_data_provider_name` in overrides --- .php-cs-fixer.dist.php | 4 ++++ .php-cs-fixer.no-header.php | 4 ++++ .php-cs-fixer.user-guide.php | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 3f9a0dd6f254..9b4acf04c5d0 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -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' => [ diff --git a/.php-cs-fixer.no-header.php b/.php-cs-fixer.no-header.php index 16271f3cb31c..5ec25a8eb8cd 100644 --- a/.php-cs-fixer.no-header.php +++ b/.php-cs-fixer.no-header.php @@ -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' => [ diff --git a/.php-cs-fixer.user-guide.php b/.php-cs-fixer.user-guide.php index ef37d80386bd..fd90c592c265 100644 --- a/.php-cs-fixer.user-guide.php +++ b/.php-cs-fixer.user-guide.php @@ -53,6 +53,10 @@ 'use', ], ], + 'php_unit_data_provider_name' => [ + 'prefix' => 'provide', + 'suffix' => '', + ], ]; $options = [ From ec1bb65e37a8a5584edb25870672b156e4a9bfe7 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Thu, 3 Aug 2023 12:00:23 +0800 Subject: [PATCH 2/3] Run cs-fix --- tests/system/AutoReview/FrameworkCodeTest.php | 4 +- tests/system/CLI/CLITest.php | 4 +- .../system/Cache/Handlers/BaseHandlerTest.php | 4 +- .../system/Cache/Handlers/FileHandlerTest.php | 4 +- tests/system/CodeIgniterTest.php | 4 +- tests/system/Commands/CommandTest.php | 4 +- .../Routes/SampleURIGeneratorTest.php | 4 +- tests/system/CommonFunctionsTest.php | 4 +- tests/system/Config/DotEnvTest.php | 4 +- tests/system/Config/MimesTest.php | 8 +-- tests/system/Cookie/CookieTest.php | 12 ++-- tests/system/Database/BaseConnectionTest.php | 4 +- tests/system/Database/BaseQueryTest.php | 8 +-- tests/system/Database/Builder/WhereTest.php | 8 +-- tests/system/Database/ConfigTest.php | 4 +- tests/system/Email/EmailTest.php | 4 +- tests/system/Filters/FiltersTest.php | 4 +- tests/system/Filters/InvalidCharsTest.php | 8 +-- tests/system/Format/XMLFormatterTest.php | 4 +- tests/system/HTTP/CLIRequestTest.php | 4 +- tests/system/HTTP/IncomingRequestTest.php | 8 +-- tests/system/HTTP/RequestTest.php | 4 +- tests/system/HTTP/ResponseTest.php | 8 +-- tests/system/HTTP/URITest.php | 24 +++---- tests/system/Helpers/ArrayHelperTest.php | 8 +-- .../system/Helpers/URLHelper/MiscUrlTest.php | 56 +++++++-------- .../system/Helpers/URLHelper/SiteUrlTest.php | 4 +- tests/system/I18n/TimeLegacyTest.php | 4 +- tests/system/I18n/TimeTest.php | 4 +- tests/system/Language/LanguageTest.php | 4 +- tests/system/Models/FindModelTest.php | 4 +- tests/system/Models/UpdateModelTest.php | 4 +- .../Publisher/PublisherRestrictionsTest.php | 8 +-- .../RouteCollectionReverseRouteTest.php | 4 +- tests/system/Router/RouteCollectionTest.php | 8 +-- tests/system/Router/RouterTest.php | 4 +- tests/system/Test/FeatureTestTraitTest.php | 4 +- tests/system/Test/TestLoggerTest.php | 4 +- tests/system/Throttle/ThrottleTest.php | 4 +- .../system/Validation/CreditCardRulesTest.php | 4 +- tests/system/Validation/FormatRulesTest.php | 72 +++++++++---------- tests/system/Validation/RulesTest.php | 60 ++++++++-------- .../StrictRules/CreditCardRulesTest.php | 4 +- .../Validation/StrictRules/RulesTest.php | 8 +-- tests/system/Validation/ValidationTest.php | 32 ++++----- tests/system/View/ParserTest.php | 4 +- 46 files changed, 228 insertions(+), 228 deletions(-) diff --git a/tests/system/AutoReview/FrameworkCodeTest.php b/tests/system/AutoReview/FrameworkCodeTest.php index f72e7ae9987f..e61e0663836b 100644 --- a/tests/system/AutoReview/FrameworkCodeTest.php +++ b/tests/system/AutoReview/FrameworkCodeTest.php @@ -39,7 +39,7 @@ final class FrameworkCodeTest extends TestCase ]; /** - * @dataProvider provideTestClassCases + * @dataProvider provideEachTestClassHasCorrectGroupAnnotation * * @phpstan-param class-string $class */ @@ -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]; diff --git a/tests/system/CLI/CLITest.php b/tests/system/CLI/CLITest.php index e02db8d97515..137f2d4a8e00 100644 --- a/tests/system/CLI/CLITest.php +++ b/tests/system/CLI/CLITest.php @@ -450,7 +450,7 @@ public function testWindow(): void } /** - * @dataProvider tableProvider + * @dataProvider provideTable * * @param array $tbody * @param array $thead @@ -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', diff --git a/tests/system/Cache/Handlers/BaseHandlerTest.php b/tests/system/Cache/Handlers/BaseHandlerTest.php index 2e835760e9e4..123c7427cc30 100644 --- a/tests/system/Cache/Handlers/BaseHandlerTest.php +++ b/tests/system/Cache/Handlers/BaseHandlerTest.php @@ -23,7 +23,7 @@ final class BaseHandlerTest extends CIUnitTestCase { /** - * @dataProvider invalidTypeProvider + * @dataProvider provideValidateKeyInvalidType * * @param mixed $input */ @@ -35,7 +35,7 @@ public function testValidateKeyInvalidType($input): void BaseHandler::validateKey($input); } - public function invalidTypeProvider(): iterable + public function provideValidateKeyInvalidType(): iterable { return [ [true], diff --git a/tests/system/Cache/Handlers/FileHandlerTest.php b/tests/system/Cache/Handlers/FileHandlerTest.php index db8387b8c9cf..bbc48ef0ff3b 100644 --- a/tests/system/Cache/Handlers/FileHandlerTest.php +++ b/tests/system/Cache/Handlers/FileHandlerTest.php @@ -273,7 +273,7 @@ public function testIsSupported(): void } /** - * @dataProvider modeProvider + * @dataProvider provideSaveMode * * permissions given on Windows are fixed to `0666` * @@ -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 [ [ diff --git a/tests/system/CodeIgniterTest.php b/tests/system/CodeIgniterTest.php index a593fb279db3..08de0281ad1d 100644 --- a/tests/system/CodeIgniterTest.php +++ b/tests/system/CodeIgniterTest.php @@ -731,7 +731,7 @@ public function testPageCacheSendSecureHeaders(): void /** * @param array|bool $cacheQueryStringValue * - * @dataProvider cacheQueryStringProvider + * @dataProvider providePageCacheWithCacheQueryString * * @see https://github.com/codeigniter4/CodeIgniter4/pull/6410 */ @@ -789,7 +789,7 @@ public function testPageCacheWithCacheQueryString($cacheQueryStringValue, int $e CITestStreamFilter::removeErrorFilter(); } - public function cacheQueryStringProvider(): iterable + public function providePageCacheWithCacheQueryString(): iterable { $testingUrls = [ 'test', // URL #1 diff --git a/tests/system/Commands/CommandTest.php b/tests/system/Commands/CommandTest.php index 90da337c11a0..8dbb8219aad9 100644 --- a/tests/system/Commands/CommandTest.php +++ b/tests/system/Commands/CommandTest.php @@ -128,7 +128,7 @@ public function testInexistentCommandsButWithManyAlternatives(): void } /** - * @dataProvider commandArgsProvider + * @dataProvider provideCommandParsesArgsCorrectly */ public function testCommandParsesArgsCorrectly(string $input, array $expected): void { @@ -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 [ [ diff --git a/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php b/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php index ec4acc47259e..2dbe3d854b47 100644 --- a/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php +++ b/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php @@ -22,7 +22,7 @@ final class SampleURIGeneratorTest extends CIUnitTestCase { /** - * @dataProvider routeKeyProvider + * @dataProvider provideGet */ public function testGet(string $routeKey, string $expected): void { @@ -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' => ['/', '/'], diff --git a/tests/system/CommonFunctionsTest.php b/tests/system/CommonFunctionsTest.php index 8d4f7199d0e1..30c5bce85bfb 100644 --- a/tests/system/CommonFunctionsTest.php +++ b/tests/system/CommonFunctionsTest.php @@ -594,7 +594,7 @@ public function testForceHttpsNullRequestAndResponse(): void } /** - * @dataProvider dirtyPathsProvider + * @dataProvider provideCleanPathActuallyCleaningThePaths * * @param mixed $input * @param mixed $expected @@ -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; diff --git a/tests/system/Config/DotEnvTest.php b/tests/system/Config/DotEnvTest.php index 6bd8b23958f5..922ecce00599 100644 --- a/tests/system/Config/DotEnvTest.php +++ b/tests/system/Config/DotEnvTest.php @@ -56,7 +56,7 @@ public function testReturnsFalseIfCannotFindFile(): void } /** - * @dataProvider provideLoadVars + * @dataProvider provideLoadsVars */ public function testLoadsVars(string $expected, string $varname): void { @@ -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'], diff --git a/tests/system/Config/MimesTest.php b/tests/system/Config/MimesTest.php index 7e1e78676155..3afaf027ddaf 100644 --- a/tests/system/Config/MimesTest.php +++ b/tests/system/Config/MimesTest.php @@ -21,7 +21,7 @@ */ final class MimesTest extends CIUnitTestCase { - public function extensionsList(): iterable + public function provideGuessExtensionFromType(): iterable { return [ 'null' => [ @@ -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' => [ @@ -82,7 +82,7 @@ public function mimesList(): iterable } /** - * @dataProvider mimesList + * @dataProvider provideGuessTypeFromExtension */ public function testGuessTypeFromExtension(?string $expected, string $ext): void { diff --git a/tests/system/Cookie/CookieTest.php b/tests/system/Cookie/CookieTest.php index c69fb1b806d2..516daac8b66c 100644 --- a/tests/system/Cookie/CookieTest.php +++ b/tests/system/Cookie/CookieTest.php @@ -79,7 +79,7 @@ public function testConfigInjectionForDefaults(): void } /** - * @dataProvider prefixProvider + * @dataProvider provideConfigPrefix */ public function testConfigPrefix(string $configPrefix, string $optionPrefix, string $expected): void { @@ -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'], @@ -165,7 +165,7 @@ public function testExpirationTime(): void } /** - * @dataProvider invalidExpiresProvider + * @dataProvider provideInvalidExpires * * @param bool|float|string $expires */ @@ -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'], @@ -189,7 +189,7 @@ public static function invalidExpiresProvider(): iterable } /** - * @dataProvider setCookieHeaderProvider + * @dataProvider provideSetCookieHeaderCreation */ public function testSetCookieHeaderCreation(string $header, array $changed): void { @@ -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', diff --git a/tests/system/Database/BaseConnectionTest.php b/tests/system/Database/BaseConnectionTest.php index 333a81c87d1f..c82be7951c38 100644 --- a/tests/system/Database/BaseConnectionTest.php +++ b/tests/system/Database/BaseConnectionTest.php @@ -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, @@ -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 diff --git a/tests/system/Database/BaseQueryTest.php b/tests/system/Database/BaseQueryTest.php index d52df3899ea6..da0d250bbb6c 100644 --- a/tests/system/Database/BaseQueryTest.php +++ b/tests/system/Database/BaseQueryTest.php @@ -104,7 +104,7 @@ public function testSwapPrefix(): void $this->assertSame($newSQL, $query->getQuery()); } - public function queryTypes(): iterable + public function provideIsWriteType(): iterable { return [ 'select' => [ @@ -183,7 +183,7 @@ public function queryTypes(): iterable } /** - * @dataProvider queryTypes + * @dataProvider provideIsWriteType * * @param mixed $expected * @param mixed $sql @@ -577,7 +577,7 @@ public function testSwapPrefixAfterGetQuery(): void $this->assertSame($expected, $query->getQuery()); } - public function queryKeywords(): iterable + public function provideHighlightQueryKeywords(): iterable { return [ 'highlightKeyWords' => [ @@ -596,7 +596,7 @@ public function queryKeywords(): iterable } /** - * @dataProvider queryKeywords + * @dataProvider provideHighlightQueryKeywords * * @param mixed $expected * @param mixed $sql diff --git a/tests/system/Database/Builder/WhereTest.php b/tests/system/Database/Builder/WhereTest.php index c0ddeb34f329..352917c002ef 100644 --- a/tests/system/Database/Builder/WhereTest.php +++ b/tests/system/Database/Builder/WhereTest.php @@ -392,7 +392,7 @@ public function testWhereInSubQuery(): void $this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect())); } - public function provideInvalidKeys(): iterable + public function provideWhereInvalidKeyThrowInvalidArgumentException(): iterable { return [ 'null' => [null], @@ -401,7 +401,7 @@ public function provideInvalidKeys(): iterable } /** - * @dataProvider provideInvalidKeys + * @dataProvider provideWhereInvalidKeyThrowInvalidArgumentException * * @param mixed $key */ @@ -413,7 +413,7 @@ public function testWhereInvalidKeyThrowInvalidArgumentException($key): void $builder->whereIn($key, ['Politician', 'Accountant']); } - public function provideInvalidValues(): iterable + public function provideWhereInEmptyValuesThrowInvalidArgumentException(): iterable { return [ 'null' => [null], @@ -423,7 +423,7 @@ public function provideInvalidValues(): iterable } /** - * @dataProvider provideInvalidValues + * @dataProvider provideWhereInEmptyValuesThrowInvalidArgumentException * * @param mixed $values */ diff --git a/tests/system/Database/ConfigTest.php b/tests/system/Database/ConfigTest.php index b401d541b7a8..78bc74669ddf 100644 --- a/tests/system/Database/ConfigTest.php +++ b/tests/system/Database/ConfigTest.php @@ -192,7 +192,7 @@ public function testConnectionGroupWithDSNPostgreNative(): void } /** - * @dataProvider convertDSNProvider + * @dataProvider provideConvertDSN * * @see https://github.com/codeigniter4/CodeIgniter4/issues/7550 */ @@ -208,7 +208,7 @@ public function testConvertDSN(string $input, string $expected): void $this->assertSame($expected, $this->getPrivateProperty($conn, 'DSN')); } - public function convertDSNProvider(): iterable + public function provideConvertDSN(): iterable { yield from [ [ diff --git a/tests/system/Email/EmailTest.php b/tests/system/Email/EmailTest.php index 2fff192e7295..656f14229d6a 100644 --- a/tests/system/Email/EmailTest.php +++ b/tests/system/Email/EmailTest.php @@ -32,7 +32,7 @@ public function testEmailValidation(): void $this->assertStringContainsString('Invalid email address: "invalid"', $email->printDebugger()); } - public function autoClearProvider(): iterable + public function provideEmailSendWithClearance(): iterable { return [ 'autoclear' => [true], @@ -41,7 +41,7 @@ public function autoClearProvider(): iterable } /** - * @dataProvider autoClearProvider + * @dataProvider provideEmailSendWithClearance * * @param mixed $autoClear */ diff --git a/tests/system/Filters/FiltersTest.php b/tests/system/Filters/FiltersTest.php index a89950c71750..5e1fbc1941da 100644 --- a/tests/system/Filters/FiltersTest.php +++ b/tests/system/Filters/FiltersTest.php @@ -208,7 +208,7 @@ public function testProcessMethodProcessGlobals(): void $this->assertSame($expected, $filters->initialize()->getFilters()); } - public function provideExcept(): iterable + public function provideProcessMethodProcessGlobalsWithExcept(): iterable { return [ [ @@ -221,7 +221,7 @@ public function provideExcept(): iterable } /** - * @dataProvider provideExcept + * @dataProvider provideProcessMethodProcessGlobalsWithExcept */ public function testProcessMethodProcessGlobalsWithExcept(array $except): void { diff --git a/tests/system/Filters/InvalidCharsTest.php b/tests/system/Filters/InvalidCharsTest.php index 7a56746d7bcb..49794e6775bd 100644 --- a/tests/system/Filters/InvalidCharsTest.php +++ b/tests/system/Filters/InvalidCharsTest.php @@ -115,7 +115,7 @@ public function testBeforeInvalidControlCharCausesException(): void /** * @doesNotPerformAssertions * - * @dataProvider stringWithLineBreakAndTabProvider + * @dataProvider provideCheckControlStringWithLineBreakAndTabReturnsTheString */ public function testCheckControlStringWithLineBreakAndTabReturnsTheString(string $input): void { @@ -124,7 +124,7 @@ public function testCheckControlStringWithLineBreakAndTabReturnsTheString(string $this->invalidChars->before($this->request); } - public function stringWithLineBreakAndTabProvider(): iterable + public function provideCheckControlStringWithLineBreakAndTabReturnsTheString(): iterable { yield from [ ["String contains \n line break."], @@ -136,7 +136,7 @@ public function stringWithLineBreakAndTabProvider(): iterable } /** - * @dataProvider stringWithControlCharsProvider + * @dataProvider provideCheckControlStringWithControlCharsCausesException */ public function testCheckControlStringWithControlCharsCausesException(string $input): void { @@ -148,7 +148,7 @@ public function testCheckControlStringWithControlCharsCausesException(string $in $this->invalidChars->before($this->request); } - public function stringWithControlCharsProvider(): iterable + public function provideCheckControlStringWithControlCharsCausesException(): iterable { yield from [ ["String contains null char.\0"], diff --git a/tests/system/Format/XMLFormatterTest.php b/tests/system/Format/XMLFormatterTest.php index b6606c1a3d19..47f49640e26f 100644 --- a/tests/system/Format/XMLFormatterTest.php +++ b/tests/system/Format/XMLFormatterTest.php @@ -102,7 +102,7 @@ public function testValidatingXmlTags(): void } /** - * @dataProvider invalidTagsProvider + * @dataProvider provideValidatingInvalidTags */ public function testValidatingInvalidTags(string $expected, array $input): void { @@ -115,7 +115,7 @@ public function testValidatingInvalidTags(string $expected, array $input): void $this->assertSame($expectedXML, $this->xmlFormatter->format($input)); } - public function invalidTagsProvider(): iterable + public function provideValidatingInvalidTags(): iterable { return [ [ diff --git a/tests/system/HTTP/CLIRequestTest.php b/tests/system/HTTP/CLIRequestTest.php index 40bf2aad3a53..964161877504 100644 --- a/tests/system/HTTP/CLIRequestTest.php +++ b/tests/system/HTTP/CLIRequestTest.php @@ -517,7 +517,7 @@ public function testFetchGlobalWithEmptyNotation(): void $this->assertSame($expected, $this->request->fetchGlobal('post', 'clients[]')); } - public function ipAddressChecks(): iterable + public function provideValidIPAddress(): iterable { return [ 'empty' => [ @@ -564,7 +564,7 @@ public function ipAddressChecks(): iterable } /** - * @dataProvider ipAddressChecks + * @dataProvider provideValidIPAddress * * @param mixed $expected * @param mixed $address diff --git a/tests/system/HTTP/IncomingRequestTest.php b/tests/system/HTTP/IncomingRequestTest.php index b8015fab933e..64230e8e935f 100644 --- a/tests/system/HTTP/IncomingRequestTest.php +++ b/tests/system/HTTP/IncomingRequestTest.php @@ -518,7 +518,7 @@ public function testCanGrabGetRawInput(): void $this->assertSame($expected, $request->getRawInput()); } - public function provideRawInputVarChecks(): iterable + public function provideCanGrabGetRawInputVar(): iterable { return [ [ @@ -598,7 +598,7 @@ public function provideRawInputVarChecks(): iterable } /** - * @dataProvider provideRawInputVarChecks + * @dataProvider provideCanGrabGetRawInputVar * * @param string $rawstring * @param mixed $var @@ -839,7 +839,7 @@ public function testGetPostIndexNotExists(): void $this->assertNull($this->request->getGetPost('gc')); } - public function providePathChecks(): iterable + public function provideExtensionPHP(): iterable { return [ 'not /index.php' => [ @@ -854,7 +854,7 @@ public function providePathChecks(): iterable } /** - * @dataProvider providePathChecks + * @dataProvider provideExtensionPHP * * @param mixed $path * @param mixed $detectPath diff --git a/tests/system/HTTP/RequestTest.php b/tests/system/HTTP/RequestTest.php index 3eaea59ed1c2..f22e173abde8 100644 --- a/tests/system/HTTP/RequestTest.php +++ b/tests/system/HTTP/RequestTest.php @@ -532,7 +532,7 @@ public function testFetchGlobalFiltersWithArrayChildElement(): void $this->assertSame($expected, $this->request->fetchGlobal('post', 'people[0]', FILTER_VALIDATE_INT)); } - public function ipAddressChecks(): iterable + public function provideValidIPAddress(): iterable { return [ 'empty' => [ @@ -579,7 +579,7 @@ public function ipAddressChecks(): iterable } /** - * @dataProvider ipAddressChecks + * @dataProvider provideValidIPAddress * * @param mixed $expected * @param mixed $address diff --git a/tests/system/HTTP/ResponseTest.php b/tests/system/HTTP/ResponseTest.php index c9cb68807ac4..ac5e1f1eb848 100644 --- a/tests/system/HTTP/ResponseTest.php +++ b/tests/system/HTTP/ResponseTest.php @@ -270,7 +270,7 @@ public function testRedirectSetsDefaultCodeAndLocationHeader(): void } /** - * @dataProvider provideForRedirect + * @dataProvider provideRedirect */ public function testRedirect( string $server, @@ -291,7 +291,7 @@ public function testRedirect( $this->assertSame($expectedCode, $response->getStatusCode()); } - public function provideForRedirect(): iterable + public function provideRedirect(): iterable { yield from [ ['Apache/2.4.17', 'HTTP/1.1', 'GET', null, 302], @@ -316,7 +316,7 @@ public function provideForRedirect(): iterable } /** - * @dataProvider provideForRedirectWithIIS + * @dataProvider provideRedirectWithIIS */ public function testRedirectWithIIS( string $protocol, @@ -337,7 +337,7 @@ public function testRedirectWithIIS( unset($_SERVER['SERVER_SOFTWARE']); } - public function provideForRedirectWithIIS(): iterable + public function provideRedirectWithIIS(): iterable { yield from [ ['HTTP/1.1', 'GET', null, 302], diff --git a/tests/system/HTTP/URITest.php b/tests/system/HTTP/URITest.php index dd802ec5de55..bea59f551c5a 100644 --- a/tests/system/HTTP/URITest.php +++ b/tests/system/HTTP/URITest.php @@ -126,7 +126,7 @@ public function testCanCastAsString(): void } /** - * @dataProvider provideURLs + * @dataProvider provideSimpleUri */ public function testSimpleUri(string $url, string $expectedURL, string $expectedPath): void { @@ -136,7 +136,7 @@ public function testSimpleUri(string $url, string $expectedURL, string $expected $this->assertSame($expectedPath, $uri->getPath()); } - public function provideURLs(): iterable + public function provideSimpleUri(): iterable { return [ '' => [ @@ -362,7 +362,7 @@ public function testSetPathSetsValue(): void } /** - * @dataProvider providePaths + * @dataProvider provideSetPath */ public function testSetPath(string $path, string $expectedURL, string $expectedPath): void { @@ -375,7 +375,7 @@ public function testSetPath(string $path, string $expectedURL, string $expectedP $this->assertSame($expectedPath, $uri->getPath()); } - public function providePaths(): iterable + public function provideSetPath(): iterable { return [ '' => [ @@ -431,7 +431,7 @@ public function providePaths(): iterable ]; } - public function invalidPaths(): iterable + public function providePathGetsFiltered(): iterable { return [ 'dot-segment' => [ @@ -462,7 +462,7 @@ public function invalidPaths(): iterable } /** - * @dataProvider invalidPaths + * @dataProvider providePathGetsFiltered * * @param string $path * @param string $expected @@ -555,7 +555,7 @@ public function testSetQueryThrowsErrorWhenFragmentPresentSilent(): void $this->assertSame('', $uri->getQuery()); } - public function authorityInfo(): iterable + public function provideAuthorityReturnsExceptedValues(): iterable { return [ 'host-only' => [ @@ -578,7 +578,7 @@ public function authorityInfo(): iterable } /** - * @dataProvider authorityInfo + * @dataProvider provideAuthorityReturnsExceptedValues * * @param string $url * @param string $expected @@ -590,7 +590,7 @@ public function testAuthorityReturnsExceptedValues($url, $expected): void $this->assertSame($expected, $uri->getAuthority()); } - public function defaultPorts(): iterable + public function provideAuthorityRemovesDefaultPorts(): iterable { return [ 'http' => [ @@ -605,7 +605,7 @@ public function defaultPorts(): iterable } /** - * @dataProvider defaultPorts + * @dataProvider provideAuthorityRemovesDefaultPorts * * @param string $scheme * @param int $port @@ -629,7 +629,7 @@ public function testSetAuthorityReconstitutes(): void $this->assertSame($authority, $uri->getAuthority()); } - public function defaultDots(): iterable + public function provideRemoveDotSegments(): iterable { return [ [ @@ -728,7 +728,7 @@ public function defaultDots(): iterable } /** - * @dataProvider defaultDots + * @dataProvider provideRemoveDotSegments * * @param string $path * @param string $expected diff --git a/tests/system/Helpers/ArrayHelperTest.php b/tests/system/Helpers/ArrayHelperTest.php index 53a860c3a4a4..f2708926b0e7 100644 --- a/tests/system/Helpers/ArrayHelperTest.php +++ b/tests/system/Helpers/ArrayHelperTest.php @@ -209,7 +209,7 @@ public function testArrayDotIgnoresLastWildcard(): void } /** - * @dataProvider deepSearchProvider + * @dataProvider provideArrayDeepSearch * * @param int|string $key * @param array|string|null $expected @@ -320,7 +320,7 @@ public function testArraySortByMultipleKeysFailsInconsistentArraySizes($data): v array_sort_by_multiple_keys($data, $sortColumns); } - public static function deepSearchProvider(): iterable + public static function provideArrayDeepSearch(): iterable { return [ [ @@ -400,14 +400,14 @@ public static function sortByMultipleKeysProvider(): iterable } /** - * @dataProvider arrayFlattenProvider + * @dataProvider provideArrayFlattening */ public function testArrayFlattening(array $input, array $expected): void { $this->assertSame($expected, array_flatten_with_dots($input)); } - public function arrayFlattenProvider(): iterable + public function provideArrayFlattening(): iterable { yield 'normal' => [ [ diff --git a/tests/system/Helpers/URLHelper/MiscUrlTest.php b/tests/system/Helpers/URLHelper/MiscUrlTest.php index 6d4daf8d56c1..17808345b38f 100644 --- a/tests/system/Helpers/URLHelper/MiscUrlTest.php +++ b/tests/system/Helpers/URLHelper/MiscUrlTest.php @@ -112,7 +112,7 @@ public function testIndexPageAlt(): void // Test anchor - public function anchorNormalPatterns(): iterable + public function provideAnchor(): iterable { return [ 'normal01' => [ @@ -156,7 +156,7 @@ public function anchorNormalPatterns(): iterable } /** - * @dataProvider anchorNormalPatterns + * @dataProvider provideAnchor * * @param mixed $expected * @param mixed $uri @@ -171,7 +171,7 @@ public function testAnchor($expected = '', $uri = '', $title = '', $attributes = $this->assertSame($expected, anchor($uri, $title, $attributes, $this->config)); } - public function anchorNoindexPatterns(): iterable + public function provideAnchorNoindex(): iterable { return [ 'noindex01' => [ @@ -221,7 +221,7 @@ public function anchorNoindexPatterns(): iterable } /** - * @dataProvider anchorNoindexPatterns + * @dataProvider provideAnchorNoindex * * @param mixed $expected * @param mixed $uri @@ -238,7 +238,7 @@ public function testAnchorNoindex($expected = '', $uri = '', $title = '', $attri $this->assertSame($expected, anchor($uri, $title, $attributes, $this->config)); } - public function anchorSubpagePatterns(): iterable + public function provideAnchorTargetted(): iterable { return [ 'subpage01' => [ @@ -278,7 +278,7 @@ public function anchorSubpagePatterns(): iterable } /** - * @dataProvider anchorSubpagePatterns + * @dataProvider provideAnchorTargetted * * @param mixed $expected * @param mixed $uri @@ -295,7 +295,7 @@ public function testAnchorTargetted($expected = '', $uri = '', $title = '', $att $this->assertSame($expected, anchor($uri, $title, $attributes, $this->config)); } - public function anchorExamplePatterns(): iterable + public function provideAnchorExamples(): iterable { return [ 'egpage01' => [ @@ -324,7 +324,7 @@ public function anchorExamplePatterns(): iterable } /** - * @dataProvider anchorExamplePatterns + * @dataProvider provideAnchorExamples * * @param mixed $expected * @param mixed $uri @@ -341,7 +341,7 @@ public function testAnchorExamples($expected = '', $uri = '', $title = '', $attr // Test anchor_popup - public function anchorPopupPatterns(): iterable + public function provideAnchorPopup(): iterable { return [ 'normal01' => [ @@ -382,7 +382,7 @@ public function anchorPopupPatterns(): iterable } /** - * @dataProvider anchorPopupPatterns + * @dataProvider provideAnchorPopup * * @param mixed $expected * @param mixed $uri @@ -399,7 +399,7 @@ public function testAnchorPopup($expected = '', $uri = '', $title = '', $attribu // Test mailto - public function mailtoPatterns(): iterable + public function provideMailto(): iterable { return [ 'page01' => [ @@ -421,7 +421,7 @@ public function mailtoPatterns(): iterable } /** - * @dataProvider mailtoPatterns + * @dataProvider provideMailto * * @param mixed $expected * @param mixed $email @@ -438,7 +438,7 @@ public function testMailto($expected = '', $email = '', $title = '', $attributes // Test safe_mailto - public function safeMailtoPatterns(): iterable + public function provideSafeMailto(): iterable { return [ 'page01' => [ @@ -460,7 +460,7 @@ public function safeMailtoPatterns(): iterable } /** - * @dataProvider safeMailtoPatterns + * @dataProvider provideSafeMailto * * @param mixed $expected * @param mixed $email @@ -487,7 +487,7 @@ public function testSafeMailtoWithCsp(): void // Test auto_link - public function autolinkUrls(): iterable + public function provideAutoLinkUrl(): iterable { return [ 'test01' => [ @@ -526,7 +526,7 @@ public function autolinkUrls(): iterable } /** - * @dataProvider autolinkUrls + * @dataProvider provideAutoLinkUrl * * @param mixed $in * @param mixed $out @@ -536,7 +536,7 @@ public function testAutoLinkUrl($in, $out): void $this->assertSame($out, auto_link($in, 'url')); } - public function autolinkEmails(): iterable + public function provideAutoLinkEmail(): iterable { return [ 'test01' => [ @@ -575,7 +575,7 @@ public function autolinkEmails(): iterable } /** - * @dataProvider autolinkEmails + * @dataProvider provideAutoLinkEmail * * @param mixed $in * @param mixed $out @@ -585,7 +585,7 @@ public function testAutoLinkEmail($in, $out): void $this->assertSame($out, auto_link($in, 'email')); } - public function autolinkBoth(): iterable + public function provideAutolinkBoth(): iterable { return [ 'test01' => [ @@ -624,7 +624,7 @@ public function autolinkBoth(): iterable } /** - * @dataProvider autolinkBoth + * @dataProvider provideAutolinkBoth * * @param mixed $in * @param mixed $out @@ -634,7 +634,7 @@ public function testAutolinkBoth($in, $out): void $this->assertSame($out, auto_link($in)); } - public function autolinkPopup(): iterable + public function provideAutoLinkPopup(): iterable { return [ 'test01' => [ @@ -673,7 +673,7 @@ public function autolinkPopup(): iterable } /** - * @dataProvider autolinkPopup + * @dataProvider provideAutoLinkPopup * * @param mixed $in * @param mixed $out @@ -685,7 +685,7 @@ public function testAutoLinkPopup($in, $out): void // Test prep_url - public function prepUrlProvider(): iterable + public function providePrepUrl(): iterable { // input, expected, secure return [ @@ -763,7 +763,7 @@ public function prepUrlProvider(): iterable } /** - * @dataProvider prepUrlProvider + * @dataProvider providePrepUrl */ public function testPrepUrl(string $input, string $expected, bool $secure): void { @@ -829,7 +829,7 @@ public function testMbUrlTitleExtraDashes(): void } /** - * @dataProvider urlToProvider + * @dataProvider provideUrlTo */ public function testUrlTo(string $expected, string $input, ...$args): void { @@ -845,7 +845,7 @@ public function testUrlTo(string $expected, string $input, ...$args): void } /** - * @dataProvider urlToMissingRoutesProvider + * @dataProvider provideUrlToThrowsOnEmptyOrMissingRoute */ public function testUrlToThrowsOnEmptyOrMissingRoute(string $route): void { @@ -854,7 +854,7 @@ public function testUrlToThrowsOnEmptyOrMissingRoute(string $route): void url_to($route); } - public function urlToProvider(): iterable + public function provideUrlTo(): iterable { $page = config('App')->indexPage !== '' ? config('App')->indexPage . '/' : ''; @@ -874,7 +874,7 @@ public function urlToProvider(): iterable ]; } - public function urlToMissingRoutesProvider(): iterable + public function provideUrlToThrowsOnEmptyOrMissingRoute(): iterable { return [ [ diff --git a/tests/system/Helpers/URLHelper/SiteUrlTest.php b/tests/system/Helpers/URLHelper/SiteUrlTest.php index 36fe9882c6d6..a4b2acf8aa26 100644 --- a/tests/system/Helpers/URLHelper/SiteUrlTest.php +++ b/tests/system/Helpers/URLHelper/SiteUrlTest.php @@ -61,7 +61,7 @@ protected function tearDown(): void * @param string $expectedSiteUrl * @param string $expectedBaseUrl * - * @dataProvider configProvider + * @dataProvider provideUrls */ public function testUrls( $baseURL, @@ -81,7 +81,7 @@ public function testUrls( $this->assertSame($expectedBaseUrl, base_url($path, $scheme)); } - public function configProvider(): iterable + public function provideUrls(): iterable { // baseURL, indexPage, scheme, secure, path, expectedSiteUrl, expectedBaseUrl return [ diff --git a/tests/system/I18n/TimeLegacyTest.php b/tests/system/I18n/TimeLegacyTest.php index f9d081709a7b..ca687c9aca43 100644 --- a/tests/system/I18n/TimeLegacyTest.php +++ b/tests/system/I18n/TimeLegacyTest.php @@ -1147,7 +1147,7 @@ public function testSetTestNowWithFaLocale(): void } /** - * @dataProvider provideLocales + * @dataProvider provideToStringDoesNotDependOnLocale */ public function testToStringDoesNotDependOnLocale(string $locale): void { @@ -1158,7 +1158,7 @@ public function testToStringDoesNotDependOnLocale(string $locale): void $this->assertSame('2017-03-10 12:00:00', (string) $time); } - public function provideLocales(): iterable + public function provideToStringDoesNotDependOnLocale(): iterable { yield from [ ['en'], diff --git a/tests/system/I18n/TimeTest.php b/tests/system/I18n/TimeTest.php index 35a64dad695e..46c1c72e2812 100644 --- a/tests/system/I18n/TimeTest.php +++ b/tests/system/I18n/TimeTest.php @@ -1159,7 +1159,7 @@ public function testSetTestNowWithFaLocale(): void } /** - * @dataProvider provideLocales + * @dataProvider provideToStringDoesNotDependOnLocale */ public function testToStringDoesNotDependOnLocale(string $locale): void { @@ -1170,7 +1170,7 @@ public function testToStringDoesNotDependOnLocale(string $locale): void $this->assertSame('2017-03-10 12:00:00', (string) $time); } - public function provideLocales(): iterable + public function provideToStringDoesNotDependOnLocale(): iterable { yield from [ ['en'], diff --git a/tests/system/Language/LanguageTest.php b/tests/system/Language/LanguageTest.php index 27c1b6bee346..4cf171bda64a 100644 --- a/tests/system/Language/LanguageTest.php +++ b/tests/system/Language/LanguageTest.php @@ -213,7 +213,7 @@ public function testPrioritizedLocator(): void $this->assertSame('billions and billions', lang('Core.bazillion', [], 'en')); } - public function MessageBundles(): iterable + public function provideBundleUniqueKeys(): iterable { return [ ['CLI'], @@ -244,7 +244,7 @@ public function MessageBundles(): iterable * There's not a whole lot that can be done with message bundles, * but we can at least try loading them ... more accurate code coverage? * - * @dataProvider MessageBundles + * @dataProvider provideBundleUniqueKeys * * @param mixed $bundle */ diff --git a/tests/system/Models/FindModelTest.php b/tests/system/Models/FindModelTest.php index bfe3ed0ec182..8b54d09fbbff 100644 --- a/tests/system/Models/FindModelTest.php +++ b/tests/system/Models/FindModelTest.php @@ -157,7 +157,7 @@ public function testFirst(): void } /** - * @dataProvider provideGroupBy + * @dataProvider provideFirstAggregate * * @param mixed $groupBy * @param mixed $total @@ -184,7 +184,7 @@ public function testFirstAggregate($groupBy, $total): void $this->assertSame($total, (int) $user->total); } - public static function provideGroupBy(): iterable + public static function provideFirstAggregate(): iterable { return [ [true, 3], diff --git a/tests/system/Models/UpdateModelTest.php b/tests/system/Models/UpdateModelTest.php index bd57025dc87f..c29e68633382 100644 --- a/tests/system/Models/UpdateModelTest.php +++ b/tests/system/Models/UpdateModelTest.php @@ -382,7 +382,7 @@ public function testUpdateWithSetAndEscape(): void } /** - * @dataProvider provideInvalidIds + * @dataProvider provideUpdateThrowDatabaseExceptionWithoutWhereClause * * @param false|null $id */ @@ -397,7 +397,7 @@ public function testUpdateThrowDatabaseExceptionWithoutWhereClause($id, string $ $this->model->update($id, ['name' => 'Foo Bar']); } - public function provideInvalidIds(): iterable + public function provideUpdateThrowDatabaseExceptionWithoutWhereClause(): iterable { yield from [ [ diff --git a/tests/system/Publisher/PublisherRestrictionsTest.php b/tests/system/Publisher/PublisherRestrictionsTest.php index ccecc704cd21..c717519b8a8e 100644 --- a/tests/system/Publisher/PublisherRestrictionsTest.php +++ b/tests/system/Publisher/PublisherRestrictionsTest.php @@ -47,7 +47,7 @@ public function testImmutableRestrictions(): void } /** - * @dataProvider fileProvider + * @dataProvider provideDefaultPublicRestrictions */ public function testDefaultPublicRestrictions(string $path): void { @@ -69,7 +69,7 @@ public function testDefaultPublicRestrictions(string $path): void $this->assertSame($expected, $errors[$file]->getMessage()); } - public function fileProvider(): iterable + public function provideDefaultPublicRestrictions(): iterable { yield from [ 'php' => ['index.php'], @@ -79,7 +79,7 @@ public function fileProvider(): iterable } /** - * @dataProvider destinationProvider + * @dataProvider provideDestinations */ public function testDestinations(string $destination, bool $allowed): void { @@ -99,7 +99,7 @@ public function testDestinations(string $destination, bool $allowed): void $this->assertInstanceOf(Publisher::class, $publisher); } - public function destinationProvider(): iterable + public function provideDestinations(): iterable { return [ 'explicit' => [ diff --git a/tests/system/Router/RouteCollectionReverseRouteTest.php b/tests/system/Router/RouteCollectionReverseRouteTest.php index 64ddacd163bb..b364ed2ac2b0 100644 --- a/tests/system/Router/RouteCollectionReverseRouteTest.php +++ b/tests/system/Router/RouteCollectionReverseRouteTest.php @@ -120,7 +120,7 @@ public function testReverseRoutingWithLocale(): void $this->assertSame('/en/contact', $routes->reverseRoute('myController::goto')); } - public function reverseRoutingHandlerProvider(): iterable + public function provideReverseRoutingDefaultNamespaceAppController(): iterable { return yield from [ 'Omit namespace' => ['Galleries::showUserGallery'], @@ -130,7 +130,7 @@ public function reverseRoutingHandlerProvider(): iterable } /** - * @dataProvider reverseRoutingHandlerProvider + * @dataProvider provideReverseRoutingDefaultNamespaceAppController */ public function testReverseRoutingDefaultNamespaceAppController(string $controller): void { diff --git a/tests/system/Router/RouteCollectionTest.php b/tests/system/Router/RouteCollectionTest.php index 4143c6a3bd2f..eb15e0ca71bf 100644 --- a/tests/system/Router/RouteCollectionTest.php +++ b/tests/system/Router/RouteCollectionTest.php @@ -380,7 +380,7 @@ static function ($routes): void { } /** - * @dataProvider groupProvider + * @dataProvider provideNestedGroupingWorksWithRootPrefix */ public function testNestedGroupingWorksWithRootPrefix( string $group, @@ -405,7 +405,7 @@ static function ($routes): void { $this->assertSame($expected, $routes->getRoutes()); } - public function groupProvider(): iterable + public function provideNestedGroupingWorksWithRootPrefix(): iterable { yield from [ ['admin', '/', [ @@ -1218,7 +1218,7 @@ static function (): void {}, } /** - * @dataProvider optionsProvider + * @dataProvider provideRoutesOptionsWithSameFromTwoRoutes */ public function testRoutesOptionsWithSameFromTwoRoutes(array $options1, array $options2): void { @@ -1242,7 +1242,7 @@ static function (): void {}, $this->assertSame($options, $options1); } - public function optionsProvider(): iterable + public function provideRoutesOptionsWithSameFromTwoRoutes(): iterable { yield from [ [ diff --git a/tests/system/Router/RouterTest.php b/tests/system/Router/RouterTest.php index c068569c4576..2b580b4e5c10 100644 --- a/tests/system/Router/RouterTest.php +++ b/tests/system/Router/RouterTest.php @@ -847,7 +847,7 @@ public function testSetDirectoryInvalid(): void } /** - * @dataProvider provideRedirectCase + * @dataProvider provideRedirectRoute */ public function testRedirectRoute( string $route, @@ -870,7 +870,7 @@ public function testRedirectRoute( $router->handle($url); } - public function provideRedirectCase(): iterable + public function provideRedirectRoute(): iterable { // [$route, $redirectFrom, $redirectTo, $url, $expectedPath, $alias] return [ diff --git a/tests/system/Test/FeatureTestTraitTest.php b/tests/system/Test/FeatureTestTraitTest.php index dc6fa35a5975..2e41d51a9c6e 100644 --- a/tests/system/Test/FeatureTestTraitTest.php +++ b/tests/system/Test/FeatureTestTraitTest.php @@ -284,7 +284,7 @@ public function testCallZeroAsPathGot404(): void $this->get('0'); } - public function provideRoutesData(): iterable + public function provideOpenCliRoutesFromHttpGot404(): iterable { return [ 'non parameterized cli' => [ @@ -316,7 +316,7 @@ public function provideRoutesData(): iterable } /** - * @dataProvider provideRoutesData + * @dataProvider provideOpenCliRoutesFromHttpGot404 * * @param mixed $from * @param mixed $to diff --git a/tests/system/Test/TestLoggerTest.php b/tests/system/Test/TestLoggerTest.php index 4240b4c2690b..c4f779dc2467 100644 --- a/tests/system/Test/TestLoggerTest.php +++ b/tests/system/Test/TestLoggerTest.php @@ -21,7 +21,7 @@ final class TestLoggerTest extends CIUnitTestCase { /** - * @dataProvider provideDidLogCases + * @dataProvider provideDidLogMethod */ public function testDidLogMethod(bool $expected, string $level, string $message, bool $exact): void { @@ -33,7 +33,7 @@ public function testDidLogMethod(bool $expected, string $level, string $message, ); } - public function provideDidLogCases(): iterable + public function provideDidLogMethod(): iterable { yield 'exact' => [ true, diff --git a/tests/system/Throttle/ThrottleTest.php b/tests/system/Throttle/ThrottleTest.php index 83a44878cf76..94f3fc43c644 100644 --- a/tests/system/Throttle/ThrottleTest.php +++ b/tests/system/Throttle/ThrottleTest.php @@ -189,7 +189,7 @@ public function testFlooding(): void } /** - * @dataProvider tokenTimeUsecases + * @dataProvider provideTokenTimeCalculationUCs */ public function testTokenTimeCalculationUCs(int $capacity, int $seconds, array $checkInputs): void { @@ -208,7 +208,7 @@ public function testTokenTimeCalculationUCs(int $capacity, int $seconds, array $ } } - public function tokenTimeUsecases(): iterable + public function provideTokenTimeCalculationUCs(): iterable { return [ '2 capacity / 200 seconds (100s refresh, 0.01 tokens/s) -> 5 checks, 1 cost each' => [ diff --git a/tests/system/Validation/CreditCardRulesTest.php b/tests/system/Validation/CreditCardRulesTest.php index 6ef13c5ecee5..397675270eda 100644 --- a/tests/system/Validation/CreditCardRulesTest.php +++ b/tests/system/Validation/CreditCardRulesTest.php @@ -49,7 +49,7 @@ protected function setUp(): void } /** - * @dataProvider creditCardProvider + * @dataProvider provideValidCCNumber */ public function testValidCCNumber(string $type, ?string $number, bool $expected): void { @@ -63,7 +63,7 @@ public function testValidCCNumber(string $type, ?string $number, bool $expected) * * @see https://www.paypalobjects.com/en_US/vhelp/paypalmanager_help/credit_card_numbers.htm */ - public function creditCardProvider(): iterable + public function provideValidCCNumber(): iterable { yield from [ 'null_test' => [ diff --git a/tests/system/Validation/FormatRulesTest.php b/tests/system/Validation/FormatRulesTest.php index c04ed0eb22e5..92f15f1ad316 100644 --- a/tests/system/Validation/FormatRulesTest.php +++ b/tests/system/Validation/FormatRulesTest.php @@ -229,7 +229,7 @@ public function urlProvider(): iterable } /** - * @dataProvider emailProviderSingle + * @dataProvider provideValidEmail */ public function testValidEmail(?string $email, bool $expected): void { @@ -245,7 +245,7 @@ public function testValidEmail(?string $email, bool $expected): void } /** - * @dataProvider emailsProvider + * @dataProvider provideValidEmails */ public function testValidEmails(?string $email, bool $expected): void { @@ -260,7 +260,7 @@ public function testValidEmails(?string $email, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function emailProviderSingle(): iterable + public function provideValidEmail(): iterable { yield from [ [ @@ -278,7 +278,7 @@ public function emailProviderSingle(): iterable ]; } - public function emailsProvider(): iterable + public function provideValidEmails(): iterable { yield from [ [ @@ -309,7 +309,7 @@ public function emailsProvider(): iterable } /** - * @dataProvider ipProvider + * @dataProvider provideValidIP */ public function testValidIP(?string $ip, ?string $which, bool $expected): void { @@ -324,7 +324,7 @@ public function testValidIP(?string $ip, ?string $which, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function ipProvider(): iterable + public function provideValidIP(): iterable { yield from [ [ @@ -376,7 +376,7 @@ public function ipProvider(): iterable } /** - * @dataProvider stringProvider + * @dataProvider provideString * * @param int|string $str */ @@ -393,7 +393,7 @@ public function testString($str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function stringProvider(): iterable + public function provideString(): iterable { yield from [ [ @@ -412,7 +412,7 @@ public function stringProvider(): iterable } /** - * @dataProvider alphaProvider + * @dataProvider provideAlpha */ public function testAlpha(?string $str, bool $expected): void { @@ -427,7 +427,7 @@ public function testAlpha(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function alphaProvider(): iterable + public function provideAlpha(): iterable { yield from [ [ @@ -454,7 +454,7 @@ public function alphaProvider(): iterable } /** - * @dataProvider alphaSpaceProvider + * @dataProvider provideAlphaSpace */ public function testAlphaSpace(?string $value, bool $expected): void { @@ -469,7 +469,7 @@ public function testAlphaSpace(?string $value, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function alphaSpaceProvider(): iterable + public function provideAlphaSpace(): iterable { yield from [ [ @@ -538,7 +538,7 @@ public function alphaNumericProvider(): iterable } /** - * @dataProvider alphaNumericPunctProvider + * @dataProvider provideAlphaNumericPunct */ public function testAlphaNumericPunct(?string $str, bool $expected): void { @@ -553,7 +553,7 @@ public function testAlphaNumericPunct(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function alphaNumericPunctProvider(): iterable + public function provideAlphaNumericPunct(): iterable { yield from [ [ @@ -670,7 +670,7 @@ public function alphaNumericSpaceProvider(): Generator } /** - * @dataProvider alphaDashProvider + * @dataProvider provideAlphaDash */ public function testAlphaDash(?string $str, bool $expected): void { @@ -685,7 +685,7 @@ public function testAlphaDash(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function alphaDashProvider(): iterable + public function provideAlphaDash(): iterable { yield from [ [ @@ -708,7 +708,7 @@ public function alphaDashProvider(): iterable } /** - * @dataProvider hexProvider + * @dataProvider provideHex */ public function testHex(?string $str, bool $expected): void { @@ -723,7 +723,7 @@ public function testHex(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function hexProvider(): iterable + public function provideHex(): iterable { yield from [ [ @@ -746,7 +746,7 @@ public function hexProvider(): iterable } /** - * @dataProvider numericProvider + * @dataProvider provideNumeric */ public function testNumeric(?string $str, bool $expected): void { @@ -761,7 +761,7 @@ public function testNumeric(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function numericProvider(): iterable + public function provideNumeric(): iterable { yield from [ [ @@ -868,7 +868,7 @@ public function integerInvalidTypeDataProvider(): iterable } /** - * @dataProvider integerProvider + * @dataProvider provideInteger */ public function testInteger(?string $str, bool $expected): void { @@ -883,7 +883,7 @@ public function testInteger(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function integerProvider(): iterable + public function provideInteger(): iterable { yield from [ [ @@ -922,7 +922,7 @@ public function integerProvider(): iterable } /** - * @dataProvider decimalProvider + * @dataProvider provideDecimal */ public function testDecimal(?string $str, bool $expected): void { @@ -937,7 +937,7 @@ public function testDecimal(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function decimalProvider(): iterable + public function provideDecimal(): iterable { yield from [ [ @@ -980,7 +980,7 @@ public function decimalProvider(): iterable } /** - * @dataProvider naturalProvider + * @dataProvider provideNatural */ public function testNatural(?string $str, bool $expected): void { @@ -995,7 +995,7 @@ public function testNatural(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function naturalProvider(): iterable + public function provideNatural(): iterable { yield from [ [ @@ -1022,7 +1022,7 @@ public function naturalProvider(): iterable } /** - * @dataProvider naturalZeroProvider + * @dataProvider provideNaturalNoZero */ public function testNaturalNoZero(?string $str, bool $expected): void { @@ -1037,7 +1037,7 @@ public function testNaturalNoZero(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function naturalZeroProvider(): iterable + public function provideNaturalNoZero(): iterable { yield from [ [ @@ -1064,7 +1064,7 @@ public function naturalZeroProvider(): iterable } /** - * @dataProvider base64Provider + * @dataProvider provideBase64 */ public function testBase64(?string $str, bool $expected): void { @@ -1079,7 +1079,7 @@ public function testBase64(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function base64Provider(): iterable + public function provideBase64(): iterable { yield from [ [ @@ -1098,7 +1098,7 @@ public function base64Provider(): iterable } /** - * @dataProvider jsonProvider + * @dataProvider provideJson */ public function testJson(?string $str, bool $expected): void { @@ -1113,7 +1113,7 @@ public function testJson(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function jsonProvider(): iterable + public function provideJson(): iterable { yield from [ [ @@ -1156,7 +1156,7 @@ public function jsonProvider(): iterable } /** - * @dataProvider timezoneProvider + * @dataProvider provideTimeZone */ public function testTimeZone(?string $str, bool $expected): void { @@ -1171,7 +1171,7 @@ public function testTimeZone(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function timezoneProvider(): iterable + public function provideTimeZone(): iterable { yield from [ [ @@ -1194,7 +1194,7 @@ public function timezoneProvider(): iterable } /** - * @dataProvider validDateProvider + * @dataProvider provideValidDate */ public function testValidDate(?string $str, ?string $format, bool $expected): void { @@ -1209,7 +1209,7 @@ public function testValidDate(?string $str, ?string $format, bool $expected): vo $this->assertSame($expected, $this->validation->run($data)); } - public function validDateProvider(): iterable + public function provideValidDate(): iterable { yield from [ [ diff --git a/tests/system/Validation/RulesTest.php b/tests/system/Validation/RulesTest.php index fe10358e20ce..81e9c468dfd8 100644 --- a/tests/system/Validation/RulesTest.php +++ b/tests/system/Validation/RulesTest.php @@ -52,7 +52,7 @@ protected function setUp(): void } /** - * @dataProvider provideRequiredCases + * @dataProvider provideRequired */ public function testRequired(array $data, bool $expected): void { @@ -60,7 +60,7 @@ public function testRequired(array $data, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function provideRequiredCases(): iterable + public function provideRequired(): iterable { yield from [ [['foo' => null], false], @@ -73,7 +73,7 @@ public function provideRequiredCases(): iterable } /** - * @dataProvider ifExistProvider + * @dataProvider provideIfExist */ public function testIfExist(array $rules, array $data, bool $expected): void { @@ -81,7 +81,7 @@ public function testIfExist(array $rules, array $data, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function ifExistProvider(): iterable + public function provideIfExist(): iterable { yield from [ [ @@ -126,7 +126,7 @@ public function ifExistProvider(): iterable } /** - * @dataProvider providePermitEmptyCases + * @dataProvider providePermitEmpty */ public function testPermitEmpty(array $rules, array $data, bool $expected): void { @@ -134,7 +134,7 @@ public function testPermitEmpty(array $rules, array $data, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function providePermitEmptyCases(): iterable + public function providePermitEmpty(): iterable { yield from [ // If the rule is only `permit_empty`, any value will pass. @@ -343,7 +343,7 @@ public function testDiffersNested(array $data, bool $expected): void } /** - * @dataProvider provideEqualsCases + * @dataProvider provideEquals */ public function testEquals(array $data, string $param, bool $expected): void { @@ -351,7 +351,7 @@ public function testEquals(array $data, string $param, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function provideEqualsCases(): iterable + public function provideEquals(): iterable { yield from [ 'null' => [['foo' => null], '', false], @@ -397,7 +397,7 @@ public function testMaxLengthReturnsFalseWithNonNumericVal(): void } /** - * @dataProvider provideExactLengthCases + * @dataProvider provideExactLength */ public function testExactLength(?string $data, bool $expected): void { @@ -405,7 +405,7 @@ public function testExactLength(?string $data, bool $expected): void $this->assertSame($expected, $this->validation->run(['foo' => $data])); } - public function provideExactLengthCases(): iterable + public function provideExactLength(): iterable { yield from [ 'null' => [null, false], @@ -423,7 +423,7 @@ public function testExactLengthDetectsBadLength(): void } /** - * @dataProvider greaterThanProvider + * @dataProvider provideGreaterThan */ public function testGreaterThan(?string $first, ?string $second, bool $expected): void { @@ -432,7 +432,7 @@ public function testGreaterThan(?string $first, ?string $second, bool $expected) $this->assertSame($expected, $this->validation->run($data)); } - public function greaterThanProvider(): iterable + public function provideGreaterThan(): iterable { yield from [ ['-10', '-11', true], @@ -448,7 +448,7 @@ public function greaterThanProvider(): iterable } /** - * @dataProvider greaterThanEqualProvider + * @dataProvider provideGreaterThanEqual */ public function testGreaterThanEqual(?string $first, ?string $second, bool $expected): void { @@ -457,7 +457,7 @@ public function testGreaterThanEqual(?string $first, ?string $second, bool $expe $this->assertSame($expected, $this->validation->run($data)); } - public function greaterThanEqualProvider(): iterable + public function provideGreaterThanEqual(): iterable { yield from [ ['0', '0', true], @@ -474,7 +474,7 @@ public function greaterThanEqualProvider(): iterable } /** - * @dataProvider lessThanProvider + * @dataProvider provideLessThan */ public function testLessThan(?string $first, ?string $second, bool $expected): void { @@ -483,7 +483,7 @@ public function testLessThan(?string $first, ?string $second, bool $expected): v $this->assertSame($expected, $this->validation->run($data)); } - public function lessThanProvider(): iterable + public function provideLessThan(): iterable { yield from [ ['-10', '-11', false], @@ -500,7 +500,7 @@ public function lessThanProvider(): iterable } /** - * @dataProvider lessThanEqualProvider + * @dataProvider provideLessThanEqual */ public function testLessThanEqual(?string $first, ?string $second, bool $expected): void { @@ -509,7 +509,7 @@ public function testLessThanEqual(?string $first, ?string $second, bool $expecte $this->assertSame($expected, $this->validation->run($data)); } - public function lessThanEqualProvider(): iterable + public function provideLessThanEqual(): iterable { yield from [ ['0', '0', true], @@ -561,7 +561,7 @@ public function inListProvider(): iterable } /** - * @dataProvider requiredWithProvider + * @dataProvider provideRequiredWith */ public function testRequiredWith(?string $field, ?string $check, bool $expected): void { @@ -581,7 +581,7 @@ public function testRequiredWith(?string $field, ?string $check, bool $expected) $this->assertSame($expected, $this->validation->run($data)); } - public function requiredWithProvider(): iterable + public function provideRequiredWith(): iterable { yield from [ ['nope', 'bar', false], @@ -616,7 +616,7 @@ public function requiredWithProvider(): iterable /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/7557 * - * @dataProvider RequiredWithAndOtherRulesProvider + * @dataProvider provideRequiredWithAndOtherRules */ public function testRequiredWithAndOtherRules(bool $expected, array $data): void { @@ -629,7 +629,7 @@ public function testRequiredWithAndOtherRules(bool $expected, array $data): void $this->assertSame($expected, $result); } - public function RequiredWithAndOtherRulesProvider(): iterable + public function provideRequiredWithAndOtherRules(): iterable { yield from [ // `otherField` and `mustBeADate` do not exist @@ -652,7 +652,7 @@ public function RequiredWithAndOtherRulesProvider(): iterable } /** - * @dataProvider RequiredWithAndOtherRuleWithValueZeroProvider + * @dataProvider provideRequiredWithAndOtherRuleWithValueZero */ public function testRequiredWithAndOtherRuleWithValueZero(bool $expected, array $data): void { @@ -666,7 +666,7 @@ public function testRequiredWithAndOtherRuleWithValueZero(bool $expected, array $this->assertSame($expected, $result); } - public function RequiredWithAndOtherRuleWithValueZeroProvider(): iterable + public function provideRequiredWithAndOtherRuleWithValueZero(): iterable { yield from [ [true, ['married' => '0', 'partner_name' => '']], @@ -676,7 +676,7 @@ public function RequiredWithAndOtherRuleWithValueZeroProvider(): iterable } /** - * @dataProvider requiredWithoutProvider + * @dataProvider provideRequiredWithout */ public function testRequiredWithout(?string $field, ?string $check, bool $expected): void { @@ -696,7 +696,7 @@ public function testRequiredWithout(?string $field, ?string $check, bool $expect $this->assertSame($expected, $this->validation->run($data)); } - public function requiredWithoutProvider(): iterable + public function provideRequiredWithout(): iterable { yield from [ ['nope', 'bars', false], @@ -728,7 +728,7 @@ public function requiredWithoutProvider(): iterable } /** - * @dataProvider requiredWithoutMultipleProvider + * @dataProvider provideRequiredWithoutMultiple */ public function testRequiredWithoutMultiple(string $foo, string $bar, string $baz, bool $result): void { @@ -742,7 +742,7 @@ public function testRequiredWithoutMultiple(string $foo, string $bar, string $ba $this->assertSame($result, $this->validation->run($data)); } - public function requiredWithoutMultipleProvider(): iterable + public function provideRequiredWithoutMultiple(): iterable { yield from [ 'all empty' => [ @@ -779,7 +779,7 @@ public function requiredWithoutMultipleProvider(): iterable } /** - * @dataProvider requiredWithoutMultipleWithoutFieldsProvider + * @dataProvider provideRequiredWithoutMultipleWithoutFields */ public function testRequiredWithoutMultipleWithoutFields(array $data, bool $result): void { @@ -788,7 +788,7 @@ public function testRequiredWithoutMultipleWithoutFields(array $data, bool $resu $this->assertSame($result, $this->validation->run($data)); } - public function requiredWithoutMultipleWithoutFieldsProvider(): iterable + public function provideRequiredWithoutMultipleWithoutFields(): iterable { yield from [ 'baz is missing' => [ diff --git a/tests/system/Validation/StrictRules/CreditCardRulesTest.php b/tests/system/Validation/StrictRules/CreditCardRulesTest.php index f6441c70b7fd..2e685c852e55 100644 --- a/tests/system/Validation/StrictRules/CreditCardRulesTest.php +++ b/tests/system/Validation/StrictRules/CreditCardRulesTest.php @@ -50,7 +50,7 @@ protected function setUp(): void } /** - * @dataProvider creditCardProvider + * @dataProvider provideValidCCNumber */ public function testValidCCNumber(string $type, ?string $number, bool $expected): void { @@ -64,7 +64,7 @@ public function testValidCCNumber(string $type, ?string $number, bool $expected) * * @see https://www.paypalobjects.com/en_US/vhelp/paypalmanager_help/credit_card_numbers.htm */ - public function creditCardProvider(): iterable + public function provideValidCCNumber(): iterable { yield from [ 'null_test' => [ diff --git a/tests/system/Validation/StrictRules/RulesTest.php b/tests/system/Validation/StrictRules/RulesTest.php index 2bbddad70561..d366f6c3e7e5 100644 --- a/tests/system/Validation/StrictRules/RulesTest.php +++ b/tests/system/Validation/StrictRules/RulesTest.php @@ -42,7 +42,7 @@ final class RulesTest extends TraditionalRulesTest ]; /** - * @dataProvider providePermitEmptyCasesStrict + * @dataProvider providePermitEmptyStrict */ public function testPermitEmptyStrict(array $rules, array $data, bool $expected): void { @@ -50,7 +50,7 @@ public function testPermitEmptyStrict(array $rules, array $data, bool $expected) $this->assertSame($expected, $this->validation->run($data)); } - public function providePermitEmptyCasesStrict(): iterable + public function providePermitEmptyStrict(): iterable { yield from [ [ @@ -174,7 +174,7 @@ public function provideLessThanStrict(): iterable } /** - * @dataProvider provideLessThanEqualStrict + * @dataProvider provideLessEqualThanStrict * * @param int $value */ @@ -186,7 +186,7 @@ public function testLessEqualThanStrict($value, ?string $param, bool $expected): $this->assertSame($expected, $this->validation->run($data)); } - public function provideLessThanEqualStrict(): iterable + public function provideLessEqualThanStrict(): iterable { yield from [ [0, '0', true], diff --git a/tests/system/Validation/ValidationTest.php b/tests/system/Validation/ValidationTest.php index ab09c9d8238a..3f9b25503e86 100644 --- a/tests/system/Validation/ValidationTest.php +++ b/tests/system/Validation/ValidationTest.php @@ -186,7 +186,7 @@ public function testSetRuleOverwritesRuleReverse(): void } /** - * @dataProvider setRuleRulesFormatCaseProvider + * @dataProvider provideSetRuleRulesFormat * * @param mixed $rules */ @@ -201,7 +201,7 @@ public function testSetRuleRulesFormat(bool $expected, $rules): void $this->addToAssertionCount(1); } - public function setRuleRulesFormatCaseProvider(): iterable + public function provideSetRuleRulesFormat(): iterable { yield 'fail-simple-object' => [ false, @@ -325,7 +325,7 @@ public function testClosureRuleWithLabel(): void /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/5368 * - * @dataProvider arrayDataProvider + * @dataProvider provideCanValidatetArrayData * * @param mixed $value */ @@ -338,7 +338,7 @@ public function testCanValidatetArrayData($value, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function arrayDataProvider(): iterable + public function provideCanValidatetArrayData(): iterable { yield 'list array' => [ [1, 2, 3, 4, 5], @@ -378,7 +378,7 @@ public function arrayDataProvider(): iterable /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/5374 * - * @dataProvider isIntInvalidTypeDataProvider + * @dataProvider provideIsIntWithInvalidTypeData * * @param mixed $value */ @@ -390,7 +390,7 @@ public function testIsIntWithInvalidTypeData($value, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function isIntInvalidTypeDataProvider(): iterable + public function provideIsIntWithInvalidTypeData(): iterable { yield 'array with int' => [ [555], @@ -608,7 +608,7 @@ public function testRunWithCustomErrorsAndAsteriskField(): void } /** - * @dataProvider rulesSetupProvider + * @dataProvider provideRulesSetup * * @param string|string[] $rules * @param string $expected @@ -622,7 +622,7 @@ public function testRulesSetup($rules, $expected, array $errors = []): void $this->assertSame($expected, $this->validation->getError('foo')); } - public function rulesSetupProvider(): iterable + public function provideRulesSetup(): iterable { yield from [ [ @@ -956,7 +956,7 @@ public function testRulesForObjectField(): void } /** - * @dataProvider arrayFieldDataProvider + * @dataProvider provideRulesForArrayField */ public function testRulesForArrayField(array $body, array $rules, array $results): void { @@ -970,7 +970,7 @@ public function testRulesForArrayField(array $body, array $rules, array $results $this->assertSame($results, $this->validation->getErrors()); } - public function arrayFieldDataProvider(): iterable + public function provideRulesForArrayField(): iterable { yield from [ 'all_rules_should_pass' => [ @@ -1195,7 +1195,7 @@ public function testTranslatedLabelTagReplacement(): void } /** - * @dataProvider dotNotationForIfExistProvider + * @dataProvider provideDotNotationOnIfExistRule * * @see https://github.com/codeigniter4/CodeIgniter4/issues/4521 */ @@ -1205,7 +1205,7 @@ public function testDotNotationOnIfExistRule(bool $expected, array $rules, array $this->assertSame($expected, $actual); } - public function dotNotationForIfExistProvider(): iterable + public function provideDotNotationOnIfExistRule(): iterable { yield 'dot-on-end-fail' => [ false, @@ -1265,7 +1265,7 @@ public function dotNotationForIfExistProvider(): iterable } /** - * @dataProvider validationArrayDataCaseProvider + * @dataProvider provideValidationOfArrayData * * @see https://github.com/codeigniter4/CodeIgniter4/issues/4510 */ @@ -1275,7 +1275,7 @@ public function testValidationOfArrayData(bool $expected, array $rules, array $d $this->assertSame($expected, $actual); } - public function validationArrayDataCaseProvider(): iterable + public function provideValidationOfArrayData(): iterable { yield 'fail-empty-string' => [ false, @@ -1321,7 +1321,7 @@ public function validationArrayDataCaseProvider(): iterable } /** - * @dataProvider provideStringRulesCases + * @dataProvider provideSplittingOfComplexStringRules * * @see https://github.com/codeigniter4/CodeIgniter4/issues/4929 */ @@ -1331,7 +1331,7 @@ public function testSplittingOfComplexStringRules(string $input, array $expected $this->assertSame($expected, $splitter($input)); } - public function provideStringRulesCases(): iterable + public function provideSplittingOfComplexStringRules(): iterable { yield [ 'required', diff --git a/tests/system/View/ParserTest.php b/tests/system/View/ParserTest.php index 5ad221cdca31..105ed5f86e50 100644 --- a/tests/system/View/ParserTest.php +++ b/tests/system/View/ParserTest.php @@ -418,7 +418,7 @@ public function testMismatchedVarPair(): void $this->assertSame($result, $this->parser->renderString($template)); } - public function escValueTypes(): iterable + public function provideEscHandling(): iterable { return [ 'scalar' => [42], @@ -473,7 +473,7 @@ public function escValueTypes(): iterable } /** - * @dataProvider escValueTypes + * @dataProvider provideEscHandling * * @param mixed $value * @param mixed|null $expected From 0e7e31ac7edc0a236cd22c742824e3848c6f7305 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Thu, 3 Aug 2023 12:06:41 +0800 Subject: [PATCH 3/3] Manually fix other data provider names --- tests/system/CommonSingleServiceTest.php | 6 +++--- tests/system/Helpers/ArrayHelperTest.php | 10 +++++----- tests/system/Helpers/URLHelper/CurrentUrlTest.php | 8 ++++---- tests/system/Test/TestResponseTest.php | 6 +++--- tests/system/Validation/FormatRulesTest.php | 12 ++++++------ tests/system/Validation/RulesTest.php | 6 +++--- .../Validation/StrictRules/FormatRulesTest.php | 5 ++--- 7 files changed, 26 insertions(+), 27 deletions(-) diff --git a/tests/system/CommonSingleServiceTest.php b/tests/system/CommonSingleServiceTest.php index 58854f27df68..9a6c094dec35 100644 --- a/tests/system/CommonSingleServiceTest.php +++ b/tests/system/CommonSingleServiceTest.php @@ -27,7 +27,7 @@ final class CommonSingleServiceTest extends CIUnitTestCase { /** - * @dataProvider serviceNamesProvider + * @dataProvider provideServiceNames */ public function testSingleServiceWithNoParamsSupplied(string $service): void { @@ -43,7 +43,7 @@ public function testSingleServiceWithNoParamsSupplied(string $service): void } /** - * @dataProvider serviceNamesProvider + * @dataProvider provideServiceNames */ public function testSingleServiceWithAtLeastOneParamSupplied(string $service): void { @@ -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 = [ diff --git a/tests/system/Helpers/ArrayHelperTest.php b/tests/system/Helpers/ArrayHelperTest.php index f2708926b0e7..fc2985efef24 100644 --- a/tests/system/Helpers/ArrayHelperTest.php +++ b/tests/system/Helpers/ArrayHelperTest.php @@ -248,7 +248,7 @@ public function testArrayDeepSearchReturnNullEmptyArray(): void } /** - * @dataProvider sortByMultipleKeysProvider + * @dataProvider provideSortByMultipleKeys */ public function testArraySortByMultipleKeysWithArray(array $data, array $sortColumns, array $expected): void { @@ -259,7 +259,7 @@ public function testArraySortByMultipleKeysWithArray(array $data, array $sortCol } /** - * @dataProvider sortByMultipleKeysProvider + * @dataProvider provideSortByMultipleKeys */ public function testArraySortByMultipleKeysWithObjects(array $data, array $sortColumns, array $expected): void { @@ -275,7 +275,7 @@ public function testArraySortByMultipleKeysWithObjects(array $data, array $sortC } /** - * @dataProvider sortByMultipleKeysProvider + * @dataProvider provideSortByMultipleKeys */ public function testArraySortByMultipleKeysFailsEmptyParameter(array $data, array $sortColumns, array $expected): void { @@ -297,7 +297,7 @@ public function testArraySortByMultipleKeysFailsEmptyParameter(array $data, arra } /** - * @dataProvider sortByMultipleKeysProvider + * @dataProvider provideSortByMultipleKeys * * @param mixed $data */ @@ -346,7 +346,7 @@ public static function provideArrayDeepSearch(): iterable ]; } - public static function sortByMultipleKeysProvider(): iterable + public static function provideSortByMultipleKeys(): iterable { $seed = [ 0 => [ diff --git a/tests/system/Helpers/URLHelper/CurrentUrlTest.php b/tests/system/Helpers/URLHelper/CurrentUrlTest.php index ec639e104594..419f11413be1 100644 --- a/tests/system/Helpers/URLHelper/CurrentUrlTest.php +++ b/tests/system/Helpers/URLHelper/CurrentUrlTest.php @@ -235,7 +235,7 @@ public function testUriStringSubfolderRelative(): void $this->assertSame('assets/image.jpg', uri_string()); } - public function urlIsProvider(): iterable + public function provideUrlIs(): iterable { return [ [ @@ -277,7 +277,7 @@ public function urlIsProvider(): iterable } /** - * @dataProvider urlIsProvider + * @dataProvider provideUrlIs */ public function testUrlIs(string $currentPath, string $testPath, bool $expected): void { @@ -291,7 +291,7 @@ public function testUrlIs(string $currentPath, string $testPath, bool $expected) } /** - * @dataProvider urlIsProvider + * @dataProvider provideUrlIs */ public function testUrlIsNoIndex(string $currentPath, string $testPath, bool $expected): void { @@ -307,7 +307,7 @@ public function testUrlIsNoIndex(string $currentPath, string $testPath, bool $ex } /** - * @dataProvider urlIsProvider + * @dataProvider provideUrlIs */ public function testUrlIsWithSubfolder(string $currentPath, string $testPath, bool $expected): void { diff --git a/tests/system/Test/TestResponseTest.php b/tests/system/Test/TestResponseTest.php index 48baf0cf4a66..34e218334576 100644 --- a/tests/system/Test/TestResponseTest.php +++ b/tests/system/Test/TestResponseTest.php @@ -33,7 +33,7 @@ protected function setUp(): void } /** - * @dataProvider statusCodeProvider + * @dataProvider provideHttpStatusCodes */ public function testIsOK(int $code, bool $isOk): void { @@ -46,7 +46,7 @@ public function testIsOK(int $code, bool $isOk): void /** * Provides status codes and their expected "OK" */ - public function statusCodeProvider(): iterable + public function provideHttpStatusCodes(): iterable { return [ [ @@ -223,7 +223,7 @@ public function testAssertStatus(): void } /** - * @dataProvider statusCodeProvider + * @dataProvider provideHttpStatusCodes */ public function testAssertIsOK(int $code, bool $isOk): void { diff --git a/tests/system/Validation/FormatRulesTest.php b/tests/system/Validation/FormatRulesTest.php index 92f15f1ad316..fe76bf9aec01 100644 --- a/tests/system/Validation/FormatRulesTest.php +++ b/tests/system/Validation/FormatRulesTest.php @@ -85,7 +85,7 @@ public function testRegexMatchFalse(): void } /** - * @dataProvider urlProvider + * @dataProvider provideValidUrl */ public function testValidURL(?string $url, bool $isLoose, bool $isStrict): void { @@ -101,7 +101,7 @@ public function testValidURL(?string $url, bool $isLoose, bool $isStrict): void } /** - * @dataProvider urlProvider + * @dataProvider provideValidUrl */ public function testValidURLStrict(?string $url, bool $isLoose, bool $isStrict): void { @@ -129,7 +129,7 @@ public function testValidURLStrictWithSchema(): void $this->assertFalse($this->validation->run($data)); } - public function urlProvider(): iterable + public function provideValidUrl(): iterable { yield from [ [ @@ -802,7 +802,7 @@ public function provideNumeric(): iterable /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/5374 * - * @dataProvider integerInvalidTypeDataProvider + * @dataProvider provideInvalidIntegerType * * @param mixed $value */ @@ -821,7 +821,7 @@ public function testIntegerWithInvalidTypeData($value, bool $expected): void /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/5374 * - * @dataProvider integerInvalidTypeDataProvider + * @dataProvider provideInvalidIntegerType * * @param mixed $value */ @@ -837,7 +837,7 @@ public function testNumericWithInvalidTypeData($value, bool $expected): void $this->assertsame($expected, $this->validation->run($data)); } - public function integerInvalidTypeDataProvider(): iterable + public function provideInvalidIntegerType(): iterable { // TypeError : CodeIgniter\Validation\FormatRules::integer(): Argument #1 ($str) must be of type ?string, array given // yield 'array with int' => [ diff --git a/tests/system/Validation/RulesTest.php b/tests/system/Validation/RulesTest.php index 81e9c468dfd8..638420b56027 100644 --- a/tests/system/Validation/RulesTest.php +++ b/tests/system/Validation/RulesTest.php @@ -526,7 +526,7 @@ public function provideLessThanEqual(): iterable } /** - * @dataProvider inListProvider + * @dataProvider provideInList */ public function testInList(?string $first, ?string $second, bool $expected): void { @@ -536,7 +536,7 @@ public function testInList(?string $first, ?string $second, bool $expected): voi } /** - * @dataProvider inListProvider + * @dataProvider provideInList */ public function testNotInList(?string $first, ?string $second, bool $expected): void { @@ -545,7 +545,7 @@ public function testNotInList(?string $first, ?string $second, bool $expected): $this->assertSame(! $expected, $this->validation->run($data)); } - public function inListProvider(): iterable + public function provideInList(): iterable { yield from [ ['red', 'red,Blue,123', true], diff --git a/tests/system/Validation/StrictRules/FormatRulesTest.php b/tests/system/Validation/StrictRules/FormatRulesTest.php index f5dd2e71609a..aeb2eba3ee33 100644 --- a/tests/system/Validation/StrictRules/FormatRulesTest.php +++ b/tests/system/Validation/StrictRules/FormatRulesTest.php @@ -12,7 +12,6 @@ namespace CodeIgniter\Validation\StrictRules; use CodeIgniter\Validation\FormatRulesTest as TraditionalFormatRulesTest; -use Generator; use Tests\Support\Validation\TestRules; /** @@ -40,7 +39,7 @@ final class FormatRulesTest extends TraditionalFormatRulesTest ], ]; - public function alphaSpaceProvider(): Generator + public function provideAlphaSpace(): iterable { yield from [ [ @@ -70,7 +69,7 @@ public function alphaSpaceProvider(): Generator ]; } - public function integerInvalidTypeDataProvider(): Generator + public function provideInvalidIntegerType(): iterable { yield 'array with int' => [ [555],