[Nostromo] Refactor config load

This commit is contained in:
Andrés Montañez
2017-01-29 19:25:03 -03:00
parent 91da979151
commit 0bae8e2b1b
18 changed files with 24 additions and 53 deletions
@@ -21,7 +21,6 @@ class DumpCommandTest extends TestCase
public function testConfigDumpTermination()
{
$application = new MageApplicationMockup(__DIR__ . '/../../../Resources/basic.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('config:dump');
@@ -21,7 +21,6 @@ class EnvironmentsCommandTest extends TestCase
public function testConfigDumpTermination()
{
$application = new MageApplicationMockup(__DIR__ . '/../../../Resources/basic.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('config:environments');
@@ -21,7 +21,6 @@ class DeployCommandMiscTasksTest extends TestCase
public function testSymfonyEnvironmentConfiguration()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/symfony-envconf.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('deploy');
@@ -54,7 +53,6 @@ class DeployCommandMiscTasksTest extends TestCase
public function testComposerFlags()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/composer.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('deploy');
@@ -85,7 +83,6 @@ class DeployCommandMiscTasksTest extends TestCase
public function testInvalidTaskName()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/invalid-task.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('deploy');
@@ -101,7 +98,6 @@ class DeployCommandMiscTasksTest extends TestCase
public function testBrokenGitBranch()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/broken-git-branch.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('deploy');
@@ -120,7 +116,6 @@ class DeployCommandMiscTasksTest extends TestCase
public function testBrokenGitCheckout()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/broken-git-branch.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('deploy');
@@ -139,7 +134,6 @@ class DeployCommandMiscTasksTest extends TestCase
public function testBrokenGitUpdate()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/broken-git-branch.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('deploy');
@@ -21,7 +21,6 @@ class DeployCommandMiscTest extends TestCase
public function testDeploymentWithNoHosts()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/no-hosts.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('deploy');
@@ -40,7 +39,6 @@ class DeployCommandMiscTest extends TestCase
public function testDeploymentWithSudo()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/testhost-sudo.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('deploy');
@@ -79,7 +77,6 @@ class DeployCommandMiscTest extends TestCase
public function testDeploymentWithBranchOverwrite()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/testhost-without-releases.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('deploy');
@@ -117,8 +114,6 @@ class DeployCommandMiscTest extends TestCase
public function testDeploymentWithCustomTask()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/testhost-custom-task.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('deploy');
@@ -151,7 +146,6 @@ class DeployCommandMiscTest extends TestCase
public function testDeploymentWithErrorTaskCommands()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/testhost-with-error.yml');
$application->configure();
$application->getRuntime()->setReleaseId('20170101015120');
@@ -193,7 +187,6 @@ class DeployCommandMiscTest extends TestCase
public function testDeploymentWithFailingPostDeployTaskCommands()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/testhost-with-postdeploy-error.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('deploy');
@@ -229,7 +222,6 @@ class DeployCommandMiscTest extends TestCase
public function testDeploymentWithSkippingTask()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/testhost-skipping.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('deploy');
@@ -21,7 +21,6 @@ class DeployCommandWithReleasesTest extends TestCase
public function testDeploymentWithReleasesCommands()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/testhost.yml');
$application->configure();
$application->getRuntime()->setReleaseId('20170101015120');
@@ -72,7 +71,6 @@ class DeployCommandWithReleasesTest extends TestCase
public function testDeploymentWithoutReleasesTarPrepare()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/testhost-force-tar1.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('deploy');
@@ -88,7 +86,6 @@ class DeployCommandWithReleasesTest extends TestCase
public function testDeploymentWithoutReleasesTarCopy()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/testhost-force-tar2.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('deploy');
@@ -104,7 +101,6 @@ class DeployCommandWithReleasesTest extends TestCase
public function testDeploymentWithoutReleasesTarCleanup()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/testhost-force-tar3.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('deploy');
@@ -120,7 +116,6 @@ class DeployCommandWithReleasesTest extends TestCase
public function testDeploymentFailCopyCommands()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/testhost-fail-copy-tar.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('deploy');
@@ -136,7 +131,6 @@ class DeployCommandWithReleasesTest extends TestCase
public function testDeploymentWithoutReleasesForceRelease()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/testhost-force-release.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('deploy');
@@ -152,7 +146,6 @@ class DeployCommandWithReleasesTest extends TestCase
public function testDeploymentFailToExtract()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/testhost.yml');
$application->configure();
$application->getRuntime()->setReleaseId('20170101015120');
@@ -195,7 +188,6 @@ class DeployCommandWithReleasesTest extends TestCase
public function testDeploymentFailToCopy()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/testhost.yml');
$application->configure();
$application->getRuntime()->setReleaseId('20170101015120');
@@ -237,7 +229,6 @@ class DeployCommandWithReleasesTest extends TestCase
public function testDeploymentFailCleanup()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/testhost.yml');
$application->configure();
$application->getRuntime()->setReleaseId('20170101015120');
@@ -291,7 +282,6 @@ class DeployCommandWithReleasesTest extends TestCase
public function testDeploymentFailMidway()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/testhost.yml');
$application->configure();
$application->getRuntime()->setReleaseId('20170101015120');
@@ -21,7 +21,6 @@ class DeployCommandWithoutReleasesTest extends TestCase
public function testDeploymentWithoutReleasesCommands()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/testhost-without-releases.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('deploy');
@@ -59,7 +58,6 @@ class DeployCommandWithoutReleasesTest extends TestCase
public function testDeploymentFailMidway()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/testhost-without-releases.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('deploy');
@@ -21,7 +21,6 @@ class ListCommandTest extends TestCase
public function testListReleasesCommands()
{
$application = new MageApplicationMockup(__DIR__ . '/../../../Resources/testhost.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('releases:list');
@@ -49,7 +48,6 @@ class ListCommandTest extends TestCase
public function testListReleasesWithInvalidEnvironment()
{
$application = new MageApplicationMockup(__DIR__ . '/../../../Resources/testhost.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('releases:list');
@@ -65,7 +63,6 @@ class ListCommandTest extends TestCase
public function testListReleasesWithoutReleases()
{
$application = new MageApplicationMockup(__DIR__ . '/../../../Resources/testhost-without-releases.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('releases:list');
@@ -81,7 +78,6 @@ class ListCommandTest extends TestCase
public function testFailToGetCurrentRelease()
{
$application = new MageApplicationMockup(__DIR__ . '/../../../Resources/testhost-fail-get-current.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('releases:list');
@@ -97,7 +93,6 @@ class ListCommandTest extends TestCase
public function testNoReleasesAvailable()
{
$application = new MageApplicationMockup(__DIR__ . '/../../../Resources/testhost-no-releases.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('releases:list');
@@ -112,7 +107,6 @@ class ListCommandTest extends TestCase
public function testFailGetReleases()
{
$application = new MageApplicationMockup(__DIR__ . '/../../../Resources/testhost-fail-get-releases.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('releases:list');
@@ -128,7 +122,6 @@ class ListCommandTest extends TestCase
public function testNoHosts()
{
$application = new MageApplicationMockup(__DIR__ . '/../../../Resources/testhost-no-hosts.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('releases:list');
@@ -21,7 +21,6 @@ class RollbackCommandTest extends TestCase
public function testRollbackReleaseCommands()
{
$application = new MageApplicationMockup(__DIR__ . '/../../../Resources/testhost.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('releases:rollback');
@@ -49,7 +48,6 @@ class RollbackCommandTest extends TestCase
public function testRollbackReleaseWithInvalidEnvironment()
{
$application = new MageApplicationMockup(__DIR__ . '/../../../Resources/testhost.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('releases:rollback');
@@ -65,7 +63,6 @@ class RollbackCommandTest extends TestCase
public function testRollbackReleaseWithoutReleases()
{
$application = new MageApplicationMockup(__DIR__ . '/../../../Resources/testhost-without-releases.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('releases:rollback');
@@ -81,7 +78,6 @@ class RollbackCommandTest extends TestCase
public function testRollbackReleaseNotAvailable()
{
$application = new MageApplicationMockup(__DIR__ . '/../../../Resources/testhost-not-have-release.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('releases:rollback');
@@ -22,7 +22,6 @@ class VersionCommandTest extends TestCase
public function testVersionOutput()
{
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/basic.yml');
$application->configure();
/** @var AbstractCommand $command */
$command = $application->find('version');
-5
View File
@@ -21,7 +21,6 @@ class MageApplicationTest extends TestCase
public function testValidConfiguration()
{
$application = new MageApplication(__DIR__ . '/Resources/basic.yml');
$application->configure();
$this->assertTrue($application instanceof MageApplication);
}
@@ -29,7 +28,6 @@ class MageApplicationTest extends TestCase
{
try {
$application = new MageApplication(__DIR__ . '/Resources/invalid.yml');
$application->configure();
} catch (Exception $exception) {
$this->assertTrue($exception instanceof RuntimeException);
$this->assertEquals(sprintf('The file "%s" does not have a valid Magallanes configuration.', __DIR__ . '/Resources/invalid.yml'), $exception->getMessage());
@@ -40,7 +38,6 @@ class MageApplicationTest extends TestCase
{
try {
$application = new MageApplication(__DIR__ . '/Resources/invalid-yaml.yml');
$application->configure();
} catch (Exception $exception) {
$this->assertTrue($exception instanceof RuntimeException);
$this->assertEquals(sprintf('Error parsing the file "%s".', __DIR__ . '/Resources/invalid-yaml.yml'), $exception->getMessage());
@@ -51,7 +48,6 @@ class MageApplicationTest extends TestCase
{
try {
$application = new MageApplication(__DIR__ . '/Resources/this-does-not-exists.yml');
$application->configure();
} catch (Exception $exception) {
$this->assertTrue($exception instanceof RuntimeException);
$this->assertEquals(sprintf('The file "%s" does not exists or is not readable.', __DIR__ . '/Resources/this-does-not-exists.yml'), $exception->getMessage());
@@ -62,7 +58,6 @@ class MageApplicationTest extends TestCase
{
$application = new MageApplication(__DIR__ . '/Resources/basic.yml');
$application->setAutoExit(false);
$application->configure();
$this->assertTrue($application instanceof MageApplication);
$application->register('foo')->setCode(function () {