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