mirror of
https://github.com/andres-montanez/Magallanes
synced 2024-05-17 21:26:40 +02:00
test added for VersionCommand
This commit is contained in:
parent
0406c7de8a
commit
67960ba3f4
44
tests/MageTest/Command/BuildIn/VersionCommandTest.php
Normal file
44
tests/MageTest/Command/BuildIn/VersionCommandTest.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace MageTest\Command\BuildIn;
|
||||
|
||||
use Mage\Command\BuiltIn\VersionCommand;
|
||||
use Mage\Console;
|
||||
use PHPUnit_Framework_TestCase;
|
||||
|
||||
/**
|
||||
* @group Mage_Command_BuildIn_VersionCommand
|
||||
*/
|
||||
class VersionCommandTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testRun()
|
||||
{
|
||||
define('MAGALLANES_VERSION', '1');
|
||||
$this->workAroundStatic();
|
||||
$command = new VersionCommand();
|
||||
$command->run();
|
||||
|
||||
$this->expectOutputString('Running Magallanes version ' . MAGALLANES_VERSION . str_repeat(PHP_EOL, 2));
|
||||
}
|
||||
|
||||
/**
|
||||
* This is only needed as long as Console-class has static methods and properties
|
||||
*/
|
||||
private function workAroundStatic()
|
||||
{
|
||||
$refClass = new \ReflectionClass('Mage\Console');
|
||||
|
||||
$refProperty = $refClass->getProperty('logEnabled');
|
||||
$refProperty->setAccessible(true);
|
||||
$refProperty->setValue(false);
|
||||
|
||||
$config = $this->getMock('Mage\Config');
|
||||
$config->expects($this->once())
|
||||
->method('getParameter')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$refProperty = $refClass->getProperty('config');
|
||||
$refProperty->setAccessible(true);
|
||||
$refProperty->setValue($config);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue