mirror of
https://github.com/hauke68/Magallanes.git
synced 2026-09-08 14:28:57 +02:00
[Nostromo] Improve tests and coverage
This commit is contained in:
@@ -12,6 +12,7 @@ namespace Mage\Tests;
|
||||
|
||||
use Mage\MageApplication;
|
||||
use Mage\Runtime\Exception\RuntimeException;
|
||||
use Symfony\Component\Console\Tester\ApplicationTester;
|
||||
use Exception;
|
||||
use PHPUnit_Framework_TestCase as TestCase;
|
||||
|
||||
@@ -35,7 +36,7 @@ class MageApplicationTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
public function testInValidFile()
|
||||
public function testInvalidFile()
|
||||
{
|
||||
try {
|
||||
$application = new MageApplication();
|
||||
@@ -45,4 +46,21 @@ class MageApplicationTest extends TestCase
|
||||
$this->assertEquals(sprintf('The file "%s" does not exists or is not readable.', __DIR__ . '/Resources/this-does-not-exists.yml'), $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function testAppDispatcher()
|
||||
{
|
||||
$application = new MageApplication();
|
||||
$application->setAutoExit(false);
|
||||
$application->configure(__DIR__ . '/Resources/basic.yml');
|
||||
$this->assertTrue($application instanceof MageApplication);
|
||||
|
||||
$application->register('foo')->setCode(function() {
|
||||
throw new \RuntimeException('foo');
|
||||
});
|
||||
|
||||
$tester = new ApplicationTester($application);
|
||||
$tester->run(['command' => 'foo']);
|
||||
|
||||
$this->assertContains('Oops, exception thrown while running command foo', $tester->getDisplay());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user