From 67960ba3f468e80282c668cdce537abe7092a616 Mon Sep 17 00:00:00 2001 From: Claudio Zizza Date: Fri, 2 Jan 2015 15:28:13 +0100 Subject: [PATCH] test added for VersionCommand --- .../Command/BuildIn/VersionCommandTest.php | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/MageTest/Command/BuildIn/VersionCommandTest.php diff --git a/tests/MageTest/Command/BuildIn/VersionCommandTest.php b/tests/MageTest/Command/BuildIn/VersionCommandTest.php new file mode 100644 index 0000000..4b3f1bf --- /dev/null +++ b/tests/MageTest/Command/BuildIn/VersionCommandTest.php @@ -0,0 +1,44 @@ +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); + } +}