2010-03-18 21:48:04 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Doctrine\Tests\Mocks;
|
|
|
|
|
|
|
|
use Doctrine\Common\Cli\AbstractNamespace;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TaskMock used for testing the CLI interface.
|
2012-12-14 18:55:28 +00:00
|
|
|
*
|
2010-03-18 21:48:04 +00:00
|
|
|
* @author Nils Adermann <naderman@naderman.de>
|
|
|
|
*/
|
|
|
|
class TaskMock extends \Doctrine\Common\Cli\Tasks\AbstractTask
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Since instances of this class can be created elsewhere all instances
|
|
|
|
* register themselves in this array for later inspection.
|
|
|
|
*
|
2012-12-14 18:55:28 +00:00
|
|
|
* @var array (TaskMock)
|
2010-03-18 21:48:04 +00:00
|
|
|
*/
|
2016-12-07 23:33:41 +01:00
|
|
|
static public $instances = [];
|
2010-03-18 21:48:04 +00:00
|
|
|
|
2012-12-14 18:55:28 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2010-03-18 21:48:04 +00:00
|
|
|
private $runCounter = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor of Task Mock Object.
|
|
|
|
* Makes sure the object can be inspected later.
|
|
|
|
*
|
2012-12-14 18:55:28 +00:00
|
|
|
* @param AbstractNamespace $namespace CLI Namespace, passed to parent constructor.
|
2010-03-18 21:48:04 +00:00
|
|
|
*/
|
|
|
|
function __construct(AbstractNamespace $namespace)
|
|
|
|
{
|
|
|
|
self::$instances[] = $this;
|
|
|
|
|
|
|
|
parent::__construct($namespace);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the number of times run() was called on this object.
|
|
|
|
*
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
public function getRunCounter()
|
|
|
|
{
|
|
|
|
return $this->runCounter;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Mock API */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method invoked by CLI to run task.
|
2012-12-14 18:55:28 +00:00
|
|
|
*
|
|
|
|
* @return void
|
2010-03-18 21:48:04 +00:00
|
|
|
*/
|
|
|
|
public function run()
|
|
|
|
{
|
|
|
|
$this->runCounter++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-12-14 18:55:28 +00:00
|
|
|
* Method supposed to generate the CLI Task Documentation.
|
|
|
|
*
|
|
|
|
* @return void
|
2010-03-18 21:48:04 +00:00
|
|
|
*/
|
|
|
|
public function buildDocumentation()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|