Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/reusable-serviceless-phpunit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ jobs:
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test-random-execution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ jobs:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
fetch-depth: 0

- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0
Expand Down
17 changes: 0 additions & 17 deletions tests/system/AutoReview/CreateNewChangelogTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,6 @@ final class CreateNewChangelogTest extends TestCase
{
private string $currentVersion;

public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();

if (getenv('GITHUB_ACTIONS') !== false) {
exec('git fetch --unshallow 2>&1', $output, $exitCode);
exec('git fetch --tags 2>&1', $output, $exitCode);

if ($exitCode !== 0) {
self::fail(sprintf(
"Failed to fetch git history and tags.\nOutput: %s",
implode("\n", $output),
));
}
}
}

protected function setUp(): void
{
parent::setUp();
Expand Down
22 changes: 6 additions & 16 deletions tests/system/AutoReview/FrameworkCodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,9 @@ private static function getTestClasses(): array

$testClasses = array_map(
static function (SplFileInfo $file) use ($directory): string {
$relativePath = substr_replace(
$file->getPathname(),
'',
0,
strlen($directory),
);
$relativePath = substr_replace(
$relativePath,
'',
strlen($relativePath) - strlen(DIRECTORY_SEPARATOR . $file->getBasename()),
);
$relativePath = substr($file->getPathname(), strlen($directory));
$separatorPos = strrpos($relativePath, DIRECTORY_SEPARATOR);
$relativePath = $separatorPos === false ? '' : substr($relativePath, 0, $separatorPos);

return sprintf(
'CodeIgniter\\%s%s%s',
Expand All @@ -128,17 +120,15 @@ static function (SplFileInfo $file) use ($directory): string {
},
array_filter(
iterator_to_array($iterator, false),
// Filename-based heuristic: avoids the is_subclass_of() cold-autoload issue
// by only considering files that end with "Test.php" or "TestCase.php".
static fn (SplFileInfo $file): bool => $file->isFile()
&& (str_ends_with($file->getBasename(), 'Test.php') || str_ends_with($file->getBasename(), 'TestCase.php'))
&& ! str_contains($file->getPathname(), DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR)
&& ! str_contains($file->getPathname(), DIRECTORY_SEPARATOR . 'Views' . DIRECTORY_SEPARATOR),
),
);

$testClasses = array_filter(
$testClasses,
static fn (string $class): bool => is_subclass_of($class, TestCase::class),
);

sort($testClasses);

self::$testClasses = $testClasses;
Expand Down
Loading