Merge pull request #448 from 2618094/php8-upgrade

Php8 upgrade
This commit is contained in:
Andrés Montañez 2021-02-18 21:28:58 -03:00 committed by GitHub
commit 7363a84853
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 104 additions and 98 deletions

2
.gitignore vendored Normal file → Executable file
View File

@ -2,3 +2,5 @@
/build
composer.lock
.mage.yml
.idea
.phpunit.result.cache

3
.travis.yml Normal file → Executable file
View File

@ -1,7 +1,8 @@
language: php
php:
- '7.1'
- '7.2'
- '7.4'
- '8.0'
install:
- composer install

23
composer.json Normal file → Executable file
View File

@ -12,18 +12,21 @@
}
],
"require": {
"php": "^7.1.3",
"monolog/monolog": "~1.11",
"symfony/console": "^4.0",
"symfony/filesystem": "^4.0",
"symfony/event-dispatcher": "^4.0",
"symfony/finder": "^4.0",
"symfony/yaml": "^4.0",
"symfony/process": "^4.0"
"php": "^7.2 | ^8.0",
"monolog/monolog": "~1.11 | ^2.0",
"symfony/console": "^4.0 | ^5.0",
"symfony/filesystem": "^4.0 | ^5.0",
"symfony/event-dispatcher": "^4.0 | ^5.0",
"symfony/finder": "^4.0 | ^5.0",
"symfony/yaml": "^4.0 | ^5.0",
"symfony/process": "^4.0 | ^5.0"
},
"require-dev": {
"phpunit/phpunit": "^7.0",
"satooshi/php-coveralls": "~1.0"
"phpunit/phpunit": "^8.0",
"php-coveralls/php-coveralls": "~2.0"
},
"suggest": {
"ext-posix": "*"
},
"autoload": {
"psr-4": {

4
src/Deploy/Strategy/ReleasesStrategy.php Normal file → Executable file
View File

@ -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));
}
}
}

2
src/Deploy/Strategy/RsyncStrategy.php Normal file → Executable file
View File

@ -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));
}
}
}

2
src/Runtime/Runtime.php Normal file → Executable file
View File

@ -405,7 +405,7 @@ class Runtime
{
$this->log($cmd, LogLevel::INFO);
$process = new Process($cmd);
$process = Process::fromShellCommandline($cmd);
$process->setTimeout($timeout);
$process->run();

8
tests/Command/BuiltIn/DeployCommandMiscTasksTest.php Normal file → Executable file
View File

@ -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());
}
}

6
tests/Command/BuiltIn/DeployCommandMiscTest.php Normal file → Executable file
View File

@ -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());
}

26
tests/Command/BuiltIn/DeployCommandWithReleasesTest.php Normal file → Executable file
View File

@ -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());
}
}

View File

@ -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());
}
}

12
tests/Command/BuiltIn/Releases/ListCommandTest.php Normal file → Executable file
View File

@ -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());
}
}

6
tests/Command/BuiltIn/Releases/RollbackCommandTest.php Normal file → Executable file
View File

@ -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());
}
}

20
tests/Deploy/StrategyTest.php Normal file → Executable file
View File

@ -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());
}
}

2
tests/MageApplicationTest.php Normal file → Executable file
View File

@ -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());
}
}

0
tests/Runtime/RuntimeTest.php Normal file → Executable file
View File

0
tests/Task/BuiltIn/Composer/BasicComposerTaskTest.php Normal file → Executable file
View File

6
tests/Task/BuiltIn/ExecTaskTest.php Normal file → Executable file
View File

@ -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();

14
tests/Task/BuiltIn/FileSystem/ChangeModeTaskTest.php Normal file → Executable file
View File

@ -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) {

18
tests/Task/BuiltIn/FileSystem/CopyTaskTest.php Normal file → Executable file
View File

@ -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) {

14
tests/Task/BuiltIn/FileSystem/LinkTaskTest.php Normal file → Executable file
View File

@ -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) {

14
tests/Task/BuiltIn/FileSystem/MoveTaskTest.php Normal file → Executable file
View File

@ -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) {

8
tests/Task/BuiltIn/FileSystem/RemoveTaskTest.php Normal file → Executable file
View File

@ -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) {

2
tests/Task/BuiltIn/Symfony/CachePoolClearTaskTest.php Normal file → Executable file
View File

@ -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' => []]]);

8
tests/Task/TaskFactoryTest.php Normal file → Executable file
View File

@ -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());
}