chore: coding style changes

This commit is contained in:
nuno maduro
2026-08-07 14:52:56 +01:00
parent eb88513baf
commit 42d9b777bf
221 changed files with 139 additions and 3086 deletions
-1
View File
@@ -34,7 +34,6 @@ describe('keysWithPrefix()', function (): void {
$state = new FileState($this->root);
$state->write('worker-edges-a.json', '{}');
// Simulate another process mid-write: its temp file exists but has not been renamed yet.
file_put_contents($this->root.'/worker-edges-b.json.'.bin2hex(random_bytes(4)).'.tmp', '{');
expect($state->keysWithPrefix('worker-edges-'))->toBe(['worker-edges-a.json']);
+20 -1
View File
@@ -232,6 +232,26 @@ describe('Livewire component views', function (): void {
'index convention' => ['resources/views/components/post/⚡index', 'resources/views/components/post/⚡index/index.blade.php'],
]);
it('maps a changed MFC sibling through the component directory hash', function (string $sibling, string $generated): void {
$componentDirectory = 'resources/views/components/post/⚡create';
$hash = substr(md5(DIRECTORY_SEPARATOR.str_replace('/', DIRECTORY_SEPARATOR, $componentDirectory)), 0, 8);
mkdir($this->projectRoot.'/'.$componentDirectory, 0755, true);
file_put_contents($this->projectRoot.'/'.$componentDirectory.'/create.blade.php', '<div>Component</div>');
file_put_contents($this->projectRoot.'/'.$componentDirectory.'/create.php', '<?php');
file_put_contents($this->projectRoot.'/'.$componentDirectory.'/create.js', '// js');
$graph = new Graph($this->projectRoot);
$graph->link('tests/Feature/ComponentTest.php', 'storage/framework/views/test_7/livewire/'.str_replace('{hash}', $hash, $generated));
$graph->link('tests/Feature/UnrelatedTest.php', 'storage/framework/views/test_8/livewire/views/deadbeef.blade.php');
expect($graph->affected([$componentDirectory.'/'.$sibling]))->toBe(['tests/Feature/ComponentTest.php']);
})->with([
'class sibling via the generated class' => ['create.php', 'classes/{hash}.php'],
'class sibling via the generated view' => ['create.php', 'views/{hash}.blade.php'],
'asset sibling via the generated view' => ['create.js', 'views/{hash}.blade.php'],
]);
it('preserves direct view edges for class-based components', function (): void {
$viewPath = 'resources/views/livewire/create-post.blade.php';
@@ -279,7 +299,6 @@ describe('markKnownTestFiles()', function (): void {
$graph->markKnownTestFiles(['tests/Feature/UserTest.php']);
// The pre-existing edge survives — the test still depends on the source file.
$affected = $graph->affected(['app/Models/User.php']);
expect($affected)->toContain('tests/Feature/UserTest.php');
@@ -3,11 +3,6 @@
use Pest\Plugins\Tia;
test('does not throw when an integer --random-order-seed is passed as a separate argv element', function (): void {
// Mirrors the parallel worker argv (see bin/worker.php), where
// `--random-order-seed` and its value arrive as separate items and the
// seed value is an int rather than a string. Regression test for the
// str_starts_with() TypeError in Tia::argumentPresent() — the same class
// of bug as #1206, which was only fixed in HandleArguments.
$arguments = ['--order-by=random', '--random-order-seed', 1782350398];
expect(Tia::isEnabledForRun($arguments))->toBeFalse();
-1
View File
@@ -38,7 +38,6 @@ describe('activateLinkTracking()', function (): void {
$recorder->linkSource('/project/resources/views/welcome.blade.php');
$recorder->endTest();
// A second test must start cleanly — endTest resets state even with no driver.
$recorder->beginTest('Some\Missing\TestClass', 'second', '/project/tests/Feature/SecondTest.php');
$recorder->linkSource('/project/resources/views/about.blade.php');
$recorder->endTest();
-3
View File
@@ -78,9 +78,6 @@ it('keys a result per dataset row rather than per method', function (): void {
$collector->testSkipped('the fake driver does not report balances');
$collector->finishTest();
// Without the dataset in the key both rows write to `Class::method`, so the
// second one overwrites the first and a replay hands every row the same
// status — a passing row reported as skipped, or a failing one as passed.
expect(array_keys($collector->all()))->toBe([
'Tests\Feature\OrderTest::it prices an order#opp',
'Tests\Feature\OrderTest::it prices an order#fake',
@@ -48,10 +48,6 @@ describe('fromSql()', function (): void {
});
it('does not leak int keys for numeric identifiers', function (): void {
// `substring(x FROM 1 FOR 3)` is standard SQL, and the `1` matches the
// FROM pattern. Collecting names as array keys makes PHP coerce the
// numeric string to an int, which then violates the declared
// list<string> and blows up Recorder::linkTable(string).
expect(TableExtractor::fromSql('select substring(name from 1 for 3) from users'))
->each->toBeString();
});
@@ -99,9 +95,6 @@ describe('fromMigrationSource()', function (): void {
});
it('does not leak int keys for numeric table names', function (): void {
// A table named `123` is a legal quoted identifier. Collecting names as
// array keys makes PHP coerce it to an int, breaking the declared
// list<string>, so it must survive as a string rather than be dropped.
expect(TableExtractor::fromMigrationSource("DB::table('123')->insert([]);"))
->toBe(['123']);
});
-3
View File
@@ -57,9 +57,6 @@ describe('isTestFile()', function (): void {
->and($paths->isTestFile('tests/Unit/Helper.php'))->toBeTrue();
});
// Regression: a suffix of "Test.php" must match "ExampleTest.php". A previous
// normalisation prepended a dot (".Test.php"), which matched nothing and left
// edited tests looking unchanged to TIA, replaying stale results.
it('does not require a dot before the suffix', function (): void {
$paths = new TestPaths(
directories: ['tests/Unit'],