Skip to content
Snippets Groups Projects
Commit bb204bd0 authored by Adam G-H's avatar Adam G-H
Browse files

Issue #3358012 by phenaproxima, Wim Leers: StageBase::stageDirectoryExists() breaks on PreCreate

parent 71f849dc
No related branches found
No related tags found
No related merge requests found
......@@ -746,10 +746,9 @@ abstract class StageBase implements LoggerAwareInterface {
*/
public function stageDirectoryExists(): bool {
try {
$this->getStageDirectory();
return TRUE;
return is_dir($this->getStageDirectory());
}
catch (\LogicException $e) {
catch (\LogicException) {
return FALSE;
}
}
......
......@@ -655,6 +655,16 @@ class StageBaseTest extends PackageManagerKernelTestBase {
* @covers ::stageDirectoryExists
*/
public function testStageDirectoryExists(): void {
// Ensure that stageDirectoryExists() returns an accurate result during
// pre-create.
$listener = function (StageEvent $event): void {
$stage = $event->stage;
// The directory should not exist yet, because we are still in pre-create.
$this->assertDirectoryDoesNotExist($stage->getStageDirectory());
$this->assertFalse($stage->stageDirectoryExists());
};
$this->addEventTestListener($listener, PreCreateEvent::class);
$stage = $this->createStage();
$this->assertFalse($stage->stageDirectoryExists());
$stage->create();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment