Browse Source

fix for Instantiator coverage instead of uses annotation

1.0
Claudio Zizza 10 years ago
parent
commit
35aa80a82f
  1. 17
      tests/MageTest/Task/FactoryTest.php

17
tests/MageTest/Task/FactoryTest.php

@ -9,7 +9,6 @@ use PHPUnit_Framework_TestCase;
* @group MageTest_Task * @group MageTest_Task
* @group MageTest_Task_Factory * @group MageTest_Task_Factory
* @uses Mage\Task\AbstractTask * @uses Mage\Task\AbstractTask
* @uses Doctrine\Instantiator\Instantiator
* @covers Mage\Task\Factory * @covers Mage\Task\Factory
* *
* @group issue-176 * @group issue-176
@ -23,12 +22,18 @@ class FactoryTest extends PHPUnit_Framework_TestCase
$this->config = $this->getMock('Mage\\Config'); $this->config = $this->getMock('Mage\\Config');
} }
/**
* @covers Mage\Task\Factory::get
*/
public function testGet() public function testGet()
{ {
$task = Factory::get('composer/install', $this->config); $task = Factory::get('composer/install', $this->config);
$this->assertInstanceOf('\\Mage\\Task\\BuiltIn\\Composer\\InstallTask', $task); $this->assertInstanceOf('\\Mage\\Task\\BuiltIn\\Composer\\InstallTask', $task);
} }
/**
* @covers Mage\Task\Factory::get
*/
public function testGetTaskDataIsArray() public function testGetTaskDataIsArray()
{ {
$taskData = array( $taskData = array(
@ -40,10 +45,13 @@ class FactoryTest extends PHPUnit_Framework_TestCase
$this->assertInstanceOf('\\Mage\\Task\\BuiltIn\\Composer\\InstallTask', $task); $this->assertInstanceOf('\\Mage\\Task\\BuiltIn\\Composer\\InstallTask', $task);
} }
/**
* @covers Mage\Task\Factory::get
*/
public function testGetCustomTask() public function testGetCustomTask()
{ {
$this->getMockBuilder('Mage\\Task\\AbstractTask') $this->getMockBuilder('Mage\\Task\\AbstractTask')
->disableOriginalConstructor() ->setConstructorArgs(array($this->config))
->setMockClassName('MyTask') ->setMockClassName('MyTask')
->getMock(); ->getMock();
@ -57,6 +65,9 @@ class FactoryTest extends PHPUnit_Framework_TestCase
$this->assertInstanceOf('Task\\MyTask', $task); $this->assertInstanceOf('Task\\MyTask', $task);
} }
/**
* @covers Mage\Task\Factory::get
*/
public function testGetWithOptionalParams() public function testGetWithOptionalParams()
{ {
$task = Factory::get('composer/install', $this->config, true, 'production'); $task = Factory::get('composer/install', $this->config, true, 'production');
@ -66,6 +77,7 @@ class FactoryTest extends PHPUnit_Framework_TestCase
/** /**
* @expectedException \Exception * @expectedException \Exception
* @expectedExceptionMessage The Task MyInconsistentTask must be an instance of Mage\Task\AbstractTask. * @expectedExceptionMessage The Task MyInconsistentTask must be an instance of Mage\Task\AbstractTask.
* @covers Mage\Task\Factory::get
*/ */
public function testGetInconsistentException() public function testGetInconsistentException()
{ {
@ -76,6 +88,7 @@ class FactoryTest extends PHPUnit_Framework_TestCase
/** /**
* @expectedException \Exception * @expectedException \Exception
* @expectedExceptionMessage Task "Unknowntask" not found. * @expectedExceptionMessage Task "Unknowntask" not found.
* @covers Mage\Task\Factory::get
*/ */
public function testGetClassDoesNotExist() public function testGetClassDoesNotExist()
{ {

Loading…
Cancel
Save