magallanes/tests/Command/BuiltIn/VersionCommandTest.php

38 lines
1.1 KiB
PHP
Raw Normal View History

2017-01-01 05:28:58 +01:00
<?php
2017-01-01 22:20:43 +01:00
/*
* This file is part of the Magallanes package.
*
* (c) Andrés Montañez <andres@andresmontanez.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
2017-01-01 05:28:58 +01:00
namespace Mage\Tests\Command\BuiltIn;
use Mage\Command\AbstractCommand;
2017-01-05 01:46:40 +01:00
use Mage\Command\BuiltIn\VersionCommand;
use Mage\Tests\MageApplicationMockup;
2017-01-01 05:28:58 +01:00
use Mage\Mage;
use Symfony\Component\Console\Tester\CommandTester;
use PHPUnit_Framework_TestCase as TestCase;
2017-01-01 05:28:58 +01:00
class VersionCommandTest extends TestCase
{
public function testVersionOutput()
{
2017-01-05 01:46:40 +01:00
$application = new MageApplicationMockup();
$application->configure(__DIR__ . '/../../Resources/basic.yml');
2017-01-01 05:28:58 +01:00
/** @var AbstractCommand $command */
$command = $application->find('version');
2017-01-05 01:46:40 +01:00
$this->assertTrue($command instanceof VersionCommand);
2017-01-01 05:28:58 +01:00
$tester = new CommandTester($command);
$tester->execute(['command' => $command->getName()]);
$output = trim($tester->getDisplay());
$this->assertEquals(sprintf('Magallanes v%s [%s]', Mage::VERSION, Mage::CODENAME), $output);
}
2017-01-01 05:34:14 +01:00
}