mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 12:33:26 +00:00
V 3.5 RC 1
This commit is contained in:
47
lib/unitTest/module/console/module_console_tasklistTest.php
Normal file
47
lib/unitTest/module/console/module_console_tasklistTest.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once dirname(__FILE__) . '/../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
|
||||
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use \Symfony\Component\Console\Application;
|
||||
/**
|
||||
* Test class for module_console_tasklist.
|
||||
* Generated by PHPUnit on 2011-11-03 at 16:11:10.
|
||||
*/
|
||||
class module_console_tasklistTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @covers module_console_tasklist::execute
|
||||
*/
|
||||
public function testExecute()
|
||||
{
|
||||
// mock the Kernel or create one depending on your needs
|
||||
$application = new Application();
|
||||
$application->add(new module_console_tasklist('task:list'));
|
||||
|
||||
$command = $application->find('task:list');
|
||||
$commandTester = new CommandTester($command);
|
||||
$commandTester->execute(array('command' => $command->getName()));
|
||||
|
||||
$task_manager = new task_manager(appbox::get_instance());
|
||||
$lines = explode("\n", trim($commandTester->getDisplay()));
|
||||
|
||||
if(count($task_manager->get_tasks()) > 0)
|
||||
{
|
||||
$this->assertEquals(count($task_manager->get_tasks()), count($lines));
|
||||
foreach($task_manager->get_tasks() as $task)
|
||||
{
|
||||
$this->assertTrue(strpos($commandTester->getDisplay(), $task->get_title()) !== false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->assertEquals(1, $n_lines);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user