Skip to content

Commit

Permalink
Enable php_unit_data_provider_static
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbalandan committed Aug 3, 2023
1 parent 6ec3a09 commit 20f2700
Show file tree
Hide file tree
Showing 51 changed files with 130 additions and 127 deletions.
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
'prefix' => 'provide',
'suffix' => '',
],
'php_unit_data_provider_static' => true,
'php_unit_data_provider_return_type' => true,
'no_extra_blank_lines' => [
'tokens' => [
Expand Down
1 change: 1 addition & 0 deletions .php-cs-fixer.no-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
'prefix' => 'provide',
'suffix' => '',
],
'php_unit_data_provider_static' => true,
'php_unit_data_provider_return_type' => true,
'no_extra_blank_lines' => [
'tokens' => [
Expand Down
3 changes: 2 additions & 1 deletion .php-cs-fixer.user-guide.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
'use',
],
],
'php_unit_data_provider_name' => [
'php_unit_data_provider_static' => true,
'php_unit_data_provider_name' => [
'prefix' => 'provide',
'suffix' => '',
],
Expand Down
2 changes: 1 addition & 1 deletion tests/system/CLI/CLITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ public function testTable($tbody, $thead, $expected): void
$this->assertSame($this->getStreamFilterBuffer(), $expected);
}

public function provideTable(): iterable
public static function provideTable(): iterable
{
$head = [
'ID',
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Cache/Handlers/BaseHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function testValidateKeyInvalidType($input): void
BaseHandler::validateKey($input);
}

public function provideValidateKeyInvalidType(): iterable
public static function provideValidateKeyInvalidType(): iterable
{
return [
[true],
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Cache/Handlers/FileHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public function testSaveMode(int $int, string $string): void
$this->assertSame($string, $mode);
}

public function provideSaveMode(): iterable
public static function provideSaveMode(): iterable
{
return [
[
Expand Down
2 changes: 1 addition & 1 deletion tests/system/CodeIgniterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ public function testPageCacheWithCacheQueryString($cacheQueryStringValue, int $e
CITestStreamFilter::removeErrorFilter();
}

public function providePageCacheWithCacheQueryString(): iterable
public static function providePageCacheWithCacheQueryString(): iterable
{
$testingUrls = [
'test', // URL #1
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Commands/CommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function testCommandParsesArgsCorrectly(string $input, array $expected):
$this->assertSame($expected, ParamsReveal::$args);
}

public function provideCommandParsesArgsCorrectly(): iterable
public static function provideCommandParsesArgsCorrectly(): iterable
{
return [
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function testGet(string $routeKey, string $expected): void
$this->assertSame($expected, $uri);
}

public function provideGet(): iterable
public static function provideGet(): iterable
{
yield from [
'root' => ['/', '/'],
Expand Down
2 changes: 1 addition & 1 deletion tests/system/CommonFunctionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ public function testCleanPathActuallyCleaningThePaths($input, $expected): void
$this->assertSame($expected, clean_path($input));
}

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

Expand Down
2 changes: 1 addition & 1 deletion tests/system/Config/DotEnvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function testLoadsVars(string $expected, string $varname): void
$this->assertSame($expected, getenv($varname));
}

public function provideLoadsVars(): iterable
public static function provideLoadsVars(): iterable
{
yield from [
['bar', 'FOO'],
Expand Down
4 changes: 2 additions & 2 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 provideGuessExtensionFromType(): iterable
public static function provideGuessExtensionFromType(): iterable
{
return [
'null' => [
Expand Down Expand Up @@ -55,7 +55,7 @@ public function testGuessExtensionFromType(?string $expected, string $mime): voi
$this->assertSame($expected, Mimes::guessExtensionFromType($mime));
}

public function provideGuessTypeFromExtension(): iterable
public static function provideGuessTypeFromExtension(): iterable
{
return [
'null' => [
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Cookie/CookieTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function testConfigPrefix(string $configPrefix, string $optionPrefix, str
$this->assertSame($expected, $cookie->getPrefixedName());
}

public function provideConfigPrefix(): iterable
public static function provideConfigPrefix(): iterable
{
yield from [
['prefix_', '', 'prefix_test'],
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Database/BaseConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public function testProtectIdentifiers(
$this->assertSame($expected, $return);
}

public function provideProtectIdentifiers(): iterable
public static function provideProtectIdentifiers(): iterable
{
yield from [
// $prefixSingle, $protectIdentifiers, $fieldExists, $item, $expected
Expand Down
4 changes: 2 additions & 2 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 provideIsWriteType(): iterable
public static function provideIsWriteType(): iterable
{
return [
'select' => [
Expand Down Expand Up @@ -577,7 +577,7 @@ public function testSwapPrefixAfterGetQuery(): void
$this->assertSame($expected, $query->getQuery());
}

public function provideHighlightQueryKeywords(): iterable
public static function provideHighlightQueryKeywords(): iterable
{
return [
'highlightKeyWords' => [
Expand Down
4 changes: 2 additions & 2 deletions tests/system/Database/Builder/WhereTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ public function testWhereInSubQuery(): void
$this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect()));
}

public function provideWhereInvalidKeyThrowInvalidArgumentException(): iterable
public static function provideWhereInvalidKeyThrowInvalidArgumentException(): iterable
{
return [
'null' => [null],
Expand All @@ -413,7 +413,7 @@ public function testWhereInvalidKeyThrowInvalidArgumentException($key): void
$builder->whereIn($key, ['Politician', 'Accountant']);
}

public function provideWhereInEmptyValuesThrowInvalidArgumentException(): iterable
public static function provideWhereInEmptyValuesThrowInvalidArgumentException(): iterable
{
return [
'null' => [null],
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Database/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public function testConvertDSN(string $input, string $expected): void
$this->assertSame($expected, $this->getPrivateProperty($conn, 'DSN'));
}

public function provideConvertDSN(): iterable
public static function provideConvertDSN(): iterable
{
yield from [
[
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Email/EmailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testEmailValidation(): void
$this->assertStringContainsString('Invalid email address: "invalid"', $email->printDebugger());
}

public function provideEmailSendWithClearance(): iterable
public static function provideEmailSendWithClearance(): iterable
{
return [
'autoclear' => [true],
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Filters/FiltersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public function testProcessMethodProcessGlobals(): void
$this->assertSame($expected, $filters->initialize()->getFilters());
}

public function provideProcessMethodProcessGlobalsWithExcept(): iterable
public static function provideProcessMethodProcessGlobalsWithExcept(): iterable
{
return [
[
Expand Down
4 changes: 2 additions & 2 deletions tests/system/Filters/InvalidCharsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function testCheckControlStringWithLineBreakAndTabReturnsTheString(string
$this->invalidChars->before($this->request);
}

public function provideCheckControlStringWithLineBreakAndTabReturnsTheString(): iterable
public static function provideCheckControlStringWithLineBreakAndTabReturnsTheString(): iterable
{
yield from [
["String contains \n line break."],
Expand All @@ -148,7 +148,7 @@ public function testCheckControlStringWithControlCharsCausesException(string $in
$this->invalidChars->before($this->request);
}

public function provideCheckControlStringWithControlCharsCausesException(): iterable
public static function provideCheckControlStringWithControlCharsCausesException(): iterable
{
yield from [
["String contains null char.\0"],
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Format/XMLFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function testValidatingInvalidTags(string $expected, array $input): void
$this->assertSame($expectedXML, $this->xmlFormatter->format($input));
}

public function provideValidatingInvalidTags(): iterable
public static function provideValidatingInvalidTags(): iterable
{
return [
[
Expand Down
2 changes: 1 addition & 1 deletion tests/system/HTTP/CLIRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ public function testFetchGlobalWithEmptyNotation(): void
$this->assertSame($expected, $this->request->fetchGlobal('post', 'clients[]'));
}

public function provideValidIPAddress(): iterable
public static function provideValidIPAddress(): iterable
{
return [
'empty' => [
Expand Down
6 changes: 3 additions & 3 deletions tests/system/HTTP/IncomingRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ public function testCanGrabGetRawInput(): void
$this->assertSame($expected, $request->getRawInput());
}

public function provideCanGrabGetRawInputVar(): iterable
public static function provideCanGrabGetRawInputVar(): iterable
{
return [
[
Expand Down Expand Up @@ -626,7 +626,7 @@ public function testIsHTTPMethodLowerCase(string $value): void
$this->assertTrue($request->is(strtolower($value)));
}

public function provideIsHTTPMethods(): iterable
public static function provideIsHTTPMethods(): iterable
{
yield from [
['GET'],
Expand Down Expand Up @@ -839,7 +839,7 @@ public function testGetPostIndexNotExists(): void
$this->assertNull($this->request->getGetPost('gc'));
}

public function provideExtensionPHP(): iterable
public static function provideExtensionPHP(): iterable
{
return [
'not /index.php' => [
Expand Down
2 changes: 1 addition & 1 deletion tests/system/HTTP/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function testSetHeaderArrayValues(): void
$this->assertSame('json, html, xml', $this->message->getHeaderLine('Accept'));
}

public function provideArrayHeaderValue(): iterable
public static function provideArrayHeaderValue(): iterable
{
return [
'existing for next not append' => [
Expand Down
2 changes: 1 addition & 1 deletion tests/system/HTTP/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ public function testFetchGlobalFiltersWithArrayChildElement(): void
$this->assertSame($expected, $this->request->fetchGlobal('post', 'people[0]', FILTER_VALIDATE_INT));
}

public function provideValidIPAddress(): iterable
public static function provideValidIPAddress(): iterable
{
return [
'empty' => [
Expand Down
4 changes: 2 additions & 2 deletions tests/system/HTTP/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public function testRedirect(
$this->assertSame($expectedCode, $response->getStatusCode());
}

public function provideRedirect(): iterable
public static function provideRedirect(): iterable
{
yield from [
['Apache/2.4.17', 'HTTP/1.1', 'GET', null, 302],
Expand Down Expand Up @@ -337,7 +337,7 @@ public function testRedirectWithIIS(
unset($_SERVER['SERVER_SOFTWARE']);
}

public function provideRedirectWithIIS(): iterable
public static function provideRedirectWithIIS(): iterable
{
yield from [
['HTTP/1.1', 'GET', null, 302],
Expand Down
14 changes: 7 additions & 7 deletions tests/system/HTTP/URITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function testSimpleUri(string $url, string $expectedURL, string $expected
$this->assertSame($expectedPath, $uri->getPath());
}

public function provideSimpleUri(): iterable
public static function provideSimpleUri(): iterable
{
return [
'' => [
Expand Down Expand Up @@ -375,7 +375,7 @@ public function testSetPath(string $path, string $expectedURL, string $expectedP
$this->assertSame($expectedPath, $uri->getPath());
}

public function provideSetPath(): iterable
public static function provideSetPath(): iterable
{
return [
'' => [
Expand Down Expand Up @@ -431,7 +431,7 @@ public function provideSetPath(): iterable
];
}

public function providePathGetsFiltered(): iterable
public static function providePathGetsFiltered(): iterable
{
return [
'dot-segment' => [
Expand Down Expand Up @@ -555,7 +555,7 @@ public function testSetQueryThrowsErrorWhenFragmentPresentSilent(): void
$this->assertSame('', $uri->getQuery());
}

public function provideAuthorityReturnsExceptedValues(): iterable
public static function provideAuthorityReturnsExceptedValues(): iterable
{
return [
'host-only' => [
Expand Down Expand Up @@ -590,7 +590,7 @@ public function testAuthorityReturnsExceptedValues($url, $expected): void
$this->assertSame($expected, $uri->getAuthority());
}

public function provideAuthorityRemovesDefaultPorts(): iterable
public static function provideAuthorityRemovesDefaultPorts(): iterable
{
return [
'http' => [
Expand Down Expand Up @@ -629,7 +629,7 @@ public function testSetAuthorityReconstitutes(): void
$this->assertSame($authority, $uri->getAuthority());
}

public function provideRemoveDotSegments(): iterable
public static function provideRemoveDotSegments(): iterable
{
return [
[
Expand Down Expand Up @@ -738,7 +738,7 @@ public function testRemoveDotSegments($path, $expected): void
$this->assertSame($expected, URI::removeDotSegments($path));
}

public function defaultResolutions(): iterable
public static function defaultResolutions(): iterable
{
return [
[
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Helpers/ArrayHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ public function testArrayFlattening(array $input, array $expected): void
$this->assertSame($expected, array_flatten_with_dots($input));
}

public function provideArrayFlattening(): iterable
public static function provideArrayFlattening(): iterable
{
yield 'normal' => [
[
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Helpers/InflectorHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public function testDasherize(): void
}
}

public function provideOrdinal(): iterable
public static function provideOrdinal(): iterable
{
return [
['st', 1],
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Helpers/URLHelper/CurrentUrlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public function testUriStringSubfolderRelative(): void
$this->assertSame('assets/image.jpg', uri_string());
}

public function provideUrlIs(): iterable
public static function provideUrlIs(): iterable
{
return [
[
Expand Down
Loading

0 comments on commit 20f2700

Please sign in to comment.