本文整理匯總了PHP中Task::getCategories方法的典型用法代碼示例。如果您正苦於以下問題:PHP Task::getCategories方法的具體用法?PHP Task::getCategories怎麽用?PHP Task::getCategories使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Task
的用法示例。
在下文中一共展示了Task::getCategories方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testGetCategories
function testGetCategories()
{
$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 = "File reports";
$id3 = 3;
$due_date = "2000-01-01";
$test_task = new Task($description, $id3, $due_date);
$test_task->save();
$test_task->addCategory($test_category);
$test_task->addCategory($test_category2);
$this->assertEquals($test_task->getCategories(), [$test_category, $test_category2]);
}
示例2: 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 = "File reports";
$id3 = 3;
$due_date = null;
$completed = 0;
$test_task = new Task($description, $id3, $completed, $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]);
}
示例3: Category
function test_getCategories()
{
//Arrange
$name = "Halloween Stuff";
$id = 1;
$test_category = new Category($name, $id);
$test_category->save();
$name2 = "Carve the pumpkin";
$id2 = 2;
$test_category2 = new Category($name2, $id2);
$test_category2->save();
$description = "Scare trick or treaters";
$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]);
}
示例4: 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]);
}