From f7d0451545e68a95ff65b12b58c81d7f306073e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Wed, 30 Mar 2022 17:44:02 +0200 Subject: [PATCH] Re-create tmp dir as well if needed --- src/Commands/Migrate.php | 3 +-- src/Commands/Rollback.php | 2 +- src/Concerns/ExtendsLaravelCommand.php | 6 ++++++ tests/QueueTest.php | 5 +++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Commands/Migrate.php b/src/Commands/Migrate.php index a74497e5..f14bb49c 100644 --- a/src/Commands/Migrate.php +++ b/src/Commands/Migrate.php @@ -23,8 +23,7 @@ class Migrate extends MigrateCommand { parent::__construct($migrator, $dispatcher); - // Add the --tenants option - $this->specifyParameters(); + $this->specifyTenantSignature(); } /** diff --git a/src/Commands/Rollback.php b/src/Commands/Rollback.php index 5dfb83b1..d00a0c4f 100644 --- a/src/Commands/Rollback.php +++ b/src/Commands/Rollback.php @@ -37,7 +37,7 @@ class Rollback extends RollbackCommand { parent::__construct($migrator); - $this->specifyParameters(); + $this->specifyTenantSignature(); } /** diff --git a/src/Concerns/ExtendsLaravelCommand.php b/src/Concerns/ExtendsLaravelCommand.php index 85438f4c..f40c85f7 100644 --- a/src/Concerns/ExtendsLaravelCommand.php +++ b/src/Concerns/ExtendsLaravelCommand.php @@ -4,6 +4,12 @@ namespace Stancl\Tenancy\Concerns; trait ExtendsLaravelCommand { + protected function specifyTenantSignature(): void + { + $this->setName('tenants:migrate'); + $this->specifyParameters(); + } + public function getName(): ?string { return static::getDefaultName(); diff --git a/tests/QueueTest.php b/tests/QueueTest.php index ac1bf799..a3df9cd7 100644 --- a/tests/QueueTest.php +++ b/tests/QueueTest.php @@ -67,6 +67,11 @@ class QueueTest extends TestCase $valueStorePath = __DIR__ . '/Etc/tmp/queuetest.json'; if (! file_exists($valueStorePath)) { + // The directory sometimes goes missing as well when the file is deleted in git + if (! is_dir(__DIR__ . '/Etc/tmp')) { + mkdir(__DIR__ . '/Etc/tmp'); + } + file_put_contents($valueStorePath, ''); }