[Nostromo] Improve test coverage

This commit is contained in:
Andrés Montañez
2017-01-07 02:04:36 -03:00
parent 238777cb41
commit 6d708c35fa
11 changed files with 73 additions and 9 deletions
@@ -18,6 +18,25 @@ use PHPUnit_Framework_TestCase as TestCase;
class DeployCommandMiscTest extends TestCase
{
public function testDeploymentWithNoHosts()
{
$application = new MageApplicationMockup();
$application->configure(__DIR__ . '/../../Resources/no-hosts.yml');
/** @var AbstractCommand $command */
$command = $application->find('deploy');
$this->assertTrue($command instanceof DeployCommand);
$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->assertEquals(0, $tester->getStatusCode());
}
public function testDeploymentWithSudo()
{
$application = new MageApplicationMockup();
@@ -132,4 +132,20 @@ class DeployCommandWithReleasesTest extends TestCase
$this->assertContains('Copying files with TarGZ ... FAIL', $tester->getDisplay());
$this->assertNotEquals(0, $tester->getStatusCode());
}
public function testDeploymentWithoutReleasesForceRelease()
{
$application = new MageApplicationMockup();
$application->configure(__DIR__ . '/../../Resources/testhost-force-release.yml');
/** @var AbstractCommand $command */
$command = $application->find('deploy');
$this->assertTrue($command instanceof DeployCommand);
$tester = new CommandTester($command);
$tester->execute(['command' => $command->getName(), 'environment' => 'test']);
$this->assertContains('This task is only available with releases enabled', $tester->getDisplay());
$this->assertNotEquals(0, $tester->getStatusCode());
}
}
+23
View File
@@ -0,0 +1,23 @@
magephp:
log_dir: /tmp
environments:
test:
user: tester
branch: test
host_path: /var/www/test
releases: 4
exclude:
- ./var/cache/*
- ./var/log/*
- ./web/app_dev.php
pre-deploy:
- git/update
- composer/install
- composer/dump-autoload
on-deploy:
- symfony/cache-warmup: { env: 'dev' }
- symfony/assets-install: { env: 'dev' }
- symfony/assetic-dump: { env: 'dev' }
on-release:
post-release:
post-deploy:
@@ -0,0 +1,15 @@
magephp:
log_dir: /tmp
environments:
test:
user: tester
branch: test
host_path: /var/www/test
exclude:
- ./var/cache/*
- ./var/log/*
- ./web/app_dev.php
hosts:
- host2
on-release:
- deploy/release