static function find($search_id) { $found_description = null; $all_descriptions = Description::getAll(); foreach ($all_descriptions as $description) { $possible_id = $description->getId(); if ($possible_id == $search_id) { $found_description = $description; } } return $found_description; }
function test_deleteAll() { //Arrange $name = "Mike"; $gender = "male"; $age = "25"; $alignment = "LG"; $height = "6ft 1in"; $eye_color = "hazel"; $hair_color = "brown"; $skin_tone = "dark"; $other = "stuff"; $test_description = new Description($name, $gender, $age, $alignment, $height, $eye_color, $hair_color, $skin_tone, $other); $test_description->save(); $name2 = "Michael"; $gender2 = "female"; $age2 = "30"; $alignment2 = "CG"; $height2 = "6ft 1in"; $eye_color2 = "brown"; $hair_color2 = "black"; $skin_tone2 = "copper"; $other2 = "more stuff"; $test_description2 = new Description($name2, $gender2, $age2, $alignment2, $height2, $eye_color2, $hair_color2, $skin_tone2, $other2); $test_description2->save(); //Act Description::deleteAll(); $result = Description::getAll(); //Assert $this->assertEquals([], $result); }