本文整理汇总了PHP中Task::addCategory方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::addCategory方法的具体用法?PHP Task::addCategory怎么用?PHP Task::addCategory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task
的用法示例。
在下文中一共展示了Task::addCategory方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUpdateMark
function testUpdateMark()
{
$name = "Work stuff";
$id = 1;
$test_category = new Category($name, $id);
$test_category->save();
$description = "File reports";
$mark = FALSE;
$id2 = 2;
$test_task = new Task($description, $mark, $id2);
$test_task->save();
$new_mark = True;
$test_task->addCategory($test_category);
$test_task->updateMark($new_mark);
$this->assertEquals(TRUE, $test_task->getMark());
}
示例2: testDelete
function testDelete()
{
//Arrange
$name = "Work stuff";
$id = 1;
$test_category = new Category($name, $id);
$test_category->save();
$description = "File reports";
$id2 = 2;
$due_date = '2015-01-01';
$test_task = new Task($description, $id2, $due_date);
$test_task->save();
//Act
$test_task->addCategory($test_category);
$test_task->delete();
//Assert
$this->assertEquals([], $test_category->getTasks());
}
示例3: testGetCategories
function testGetCategories()
{
// Arrange
$name = "Work stuff";
$id = 1;
$test_category = new Category($name, $id);
$test_category->save();
$name2 = "Volunteer stuff";
$id2 = 2;
$test_category2 = new Category($name2, $id2);
$test_category2->save();
$description = "Reply to emails";
$id3 = 3;
$due_date = "2016-02-28";
$test_task = new Task($description, $id3, $due_date);
$test_task->save();
// Act
$test_task->addCategory($test_category);
$test_task->addCategory($test_category2);
// Assert
$this->assertEquals($test_task->getCategories(), [$test_category, $test_category2]);
}
示例4: testDelete
function testDelete()
{
//Arrange
$category_name = "Work stuff";
$id = 1;
$test_category = new Category($category_name, $id);
$test_category->save();
$task_name = "File reports";
$id2 = 2;
$due_date = null;
$test_task = new Task($task_name, $id2, $due_date);
$test_task->save();
//Act
$test_task->addCategory($test_category);
$test_task->deleteOne();
//Assert
$this->assertEquals([], $test_category->getTasks());
}
示例5: Category
function test_delete()
{
//Arrange
$name = "Work stuff";
$test_category = new Category($name);
$test_category->save();
$description = "File reports";
$due_date = "2014-09-08";
$test_task = new Task($description, $due_date);
$test_task->save();
//Act
$test_task->addCategory($test_category);
$test_task->delete();
//Assert
$this->assertEquals([], $test_category->getTasks());
}
示例6: testGetCategories
function testGetCategories()
{
//Arrange
$name = "Home stuff";
$id = 1;
$test_category = new Category($name, $id);
$test_category->save();
$name2 = "not home stuff";
$id2 = 2;
$test_category2 = new Category($name, $id2);
$test_category2->save();
$description = "File reports";
$id3 = 3;
$test_task = new Task($description, $id3);
$test_task->save();
//Act
$test_task->addCategory($test_category);
$test_task->addCategory($test_category2);
//Assert
$this->assertEquals($test_task->getCategories(), [$test_category, $test_category2]);
}
示例7: testDeleteTask
function testDeleteTask()
{
//Arrange
$name = "Work stuff";
$id = 1;
$test_category = new Category($name, $id);
$test_category->save();
$description2 = "Water the lawn";
$id2 = 2;
$due_date2 = "3094-09-21";
$test_task2 = new Task($description2, $id2, $due_date2);
$test_task2->save();
//Act
$test_task2->addCategory($test_category);
$test_task2->delete();
//Assert
$this->assertEquals([], $test_category->getTasks());
}