From 1925f692bcc60deb81b103e8814687fd6e53094e Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 11 Feb 2025 14:30:12 +0700 Subject: [PATCH] fix Revert "refactor: re-run rector" This reverts commit 65b71e963b1cb6f36b284ae0e5be13faabe33ff4. fix: skip rector.php --- rector.php | 3 +++ tests/system/Database/Live/ForgeTest.php | 6 +++--- tests/system/Database/Live/GetTest.php | 2 +- tests/system/Log/LoggerTest.php | 2 +- tests/system/Models/FindModelTest.php | 2 +- tests/system/View/ViewTest.php | 6 +++--- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/rector.php b/rector.php index ffa21b4e66..7adec00da4 100644 --- a/rector.php +++ b/rector.php @@ -37,6 +37,7 @@ use Rector\Php70\Rector\FuncCall\RandomFunctionRector; use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector; use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector; +use Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertCountWithZeroToAssertEmptyRector; use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector; use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector; use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector; @@ -168,6 +169,8 @@ return RectorConfig::configure() NullToStrictStringFuncCallArgRector::class, CompactToVariablesRector::class, + + AssertCountWithZeroToAssertEmptyRector::class, ]) // auto import fully qualified class names ->withImportNames(removeUnusedImports: true) diff --git a/tests/system/Database/Live/ForgeTest.php b/tests/system/Database/Live/ForgeTest.php index 6c43c246cf..ab5b17bec1 100644 --- a/tests/system/Database/Live/ForgeTest.php +++ b/tests/system/Database/Live/ForgeTest.php @@ -1292,7 +1292,7 @@ final class ForgeTest extends CIUnitTestCase $this->forge->dropKey('forge_test_1', $index, false); $this->forge->dropKey('forge_test_1', $uniqueIndex, false); - $this->assertEmpty($this->db->getIndexData('forge_test_1')); + $this->assertCount(0, $this->db->getIndexData('forge_test_1')); $this->forge->dropTable('forge_test_1', true); } @@ -1500,7 +1500,7 @@ final class ForgeTest extends CIUnitTestCase $this->assertFalse($this->db->tableExists('dropTest')); if ($this->db->DBDriver === 'SQLite3') { - $this->assertEmpty($this->db->getIndexData('droptest')); + $this->assertCount(0, $this->db->getIndexData('droptest')); } } @@ -1668,7 +1668,7 @@ final class ForgeTest extends CIUnitTestCase $indexes = $this->db->getIndexData('forge_test_users'); - $this->assertEmpty($indexes); + $this->assertCount(0, $indexes); $this->forge->dropTable('forge_test_users', true); } diff --git a/tests/system/Database/Live/GetTest.php b/tests/system/Database/Live/GetTest.php index 3bfa417f91..ce98ebf413 100644 --- a/tests/system/Database/Live/GetTest.php +++ b/tests/system/Database/Live/GetTest.php @@ -58,7 +58,7 @@ final class GetTest extends CIUnitTestCase $jobs = $this->db->table('job')->limit(0)->get()->getResult(); - $this->assertEmpty($jobs); + $this->assertCount(0, $jobs); } public function testGetWithLimitZeroAsAll(): void diff --git a/tests/system/Log/LoggerTest.php b/tests/system/Log/LoggerTest.php index 497ff9fe47..569de4dbd3 100644 --- a/tests/system/Log/LoggerTest.php +++ b/tests/system/Log/LoggerTest.php @@ -103,7 +103,7 @@ final class LoggerTest extends CIUnitTestCase $logs = TestHandler::getLogs(); - $this->assertEmpty($logs); + $this->assertCount(0, $logs); } public function testLogInterpolatesMessage(): void diff --git a/tests/system/Models/FindModelTest.php b/tests/system/Models/FindModelTest.php index cd62f2dec1..43fb96d76b 100644 --- a/tests/system/Models/FindModelTest.php +++ b/tests/system/Models/FindModelTest.php @@ -130,7 +130,7 @@ final class FindModelTest extends LiveModelTestCase // Binds should be reset to 0 after each one $binds = $this->model->builder()->getBinds(); - $this->assertEmpty($binds); + $this->assertCount(0, $binds); $query = $this->model->getLastQuery(); $this->assertCount(1, $this->getPrivateProperty($query, 'binds')); diff --git a/tests/system/View/ViewTest.php b/tests/system/View/ViewTest.php index c1fc85ede2..b15e603408 100644 --- a/tests/system/View/ViewTest.php +++ b/tests/system/View/ViewTest.php @@ -250,7 +250,7 @@ final class ViewTest extends CIUnitTestCase { // Make sure debugging is on for our view $view = new View($this->config, $this->viewsDir, $this->loader, true); - $this->assertEmpty($view->getPerformanceData()); + $this->assertCount(0, $view->getPerformanceData()); $view->setVar('testString', 'Hello World'); $expected = '

Hello World

'; @@ -262,12 +262,12 @@ final class ViewTest extends CIUnitTestCase { // Make sure debugging is on for our view $view = new View($this->config, $this->viewsDir, $this->loader, false); - $this->assertEmpty($view->getPerformanceData()); + $this->assertCount(0, $view->getPerformanceData()); $view->setVar('testString', 'Hello World'); $expected = '

Hello World

'; $this->assertSame($expected, $view->renderString('

', [], true)); - $this->assertEmpty($view->getPerformanceData()); + $this->assertCount(0, $view->getPerformanceData()); } public function testRenderLayoutExtendsCorrectly(): void