Esempio n. 1
0
 function test_getRestaurants()
 {
     //arrange
     $name = "peanuts";
     $test_allergen = new Allergen($name);
     $test_allergen->save();
     $test_allergen_id = $test_allergen->getId();
     $restaurant_name = "Taco Hell";
     $test_restaurant = new Restaurant($restaurant_name, $test_allergen_id);
     $test_restaurant->save();
     $restaurant_name2 = "Burger Queen";
     $test_restaurant2 = new Restaurant($restaurant_name2, $test_allergen_id);
     $test_restaurant2->save();
     //act
     $result = $test_allergen->getRestaurants();
     //assert
     $this->assertEquals([$test_restaurant, $test_restaurant2], $result);
 }
 function test_getRestaurants()
 {
     //arrange
     $name = "peanuts";
     $test_allergen = new Allergen($name);
     $test_allergen->save();
     $test_allergen_id = $test_allergen->getId();
     $restaurant_name = "Taco Hell";
     $test_restaurant = new Restaurant($restaurant_name);
     $test_restaurant->save();
     $restaurant_name2 = "Burger Queen";
     $test_restaurant2 = new Restaurant($restaurant_name2);
     $test_restaurant2->save();
     //act
     //addRestaurant and getRestaurant are dependent on each other!
     $test_allergen->addRestaurant($test_restaurant);
     $test_allergen->addRestaurant($test_restaurant2);
     $result = $test_allergen->getRestaurants();
     //assert
     $this->assertEquals([$test_restaurant, $test_restaurant2], $result);
 }