-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace MageTest\Command\BuiltIn; | ||
|
||
use Mage\Command\BuiltIn\VersionCommand; | ||
use Mage\Console; | ||
use PHPUnit_Framework_TestCase; | ||
|
||
/** | ||
* @group Mage_Command_BuildIn_VersionCommand | ||
*/ | ||
class VersionCommandTest extends PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @group 175 | ||
*/ | ||
public function testRun() | ||
{ | ||
$this->workAroundStatic(); | ||
$command = new VersionCommand(); | ||
$command->run(); | ||
|
||
$this->expectOutputString('Running Magallanes version 2' . 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); | ||
} | ||
} |