mirror of
https://github.com/hauke68/Magallanes.git
synced 2026-08-29 18:48:56 +02:00
[Nostromo] Refactor config
This commit is contained in:
@@ -20,16 +20,16 @@ class MageApplicationTest extends TestCase
|
||||
{
|
||||
public function testValidConfiguration()
|
||||
{
|
||||
$application = new MageApplication();
|
||||
$application->configure(__DIR__ . '/Resources/basic.yml');
|
||||
$application = new MageApplication(__DIR__ . '/Resources/basic.yml');
|
||||
$application->configure();
|
||||
$this->assertTrue($application instanceof MageApplication);
|
||||
}
|
||||
|
||||
public function testInValidConfiguration()
|
||||
{
|
||||
try {
|
||||
$application = new MageApplication();
|
||||
$application->configure(__DIR__ . '/Resources/invalid.yml');
|
||||
$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());
|
||||
@@ -39,8 +39,8 @@ class MageApplicationTest extends TestCase
|
||||
public function testParserError()
|
||||
{
|
||||
try {
|
||||
$application = new MageApplication();
|
||||
$application->configure(__DIR__ . '/Resources/invalid-yaml.yml');
|
||||
$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());
|
||||
@@ -50,8 +50,8 @@ class MageApplicationTest extends TestCase
|
||||
public function testInvalidFile()
|
||||
{
|
||||
try {
|
||||
$application = new MageApplication();
|
||||
$application->configure(__DIR__ . '/Resources/this-does-not-exists.yml');
|
||||
$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());
|
||||
@@ -60,9 +60,9 @@ class MageApplicationTest extends TestCase
|
||||
|
||||
public function testAppDispatcher()
|
||||
{
|
||||
$application = new MageApplication();
|
||||
$application = new MageApplication(__DIR__ . '/Resources/basic.yml');
|
||||
$application->setAutoExit(false);
|
||||
$application->configure(__DIR__ . '/Resources/basic.yml');
|
||||
$application->configure();
|
||||
$this->assertTrue($application instanceof MageApplication);
|
||||
|
||||
$application->register('foo')->setCode(function () {
|
||||
|
||||
Reference in New Issue
Block a user