コード例 #1
0
ファイル: DrunkTest.php プロジェクト: calascionec/tapThat
 function testdelete()
 {
     //Arrange
     $name = "Person 1";
     $date_of_birth = "1988-03-04";
     $location = "Portland, OR";
     $email = "*****@*****.**";
     $password = "******";
     $test_drunk = new Drunk($name, $date_of_birth, $location, $email, $password);
     $test_drunk->save();
     $name2 = "Person 1";
     $date_of_birth2 = "1988-03-04";
     $location2 = "Portland, OR";
     $email2 = "*****@*****.**";
     $password2 = "them";
     $test_drunk2 = new Drunk($name2, $date_of_birth2, $location2, $email2, $password2);
     $test_drunk2->save();
     //Act
     $test_drunk->delete();
     $result = Drunk::getALL();
     //Assert
     $this->assertEquals([$test_drunk2], $result);
 }
コード例 #2
0
ファイル: Drunk.php プロジェクト: calascionec/tapThat
 static function find($search_id)
 {
     $found_drunk = null;
     $returned_drunks = Drunk::getALL();
     foreach ($returned_drunks as $drunk) {
         $id = $drunk->getid();
         if ($id == $search_id) {
             $found_drunk = $drunk;
         }
     }
     return $found_drunk;
 }