Improvements to BootManagerTest

This commit is contained in:
Chris Kankiewicz
2021-06-25 17:52:29 -07:00
parent b1c3054f91
commit a1d79806dd
2 changed files with 16 additions and 6 deletions

View File

@@ -12,10 +12,20 @@ class BootManagerTest extends TestCase
/** Path to the compiled container. */
private const COMPILED_CONTAINER_PATH = 'app/cache/CompiledContainer.php';
/** @var string The compiled container path */
private $compiledContainerPath;
protected function setUp(): void
{
parent::setUp();
$this->compiledContainerPath = $this->filePath(self::COMPILED_CONTAINER_PATH);
}
protected function tearDown(): void
{
if (file_exists($this->filePath(self::COMPILED_CONTAINER_PATH))) {
unlink($this->filePath(self::COMPILED_CONTAINER_PATH));
if (file_exists($this->compiledContainerPath)) {
unlink($this->compiledContainerPath);
}
parent::tearDown();
@@ -32,7 +42,7 @@ class BootManagerTest extends TestCase
);
$this->assertInstanceOf(Container::class, $container);
$this->assertFileExists($this->filePath(self::COMPILED_CONTAINER_PATH));
$this->assertFileExists($this->compiledContainerPath);
}
/** @test */
@@ -46,7 +56,7 @@ class BootManagerTest extends TestCase
);
$this->assertInstanceOf(Container::class, $container);
$this->assertFileDoesNotExist($this->filePath('app/cache/CompiledContainer.php'));
$this->assertFileDoesNotExist($this->compiledContainerPath);
}
/** @test */
@@ -60,6 +70,6 @@ class BootManagerTest extends TestCase
);
$this->assertInstanceOf(Container::class, $container);
$this->assertFileDoesNotExist($this->filePath('app/cache/CompiledContainer.php'));
$this->assertFileDoesNotExist($this->compiledContainerPath);
}
}

View File

@@ -44,6 +44,6 @@ class TestCase extends BaseTestCase
/** Get the file path to a test file. */
protected function filePath(string $filePath): string
{
return realpath($this->testFilesPath . '/' . $filePath);
return sprintf('%s/%s', $this->testFilesPath, $filePath);
}
}