コード例 #1
0
	public function next($request, $response)
	{
		$taskItemId = $request->taskItemId;
		$taskItem = TaskItem::getById($taskItemId);
		
		
		$preTaskItemId = $request->preTaskItemId;
		$preTaskItem = TaskItem::getById($preTaskItemId);
		
		$testTask = new NullEntity();
		if(false == $taskItem instanceof TaskItem 
				&& $preTaskItem instanceof TaskItem)
		{
			//$taskItem = $preTaskItem->testtask->getNextTaskItem($preTaskItem);// fix FU-4265 ,不获取直接的下一个taskItem,改成获取下一个init TaskItem
			$request->testTaskId = $preTaskItem->testtask->id;
		}
			
		if(false == $taskItem instanceof TaskItem)
		{
			$testTask = TestTask::getById( $request->testTaskId);
			DBC::requireTrue($testTask instanceof TestTask,'任务单不存在');
			
			$funpointId = $request->funpointId;
			$moduleId = $request->moduleId;
			$programId = $request->programId;
			
			if($funpointId > 0)
			{
				$taskItem = $testTask->getNextTaskItemOfFunpoint($funpointId);
			}elseif($moduleId > 0) {
				$taskItem = $testTask->getNextTaskItemOfModule($moduleId);
			}elseif($programId > 0){
				$taskItem = $testTask->getNextTaskItemOfProgram($programId);
			}else {
				$taskItem = $testTask->getNextInitTaskItem($preTaskItem);
			}
			
			if(false == ($taskItem instanceof TaskItem))
			{
				$preMsg = $request->preMsg;
				$preMsg .= " 任务单 {$testTask->id} 已没有未执行用例. "; 
				$response->setRedirect($response->router->urlfor('testtask/detail',array('testtaskid'=>$testTask->id,'preMsg'=>$preMsg)));
			}
			
		}
		
		$testTask = $taskItem->testtask;
		$response->testTask = $testTask;
		$response->taskItem = $taskItem;
		$response->usecase = $taskItem->usecase;
		//$response->bugList = DAL::get()->find('Bug', $taskItem->usecase->bugIds);
		//$response->attachments = DAL::get()->find('Attachment', $taskItem->usecase->attachmentIds);
		
		$response->testTaskProgressStr = "{$testTask->getPos($taskItem)} / {$testTask->getTaskItemCnt()} ".$testTask->getSumInfoStr4All();
	}
コード例 #2
0
ファイル: sfBaseTaskTest.php プロジェクト: Phennim/symfony1
    {
        parent::reloadAutoload();
    }
    public function initializeAutoload(sfProjectConfiguration $configuration, $reload = false)
    {
        parent::initializeAutoload($configuration, $reload);
    }
}
$rootDir = __DIR__ . '/../../functional/fixtures';
sfToolkit::clearDirectory($rootDir . '/cache');
$dispatcher = new sfEventDispatcher();
require_once $rootDir . '/config/ProjectConfiguration.class.php';
$configuration = new ProjectConfiguration($rootDir, $dispatcher);
$autoload = sfSimpleAutoload::getInstance();
$t = new lime_test(16);
$task = new TestTask($dispatcher, new sfFormatter());
// ->initializeAutoload()
$t->diag('->initializeAutoload()');
$t->is($autoload->getClassPath('myLibClass'), null, 'no project classes are autoloaded before ->initializeAutoload()');
$task->initializeAutoload($configuration);
$t->ok(null !== $autoload->getClassPath('myLibClass'), '->initializeAutoload() loads project classes');
$t->ok(null !== $autoload->getClassPath('BaseExtendMe'), '->initializeAutoload() includes plugin classes');
$t->is($autoload->getClassPath('ExtendMe'), sfConfig::get('sf_lib_dir') . '/ExtendMe.class.php', '->initializeAutoload() prefers project to plugin classes');
$task->initializeAutoload($configuration, true);
$t->is($autoload->getClassPath('ExtendMe'), sfConfig::get('sf_lib_dir') . '/ExtendMe.class.php', '->initializeAutoload() prefers project to plugin classes after reload');
// ->run()
$t->diag('->run()');
class ApplicationTask extends sfBaseTask
{
    protected function configure()
    {
コード例 #3
0
ファイル: example.php プロジェクト: skipperbent/asynctask
    {
        self::setProperty("count", 100);
    }
    protected function doInBackground($parameters)
    {
        sleep(2);
        self::setProperty("count", self::getProperty("count") + $parameters[0]);
        sleep(1);
        return $parameters[1] . self::getProperty("count");
    }
    protected function onPostExecute($result)
    {
        echo "{$result}\n";
    }
}
$task = new TestTask();
$task->execute(array(100, 'task 1: '));
sleep(5);
$task2 = new TestTask();
$task2->execute(array(100, 'task 2: '));
echo "task 1: " . $task->getStatus() . "\n";
echo "task 2: " . $task2->getStatus() . "\n";
sleep(10);
if ($task->getStatus() == 'RUNNING') {
    $task->cancel();
}
if ($task2->getStatus() == 'RUNNING') {
    $task2->cancel();
}
echo "task 1: " . $task->getStatus() . "\n";
echo "task 2: " . $task2->getStatus() . "\n";