Skip to content

Commit

Permalink
Merge pull request #8864 from paulbalandan/ordered-attributes
Browse files Browse the repository at this point in the history
style: enable `ordered_attributes`
  • Loading branch information
kenjis committed May 8, 2024
2 parents 174d76e + 13015db commit 6cb01b1
Show file tree
Hide file tree
Showing 32 changed files with 101 additions and 97 deletions.
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
$overrides = [
// for updating to coding-standard
'modernize_strpos' => true,
'ordered_attributes' => ['order' => [], 'sort_algorithm' => 'alpha'],
'php_unit_attributes' => true,
];

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 @@ -32,6 +32,7 @@
$overrides = [
// for updating to coding-standard
'modernize_strpos' => true,
'ordered_attributes' => ['order' => [], 'sort_algorithm' => 'alpha'],
'php_unit_attributes' => true,
];

Expand Down
1 change: 1 addition & 0 deletions .php-cs-fixer.tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
'void_return' => true,
// for updating to coding-standard
'modernize_strpos' => true,
'ordered_attributes' => ['order' => [], 'sort_algorithm' => 'alpha'],
'php_unit_attributes' => true,
];

Expand Down
1 change: 1 addition & 0 deletions .php-cs-fixer.user-guide.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
],
// for updating to coding-standard
'modernize_strpos' => true,
'ordered_attributes' => ['order' => [], 'sort_algorithm' => 'alpha'],
'php_unit_attributes' => true,
];

Expand Down
2 changes: 1 addition & 1 deletion tests/system/Autoloader/AutoloaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,8 @@ public function testAutoloaderLoadsNonClassFiles(): void
$loader->unregister();
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testLoadHelpers(): void
{
// Workaround for errors on PHPUnit 10 and PHP 8.3.
Expand Down
2 changes: 1 addition & 1 deletion tests/system/CodeIgniterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
/**
* @internal
*/
#[RunTestsInSeparateProcesses]
#[BackupGlobals(true)]
#[Group('Others')]
#[RunTestsInSeparateProcesses]
final class CodeIgniterTest extends CIUnitTestCase
{
private CodeIgniter $codeigniter;
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Commands/GenerateKeyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ public function testGenerateKeyShowsEncodedKey(): void
$this->assertStringContainsString('hex2bin:', $this->getBuffer());
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testGenerateKeyCreatesNewKey(): void
{
command('key:generate');
Expand Down
2 changes: 1 addition & 1 deletion tests/system/CommonFunctionsSendTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ protected function setUp(): void
* Make sure cookies are set by RedirectResponse this way
* See https://github.com/codeigniter4/CodeIgniter4/issues/1393
*/
#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testRedirectResponseCookiesSent(): void
{
$loginTime = time();
Expand Down
18 changes: 9 additions & 9 deletions tests/system/CommonFunctionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ public function testEscapeRecursiveArrayRaw(): void
$this->assertSame($data, esc($data, 'raw'));
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testSessionInstance(): void
{
// Workaround for errors on PHPUnit 10 and PHP 8.3.
Expand All @@ -285,8 +285,8 @@ public function testSessionInstance(): void
$this->assertInstanceOf(Session::class, session());
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testSessionVariable(): void
{
// Workaround for errors on PHPUnit 10 and PHP 8.3.
Expand All @@ -300,8 +300,8 @@ public function testSessionVariable(): void
$this->assertSame('Hi there', session('notbogus'));
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testSessionVariableNotThere(): void
{
// Workaround for errors on PHPUnit 10 and PHP 8.3.
Expand Down Expand Up @@ -426,8 +426,8 @@ public function testModelExistsAbsoluteClassname(): void
$this->assertInstanceOf(JobModel::class, model(JobModel::class));
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testOldInput(): void
{
// Workaround for errors on PHPUnit 10 and PHP 8.3.
Expand Down Expand Up @@ -463,8 +463,8 @@ public function testOldInput(): void
$this->assertSame('fritz', old('zibble'));
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testOldInputSerializeData(): void
{
// Workaround for errors on PHPUnit 10 and PHP 8.3.
Expand Down Expand Up @@ -501,8 +501,8 @@ public function testOldInputSerializeData(): void
/**
* @see https://github.com/codeigniter4/CodeIgniter4/issues/1492
*/
#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testOldInputArray(): void
{
// Workaround for errors on PHPUnit 10 and PHP 8.3.
Expand Down Expand Up @@ -620,8 +620,8 @@ public function testRedirectResponseCookies1(): void
$this->assertTrue($answer1->hasCookie('login_time'));
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testTrace(): void
{
// Workaround for errors on PHPUnit 10 and PHP 8.3.
Expand All @@ -645,8 +645,8 @@ public function testViewNotSaveData(): void
$this->assertStringContainsString('<h1>is_not</h1>', view('\Tests\Support\View\Views\simples'));
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testForceHttpsNullRequestAndResponse(): void
{
// Workaround for errors on PHPUnit 10 and PHP 8.3.
Expand Down Expand Up @@ -761,8 +761,8 @@ public function testDWithCSP(): void
Kint::$cli_detection = $cliDetection;
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testTraceWithCSP(): void
{
// Workaround for errors on PHPUnit 10 and PHP 8.3.
Expand Down
2 changes: 1 addition & 1 deletion tests/system/CommonHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
/**
* @internal
*/
#[Group('Others')]
#[CoversFunction('helper')]
#[Group('Others')]
final class CommonHelperTest extends CIUnitTestCase
{
private array $dummyHelpers = [
Expand Down
6 changes: 3 additions & 3 deletions tests/system/Config/BaseConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ public function testUseDefaultValueTypeStringValue(): void
$this->assertSame('123456', $config->password);
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testServerValues(): void
{
$_SERVER = [
Expand Down Expand Up @@ -195,8 +195,8 @@ public function testSetsDefaultValues(): void
$this->assertSame('bar', $config->second);
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testSetsDefaultValuesEncryptionUsingHex2Bin(): void
{
$dotenv = new DotEnv($this->fixturesFolder, 'encryption.env');
Expand All @@ -208,8 +208,8 @@ public function testSetsDefaultValuesEncryptionUsingHex2Bin(): void
$this->assertSame('OpenSSL', $config->driver);
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testSetDefaultValuesEncryptionUsingBase64(): void
{
$dotenv = new DotEnv($this->fixturesFolder, 'base64encryption.env');
Expand Down
4 changes: 2 additions & 2 deletions tests/system/Config/DotEnvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ public static function provideLoadsVars(): iterable
];
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testLoadsHex2Bin(): void
{
$dotenv = new DotEnv($this->fixturesFolder, 'encryption.env');
Expand All @@ -101,8 +101,8 @@ public function testLoadsHex2Bin(): void
$this->assertSame('OpenSSL', getenv('encryption.driver'));
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testLoadsBase64(): void
{
$dotenv = new DotEnv($this->fixturesFolder, 'base64encryption.env');
Expand Down
14 changes: 7 additions & 7 deletions tests/system/Config/ServicesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,24 +243,24 @@ public function testNewViewcell(): void
$this->assertInstanceOf(Cell::class, $actual);
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testNewSession(): void
{
$actual = Services::session();
$this->assertInstanceOf(Session::class, $actual);
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testNewSessionWithNullConfig(): void
{
$actual = Services::session(null, false);
$this->assertInstanceOf(Session::class, $actual);
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testCallStatic(): void
{
// __callStatic should kick in for this but fail
Expand All @@ -271,17 +271,17 @@ public function testCallStatic(): void
$this->assertInstanceOf(Session::class, $actual);
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testCallStaticDirectly(): void
{
// $actual = \CodeIgniter\Config\Services::SeSsIoN(null, false); // original
$actual = Services::__callStatic('SeSsIoN', [null, false]);
$this->assertInstanceOf(Session::class, $actual);
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testMockInjection(): void
{
Services::injectMock('response', new MockResponse(new App()));
Expand All @@ -300,8 +300,8 @@ public function testMockInjection(): void
$this->assertSame($response, $response3);
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testReset(): void
{
Services::injectMock('response', new MockResponse(new App()));
Expand All @@ -317,8 +317,8 @@ public function testReset(): void
$this->assertNotSame($response2, $response);
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testResetSingle(): void
{
Services::injectMock('response', new MockResponse(new App()));
Expand Down
2 changes: 1 addition & 1 deletion tests/system/DebugTraceableTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
/**
* @internal
*/
#[Group('Others')]
#[CoversClass(DebugTraceableTrait::class)]
#[Group('Others')]
final class DebugTraceableTraitTest extends CIUnitTestCase
{
public function testFactoryInstanceReturnsWhereItIsRaised(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Events/EventsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ protected function tearDown(): void
Events::simulate(false);
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testInitialize(): void
{
/**
Expand Down
4 changes: 2 additions & 2 deletions tests/system/Filters/HoneypotTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ public function testBeforeClean(): void
$this->assertSame($expected, $request);
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testAfter(): void
{
$this->config->globals = [
Expand All @@ -114,8 +114,8 @@ public function testAfter(): void
$this->assertStringContainsString($this->honey->name, $this->response->getBody());
}

#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RunInSeparateProcess]
public function testAfterNotApplicable(): void
{
$this->config->globals = [
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Filters/InvalidCharsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ public function testBeforeInvalidControlCharCausesException(): void
$this->invalidChars->before($this->request);
}

#[DoesNotPerformAssertions]
#[DataProvider('provideCheckControlStringWithLineBreakAndTabReturnsTheString')]
#[DoesNotPerformAssertions]
public function testCheckControlStringWithLineBreakAndTabReturnsTheString(string $input): void
{
$_GET['val'] = $input;
Expand Down
Loading

0 comments on commit 6cb01b1

Please sign in to comment.