function test_save()
 {
     //Arrange
     $description = "Buy book on learning French";
     $project_id = 1;
     $position = 1;
     $test_step = new Step($description, $project_id, $position);
     //Act
     $test_step->save();
     //Assert
     $result = Step::getAll();
     $this->assertEquals([$test_step], $result);
 }
예제 #2
0
 function test_delete()
 {
     //Arrange
     $description = "Buy book on learning French";
     $project_id = 1;
     $position = 1;
     $test_step = new Step($description, $project_id, $position);
     $test_step->save();
     $description2 = "Buy French bread";
     $project_id2 = 1;
     $position2 = 2;
     $test_step2 = new Step($description2, $project_id2, $position2);
     $test_step2->save();
     //Act
     $test_step->delete();
     $result = Step::getAll();
     //Assert
     $this->assertEquals([$test_step2], $result);
 }
예제 #3
0
파일: Step.php 프로젝트: r-hills/live_test
 static function find($search_id)
 {
     $found_step = null;
     $steps = Step::getAll();
     foreach ($steps as $step) {
         if ($step->getId() == $search_id) {
             $found_step = $step;
         }
     }
     return $found_step;
 }