Enable php_unit_data_provider_static

This commit is contained in:
John Paul E. Balandan, CPA 2023-08-03 18:13:11 +08:00
parent 6ec3a099de
commit 20f2700d1f
No known key found for this signature in database
GPG Key ID: FB7B51499BC27610
51 changed files with 130 additions and 127 deletions

View File

@ -48,6 +48,7 @@ $overrides = [
'prefix' => 'provide',
'suffix' => '',
],
'php_unit_data_provider_static' => true,
'php_unit_data_provider_return_type' => true,
'no_extra_blank_lines' => [
'tokens' => [

View File

@ -34,6 +34,7 @@ $overrides = [
'prefix' => 'provide',
'suffix' => '',
],
'php_unit_data_provider_static' => true,
'php_unit_data_provider_return_type' => true,
'no_extra_blank_lines' => [
'tokens' => [

View File

@ -53,7 +53,8 @@ $overrides = [
'use',
],
],
'php_unit_data_provider_name' => [
'php_unit_data_provider_static' => true,
'php_unit_data_provider_name' => [
'prefix' => 'provide',
'suffix' => '',
],

View File

@ -463,7 +463,7 @@ final class CLITest extends CIUnitTestCase
$this->assertSame($this->getStreamFilterBuffer(), $expected);
}
public function provideTable(): iterable
public static function provideTable(): iterable
{
$head = [
'ID',

View File

@ -35,7 +35,7 @@ final class BaseHandlerTest extends CIUnitTestCase
BaseHandler::validateKey($input);
}
public function provideValidateKeyInvalidType(): iterable
public static function provideValidateKeyInvalidType(): iterable
{
return [
[true],

View File

@ -296,7 +296,7 @@ final class FileHandlerTest extends AbstractHandlerTest
$this->assertSame($string, $mode);
}
public function provideSaveMode(): iterable
public static function provideSaveMode(): iterable
{
return [
[

View File

@ -789,7 +789,7 @@ final class CodeIgniterTest extends CIUnitTestCase
CITestStreamFilter::removeErrorFilter();
}
public function providePageCacheWithCacheQueryString(): iterable
public static function providePageCacheWithCacheQueryString(): iterable
{
$testingUrls = [
'test', // URL #1

View File

@ -138,7 +138,7 @@ final class CommandTest extends CIUnitTestCase
$this->assertSame($expected, ParamsReveal::$args);
}
public function provideCommandParsesArgsCorrectly(): iterable
public static function provideCommandParsesArgsCorrectly(): iterable
{
return [
[

View File

@ -33,7 +33,7 @@ final class SampleURIGeneratorTest extends CIUnitTestCase
$this->assertSame($expected, $uri);
}
public function provideGet(): iterable
public static function provideGet(): iterable
{
yield from [
'root' => ['/', '/'],

View File

@ -604,7 +604,7 @@ final class CommonFunctionsTest extends CIUnitTestCase
$this->assertSame($expected, clean_path($input));
}
public function provideCleanPathActuallyCleaningThePaths(): iterable
public static function provideCleanPathActuallyCleaningThePaths(): iterable
{
$ds = DIRECTORY_SEPARATOR;

View File

@ -66,7 +66,7 @@ final class DotEnvTest extends CIUnitTestCase
$this->assertSame($expected, getenv($varname));
}
public function provideLoadsVars(): iterable
public static function provideLoadsVars(): iterable
{
yield from [
['bar', 'FOO'],

View File

@ -21,7 +21,7 @@ use Config\Mimes;
*/
final class MimesTest extends CIUnitTestCase
{
public function provideGuessExtensionFromType(): iterable
public static function provideGuessExtensionFromType(): iterable
{
return [
'null' => [
@ -55,7 +55,7 @@ final class MimesTest extends CIUnitTestCase
$this->assertSame($expected, Mimes::guessExtensionFromType($mime));
}
public function provideGuessTypeFromExtension(): iterable
public static function provideGuessTypeFromExtension(): iterable
{
return [
'null' => [

View File

@ -98,7 +98,7 @@ final class CookieTest extends CIUnitTestCase
$this->assertSame($expected, $cookie->getPrefixedName());
}
public function provideConfigPrefix(): iterable
public static function provideConfigPrefix(): iterable
{
yield from [
['prefix_', '', 'prefix_test'],

View File

@ -183,7 +183,7 @@ final class BaseConnectionTest extends CIUnitTestCase
$this->assertSame($expected, $return);
}
public function provideProtectIdentifiers(): iterable
public static function provideProtectIdentifiers(): iterable
{
yield from [
// $prefixSingle, $protectIdentifiers, $fieldExists, $item, $expected

View File

@ -104,7 +104,7 @@ final class BaseQueryTest extends CIUnitTestCase
$this->assertSame($newSQL, $query->getQuery());
}
public function provideIsWriteType(): iterable
public static function provideIsWriteType(): iterable
{
return [
'select' => [
@ -577,7 +577,7 @@ final class BaseQueryTest extends CIUnitTestCase
$this->assertSame($expected, $query->getQuery());
}
public function provideHighlightQueryKeywords(): iterable
public static function provideHighlightQueryKeywords(): iterable
{
return [
'highlightKeyWords' => [

View File

@ -392,7 +392,7 @@ final class WhereTest extends CIUnitTestCase
$this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect()));
}
public function provideWhereInvalidKeyThrowInvalidArgumentException(): iterable
public static function provideWhereInvalidKeyThrowInvalidArgumentException(): iterable
{
return [
'null' => [null],
@ -413,7 +413,7 @@ final class WhereTest extends CIUnitTestCase
$builder->whereIn($key, ['Politician', 'Accountant']);
}
public function provideWhereInEmptyValuesThrowInvalidArgumentException(): iterable
public static function provideWhereInEmptyValuesThrowInvalidArgumentException(): iterable
{
return [
'null' => [null],

View File

@ -208,7 +208,7 @@ final class ConfigTest extends CIUnitTestCase
$this->assertSame($expected, $this->getPrivateProperty($conn, 'DSN'));
}
public function provideConvertDSN(): iterable
public static function provideConvertDSN(): iterable
{
yield from [
[

View File

@ -32,7 +32,7 @@ final class EmailTest extends CIUnitTestCase
$this->assertStringContainsString('Invalid email address: "invalid"', $email->printDebugger());
}
public function provideEmailSendWithClearance(): iterable
public static function provideEmailSendWithClearance(): iterable
{
return [
'autoclear' => [true],

View File

@ -208,7 +208,7 @@ final class FiltersTest extends CIUnitTestCase
$this->assertSame($expected, $filters->initialize()->getFilters());
}
public function provideProcessMethodProcessGlobalsWithExcept(): iterable
public static function provideProcessMethodProcessGlobalsWithExcept(): iterable
{
return [
[

View File

@ -124,7 +124,7 @@ final class InvalidCharsTest extends CIUnitTestCase
$this->invalidChars->before($this->request);
}
public function provideCheckControlStringWithLineBreakAndTabReturnsTheString(): iterable
public static function provideCheckControlStringWithLineBreakAndTabReturnsTheString(): iterable
{
yield from [
["String contains \n line break."],
@ -148,7 +148,7 @@ final class InvalidCharsTest extends CIUnitTestCase
$this->invalidChars->before($this->request);
}
public function provideCheckControlStringWithControlCharsCausesException(): iterable
public static function provideCheckControlStringWithControlCharsCausesException(): iterable
{
yield from [
["String contains null char.\0"],

View File

@ -115,7 +115,7 @@ final class XMLFormatterTest extends CIUnitTestCase
$this->assertSame($expectedXML, $this->xmlFormatter->format($input));
}
public function provideValidatingInvalidTags(): iterable
public static function provideValidatingInvalidTags(): iterable
{
return [
[

View File

@ -517,7 +517,7 @@ final class CLIRequestTest extends CIUnitTestCase
$this->assertSame($expected, $this->request->fetchGlobal('post', 'clients[]'));
}
public function provideValidIPAddress(): iterable
public static function provideValidIPAddress(): iterable
{
return [
'empty' => [

View File

@ -518,7 +518,7 @@ final class IncomingRequestTest extends CIUnitTestCase
$this->assertSame($expected, $request->getRawInput());
}
public function provideCanGrabGetRawInputVar(): iterable
public static function provideCanGrabGetRawInputVar(): iterable
{
return [
[
@ -626,7 +626,7 @@ final class IncomingRequestTest extends CIUnitTestCase
$this->assertTrue($request->is(strtolower($value)));
}
public function provideIsHTTPMethods(): iterable
public static function provideIsHTTPMethods(): iterable
{
yield from [
['GET'],
@ -839,7 +839,7 @@ final class IncomingRequestTest extends CIUnitTestCase
$this->assertNull($this->request->getGetPost('gc'));
}
public function provideExtensionPHP(): iterable
public static function provideExtensionPHP(): iterable
{
return [
'not /index.php' => [

View File

@ -185,7 +185,7 @@ final class MessageTest extends CIUnitTestCase
$this->assertSame('json, html, xml', $this->message->getHeaderLine('Accept'));
}
public function provideArrayHeaderValue(): iterable
public static function provideArrayHeaderValue(): iterable
{
return [
'existing for next not append' => [

View File

@ -532,7 +532,7 @@ final class RequestTest extends CIUnitTestCase
$this->assertSame($expected, $this->request->fetchGlobal('post', 'people[0]', FILTER_VALIDATE_INT));
}
public function provideValidIPAddress(): iterable
public static function provideValidIPAddress(): iterable
{
return [
'empty' => [

View File

@ -291,7 +291,7 @@ final class ResponseTest extends CIUnitTestCase
$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],
@ -337,7 +337,7 @@ final class ResponseTest extends CIUnitTestCase
unset($_SERVER['SERVER_SOFTWARE']);
}
public function provideRedirectWithIIS(): iterable
public static function provideRedirectWithIIS(): iterable
{
yield from [
['HTTP/1.1', 'GET', null, 302],

View File

@ -136,7 +136,7 @@ final class URITest extends CIUnitTestCase
$this->assertSame($expectedPath, $uri->getPath());
}
public function provideSimpleUri(): iterable
public static function provideSimpleUri(): iterable
{
return [
'' => [
@ -375,7 +375,7 @@ final class URITest extends CIUnitTestCase
$this->assertSame($expectedPath, $uri->getPath());
}
public function provideSetPath(): iterable
public static function provideSetPath(): iterable
{
return [
'' => [
@ -431,7 +431,7 @@ final class URITest extends CIUnitTestCase
];
}
public function providePathGetsFiltered(): iterable
public static function providePathGetsFiltered(): iterable
{
return [
'dot-segment' => [
@ -555,7 +555,7 @@ final class URITest extends CIUnitTestCase
$this->assertSame('', $uri->getQuery());
}
public function provideAuthorityReturnsExceptedValues(): iterable
public static function provideAuthorityReturnsExceptedValues(): iterable
{
return [
'host-only' => [
@ -590,7 +590,7 @@ final class URITest extends CIUnitTestCase
$this->assertSame($expected, $uri->getAuthority());
}
public function provideAuthorityRemovesDefaultPorts(): iterable
public static function provideAuthorityRemovesDefaultPorts(): iterable
{
return [
'http' => [
@ -629,7 +629,7 @@ final class URITest extends CIUnitTestCase
$this->assertSame($authority, $uri->getAuthority());
}
public function provideRemoveDotSegments(): iterable
public static function provideRemoveDotSegments(): iterable
{
return [
[
@ -738,7 +738,7 @@ final class URITest extends CIUnitTestCase
$this->assertSame($expected, URI::removeDotSegments($path));
}
public function defaultResolutions(): iterable
public static function defaultResolutions(): iterable
{
return [
[

View File

@ -407,7 +407,7 @@ final class ArrayHelperTest extends CIUnitTestCase
$this->assertSame($expected, array_flatten_with_dots($input));
}
public function provideArrayFlattening(): iterable
public static function provideArrayFlattening(): iterable
{
yield 'normal' => [
[

View File

@ -243,7 +243,7 @@ final class InflectorHelperTest extends CIUnitTestCase
}
}
public function provideOrdinal(): iterable
public static function provideOrdinal(): iterable
{
return [
['st', 1],

View File

@ -235,7 +235,7 @@ final class CurrentUrlTest extends CIUnitTestCase
$this->assertSame('assets/image.jpg', uri_string());
}
public function provideUrlIs(): iterable
public static function provideUrlIs(): iterable
{
return [
[

View File

@ -112,7 +112,7 @@ final class MiscUrlTest extends CIUnitTestCase
// Test anchor
public function provideAnchor(): iterable
public static function provideAnchor(): iterable
{
return [
'normal01' => [
@ -171,7 +171,7 @@ final class MiscUrlTest extends CIUnitTestCase
$this->assertSame($expected, anchor($uri, $title, $attributes, $this->config));
}
public function provideAnchorNoindex(): iterable
public static function provideAnchorNoindex(): iterable
{
return [
'noindex01' => [
@ -238,7 +238,7 @@ final class MiscUrlTest extends CIUnitTestCase
$this->assertSame($expected, anchor($uri, $title, $attributes, $this->config));
}
public function provideAnchorTargetted(): iterable
public static function provideAnchorTargetted(): iterable
{
return [
'subpage01' => [
@ -295,7 +295,7 @@ final class MiscUrlTest extends CIUnitTestCase
$this->assertSame($expected, anchor($uri, $title, $attributes, $this->config));
}
public function provideAnchorExamples(): iterable
public static function provideAnchorExamples(): iterable
{
return [
'egpage01' => [
@ -341,7 +341,7 @@ final class MiscUrlTest extends CIUnitTestCase
// Test anchor_popup
public function provideAnchorPopup(): iterable
public static function provideAnchorPopup(): iterable
{
return [
'normal01' => [
@ -399,7 +399,7 @@ final class MiscUrlTest extends CIUnitTestCase
// Test mailto
public function provideMailto(): iterable
public static function provideMailto(): iterable
{
return [
'page01' => [
@ -438,7 +438,7 @@ final class MiscUrlTest extends CIUnitTestCase
// Test safe_mailto
public function provideSafeMailto(): iterable
public static function provideSafeMailto(): iterable
{
return [
'page01' => [
@ -487,7 +487,7 @@ final class MiscUrlTest extends CIUnitTestCase
// Test auto_link
public function provideAutoLinkUrl(): iterable
public static function provideAutoLinkUrl(): iterable
{
return [
'test01' => [
@ -536,7 +536,7 @@ final class MiscUrlTest extends CIUnitTestCase
$this->assertSame($out, auto_link($in, 'url'));
}
public function provideAutoLinkEmail(): iterable
public static function provideAutoLinkEmail(): iterable
{
return [
'test01' => [
@ -585,7 +585,7 @@ final class MiscUrlTest extends CIUnitTestCase
$this->assertSame($out, auto_link($in, 'email'));
}
public function provideAutolinkBoth(): iterable
public static function provideAutolinkBoth(): iterable
{
return [
'test01' => [
@ -634,7 +634,7 @@ final class MiscUrlTest extends CIUnitTestCase
$this->assertSame($out, auto_link($in));
}
public function provideAutoLinkPopup(): iterable
public static function provideAutoLinkPopup(): iterable
{
return [
'test01' => [
@ -685,7 +685,7 @@ final class MiscUrlTest extends CIUnitTestCase
// Test prep_url
public function providePrepUrl(): iterable
public static function providePrepUrl(): iterable
{
// input, expected, secure
return [
@ -854,7 +854,7 @@ final class MiscUrlTest extends CIUnitTestCase
url_to($route);
}
public function provideUrlTo(): iterable
public static function provideUrlTo(): iterable
{
$page = config('App')->indexPage !== '' ? config('App')->indexPage . '/' : '';
@ -874,7 +874,7 @@ final class MiscUrlTest extends CIUnitTestCase
];
}
public function provideUrlToThrowsOnEmptyOrMissingRoute(): iterable
public static function provideUrlToThrowsOnEmptyOrMissingRoute(): iterable
{
return [
[

View File

@ -81,7 +81,7 @@ final class SiteUrlTest extends CIUnitTestCase
$this->assertSame($expectedBaseUrl, base_url($path, $scheme));
}
public function provideUrls(): iterable
public static function provideUrls(): iterable
{
// baseURL, indexPage, scheme, secure, path, expectedSiteUrl, expectedBaseUrl
return [

View File

@ -1158,7 +1158,7 @@ final class TimeLegacyTest extends CIUnitTestCase
$this->assertSame('2017-03-10 12:00:00', (string) $time);
}
public function provideToStringDoesNotDependOnLocale(): iterable
public static function provideToStringDoesNotDependOnLocale(): iterable
{
yield from [
['en'],

View File

@ -1170,7 +1170,7 @@ final class TimeTest extends CIUnitTestCase
$this->assertSame('2017-03-10 12:00:00', (string) $time);
}
public function provideToStringDoesNotDependOnLocale(): iterable
public static function provideToStringDoesNotDependOnLocale(): iterable
{
yield from [
['en'],

View File

@ -213,7 +213,7 @@ final class LanguageTest extends CIUnitTestCase
$this->assertSame('billions and billions', lang('Core.bazillion', [], 'en'));
}
public function provideBundleUniqueKeys(): iterable
public static function provideBundleUniqueKeys(): iterable
{
return [
['CLI'],

View File

@ -397,7 +397,7 @@ final class UpdateModelTest extends LiveModelTestCase
$this->model->update($id, ['name' => 'Foo Bar']);
}
public function provideUpdateThrowDatabaseExceptionWithoutWhereClause(): iterable
public static function provideUpdateThrowDatabaseExceptionWithoutWhereClause(): iterable
{
yield from [
[

View File

@ -69,7 +69,7 @@ final class PublisherRestrictionsTest extends CIUnitTestCase
$this->assertSame($expected, $errors[$file]->getMessage());
}
public function provideDefaultPublicRestrictions(): iterable
public static function provideDefaultPublicRestrictions(): iterable
{
yield from [
'php' => ['index.php'],
@ -99,7 +99,7 @@ final class PublisherRestrictionsTest extends CIUnitTestCase
$this->assertInstanceOf(Publisher::class, $publisher);
}
public function provideDestinations(): iterable
public static function provideDestinations(): iterable
{
return [
'explicit' => [

View File

@ -120,7 +120,7 @@ final class RouteCollectionReverseRouteTest extends CIUnitTestCase
$this->assertSame('/en/contact', $routes->reverseRoute('myController::goto'));
}
public function provideReverseRoutingDefaultNamespaceAppController(): iterable
public static function provideReverseRoutingDefaultNamespaceAppController(): iterable
{
return yield from [
'Omit namespace' => ['Galleries::showUserGallery'],

View File

@ -405,7 +405,7 @@ final class RouteCollectionTest extends CIUnitTestCase
$this->assertSame($expected, $routes->getRoutes());
}
public function provideNestedGroupingWorksWithRootPrefix(): iterable
public static function provideNestedGroupingWorksWithRootPrefix(): iterable
{
yield from [
['admin', '/', [
@ -1242,7 +1242,7 @@ final class RouteCollectionTest extends CIUnitTestCase
$this->assertSame($options, $options1);
}
public function provideRoutesOptionsWithSameFromTwoRoutes(): iterable
public static function provideRoutesOptionsWithSameFromTwoRoutes(): iterable
{
yield from [
[
@ -1657,7 +1657,7 @@ final class RouteCollectionTest extends CIUnitTestCase
$this->assertSame($expects, $router->handle('/0'));
}
public function provideRouteDefaultNamespace(): iterable
public static function provideRouteDefaultNamespace(): iterable
{
return [
'with \\ prefix' => ['\App\Controllers'],

View File

@ -870,7 +870,7 @@ final class RouterTest extends CIUnitTestCase
$router->handle($url);
}
public function provideRedirectRoute(): iterable
public static function provideRedirectRoute(): iterable
{
// [$route, $redirectFrom, $redirectTo, $url, $expectedPath, $alias]
return [

View File

@ -79,7 +79,7 @@ final class DOMParserTest extends CIUnitTestCase
$this->assertSame(['href' => 'http://example.com'], $selector['attr']);
}
public function provideText(): iterable
public static function provideText(): iterable
{
return [
'en' => ['Hello World'],

View File

@ -284,7 +284,7 @@ final class FeatureTestTraitTest extends CIUnitTestCase
$this->get('0');
}
public function provideOpenCliRoutesFromHttpGot404(): iterable
public static function provideOpenCliRoutesFromHttpGot404(): iterable
{
return [
'non parameterized cli' => [

View File

@ -33,7 +33,7 @@ final class TestLoggerTest extends CIUnitTestCase
);
}
public function provideDidLogMethod(): iterable
public static function provideDidLogMethod(): iterable
{
yield 'exact' => [
true,

View File

@ -46,7 +46,7 @@ final class TestResponseTest extends CIUnitTestCase
/**
* Provides status codes and their expected "OK"
*/
public function provideHttpStatusCodes(): iterable
public static function provideHttpStatusCodes(): iterable
{
return [
[

View File

@ -208,7 +208,7 @@ final class ThrottleTest extends CIUnitTestCase
}
}
public function provideTokenTimeCalculationUCs(): iterable
public static function provideTokenTimeCalculationUCs(): iterable
{
return [
'2 capacity / 200 seconds (100s refresh, 0.01 tokens/s) -> 5 checks, 1 cost each' => [

View File

@ -129,7 +129,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertFalse($this->validation->run($data));
}
public function provideValidUrl(): iterable
public static function provideValidUrl(): iterable
{
yield from [
[
@ -260,7 +260,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideValidEmail(): iterable
public static function provideValidEmail(): iterable
{
yield from [
[
@ -278,7 +278,7 @@ class FormatRulesTest extends CIUnitTestCase
];
}
public function provideValidEmails(): iterable
public static function provideValidEmails(): iterable
{
yield from [
[
@ -324,7 +324,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideValidIP(): iterable
public static function provideValidIP(): iterable
{
yield from [
[
@ -393,7 +393,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideString(): iterable
public static function provideString(): iterable
{
yield from [
[
@ -427,7 +427,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideAlpha(): iterable
public static function provideAlpha(): iterable
{
yield from [
[
@ -469,7 +469,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideAlphaSpace(): iterable
public static function provideAlphaSpace(): iterable
{
yield from [
[
@ -515,7 +515,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function alphaNumericProvider(): iterable
public static function alphaNumericProvider(): iterable
{
yield from [
[
@ -553,7 +553,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideAlphaNumericPunct(): iterable
public static function provideAlphaNumericPunct(): iterable
{
yield from [
[
@ -685,7 +685,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideAlphaDash(): iterable
public static function provideAlphaDash(): iterable
{
yield from [
[
@ -723,7 +723,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideHex(): iterable
public static function provideHex(): iterable
{
yield from [
[
@ -761,7 +761,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideNumeric(): iterable
public static function provideNumeric(): iterable
{
yield from [
[
@ -837,7 +837,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertsame($expected, $this->validation->run($data));
}
public function provideInvalidIntegerType(): iterable
public static function provideInvalidIntegerType(): iterable
{
// TypeError : CodeIgniter\Validation\FormatRules::integer(): Argument #1 ($str) must be of type ?string, array given
// yield 'array with int' => [
@ -883,7 +883,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideInteger(): iterable
public static function provideInteger(): iterable
{
yield from [
[
@ -937,7 +937,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideDecimal(): iterable
public static function provideDecimal(): iterable
{
yield from [
[
@ -995,7 +995,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideNatural(): iterable
public static function provideNatural(): iterable
{
yield from [
[
@ -1037,7 +1037,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideNaturalNoZero(): iterable
public static function provideNaturalNoZero(): iterable
{
yield from [
[
@ -1079,7 +1079,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideBase64(): iterable
public static function provideBase64(): iterable
{
yield from [
[
@ -1113,7 +1113,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideJson(): iterable
public static function provideJson(): iterable
{
yield from [
[
@ -1171,7 +1171,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideTimeZone(): iterable
public static function provideTimeZone(): iterable
{
yield from [
[
@ -1209,7 +1209,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideValidDate(): iterable
public static function provideValidDate(): iterable
{
yield from [
[

View File

@ -60,7 +60,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideRequired(): iterable
public static function provideRequired(): iterable
{
yield from [
[['foo' => null], false],
@ -81,7 +81,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideIfExist(): iterable
public static function provideIfExist(): iterable
{
yield from [
[
@ -134,7 +134,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function providePermitEmpty(): iterable
public static function providePermitEmpty(): iterable
{
yield from [
// If the rule is only `permit_empty`, any value will pass.
@ -298,7 +298,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideMatchesCases(): iterable
public static function provideMatchesCases(): iterable
{
yield from [
[['foo' => null, 'bar' => null], true],
@ -316,7 +316,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideMatchesNestedCases(): iterable
public static function provideMatchesNestedCases(): iterable
{
yield from [
[['nested' => ['foo' => 'match', 'bar' => 'match']], true],
@ -351,7 +351,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideEquals(): iterable
public static function provideEquals(): iterable
{
yield from [
'null' => [['foo' => null], '', false],
@ -371,7 +371,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run(['foo' => $data]));
}
public function provideMinLengthCases(): iterable
public static function provideMinLengthCases(): iterable
{
yield from [
'null' => [null, '2', false],
@ -405,7 +405,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run(['foo' => $data]));
}
public function provideExactLength(): iterable
public static function provideExactLength(): iterable
{
yield from [
'null' => [null, false],
@ -432,7 +432,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideGreaterThan(): iterable
public static function provideGreaterThan(): iterable
{
yield from [
['-10', '-11', true],
@ -457,7 +457,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideGreaterThanEqual(): iterable
public static function provideGreaterThanEqual(): iterable
{
yield from [
['0', '0', true],
@ -483,7 +483,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideLessThan(): iterable
public static function provideLessThan(): iterable
{
yield from [
['-10', '-11', false],
@ -509,7 +509,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideLessThanEqual(): iterable
public static function provideLessThanEqual(): iterable
{
yield from [
['0', '0', true],
@ -545,7 +545,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame(! $expected, $this->validation->run($data));
}
public function provideInList(): iterable
public static function provideInList(): iterable
{
yield from [
['red', 'red,Blue,123', true],
@ -581,7 +581,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideRequiredWith(): iterable
public static function provideRequiredWith(): iterable
{
yield from [
['nope', 'bar', false],
@ -629,7 +629,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $result);
}
public function provideRequiredWithAndOtherRules(): iterable
public static function provideRequiredWithAndOtherRules(): iterable
{
yield from [
// `otherField` and `mustBeADate` do not exist
@ -666,7 +666,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $result);
}
public function provideRequiredWithAndOtherRuleWithValueZero(): iterable
public static function provideRequiredWithAndOtherRuleWithValueZero(): iterable
{
yield from [
[true, ['married' => '0', 'partner_name' => '']],
@ -696,7 +696,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideRequiredWithout(): iterable
public static function provideRequiredWithout(): iterable
{
yield from [
['nope', 'bars', false],
@ -742,7 +742,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($result, $this->validation->run($data));
}
public function provideRequiredWithoutMultiple(): iterable
public static function provideRequiredWithoutMultiple(): iterable
{
yield from [
'all empty' => [
@ -788,7 +788,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($result, $this->validation->run($data));
}
public function provideRequiredWithoutMultipleWithoutFields(): iterable
public static function provideRequiredWithoutMultipleWithoutFields(): iterable
{
yield from [
'baz is missing' => [

View File

@ -39,7 +39,7 @@ final class FormatRulesTest extends TraditionalFormatRulesTest
],
];
public function provideAlphaSpace(): iterable
public static function provideAlphaSpace(): iterable
{
yield from [
[
@ -69,7 +69,7 @@ final class FormatRulesTest extends TraditionalFormatRulesTest
];
}
public function provideInvalidIntegerType(): iterable
public static function provideInvalidIntegerType(): iterable
{
yield 'array with int' => [
[555],

View File

@ -50,7 +50,7 @@ final class RulesTest extends TraditionalRulesTest
$this->assertSame($expected, $this->validation->run($data));
}
public function providePermitEmptyStrict(): iterable
public static function providePermitEmptyStrict(): iterable
{
yield from [
[
@ -105,7 +105,7 @@ final class RulesTest extends TraditionalRulesTest
$this->assertSame($expected, $this->validation->run($data));
}
public function provideGreaterThanEqualStrict(): iterable
public static function provideGreaterThanEqualStrict(): iterable
{
yield from [
[0, '0', true],
@ -131,7 +131,7 @@ final class RulesTest extends TraditionalRulesTest
$this->assertSame($expected, $this->validation->run($data));
}
public function provideGreaterThanStrict(): iterable
public static function provideGreaterThanStrict(): iterable
{
yield from [
[-10, '-11', true],
@ -158,7 +158,7 @@ final class RulesTest extends TraditionalRulesTest
$this->assertSame($expected, $this->validation->run($data));
}
public function provideLessThanStrict(): iterable
public static function provideLessThanStrict(): iterable
{
yield from [
[-10, '-11', false],
@ -186,7 +186,7 @@ final class RulesTest extends TraditionalRulesTest
$this->assertSame($expected, $this->validation->run($data));
}
public function provideLessEqualThanStrict(): iterable
public static function provideLessEqualThanStrict(): iterable
{
yield from [
[0, '0', true],

View File

@ -338,7 +338,7 @@ class ValidationTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideCanValidatetArrayData(): iterable
public static function provideCanValidatetArrayData(): iterable
{
yield 'list array' => [
[1, 2, 3, 4, 5],
@ -390,7 +390,7 @@ class ValidationTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideIsIntWithInvalidTypeData(): iterable
public static function provideIsIntWithInvalidTypeData(): iterable
{
yield 'array with int' => [
[555],
@ -622,7 +622,7 @@ class ValidationTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->getError('foo'));
}
public function provideRulesSetup(): iterable
public static function provideRulesSetup(): iterable
{
yield from [
[
@ -970,7 +970,7 @@ class ValidationTest extends CIUnitTestCase
$this->assertSame($results, $this->validation->getErrors());
}
public function provideRulesForArrayField(): iterable
public static function provideRulesForArrayField(): iterable
{
yield from [
'all_rules_should_pass' => [
@ -1205,7 +1205,7 @@ class ValidationTest extends CIUnitTestCase
$this->assertSame($expected, $actual);
}
public function provideDotNotationOnIfExistRule(): iterable
public static function provideDotNotationOnIfExistRule(): iterable
{
yield 'dot-on-end-fail' => [
false,
@ -1275,7 +1275,7 @@ class ValidationTest extends CIUnitTestCase
$this->assertSame($expected, $actual);
}
public function provideValidationOfArrayData(): iterable
public static function provideValidationOfArrayData(): iterable
{
yield 'fail-empty-string' => [
false,
@ -1331,7 +1331,7 @@ class ValidationTest extends CIUnitTestCase
$this->assertSame($expected, $splitter($input));
}
public function provideSplittingOfComplexStringRules(): iterable
public static function provideSplittingOfComplexStringRules(): iterable
{
yield [
'required',

View File

@ -418,7 +418,7 @@ final class ParserTest extends CIUnitTestCase
$this->assertSame($result, $this->parser->renderString($template));
}
public function provideEscHandling(): iterable
public static function provideEscHandling(): iterable
{
return [
'scalar' => [42],