Merge pull request #162 from edpauto/phpunit-tests-completion

Fixes #159: PHPUnit tests tuning
This commit is contained in:
Kuba Turek 2015-01-29 22:10:39 +01:00
commit 7be2dd8589
5 changed files with 17 additions and 3 deletions

2
.gitignore vendored
View file

@ -1,5 +1,7 @@
vendor vendor
mage.phar mage.phar
bin
!bin/mage
# OS generated files # // GitHub Recommendation # OS generated files # // GitHub Recommendation
###################### ######################

View file

@ -18,6 +18,9 @@
"Command\\": ".mage/commands" "Command\\": ".mage/commands"
} }
}, },
"config": {
"bin-dir": "bin"
},
"bin": [ "bin": [
"bin/mage" "bin/mage"
] ]

3
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "a19528b890d301384e45c1ed7d221e26", "hash": "c66ae8cd7e44d614445b273f310d9c34",
"packages": [], "packages": [],
"packages-dev": [ "packages-dev": [
{ {
@ -755,6 +755,7 @@
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": [], "stability-flags": [],
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false,
"platform": { "platform": {
"php": ">=5.3" "php": ">=5.3"
}, },

View file

@ -5,8 +5,8 @@
backupGlobals="false" backupGlobals="false"
verbose="true" verbose="true"
strict="true" strict="true"
colors="false"> colors="true">
<testsuite name="small"> <testsuite name="unit-tests">
<directory suffix="Test.php">tests</directory> <directory suffix="Test.php">tests</directory>
</testsuite> </testsuite>

View file

@ -7,17 +7,21 @@ use PHPUnit_Framework_TestCase;
/** /**
* @group Mage_Console_Colors * @group Mage_Console_Colors
* @coversDefaultClass Mage\Console\Colors
*/ */
class ColorsTest extends PHPUnit_Framework_TestCase class ColorsTest extends PHPUnit_Framework_TestCase
{ {
private $noColorParameter = "no-color";
/** /**
* @group 159 * @group 159
* @covers ::color
*/ */
public function testColor() public function testColor()
{ {
$config = $this->getMock('Mage\Config'); $config = $this->getMock('Mage\Config');
$config->expects($this->once()) $config->expects($this->once())
->method('getParameter') ->method('getParameter')
->with($this->noColorParameter)
->will($this->returnValue(false)); ->will($this->returnValue(false));
$string = '<green>FooBar</green>'; $string = '<green>FooBar</green>';
@ -31,12 +35,14 @@ class ColorsTest extends PHPUnit_Framework_TestCase
/** /**
* @group 159 * @group 159
* @covers ::color
*/ */
public function testColorNoColor() public function testColorNoColor()
{ {
$config = $this->getMock('Mage\Config'); $config = $this->getMock('Mage\Config');
$config->expects($this->once()) $config->expects($this->once())
->method('getParameter') ->method('getParameter')
->with($this->noColorParameter)
->will($this->returnValue(true)); ->will($this->returnValue(true));
$string = '<black>FooBar</black>'; $string = '<black>FooBar</black>';
@ -50,12 +56,14 @@ class ColorsTest extends PHPUnit_Framework_TestCase
/** /**
* @group 159 * @group 159
* @covers ::color
*/ */
public function testColorUnknownColorName() public function testColorUnknownColorName()
{ {
$config = $this->getMock('Mage\Config'); $config = $this->getMock('Mage\Config');
$config->expects($this->once()) $config->expects($this->once())
->method('getParameter') ->method('getParameter')
->with($this->noColorParameter)
->will($this->returnValue(false)); ->will($this->returnValue(false));
$string = '<foo>FooBar</foo>'; $string = '<foo>FooBar</foo>';