Skip to content

Commit 29d26fe

Browse files
authored
refactor: fix method.alreadyNarrowedType errors (#10440)
1 parent 39e6884 commit 29d26fe

17 files changed

Lines changed: 23 additions & 115 deletions

‎admin/starter/tests/unit/HealthTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ final class HealthTest extends CIUnitTestCase
1111
{
1212
public function testIsDefinedAppPath(): void
1313
{
14-
$this->assertTrue(defined('APPPATH'));
14+
$this->assertDirectoryExists(APPPATH);
1515
}
1616

1717
public function testBaseUrlHasBeenSet(): void

‎tests/system/CLI/CLITest.php‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,10 @@ public function testColorSupportOnHyperTerminals(): void
292292
public function testStreamSupports(): void
293293
{
294294
$this->assertTrue(CLI::streamSupports('stream_isatty', STDOUT));
295-
$this->assertIsBool(CLI::streamSupports('sapi_windows_vt100_support', STDOUT));
295+
$this->assertSame(
296+
function_exists('sapi_windows_vt100_support'),
297+
CLI::streamSupports('sapi_windows_vt100_support', STDOUT),
298+
);
296299
}
297300

298301
public function testColor(): void
@@ -587,12 +590,12 @@ public function testWindow(): void
587590
$height = new ReflectionProperty(CLI::class, 'height');
588591
$height->setValue(null, null);
589592

590-
$this->assertIsInt(CLI::getHeight());
593+
$this->assertGreaterThan(0, CLI::getHeight());
591594

592595
$width = new ReflectionProperty(CLI::class, 'width');
593596
$width->setValue(null, null);
594597

595-
$this->assertIsInt(CLI::getWidth());
598+
$this->assertGreaterThan(0, CLI::getWidth());
596599
}
597600

598601
#[RequiresOperatingSystem('Darwin|Linux')]

‎tests/system/CodeIgniterTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ public function testStartControllerPermitsInvoke(): void
984984
$startController();
985985

986986
// No PageNotFoundException
987-
$this->assertTrue(true);
987+
$this->expectNotToPerformAssertions();
988988
}
989989

990990
public function testRouteAttributeCacheIntegration(): void

‎tests/system/CommonFunctionsTest.php‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,6 @@ public static function provideCleanPathActuallyCleaningThePaths(): iterable
773773

774774
public function testIsCli(): void
775775
{
776-
$this->assertIsBool(is_cli());
777776
$this->assertTrue(is_cli());
778777
}
779778

‎tests/system/Config/FactoriesTest.php‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,6 @@ public function testGetComponentInstances(): array
439439

440440
$data = Factories::getComponentInstances('config');
441441

442-
$this->assertIsArray($data);
443442
$this->assertArrayHasKey('aliases', $data);
444443
$this->assertArrayHasKey('instances', $data);
445444

@@ -469,7 +468,6 @@ public function testSetComponentInstances(array $data): array
469468

470469
$data = Factories::getComponentInstances('config');
471470

472-
$this->assertIsArray($data);
473471
$this->assertArrayHasKey('aliases', $data);
474472
$this->assertArrayHasKey('instances', $data);
475473

‎tests/system/Database/Live/UpdateTest.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function testUpdateSetsAllWithoutWhereAndLimit(): void
7575
} catch (DatabaseException) {
7676
// This DB doesn't support Where and Limit together
7777
// but we don't want it called a "Risky" test.
78-
$this->assertTrue(true);
78+
$this->expectNotToPerformAssertions();
7979
}
8080
}
8181

@@ -110,7 +110,7 @@ public function testUpdateWithWhereAndLimit(): void
110110
} catch (DatabaseException) {
111111
// This DB doesn't support Where and Limit together
112112
// but we don't want it called a "Risky" test.
113-
$this->assertTrue(true);
113+
$this->expectNotToPerformAssertions();
114114
}
115115
}
116116

‎tests/system/HTTP/CLIRequestTest.php‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,6 @@ public function testFetchGlobalReturnsArrayValues(): void
431431
$result = $this->request->fetchGlobal('post');
432432

433433
$this->assertSame($post, $result);
434-
$this->assertIsArray($result['ANNOUNCEMENTS']);
435434
$this->assertCount(2, $result['ANNOUNCEMENTS']);
436435
}
437436

‎tests/system/HTTP/RequestTest.php‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ public function testFetchGlobalReturnsArrayValues(): void
195195
$result = $this->request->fetchGlobal('post');
196196

197197
$this->assertSame($post, $result);
198-
$this->assertIsArray($result['ANNOUNCEMENTS']);
199198
$this->assertCount(2, $result['ANNOUNCEMENTS']);
200199
}
201200

‎tests/system/HTTP/URITest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,7 @@ public function testSetURISilent(): void
11921192

11931193
$uri->setSilent()->setURI($url);
11941194

1195-
$this->assertTrue(true);
1195+
$this->expectNotToPerformAssertions();
11961196
}
11971197

11981198
public function testCreateURIStringNoArguments(): void

‎tests/system/Helpers/TextHelperTest.php‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ public function testRandomString(): void
130130
$this->assertSame(16, strlen(random_string('numeric', 16)));
131131
$this->assertSame(8, strlen(random_string('numeric')));
132132

133-
$this->assertSame(16, strlen($random = random_string('crypto', 16)));
134-
$this->assertIsString($random);
133+
$this->assertSame(16, strlen(random_string('crypto', 16)));
135134
}
136135

137136
/**

0 commit comments

Comments
 (0)