本文整理匯總了PHP中Task::getTaskName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Task::getTaskName方法的具體用法?PHP Task::getTaskName怎麽用?PHP Task::getTaskName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Task
的用法示例。
在下文中一共展示了Task::getTaskName方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: main
/**
* Perform the work.
*
* @throws BuildException if there is an error.
*/
public function main()
{
$errorMessages = '';
for ($i = 0; $i <= $this->retryCount; $i++) {
try {
$this->nestedTask->perform();
break;
} catch (Exception $e) {
$errorMessages .= $e->getMessage();
if ($i >= $this->retryCount) {
$taskName = $this->nestedTask->getTaskName();
$exceptionMessage = <<<EXCEPTION_MESSAGE
Task [{$taskName}] failed after [{$this->retryCount}] attempts; giving up
Error messages:
{$errorMessages}
EXCEPTION_MESSAGE;
throw new BuildException($exceptionMessage, $this->getLocation());
}
if ($this->retryDelay > 0) {
$msg = sprintf('Attempt [%s]: error occurred; retrying after %s s...', $i, $this->retryDelay);
} else {
$msg = sprintf('Attempt [%s]: error occurred; retrying...', $i);
}
$this->log($msg, Project::MSG_INFO);
$errorMessages .= PHP_EOL;
if ($this->retryDelay > 0) {
sleep($this->retryDelay);
}
}
}
}
示例2: getTaskName
/**
* Get the name of the task to use in logging messages.
*
* @return string The task's name
*/
public function getTaskName()
{
return $this->realThing === null ? parent::getTaskName() : $this->realThing->getTaskName();
}
示例3: getTaskName
/**
* Get the name of the task to use in logging messages.
*
* @return string The task's name
*/
public function getTaskName()
{
return $this->realThing === null || !$this->realThing instanceof Task ? parent::getTaskName() : $this->realThing->getTaskName();
}
示例4: testUpdate
function testUpdate()
{
//Arrange
$task_name = "Wash the dog";
$id = 1;
$due_date = null;
$test_task = new Task($task_name, $id, $due_date);
$test_task->save();
$new_task_name = "Clean the dog";
//Act
$test_task->update($new_task_name);
//Assert
$this->assertEquals("Clean the dog", $test_task->getTaskName());
}