mirror of
https://github.com/andres-montanez/Magallanes
synced 2024-05-11 10:16:38 +02:00
[Issue-380] Throw exception if log_dir is defined but doesn't exists
This commit is contained in:
parent
1c654e4eac
commit
ceb07a306f
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
/vendor/
|
/vendor/
|
||||||
/build
|
/build
|
||||||
composer.lock
|
composer.lock
|
||||||
|
.mage.yml
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
CHANGELOG for 3.X
|
CHANGELOG for 3.X
|
||||||
=================
|
=================
|
||||||
|
|
||||||
|
* 3.4.0 (2018-03-29)
|
||||||
|
* [Issue#380] Throw exception if log_dir is defined but directory doesn't exists
|
||||||
|
|
||||||
|
|
||||||
* 3.3.0 (2017-07-22)
|
* 3.3.0 (2017-07-22)
|
||||||
* [PR#386] Allow to define timeout (default 120s) for symfony/assetic-dump task.
|
* [PR#386] Allow to define timeout (default 120s) for symfony/assetic-dump task.
|
||||||
* [PR#392] Allow to define Host Port in Host configuration.
|
* [PR#392] Allow to define Host Port in Host configuration.
|
||||||
|
|
|
@ -84,6 +84,9 @@ class MageApplication extends Application
|
||||||
|
|
||||||
$logger = new Logger('magephp');
|
$logger = new Logger('magephp');
|
||||||
$logger->pushHandler(new StreamHandler($logfile));
|
$logger->pushHandler(new StreamHandler($logfile));
|
||||||
|
|
||||||
|
} elseif (array_key_exists('log_dir', $config['magephp']) && !is_dir($config['magephp']['log_dir'])) {
|
||||||
|
throw new RuntimeException(sprintf('The configured log_dir "%s" does not exists or is not a directory.', $config['magephp']['log_dir']));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->runtime->setConfiguration($config['magephp']);
|
$this->runtime->setConfiguration($config['magephp']);
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
namespace Mage\Tests\Command\BuiltIn;
|
namespace Mage\Tests\Command\BuiltIn;
|
||||||
|
|
||||||
use Mage\Command\BuiltIn\DeployCommand;
|
use Mage\Command\BuiltIn\DeployCommand;
|
||||||
|
use Mage\Runtime\Exception\RuntimeException;
|
||||||
use Mage\Tests\MageApplicationMockup;
|
use Mage\Tests\MageApplicationMockup;
|
||||||
use Mage\Command\AbstractCommand;
|
use Mage\Command\AbstractCommand;
|
||||||
use Symfony\Component\Console\Tester\CommandTester;
|
use Symfony\Component\Console\Tester\CommandTester;
|
||||||
|
@ -36,6 +37,24 @@ class DeployCommandMiscTest extends TestCase
|
||||||
$this->assertEquals(0, $tester->getStatusCode());
|
$this->assertEquals(0, $tester->getStatusCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testInvalidLog()
|
||||||
|
{
|
||||||
|
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/invalid-log.yml');
|
||||||
|
|
||||||
|
/** @var AbstractCommand $command */
|
||||||
|
$command = $application->find('deploy');
|
||||||
|
$this->assertTrue($command instanceof DeployCommand);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$tester = new CommandTester($command);
|
||||||
|
$tester->execute(['command' => $command->getName(), 'environment' => 'test']);
|
||||||
|
} catch (RuntimeException $exception) {
|
||||||
|
$this->assertEquals('The configured log_dir "/no-temp" does not exists or is not a directory.', $exception->getMessage());
|
||||||
|
} catch (\Exception $exception) {
|
||||||
|
$this->assertFalse(true, sprintf('Exception "%s" catched, message: "%s"', get_class($exception), $exception->getMessage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function testDeploymentWithSudo()
|
public function testDeploymentWithSudo()
|
||||||
{
|
{
|
||||||
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/testhost-sudo.yml');
|
$application = new MageApplicationMockup(__DIR__ . '/../../Resources/testhost-sudo.yml');
|
||||||
|
|
Loading…
Reference in a new issue