當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Task::getCategories方法代碼示例

本文整理匯總了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]);
 }
開發者ID:CaseyH33,項目名稱:epic_ToDo_mySQL,代碼行數:19,代碼來源:TaskTest.php

示例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]);
 }
開發者ID:jtorrespdx,項目名稱:to_do,代碼行數:23,代碼來源:TaskTest.php

示例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]);
 }
開發者ID:kevintokheim,項目名稱:To_Do_Join_Database,代碼行數:21,代碼來源:TaskTest.php

示例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]);
 }
開發者ID:julianstewart,項目名稱:ToDoList,代碼行數:21,代碼來源:TaskTest.php


注:本文中的Task::getCategories方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。