Beispiel #1
0
 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());
 }
 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());
 }
Beispiel #3
0
 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]);
 }
 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());
 }
 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());
 }
Beispiel #6
0
 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]);
 }
 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());
 }