Skip to content

Commit

Permalink
Merge 247e979 into 0406c7d
Browse files Browse the repository at this point in the history
  • Loading branch information
flagbird committed Mar 11, 2015
2 parents 0406c7d + 247e979 commit 3c0e440
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
4 changes: 4 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,9 @@
<directory suffix=".php">src</directory>
</whitelist>
</filter>

<php>
<const name="MAGALLANES_VERSION" value="2" />
</php>
</phpunit>

46 changes: 46 additions & 0 deletions tests/MageTest/Command/BuiltIn/VersionCommandTest.php
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);
}
}

0 comments on commit 3c0e440

Please sign in to comment.