本文整理汇总了PHP中Task::getDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::getDescription方法的具体用法?PHP Task::getDescription怎么用?PHP Task::getDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task
的用法示例。
在下文中一共展示了Task::getDescription方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testTask
public function testTask()
{
$mock = $this->getMock('stdClass', ['callback']);
$mock->expects($this->exactly(1))->method('callback');
$task = new Task('task_name', function () use($mock) {
$mock->callback();
});
$context = $this->getMockBuilder('Deployer\\Task\\Context')->disableOriginalConstructor()->getMock();
$task->run($context);
$this->assertEquals('task_name', $task->getName());
$task->desc('Task description.');
$this->assertEquals('Task description.', $task->getDescription());
$task->once();
$this->assertTrue($task->isOnce());
$task->onlyOn(['server']);
$this->assertEquals(['server' => 0], $task->getOnlyOn());
$this->assertTrue($task->runOnServer('server'));
$task->onlyOn([]);
$this->assertTrue($task->runOnServer('server'));
$task->onlyOn('server');
$this->assertEquals(['server' => 0], $task->getOnlyOn());
$this->assertTrue($task->runOnServer('server'));
$task->onlyOn();
$this->assertTrue($task->runOnServer('server'));
$task->setPrivate();
$this->assertTrue($task->isPrivate());
}
示例2: Task
function test_getDescription()
{
//Arrange
$description = "Wash the dog";
$test_task = new Task($description);
$test_task->save();
//Act
$result = $test_task->getDescription();
//Assert
$this->assertEquals("Wash the dog", $result);
}
示例3: Task
function test_Update()
{
//Arrange
$id = 1;
$description = "Wash the dog";
$date_due = "1990-12-11";
$time_due = "09:00:00";
$test_task = new Task($id, $description, $date_due, $time_due);
$test_task->save();
$new_description = "Home stuff";
//Act
$test_task->update($new_description);
//Assert
$this->assertEquals("Home stuff", $test_task->getDescription());
}
示例4: testUpdate
function testUpdate()
{
//Arrange
$description = "Wash the dog";
$id = 1;
$due_date = '2015-01-01';
$test_task = new Task($description, $due_date, $id);
$test_task->save();
$new_description = "Clean the dog";
$new_due_date = '2015-02-01';
//Act
$test_task->update($new_description, $new_due_date);
//Assert
$this->assertEquals("Clean the dog", $test_task->getDescription());
}
示例5: testUpdate
function testUpdate()
{
//Arrange
$description = "Wash the dog";
$id = 1;
$due_date = null;
$completed = 0;
$test_task = new Task($description, $id, $completed, $due_date);
$test_task->save();
$new_description = "Clean the dog";
//Act
$test_task->update($new_description);
//Assert
$this->assertEquals("Clean the dog", $test_task->getDescription());
}
示例6: date
if ($formattedDeadline !== false) {
$formattedDeadline = date("Y-m-d H:i:s", $formattedDeadline);
$task->setDeadline($formattedDeadline);
}
if ($numNeeded != '') {
$task->setNumNeeded($numNeeded);
}
$task->save();
// save uploaded files to database
foreach ($_POST['file'] as $stored => $orig) {
$stored = Filter::text($stored);
$orig = Filter::text($orig);
Upload::saveToDatabase($orig, $stored, Upload::TYPE_TASK, $task->getID(), $project->getID());
}
// log it
$logEvent = new Event(array('event_type_id' => 'create_task', 'project_id' => $project->getID(), 'user_1_id' => Session::getUserID(), 'item_1_id' => $task->getID(), 'data_1' => $task->getTitle(), 'data_2' => $task->getDescription()));
$logEvent->save();
// we're done here
Session::setMessage('You created a new task.');
$json = array('success' => '1', 'successUrl' => Url::task($task->getID()));
echo json_encode($json);
} elseif ($action == 'edit') {
// flag default is false; assume nothing is modified to start
$modified = false;
// is title modified?
if ($title != $task->getTitle()) {
// save changes
$oldTitle = $task->getTitle();
$task->setTitle($title);
$task->save();
// log it
示例7: testUpdate
function testUpdate()
{
// Arrange
$due_date = "2015-10-12";
$description = "Wash the dog";
$test_task = new Task($description, $due_date, 1);
$test_task->save();
$new_description = "Clean the dog";
//Act
$test_task->update($new_description);
//Assert
$this->assertEquals("Clean the dog", $test_task->getDescription());
}
示例8: shouldCreateNewTask
/**
* @test
*/
public function shouldCreateNewTask()
{
$task = new Task('Sample Title', 'Sample Description');
$this->assertEquals('Sample Title', $task->getTitle());
$this->assertEquals('Sample Description', $task->getDescription());
}
示例9: array
require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/Task.php";
session_start();
if (empty($_SESSION['list_of_tasks'])) {
$_SESSION['list_of_tasks'] = array();
}
$app = new Silex\Application();
$app->get("/", function () {
$output = "";
$all_tasks = Task::getAll();
if (!empty($all_tasks)) {
$output = $output . "\n <h1>Here's what you need to do</h1>\n ";
foreach (Task::getAll() as $task) {
$output = $output . "<p>" . $task->getDescription() . "</p>";
}
}
$output = $output . "\n <form action='/tasks' method='post'>\n <label for='description'>Task Description</label>\n <input id='description' name='description' type='text'>\n\n <button type='submit'>Add Task</button>\n </form>\n ";
$output .= "\n <form action ='/delete_tasks' method='post'>\n <button type='submit'>DELETE!</button>\n </form>\n ";
return $output;
});
$app->post("/tasks", function () {
$task = new Task($_POST['description']);
$task->save();
return "\n <h1>You made a Task!</h1>\n <p>" . $task->getDescription() . "</p>\n <p><a href='/'> View your list of things to do.</a></p>\n ";
});
$app->post("/delete_tasks", function () {
Task::deleteAll();
return "\n <h1> ALL DONE!</a1>\n <p><a href='/'>Back to Work!</a></p>\n ";
});
return $app;
示例10: InsertNewTask
public function InsertNewTask(Task $task = null)
{
if ($task == null || !$task instanceof Task) {
return null;
}
$props = array("UserID," => $task->getUserID(), "ProjectID," => $task->getProjectID(), "Title," => $task->getTitle(), "Date," => $task->getDate(), "TargetHours," => $task->getTargetHours(), "ActualHours," => $task->getActualHours(), "Description," => $task->getDescription(), "IsComplete" => $task->getIsComplete());
foreach ($props as $k => $v) {
if ($v != null) {
if ($k == "IsComplete") {
$_props[$k] = "{$v}";
} else {
if (gettype($v) == "string") {
$_props[$k] = "'" . $v . "', ";
} else {
$_props[$k] = "{$v}, ";
}
}
}
}
$this->_dbAdapt->IStatement($this->dbTbl, $_props);
$tmp = $this->_dbAdapt->getLnk();
$tmp->query($this->_dbAdapt->getQry());
unset($tmp);
return true;
}
示例11: Task
function test_update()
{
$description = "Wash the dog";
$id = 1;
$due_date = "2000-01-01";
$test_task = new Task($description, $id, $due_date);
$test_task->save();
$new_description = "Clean the dog";
$test_task->update($new_description, $due_date, 0);
$this->assertEquals("Clean the dog", $test_task->getDescription());
}
示例12: Task
function test_update()
{
//Arrange
$description = "Wash the dog";
$due_date = "1234-12-12";
$id = 1;
$task = new Task($description, $due_date, $id);
$task->save();
$new_description = "Clean the dog";
//Act
$task->update($new_description);
//Assert
$this->assertEquals("Clean the dog", $task->getDescription());
}
示例13: testUpdate
function testUpdate()
{
//Arrange
$name = "School stuff";
$id = null;
$test_category = new Category($name, $id);
$test_category->save();
$description = "Wash the dog";
$category_id = $test_category->getId();
$test_task = new Task($description, $id, $category_id);
$test_task->save();
$new_description = "Clean the dog";
//Act
$test_task->update($new_description);
//Assert
$this->assertEquals("Clean the dog", $test_task->getDescription());
}
示例14: equals
public function equals(Task $that)
{
return $this->getTitle() === $that->getTitle() && $this->getDescription() === $that->getDescription();
}