From f2239b6156f54384c21909a23a0b55b13f54b802 Mon Sep 17 00:00:00 2001 From: Maksim Mikhailov <2618094@gmail.com> Date: Thu, 11 Feb 2021 19:57:40 +0300 Subject: [PATCH] update tests --- src/Deploy/Strategy/ReleasesStrategy.php | 4 +-- src/Deploy/Strategy/RsyncStrategy.php | 2 +- src/Runtime/Runtime.php | 2 +- .../BuiltIn/DeployCommandMiscTasksTest.php | 8 +++--- .../Command/BuiltIn/DeployCommandMiscTest.php | 6 ++--- .../BuiltIn/DeployCommandWithReleasesTest.php | 26 +++++++++---------- .../DeployCommandWithoutReleasesTest.php | 2 +- .../BuiltIn/Releases/ListCommandTest.php | 12 ++++----- .../BuiltIn/Releases/RollbackCommandTest.php | 6 ++--- tests/Deploy/StrategyTest.php | 20 +++++++------- tests/MageApplicationTest.php | 2 +- tests/Runtime/RuntimeTest.php | 0 .../Composer/BasicComposerTaskTest.php | 0 tests/Task/BuiltIn/ExecTaskTest.php | 6 ++--- .../BuiltIn/FileSystem/ChangeModeTaskTest.php | 14 +++++----- .../Task/BuiltIn/FileSystem/CopyTaskTest.php | 18 ++++++------- .../Task/BuiltIn/FileSystem/LinkTaskTest.php | 14 +++++----- .../Task/BuiltIn/FileSystem/MoveTaskTest.php | 14 +++++----- .../BuiltIn/FileSystem/RemoveTaskTest.php | 8 +++--- .../Symfony/CachePoolClearTaskTest.php | 2 +- tests/Task/TaskFactoryTest.php | 8 +++--- 21 files changed, 87 insertions(+), 87 deletions(-) mode change 100644 => 100755 src/Deploy/Strategy/ReleasesStrategy.php mode change 100644 => 100755 src/Deploy/Strategy/RsyncStrategy.php mode change 100644 => 100755 src/Runtime/Runtime.php mode change 100644 => 100755 tests/Command/BuiltIn/DeployCommandMiscTasksTest.php mode change 100644 => 100755 tests/Command/BuiltIn/DeployCommandMiscTest.php mode change 100644 => 100755 tests/Command/BuiltIn/DeployCommandWithReleasesTest.php mode change 100644 => 100755 tests/Command/BuiltIn/DeployCommandWithoutReleasesTest.php mode change 100644 => 100755 tests/Command/BuiltIn/Releases/ListCommandTest.php mode change 100644 => 100755 tests/Command/BuiltIn/Releases/RollbackCommandTest.php mode change 100644 => 100755 tests/Deploy/StrategyTest.php mode change 100644 => 100755 tests/MageApplicationTest.php mode change 100644 => 100755 tests/Runtime/RuntimeTest.php mode change 100644 => 100755 tests/Task/BuiltIn/Composer/BasicComposerTaskTest.php mode change 100644 => 100755 tests/Task/BuiltIn/ExecTaskTest.php mode change 100644 => 100755 tests/Task/BuiltIn/FileSystem/ChangeModeTaskTest.php mode change 100644 => 100755 tests/Task/BuiltIn/FileSystem/CopyTaskTest.php mode change 100644 => 100755 tests/Task/BuiltIn/FileSystem/LinkTaskTest.php mode change 100644 => 100755 tests/Task/BuiltIn/FileSystem/MoveTaskTest.php mode change 100644 => 100755 tests/Task/BuiltIn/FileSystem/RemoveTaskTest.php mode change 100644 => 100755 tests/Task/BuiltIn/Symfony/CachePoolClearTaskTest.php mode change 100644 => 100755 tests/Task/TaskFactoryTest.php diff --git a/src/Deploy/Strategy/ReleasesStrategy.php b/src/Deploy/Strategy/ReleasesStrategy.php old mode 100644 new mode 100755 index ec34118..132fdd0 --- a/src/Deploy/Strategy/ReleasesStrategy.php +++ b/src/Deploy/Strategy/ReleasesStrategy.php @@ -110,13 +110,13 @@ class ReleasesStrategy implements StrategyInterface /** * Check the runtime stage is correct * - * @param $stage + * @param string $stage * @throws RuntimeException */ private function checkStage($stage) { if ($this->runtime->getStage() !== $stage) { - throw new RuntimeException(sprintf('Invalid stage, got "%s" but expected "%"', $this->runtime->getStage(), $stage)); + throw new RuntimeException(sprintf('Invalid stage, got "%s" but expected "%s"', $this->runtime->getStage(), $stage)); } } } diff --git a/src/Deploy/Strategy/RsyncStrategy.php b/src/Deploy/Strategy/RsyncStrategy.php old mode 100644 new mode 100755 index 499a6f6..2be748e --- a/src/Deploy/Strategy/RsyncStrategy.php +++ b/src/Deploy/Strategy/RsyncStrategy.php @@ -90,7 +90,7 @@ class RsyncStrategy implements StrategyInterface private function checkStage($stage) { if ($this->runtime->getStage() !== $stage) { - throw new RuntimeException(sprintf('Invalid stage, got "%s" but expected "%"', $this->runtime->getStage(), $stage)); + throw new RuntimeException(sprintf('Invalid stage, got "%s" but expected "%s"', $this->runtime->getStage(), $stage)); } } } diff --git a/src/Runtime/Runtime.php b/src/Runtime/Runtime.php old mode 100644 new mode 100755 index 5b7368d..290134d --- a/src/Runtime/Runtime.php +++ b/src/Runtime/Runtime.php @@ -405,7 +405,7 @@ class Runtime { $this->log($cmd, LogLevel::INFO); - $process = new Process($cmd); + $process = Process::fromShellCommandline($cmd); $process->setTimeout($timeout); $process->run(); diff --git a/tests/Command/BuiltIn/DeployCommandMiscTasksTest.php b/tests/Command/BuiltIn/DeployCommandMiscTasksTest.php old mode 100644 new mode 100755 index 7bad23a..9fb0d8a --- a/tests/Command/BuiltIn/DeployCommandMiscTasksTest.php +++ b/tests/Command/BuiltIn/DeployCommandMiscTasksTest.php @@ -154,7 +154,7 @@ class DeployCommandMiscTasksTest extends TestCase $tester->execute(['command' => $command->getName(), 'environment' => 'test']); $this->assertEquals(7, $tester->getStatusCode()); - $this->assertContains('Invalid task name "invalid/task"', $tester->getDisplay()); + $this->assertStringContainsString('Invalid task name "invalid/task"', $tester->getDisplay()); } public function testBrokenGitBranch() @@ -171,7 +171,7 @@ class DeployCommandMiscTasksTest extends TestCase $tester->execute(['command' => $command->getName(), 'environment' => 'test']); - $this->assertContains('Running [Git] Change Branch (broken-test) ... FAIL', $tester->getDisplay()); + $this->assertStringContainsString('Running [Git] Change Branch (broken-test) ... FAIL', $tester->getDisplay()); $this->assertNotEquals(0, $tester->getStatusCode()); } @@ -189,7 +189,7 @@ class DeployCommandMiscTasksTest extends TestCase $tester->execute(['command' => $command->getName(), 'environment' => 'test']); - $this->assertContains('Running [Git] Change Branch (broken-test) ... FAIL', $tester->getDisplay()); + $this->assertStringContainsString('Running [Git] Change Branch (broken-test) ... FAIL', $tester->getDisplay()); $this->assertNotEquals(0, $tester->getStatusCode()); } @@ -207,7 +207,7 @@ class DeployCommandMiscTasksTest extends TestCase $tester->execute(['command' => $command->getName(), 'environment' => 'test']); - $this->assertContains('Running [Git] Update ... FAIL', $tester->getDisplay()); + $this->assertStringContainsString('Running [Git] Update ... FAIL', $tester->getDisplay()); $this->assertNotEquals(0, $tester->getStatusCode()); } } diff --git a/tests/Command/BuiltIn/DeployCommandMiscTest.php b/tests/Command/BuiltIn/DeployCommandMiscTest.php old mode 100644 new mode 100755 index 4b4cec3..240ee21 --- a/tests/Command/BuiltIn/DeployCommandMiscTest.php +++ b/tests/Command/BuiltIn/DeployCommandMiscTest.php @@ -30,9 +30,9 @@ class DeployCommandMiscTest extends TestCase $tester = new CommandTester($command); $tester->execute(['command' => $command->getName(), 'environment' => 'test']); - $this->assertContains('No hosts defined, skipping On Deploy tasks', $tester->getDisplay()); - $this->assertContains('No hosts defined, skipping On Release tasks', $tester->getDisplay()); - $this->assertContains('No hosts defined, skipping Post Release tasks', $tester->getDisplay()); + $this->assertStringContainsString('No hosts defined, skipping On Deploy tasks', $tester->getDisplay()); + $this->assertStringContainsString('No hosts defined, skipping On Release tasks', $tester->getDisplay()); + $this->assertStringContainsString('No hosts defined, skipping Post Release tasks', $tester->getDisplay()); $this->assertEquals(0, $tester->getStatusCode()); } diff --git a/tests/Command/BuiltIn/DeployCommandWithReleasesTest.php b/tests/Command/BuiltIn/DeployCommandWithReleasesTest.php old mode 100644 new mode 100755 index 366e38d..2e5ee33 --- a/tests/Command/BuiltIn/DeployCommandWithReleasesTest.php +++ b/tests/Command/BuiltIn/DeployCommandWithReleasesTest.php @@ -179,7 +179,7 @@ class DeployCommandWithReleasesTest extends TestCase $tester = new CommandTester($command); $tester->execute(['command' => $command->getName(), 'environment' => 'test']); - $this->assertContains('This task is only available with releases enabled', $tester->getDisplay()); + $this->assertStringContainsString('This task is only available with releases enabled', $tester->getDisplay()); $this->assertNotEquals(0, $tester->getStatusCode()); } @@ -194,7 +194,7 @@ class DeployCommandWithReleasesTest extends TestCase $tester = new CommandTester($command); $tester->execute(['command' => $command->getName(), 'environment' => 'test']); - $this->assertContains('This task is only available with releases enabled', $tester->getDisplay()); + $this->assertStringContainsString('This task is only available with releases enabled', $tester->getDisplay()); $this->assertNotEquals(0, $tester->getStatusCode()); } @@ -209,7 +209,7 @@ class DeployCommandWithReleasesTest extends TestCase $tester = new CommandTester($command); $tester->execute(['command' => $command->getName(), 'environment' => 'test']); - $this->assertContains('This task is only available with releases enabled', $tester->getDisplay()); + $this->assertStringContainsString('This task is only available with releases enabled', $tester->getDisplay()); $this->assertNotEquals(0, $tester->getStatusCode()); } @@ -224,7 +224,7 @@ class DeployCommandWithReleasesTest extends TestCase $tester = new CommandTester($command); $tester->execute(['command' => $command->getName(), 'environment' => 'test']); - $this->assertContains('Copying files with Tar ... FAIL', $tester->getDisplay()); + $this->assertStringContainsString('Copying files with Tar ... FAIL', $tester->getDisplay()); $this->assertNotEquals(0, $tester->getStatusCode()); } @@ -239,7 +239,7 @@ class DeployCommandWithReleasesTest extends TestCase $tester = new CommandTester($command); $tester->execute(['command' => $command->getName(), 'environment' => 'test']); - $this->assertContains('This task is only available with releases enabled', $tester->getDisplay()); + $this->assertStringContainsString('This task is only available with releases enabled', $tester->getDisplay()); $this->assertNotEquals(0, $tester->getStatusCode()); } @@ -280,8 +280,8 @@ class DeployCommandWithReleasesTest extends TestCase $this->assertEquals($command, $ranCommands[$index]); } - $this->assertContains('Running [Deploy] Copying files with Tar ... FAIL', $tester->getDisplay()); - $this->assertContains('Stage "On Deploy" did not finished successfully, halting command.', $tester->getDisplay()); + $this->assertStringContainsString('Running [Deploy] Copying files with Tar ... FAIL', $tester->getDisplay()); + $this->assertStringContainsString('Stage "On Deploy" did not finished successfully, halting command.', $tester->getDisplay()); $this->assertNotEquals(0, $tester->getStatusCode()); } @@ -321,8 +321,8 @@ class DeployCommandWithReleasesTest extends TestCase $this->assertEquals($command, $ranCommands[$index]); } - $this->assertContains('Running [Deploy] Copying files with Tar ... FAIL', $tester->getDisplay()); - $this->assertContains('Stage "On Deploy" did not finished successfully, halting command.', $tester->getDisplay()); + $this->assertStringContainsString('Running [Deploy] Copying files with Tar ... FAIL', $tester->getDisplay()); + $this->assertStringContainsString('Stage "On Deploy" did not finished successfully, halting command.', $tester->getDisplay()); $this->assertNotEquals(0, $tester->getStatusCode()); } @@ -374,8 +374,8 @@ class DeployCommandWithReleasesTest extends TestCase $this->assertEquals($command, $ranCommands[$index]); } - $this->assertContains('Running [Deploy] Cleanup Tar file ... FAIL', $tester->getDisplay()); - $this->assertContains('Stage "Post Deploy" did not finished successfully, halting command.', $tester->getDisplay()); + $this->assertStringContainsString('Running [Deploy] Cleanup Tar file ... FAIL', $tester->getDisplay()); + $this->assertStringContainsString('Stage "Post Deploy" did not finished successfully, halting command.', $tester->getDisplay()); $this->assertNotEquals(0, $tester->getStatusCode()); } @@ -422,8 +422,8 @@ class DeployCommandWithReleasesTest extends TestCase $this->assertEquals($command, $ranCommands[$index]); } - $this->assertContains('Running [Release] Cleaning up old Releases ... FAIL', $tester->getDisplay()); - $this->assertContains('Stage "Post Release" did not finished successfully, halting command.', $tester->getDisplay()); + $this->assertStringContainsString('Running [Release] Cleaning up old Releases ... FAIL', $tester->getDisplay()); + $this->assertStringContainsString('Stage "Post Release" did not finished successfully, halting command.', $tester->getDisplay()); $this->assertNotEquals(0, $tester->getStatusCode()); } } diff --git a/tests/Command/BuiltIn/DeployCommandWithoutReleasesTest.php b/tests/Command/BuiltIn/DeployCommandWithoutReleasesTest.php old mode 100644 new mode 100755 index 4674096..2a2a796 --- a/tests/Command/BuiltIn/DeployCommandWithoutReleasesTest.php +++ b/tests/Command/BuiltIn/DeployCommandWithoutReleasesTest.php @@ -161,7 +161,7 @@ class DeployCommandWithoutReleasesTest extends TestCase $this->assertEquals($command, $ranCommands[$index]); } - $this->assertContains('Stage "On Deploy" did not finished successfully, halting command.', $tester->getDisplay()); + $this->assertStringContainsString('Stage "On Deploy" did not finished successfully, halting command.', $tester->getDisplay()); $this->assertNotEquals(0, $tester->getStatusCode()); } } diff --git a/tests/Command/BuiltIn/Releases/ListCommandTest.php b/tests/Command/BuiltIn/Releases/ListCommandTest.php old mode 100644 new mode 100755 index 8c06412..515b584 --- a/tests/Command/BuiltIn/Releases/ListCommandTest.php +++ b/tests/Command/BuiltIn/Releases/ListCommandTest.php @@ -57,7 +57,7 @@ class ListCommandTest extends TestCase $tester->execute(['command' => $command->getName(), 'environment' => 'developers']); $this->assertNotEquals(0, $tester->getStatusCode()); - $this->assertContains('The environment "developers" does not exists.', $tester->getDisplay()); + $this->assertStringContainsString('The environment "developers" does not exists.', $tester->getDisplay()); } public function testListReleasesWithoutReleases() @@ -72,7 +72,7 @@ class ListCommandTest extends TestCase $tester->execute(['command' => $command->getName(), 'environment' => 'test']); $this->assertNotEquals(0, $tester->getStatusCode()); - $this->assertContains('Releases are not enabled', $tester->getDisplay()); + $this->assertStringContainsString('Releases are not enabled', $tester->getDisplay()); } public function testFailToGetCurrentRelease() @@ -87,7 +87,7 @@ class ListCommandTest extends TestCase $tester->execute(['command' => $command->getName(), 'environment' => 'test']); $this->assertNotEquals(0, $tester->getStatusCode()); - $this->assertContains('Unable to retrieve current release from host "host1"', $tester->getDisplay()); + $this->assertStringContainsString('Unable to retrieve current release from host "host1"', $tester->getDisplay()); } public function testNoReleasesAvailable() @@ -101,7 +101,7 @@ class ListCommandTest extends TestCase $tester = new CommandTester($command); $tester->execute(['command' => $command->getName(), 'environment' => 'test']); - $this->assertContains('No releases available on host host2', $tester->getDisplay()); + $this->assertStringContainsString('No releases available on host host2', $tester->getDisplay()); } public function testFailGetReleases() @@ -116,7 +116,7 @@ class ListCommandTest extends TestCase $tester->execute(['command' => $command->getName(), 'environment' => 'test']); $this->assertNotEquals(0, $tester->getStatusCode()); - $this->assertContains('Unable to retrieve releases from host "host3"', $tester->getDisplay()); + $this->assertStringContainsString('Unable to retrieve releases from host "host3"', $tester->getDisplay()); } public function testNoHosts() @@ -130,6 +130,6 @@ class ListCommandTest extends TestCase $tester = new CommandTester($command); $tester->execute(['command' => $command->getName(), 'environment' => 'test']); - $this->assertContains('No hosts defined', $tester->getDisplay()); + $this->assertStringContainsString('No hosts defined', $tester->getDisplay()); } } diff --git a/tests/Command/BuiltIn/Releases/RollbackCommandTest.php b/tests/Command/BuiltIn/Releases/RollbackCommandTest.php old mode 100644 new mode 100755 index 17406dd..f2c7849 --- a/tests/Command/BuiltIn/Releases/RollbackCommandTest.php +++ b/tests/Command/BuiltIn/Releases/RollbackCommandTest.php @@ -57,7 +57,7 @@ class RollbackCommandTest extends TestCase $tester->execute(['command' => $command->getName(), 'environment' => 'developers', 'release' => '20170101015115']); $this->assertNotEquals(0, $tester->getStatusCode()); - $this->assertContains('The environment "developers" does not exists.', $tester->getDisplay()); + $this->assertStringContainsString('The environment "developers" does not exists.', $tester->getDisplay()); } public function testRollbackReleaseWithoutReleases() @@ -72,7 +72,7 @@ class RollbackCommandTest extends TestCase $tester->execute(['command' => $command->getName(), 'environment' => 'test', 'release' => '20170101015115']); $this->assertNotEquals(0, $tester->getStatusCode()); - $this->assertContains('Releases are not enabled', $tester->getDisplay()); + $this->assertStringContainsString('Releases are not enabled', $tester->getDisplay()); } public function testRollbackReleaseNotAvailable() @@ -87,6 +87,6 @@ class RollbackCommandTest extends TestCase $tester->execute(['command' => $command->getName(), 'environment' => 'test', 'release' => '20170101015115']); $this->assertNotEquals(0, $tester->getStatusCode()); - $this->assertContains('Release "20170101015115" is not available on all hosts', $tester->getDisplay()); + $this->assertStringContainsString('Release "20170101015115" is not available on all hosts', $tester->getDisplay()); } } diff --git a/tests/Deploy/StrategyTest.php b/tests/Deploy/StrategyTest.php old mode 100644 new mode 100755 index c54beed..9800a02 --- a/tests/Deploy/StrategyTest.php +++ b/tests/Deploy/StrategyTest.php @@ -31,7 +31,7 @@ class StrategyTest extends TestCase $rsync->getPreDeployTasks(); } catch (Exception $exception) { $this->assertTrue($exception instanceof RuntimeException); - $this->assertEquals(sprintf('Invalid stage, got "%s" but expected "%"', Runtime::ON_DEPLOY, Runtime::PRE_DEPLOY), $exception->getMessage()); + $this->assertEquals(sprintf('Invalid stage, got "%s" but expected "%s"', Runtime::ON_DEPLOY, Runtime::PRE_DEPLOY), $exception->getMessage()); } try { @@ -39,7 +39,7 @@ class StrategyTest extends TestCase $rsync->getOnDeployTasks(); } catch (Exception $exception) { $this->assertTrue($exception instanceof RuntimeException); - $this->assertEquals(sprintf('Invalid stage, got "%s" but expected "%"', Runtime::PRE_DEPLOY, Runtime::ON_DEPLOY), $exception->getMessage()); + $this->assertEquals(sprintf('Invalid stage, got "%s" but expected "%s"', Runtime::PRE_DEPLOY, Runtime::ON_DEPLOY), $exception->getMessage()); } try { @@ -47,7 +47,7 @@ class StrategyTest extends TestCase $rsync->getOnReleaseTasks(); } catch (Exception $exception) { $this->assertTrue($exception instanceof RuntimeException); - $this->assertEquals(sprintf('Invalid stage, got "%s" but expected "%"', Runtime::PRE_DEPLOY, Runtime::ON_RELEASE), $exception->getMessage()); + $this->assertEquals(sprintf('Invalid stage, got "%s" but expected "%s"', Runtime::PRE_DEPLOY, Runtime::ON_RELEASE), $exception->getMessage()); } try { @@ -55,7 +55,7 @@ class StrategyTest extends TestCase $rsync->getPostReleaseTasks(); } catch (Exception $exception) { $this->assertTrue($exception instanceof RuntimeException); - $this->assertEquals(sprintf('Invalid stage, got "%s" but expected "%"', Runtime::PRE_DEPLOY, Runtime::POST_RELEASE), $exception->getMessage()); + $this->assertEquals(sprintf('Invalid stage, got "%s" but expected "%s"', Runtime::PRE_DEPLOY, Runtime::POST_RELEASE), $exception->getMessage()); } try { @@ -63,7 +63,7 @@ class StrategyTest extends TestCase $rsync->getPostDeployTasks(); } catch (Exception $exception) { $this->assertTrue($exception instanceof RuntimeException); - $this->assertEquals(sprintf('Invalid stage, got "%s" but expected "%"', Runtime::PRE_DEPLOY, Runtime::POST_DEPLOY), $exception->getMessage()); + $this->assertEquals(sprintf('Invalid stage, got "%s" but expected "%s"', Runtime::PRE_DEPLOY, Runtime::POST_DEPLOY), $exception->getMessage()); } } @@ -79,7 +79,7 @@ class StrategyTest extends TestCase $releases->getPreDeployTasks(); } catch (Exception $exception) { $this->assertTrue($exception instanceof RuntimeException); - $this->assertEquals(sprintf('Invalid stage, got "%s" but expected "%"', Runtime::ON_DEPLOY, Runtime::PRE_DEPLOY), $exception->getMessage()); + $this->assertEquals(sprintf('Invalid stage, got "%s" but expected "%s"', Runtime::ON_DEPLOY, Runtime::PRE_DEPLOY), $exception->getMessage()); } try { @@ -87,7 +87,7 @@ class StrategyTest extends TestCase $releases->getOnDeployTasks(); } catch (Exception $exception) { $this->assertTrue($exception instanceof RuntimeException); - $this->assertEquals(sprintf('Invalid stage, got "%s" but expected "%"', Runtime::PRE_DEPLOY, Runtime::ON_DEPLOY), $exception->getMessage()); + $this->assertEquals(sprintf('Invalid stage, got "%s" but expected "%s"', Runtime::PRE_DEPLOY, Runtime::ON_DEPLOY), $exception->getMessage()); } try { @@ -95,7 +95,7 @@ class StrategyTest extends TestCase $releases->getOnReleaseTasks(); } catch (Exception $exception) { $this->assertTrue($exception instanceof RuntimeException); - $this->assertEquals(sprintf('Invalid stage, got "%s" but expected "%"', Runtime::PRE_DEPLOY, Runtime::ON_RELEASE), $exception->getMessage()); + $this->assertEquals(sprintf('Invalid stage, got "%s" but expected "%s"', Runtime::PRE_DEPLOY, Runtime::ON_RELEASE), $exception->getMessage()); } try { @@ -103,7 +103,7 @@ class StrategyTest extends TestCase $releases->getPostReleaseTasks(); } catch (Exception $exception) { $this->assertTrue($exception instanceof RuntimeException); - $this->assertEquals(sprintf('Invalid stage, got "%s" but expected "%"', Runtime::PRE_DEPLOY, Runtime::POST_RELEASE), $exception->getMessage()); + $this->assertEquals(sprintf('Invalid stage, got "%s" but expected "%s"', Runtime::PRE_DEPLOY, Runtime::POST_RELEASE), $exception->getMessage()); } try { @@ -111,7 +111,7 @@ class StrategyTest extends TestCase $releases->getPostDeployTasks(); } catch (Exception $exception) { $this->assertTrue($exception instanceof RuntimeException); - $this->assertEquals(sprintf('Invalid stage, got "%s" but expected "%"', Runtime::PRE_DEPLOY, Runtime::POST_DEPLOY), $exception->getMessage()); + $this->assertEquals(sprintf('Invalid stage, got "%s" but expected "%s"', Runtime::PRE_DEPLOY, Runtime::POST_DEPLOY), $exception->getMessage()); } } diff --git a/tests/MageApplicationTest.php b/tests/MageApplicationTest.php old mode 100644 new mode 100755 index 891cd9d..3893806 --- a/tests/MageApplicationTest.php +++ b/tests/MageApplicationTest.php @@ -73,6 +73,6 @@ class MageApplicationTest extends TestCase $tester = new ApplicationTester($application); $tester->run(['command' => 'foo']); - $this->assertContains('Oops, exception thrown while running command foo', $tester->getDisplay()); + $this->assertStringContainsString('Oops, exception thrown while running command foo', $tester->getDisplay()); } } diff --git a/tests/Runtime/RuntimeTest.php b/tests/Runtime/RuntimeTest.php old mode 100644 new mode 100755 diff --git a/tests/Task/BuiltIn/Composer/BasicComposerTaskTest.php b/tests/Task/BuiltIn/Composer/BasicComposerTaskTest.php old mode 100644 new mode 100755 diff --git a/tests/Task/BuiltIn/ExecTaskTest.php b/tests/Task/BuiltIn/ExecTaskTest.php old mode 100644 new mode 100755 index c500ad0..048670c --- a/tests/Task/BuiltIn/ExecTaskTest.php +++ b/tests/Task/BuiltIn/ExecTaskTest.php @@ -28,7 +28,7 @@ class ExecTest extends TestCase $task->setOptions(['cmd' => 'ls -l', 'desc' => 'Loading docker']); $task->setRuntime($runtime); - $this->assertContains('[Exec] Loading docker', $task->getDescription()); + $this->assertStringContainsString('[Exec] Loading docker', $task->getDescription()); $task->execute(); $ranCommands = $runtime->getRanCommands(); @@ -56,7 +56,7 @@ class ExecTest extends TestCase $task->setOptions(['cmd' => 'ls -la']); $task->setRuntime($runtime); - $this->assertContains('[Exec] Custom command', $task->getDescription()); + $this->assertStringContainsString('[Exec] Custom command', $task->getDescription()); $task->execute(); $ranCommands = $runtime->getRanCommands(); @@ -84,7 +84,7 @@ class ExecTest extends TestCase $task->setOptions(['desc' => 'Loading docker']); $task->setRuntime($runtime); - $this->assertContains('[Exec] Loading docker', $task->getDescription()); + $this->assertStringContainsString('[Exec] Loading docker', $task->getDescription()); try { $task->execute(); diff --git a/tests/Task/BuiltIn/FileSystem/ChangeModeTaskTest.php b/tests/Task/BuiltIn/FileSystem/ChangeModeTaskTest.php old mode 100644 new mode 100755 index 2456502..877caa2 --- a/tests/Task/BuiltIn/FileSystem/ChangeModeTaskTest.php +++ b/tests/Task/BuiltIn/FileSystem/ChangeModeTaskTest.php @@ -28,8 +28,8 @@ class ChangeModeTest extends TestCase $task->setOptions(['file' => 'a.txt', 'flags' => '-R', 'mode' => 'o+w']); $task->setRuntime($runtime); - $this->assertContains('a.txt', $task->getDescription()); - $this->assertContains('o+w', $task->getDescription()); + $this->assertStringContainsString('a.txt', $task->getDescription()); + $this->assertStringContainsString('o+w', $task->getDescription()); $task->execute(); $ranCommands = $runtime->getRanCommands(); @@ -57,8 +57,8 @@ class ChangeModeTest extends TestCase $task->setOptions(['file' => 'a.txt', 'mode' => 'o+w']); $task->setRuntime($runtime); - $this->assertContains('a.txt', $task->getDescription()); - $this->assertContains('o+w', $task->getDescription()); + $this->assertStringContainsString('a.txt', $task->getDescription()); + $this->assertStringContainsString('o+w', $task->getDescription()); $task->execute(); $ranCommands = $runtime->getRanCommands(); @@ -86,8 +86,8 @@ class ChangeModeTest extends TestCase $task->setOptions(['file' => '%environment%.txt', 'flags' => '-R', 'mode' => 'o+w']); $task->setRuntime($runtime); - $this->assertContains('test.txt', $task->getDescription()); - $this->assertContains('o+w', $task->getDescription()); + $this->assertStringContainsString('test.txt', $task->getDescription()); + $this->assertStringContainsString('o+w', $task->getDescription()); $task->execute(); $ranCommands = $runtime->getRanCommands(); @@ -116,7 +116,7 @@ class ChangeModeTest extends TestCase $task->setRuntime($runtime); try { - $this->assertContains('[missing parameters]', $task->getDescription()); + $this->assertStringContainsString('[missing parameters]', $task->getDescription()); $task->execute(); $this->assertTrue(false, 'Task should have raised an exception'); } catch (Exception $exception) { diff --git a/tests/Task/BuiltIn/FileSystem/CopyTaskTest.php b/tests/Task/BuiltIn/FileSystem/CopyTaskTest.php old mode 100644 new mode 100755 index 0242b97..28830d8 --- a/tests/Task/BuiltIn/FileSystem/CopyTaskTest.php +++ b/tests/Task/BuiltIn/FileSystem/CopyTaskTest.php @@ -28,8 +28,8 @@ class CopyTaskTest extends TestCase $task->setOptions(['from' => 'a.txt', 'to' => 'b.txt']); $task->setRuntime($runtime); - $this->assertContains('a.txt', $task->getDescription()); - $this->assertContains('b.txt', $task->getDescription()); + $this->assertStringContainsString('a.txt', $task->getDescription()); + $this->assertStringContainsString('b.txt', $task->getDescription()); $task->execute(); $ranCommands = $runtime->getRanCommands(); @@ -57,8 +57,8 @@ class CopyTaskTest extends TestCase $task->setOptions(['from' => 'a.txt', 'to' => 'b.txt', 'flags' => '-rp']); $task->setRuntime($runtime); - $this->assertContains('a.txt', $task->getDescription()); - $this->assertContains('b.txt', $task->getDescription()); + $this->assertStringContainsString('a.txt', $task->getDescription()); + $this->assertStringContainsString('b.txt', $task->getDescription()); $task->execute(); $ranCommands = $runtime->getRanCommands(); @@ -86,8 +86,8 @@ class CopyTaskTest extends TestCase $task->setOptions(['from' => '%environment%.txt', 'to' => 'b.txt']); $task->setRuntime($runtime); - $this->assertContains('test.txt', $task->getDescription()); - $this->assertContains('b.txt', $task->getDescription()); + $this->assertStringContainsString('test.txt', $task->getDescription()); + $this->assertStringContainsString('b.txt', $task->getDescription()); $task->execute(); $ranCommands = $runtime->getRanCommands(); @@ -117,8 +117,8 @@ class CopyTaskTest extends TestCase $task->setOptions(['from' => '%host%.txt', 'to' => '%release%.yml']); $task->setRuntime($runtime); - $this->assertContains('localhost.txt', $task->getDescription()); - $this->assertContains('1234.yml', $task->getDescription()); + $this->assertStringContainsString('localhost.txt', $task->getDescription()); + $this->assertStringContainsString('1234.yml', $task->getDescription()); $task->execute(); $ranCommands = $runtime->getRanCommands(); @@ -147,7 +147,7 @@ class CopyTaskTest extends TestCase $task->setRuntime($runtime); try { - $this->assertContains('[missing parameters]', $task->getDescription()); + $this->assertStringContainsString('[missing parameters]', $task->getDescription()); $task->execute(); $this->assertTrue(false, 'Task did not failed'); } catch (Exception $exception) { diff --git a/tests/Task/BuiltIn/FileSystem/LinkTaskTest.php b/tests/Task/BuiltIn/FileSystem/LinkTaskTest.php old mode 100644 new mode 100755 index f7bd858..4b29658 --- a/tests/Task/BuiltIn/FileSystem/LinkTaskTest.php +++ b/tests/Task/BuiltIn/FileSystem/LinkTaskTest.php @@ -28,8 +28,8 @@ class LinkTaskTest extends TestCase $task->setOptions(['from' => 'a.txt', 'to' => 'b.txt']); $task->setRuntime($runtime); - $this->assertContains('a.txt', $task->getDescription()); - $this->assertContains('b.txt', $task->getDescription()); + $this->assertStringContainsString('a.txt', $task->getDescription()); + $this->assertStringContainsString('b.txt', $task->getDescription()); $task->execute(); $ranCommands = $runtime->getRanCommands(); @@ -57,8 +57,8 @@ class LinkTaskTest extends TestCase $task->setOptions(['from' => 'a.txt', 'to' => 'b.txt', 'flags' => '-P']); $task->setRuntime($runtime); - $this->assertContains('a.txt', $task->getDescription()); - $this->assertContains('b.txt', $task->getDescription()); + $this->assertStringContainsString('a.txt', $task->getDescription()); + $this->assertStringContainsString('b.txt', $task->getDescription()); $task->execute(); $ranCommands = $runtime->getRanCommands(); @@ -86,8 +86,8 @@ class LinkTaskTest extends TestCase $task->setOptions(['from' => '%environment%.txt', 'to' => 'b.txt']); $task->setRuntime($runtime); - $this->assertContains('test.txt', $task->getDescription()); - $this->assertContains('b.txt', $task->getDescription()); + $this->assertStringContainsString('test.txt', $task->getDescription()); + $this->assertStringContainsString('b.txt', $task->getDescription()); $task->execute(); $ranCommands = $runtime->getRanCommands(); @@ -116,7 +116,7 @@ class LinkTaskTest extends TestCase $task->setRuntime($runtime); try { - $this->assertContains('[missing parameters]', $task->getDescription()); + $this->assertStringContainsString('[missing parameters]', $task->getDescription()); $task->execute(); $this->assertTrue(false, 'Task did not failed'); } catch (Exception $exception) { diff --git a/tests/Task/BuiltIn/FileSystem/MoveTaskTest.php b/tests/Task/BuiltIn/FileSystem/MoveTaskTest.php old mode 100644 new mode 100755 index fb8cea6..05debe5 --- a/tests/Task/BuiltIn/FileSystem/MoveTaskTest.php +++ b/tests/Task/BuiltIn/FileSystem/MoveTaskTest.php @@ -28,8 +28,8 @@ class MoveTaskTest extends TestCase $task->setOptions(['from' => 'a.txt', 'to' => 'b.txt']); $task->setRuntime($runtime); - $this->assertContains('a.txt', $task->getDescription()); - $this->assertContains('b.txt', $task->getDescription()); + $this->assertStringContainsString('a.txt', $task->getDescription()); + $this->assertStringContainsString('b.txt', $task->getDescription()); $task->execute(); $ranCommands = $runtime->getRanCommands(); @@ -57,8 +57,8 @@ class MoveTaskTest extends TestCase $task->setOptions(['from' => 'a.txt', 'to' => 'b.txt', 'flags' => '-n']); $task->setRuntime($runtime); - $this->assertContains('a.txt', $task->getDescription()); - $this->assertContains('b.txt', $task->getDescription()); + $this->assertStringContainsString('a.txt', $task->getDescription()); + $this->assertStringContainsString('b.txt', $task->getDescription()); $task->execute(); $ranCommands = $runtime->getRanCommands(); @@ -86,8 +86,8 @@ class MoveTaskTest extends TestCase $task->setOptions(['from' => '%environment%.txt', 'to' => 'b.txt']); $task->setRuntime($runtime); - $this->assertContains('test.txt', $task->getDescription()); - $this->assertContains('b.txt', $task->getDescription()); + $this->assertStringContainsString('test.txt', $task->getDescription()); + $this->assertStringContainsString('b.txt', $task->getDescription()); $task->execute(); $ranCommands = $runtime->getRanCommands(); @@ -116,7 +116,7 @@ class MoveTaskTest extends TestCase $task->setRuntime($runtime); try { - $this->assertContains('[missing parameters]', $task->getDescription()); + $this->assertStringContainsString('[missing parameters]', $task->getDescription()); $task->execute(); $this->assertTrue(false, 'Task did not failed'); } catch (Exception $exception) { diff --git a/tests/Task/BuiltIn/FileSystem/RemoveTaskTest.php b/tests/Task/BuiltIn/FileSystem/RemoveTaskTest.php old mode 100644 new mode 100755 index 1b2a0ad..0ece36e --- a/tests/Task/BuiltIn/FileSystem/RemoveTaskTest.php +++ b/tests/Task/BuiltIn/FileSystem/RemoveTaskTest.php @@ -28,7 +28,7 @@ class RemoveTaskTest extends TestCase $task->setOptions(['file' => 'a.txt']); $task->setRuntime($runtime); - $this->assertContains('a.txt', $task->getDescription()); + $this->assertStringContainsString('a.txt', $task->getDescription()); $task->execute(); $ranCommands = $runtime->getRanCommands(); @@ -56,7 +56,7 @@ class RemoveTaskTest extends TestCase $task->setOptions(['file' => 'a.txt', 'flags' => '-fr']); $task->setRuntime($runtime); - $this->assertContains('a.txt', $task->getDescription()); + $this->assertStringContainsString('a.txt', $task->getDescription()); $task->execute(); $ranCommands = $runtime->getRanCommands(); @@ -84,7 +84,7 @@ class RemoveTaskTest extends TestCase $task->setOptions(['file' => '%environment%.txt']); $task->setRuntime($runtime); - $this->assertContains('test.txt', $task->getDescription()); + $this->assertStringContainsString('test.txt', $task->getDescription()); $task->execute(); $ranCommands = $runtime->getRanCommands(); @@ -113,7 +113,7 @@ class RemoveTaskTest extends TestCase $task->setRuntime($runtime); try { - $this->assertContains('[missing parameters]', $task->getDescription()); + $this->assertStringContainsString('[missing parameters]', $task->getDescription()); $task->execute(); $this->assertTrue(false, 'Task did not failed'); } catch (Exception $exception) { diff --git a/tests/Task/BuiltIn/Symfony/CachePoolClearTaskTest.php b/tests/Task/BuiltIn/Symfony/CachePoolClearTaskTest.php old mode 100644 new mode 100755 index 0aa8098..78b2871 --- a/tests/Task/BuiltIn/Symfony/CachePoolClearTaskTest.php +++ b/tests/Task/BuiltIn/Symfony/CachePoolClearTaskTest.php @@ -15,7 +15,7 @@ class CachePoolClearTaskTest extends TestCase */ private $runtime; - public function setUp() + public function setUp(): void { $this->runtime = new RuntimeMockup(); $this->runtime->setConfiguration(['environments' => ['test' => []]]); diff --git a/tests/Task/TaskFactoryTest.php b/tests/Task/TaskFactoryTest.php old mode 100644 new mode 100755 index 0698669..a54890e --- a/tests/Task/TaskFactoryTest.php +++ b/tests/Task/TaskFactoryTest.php @@ -59,7 +59,7 @@ class TaskFactoryTest extends TestCase $tester = new CommandTester($command); $tester->execute(['command' => $command->getName(), 'environment' => 'production']); - $this->assertContains('[Custom] Valid*', $tester->getDisplay()); + $this->assertStringContainsString('[Custom] Valid*', $tester->getDisplay()); $ranCommands = $application->getRuntime()->getRanCommands(); @@ -90,7 +90,7 @@ class TaskFactoryTest extends TestCase $tester = new CommandTester($command); $tester->execute(['command' => $command->getName(), 'environment' => 'production']); - $this->assertContains('Custom Task "Mage\Tests\Task\Custom\InvalidClass" does not exists.', $tester->getDisplay()); + $this->assertStringContainsString('Custom Task "Mage\Tests\Task\Custom\InvalidClass" does not exists.', $tester->getDisplay()); $this->assertNotEquals(0, $tester->getStatusCode()); } @@ -106,7 +106,7 @@ class TaskFactoryTest extends TestCase $tester = new CommandTester($command); $tester->execute(['command' => $command->getName(), 'environment' => 'production']); - $this->assertContains('Custom Task "Mage\Tests\Task\Custom\NotInstantiableTask" can not be instantiated.', $tester->getDisplay()); + $this->assertStringContainsString('Custom Task "Mage\Tests\Task\Custom\NotInstantiableTask" can not be instantiated.', $tester->getDisplay()); $this->assertNotEquals(0, $tester->getStatusCode()); } @@ -122,7 +122,7 @@ class TaskFactoryTest extends TestCase $tester = new CommandTester($command); $tester->execute(['command' => $command->getName(), 'environment' => 'production']); - $this->assertContains('Custom Task "Mage\Tests\Task\Custom\InvalidInheritanceTask" must inherit "Mage\Task\AbstractTask".', $tester->getDisplay()); + $this->assertStringContainsString('Custom Task "Mage\Tests\Task\Custom\InvalidInheritanceTask" must inherit "Mage\Task\AbstractTask".', $tester->getDisplay()); $this->assertNotEquals(0, $tester->getStatusCode()); }