From a3da5888290671d3baede3e79fabce1a2242865b Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 16 Oct 2025 07:54:44 -0600 Subject: [PATCH] should fix tests this time Signed-off-by: Andy Miller --- system/recovery.flag | 3 +++ tests/unit/Grav/Common/Recovery/RecoveryManagerTest.php | 8 ++++++-- tests/unit/Grav/Common/Upgrade/SafeUpgradeServiceTest.php | 8 ++++++-- tests/unit/Grav/Console/Gpm/RollbackCommandTest.php | 3 ++- tests/unit/Grav/Console/Gpm/SelfupgradeCommandTest.php | 7 ++++--- 5 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 system/recovery.flag diff --git a/system/recovery.flag b/system/recovery.flag new file mode 100644 index 000000000..7092baa39 --- /dev/null +++ b/system/recovery.flag @@ -0,0 +1,3 @@ +{ + "token": "2d1aaf07ea67021fa3adb08ac80cf0a4" +} diff --git a/tests/unit/Grav/Common/Recovery/RecoveryManagerTest.php b/tests/unit/Grav/Common/Recovery/RecoveryManagerTest.php index 4fe893c59..d0035058e 100644 --- a/tests/unit/Grav/Common/Recovery/RecoveryManagerTest.php +++ b/tests/unit/Grav/Common/Recovery/RecoveryManagerTest.php @@ -8,19 +8,23 @@ class RecoveryManagerTest extends \PHPUnit\Framework\TestCase /** @var string */ private $tmpDir; - protected function _before(): void + protected function setUp(): void { + parent::setUp(); + $this->tmpDir = sys_get_temp_dir() . '/grav-recovery-' . uniqid('', true); Folder::create($this->tmpDir); Folder::create($this->tmpDir . '/user'); Folder::create($this->tmpDir . '/system'); } - protected function _after(): void + protected function tearDown(): void { if (is_dir($this->tmpDir)) { Folder::delete($this->tmpDir); } + + parent::tearDown(); } public function testHandleShutdownQuarantinesPluginAndCreatesFlag(): void diff --git a/tests/unit/Grav/Common/Upgrade/SafeUpgradeServiceTest.php b/tests/unit/Grav/Common/Upgrade/SafeUpgradeServiceTest.php index ecece2693..43bec9258 100644 --- a/tests/unit/Grav/Common/Upgrade/SafeUpgradeServiceTest.php +++ b/tests/unit/Grav/Common/Upgrade/SafeUpgradeServiceTest.php @@ -8,17 +8,21 @@ class SafeUpgradeServiceTest extends \PHPUnit\Framework\TestCase /** @var string */ private $tmpDir; - protected function _before(): void + protected function setUp(): void { + parent::setUp(); + $this->tmpDir = sys_get_temp_dir() . '/grav-safe-upgrade-' . uniqid('', true); Folder::create($this->tmpDir); } - protected function _after(): void + protected function tearDown(): void { if (is_dir($this->tmpDir)) { Folder::delete($this->tmpDir); } + + parent::tearDown(); } public function testPreflightAggregatesWarnings(): void diff --git a/tests/unit/Grav/Console/Gpm/RollbackCommandTest.php b/tests/unit/Grav/Console/Gpm/RollbackCommandTest.php index 353b61955..d5fee85c6 100644 --- a/tests/unit/Grav/Console/Gpm/RollbackCommandTest.php +++ b/tests/unit/Grav/Console/Gpm/RollbackCommandTest.php @@ -5,6 +5,7 @@ use Grav\Common\Upgrade\SafeUpgradeService; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\BufferedOutput; +use Symfony\Component\Console\Question\Question; use Symfony\Component\Console\Style\SymfonyStyle; class RollbackCommandTest extends \PHPUnit\Framework\TestCase @@ -233,7 +234,7 @@ class RollbackMemoryStyle extends SymfonyStyle parent::success($message); } - public function askQuestion($question) + public function askQuestion(Question $question): mixed { if ($this->responses) { return array_shift($this->responses); diff --git a/tests/unit/Grav/Console/Gpm/SelfupgradeCommandTest.php b/tests/unit/Grav/Console/Gpm/SelfupgradeCommandTest.php index 4fd9687f1..6f87e1a3c 100644 --- a/tests/unit/Grav/Console/Gpm/SelfupgradeCommandTest.php +++ b/tests/unit/Grav/Console/Gpm/SelfupgradeCommandTest.php @@ -5,6 +5,7 @@ use Grav\Console\Gpm\SelfupgradeCommand; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\BufferedOutput; +use Symfony\Component\Console\Question\Question; use Symfony\Component\Console\Style\SymfonyStyle; class SelfupgradeCommandTest extends \PHPUnit\Framework\TestCase @@ -193,7 +194,7 @@ class SelfUpgradeMemoryStyle extends SymfonyStyle parent::writeln($messages, $type); } - public function askQuestion($question) + public function askQuestion(Question $question): mixed { if ($this->responses) { return array_shift($this->responses); @@ -202,12 +203,12 @@ class SelfUpgradeMemoryStyle extends SymfonyStyle return parent::askQuestion($question); } - public function choice($question, array $choices, $default = null, $attempts = null, $errorMessage = 'Invalid value.') + public function choice(string $question, array $choices, mixed $default = null, bool $multiSelect = false): mixed { if ($this->responses) { return array_shift($this->responses); } - return parent::choice($question, $choices, $default, $attempts, $errorMessage); + return parent::choice($question, $choices, $default, $multiSelect); } }