mirror of
https://github.com/hauke68/Magallanes.git
synced 2025-09-16 13:50:17 +02:00
Move "setUpConsoleStatics" into the BaseClass
This commit is contained in:
parent
d58e89c41d
commit
ee8bb3c2f9
@ -51,29 +51,8 @@ class ListCommandTest extends BaseTest
|
|||||||
->build();
|
->build();
|
||||||
$this->scandirMock->disable();
|
$this->scandirMock->disable();
|
||||||
$this->scandirMock->enable();
|
$this->scandirMock->enable();
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
$this->setUpConsoleStatics();
|
||||||
* Disable logging to log file and turn off colors
|
|
||||||
*
|
|
||||||
* @before
|
|
||||||
*/
|
|
||||||
public function setUpConsoleStatics()
|
|
||||||
{
|
|
||||||
$consoleReflection = new \ReflectionClass('Mage\Console');
|
|
||||||
$logEnableProperty = $consoleReflection->getProperty('logEnabled');
|
|
||||||
$logEnableProperty->setAccessible(true);
|
|
||||||
$logEnableProperty->setValue(false);
|
|
||||||
|
|
||||||
$configMock = $this->getMock('Mage\Config');
|
|
||||||
$configMock->expects($this->atLeastOnce())
|
|
||||||
->method('getParameter')
|
|
||||||
->with('no-color')
|
|
||||||
->willReturn(true);
|
|
||||||
|
|
||||||
$configProperty = $consoleReflection->getProperty('config');
|
|
||||||
$configProperty->setAccessible(true);
|
|
||||||
$configProperty->setValue($configMock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function listEnvironmentsProvider()
|
public function listEnvironmentsProvider()
|
||||||
|
@ -42,4 +42,27 @@ abstract class BaseTest extends \PHPUnit_Framework_TestCase
|
|||||||
$configProperty->setAccessible(true);
|
$configProperty->setAccessible(true);
|
||||||
$configProperty->setValue($object, $value);
|
$configProperty->setValue($object, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable logging to log file and turn off colors
|
||||||
|
*
|
||||||
|
* @before
|
||||||
|
*/
|
||||||
|
protected function setUpConsoleStatics()
|
||||||
|
{
|
||||||
|
$consoleReflection = new \ReflectionClass('Mage\Console');
|
||||||
|
$logEnableProperty = $consoleReflection->getProperty('logEnabled');
|
||||||
|
$logEnableProperty->setAccessible(true);
|
||||||
|
$logEnableProperty->setValue(false);
|
||||||
|
|
||||||
|
$configMock = $this->getMock('Mage\Config');
|
||||||
|
$configMock->expects($this->any())
|
||||||
|
->method('getParameter')
|
||||||
|
->with('no-color')
|
||||||
|
->willReturn(true);
|
||||||
|
|
||||||
|
$configProperty = $consoleReflection->getProperty('config');
|
||||||
|
$configProperty->setAccessible(true);
|
||||||
|
$configProperty->setValue($configMock);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user