Skip to content

Commit

Permalink
Refactor test cleanup with variable for script directory
Browse files Browse the repository at this point in the history
Replace repeated directory paths with a variable to improve readability and maintainability. This ensures consistent usage of the script directory across test methods.
  • Loading branch information
koriym committed Jan 14, 2025
1 parent 1d5a54b commit 9d9d413
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/CompiledInjectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ public function testSingleton(): void

public function testSerialize(): void
{
deleteFiles(__DIR__ . '/tmp');
$scriptDir = __DIR__ . '/tmp';
deleteFiles($scriptDir);
(new Compiler())->compile($scriptDir, new FakeLazyModule());
$injector = new CompiledInjector($scriptDir);
$injector = unserialize(serialize($injector));
Expand All @@ -78,9 +78,9 @@ public function testSerialize(): void

public function testUnbound(): void
{
deleteFiles(__DIR__ . '/tmp');
$this->expectException(Unbound::class);
$scriptDir = __DIR__ . '/tmp';
deleteFiles($scriptDir);
$this->expectException(Unbound::class);
$injector = new CompiledInjector($scriptDir);
$injector->getInstance(FakeCar2::class);
}
Expand Down

0 comments on commit 9d9d413

Please sign in to comment.