function test_GetRestaurants() { //Arrange $name = "Drinks"; $id = null; $test_cuisine = new Cuisine($name, $id); $test_cuisine->save(); $restaurant = "Aalto"; $address = "123 Belmont"; $phone = "123-456-7890"; $cuisine_id = $test_cuisine->getId(); $id = 1; $test_restaurant = new Restaurant($restaurant, $address, $phone, $cuisine_id, $id); $test_restaurant->save(); $restaurant2 = "Aalto"; $address2 = "123 Belmont"; $phone2 = "123-456-7890"; $cuisine_id2 = $test_cuisine->getId(); $id = 2; $test_restaurant2 = new Restaurant($restaurant, $address, $phone, $cuisine_id, $id); $test_restaurant2->save(); //Act $result = $test_cuisine->getRestaurants(); //Assert $this->assertEquals([$test_restaurant, $test_restaurant2], $result); }
function fest_allRestaurantsInCuisine() { //Arrange $cuisine = "Pizza"; $test_cuisine = new Cuisine($cuisine); $test_cuisine->save(); $cuisine = "Burgers"; $test_cuisine2 = new Cuisine($cuisine); $test_cuisine2->save(); $restaurant_name = "Antoons"; $cuisine_type = 1; $restaurant_phone = "4128675309"; $restaurant_address = "123 Atwood St"; $test_Restaurant = new Restaurant($restaurant_name, $cuisine_type, $restaurant_phone, $restaurant_address); $test_Restaurant->save(); $restaurant_name = "Spankys"; $cuisine_type = 2; $restaurant_phone = "8015715713"; $restaurant_address = "379 E 3333 S"; $test_next_Restaurant = new Restaurant($restaurant_name, $cuisine_type, $restaurant_phone, $restaurant_address); $test_next_Restaurant->save(); $restaurant_name = "Dave & Busters"; $cuisine_type = 1; $restaurant_phone = "44444444"; $restaurant_address = "HELL"; $test_third_restaurant = new Restaurant($restaurant_name, $cuisine_type, $restaurant_phone, $restaurant_address); $test_third_restaurant->save(); //Act $result = Cuisine::getRestaurants(); //Assert $this->assertEquals([$test_Restaurant, $test_third_restaurant], $result); }
function test_getRestaurants() { //arrange $type = "Tacos"; $id = null; $test_cuisine = new Cuisine($type, $id); $test_cuisine->save(); //$test_cuisine_id = $test_cuisine->getId(); $name = "Nathans"; $cuisine_id = $test_cuisine->getId(); $price_range = 1; $neighborhood = "Felony Flats"; $test_restaurant = new Restaurant($name, $id, $cuisine_id, $price_range, $neighborhood); $test_restaurant->save(); $name2 = "Joses"; $cuisine_id = $test_cuisine->getId(); $price_range = 2; $neighborhood = "Buckman"; $test_restaurant2 = new Restaurant($name2, $id, $cuisine_id, $price_range, $neighborhood); $test_restaurant2->save(); //act $result = $test_cuisine->getRestaurants(); //assert $this->assertEquals([$test_restaurant, $test_restaurant2], $result); }
function testGetRestaurants() { //Arrange $name = "Italian"; $id = null; $test_cuisine = new Cuisine($name, $id); $test_cuisine->save(); $test_cuisine_id = $test_cuisine->getId(); $name = "Piazza Italia"; $test_restaurant = new Restaurant($name, $id, $test_cuisine_id, $rating); $test_restaurant->save(); $name2 = "Ristotante Roma"; $test_restaurant2 = new Restaurant($name, $id, $test_cuisine_id, $rating); $test_restaurant2->save(); //Act $result = $test_cuisine->getRestaurants(); //Assert $this->assertEquals([$test_restaurant, $test_restaurant2], $result); }
function test_getRestaurants() { //Arrange $flavor = "Pizza"; $id = null; $test_cuisine = new Cuisine($flavor, $id); $test_cuisine->save(); $test_cuisine_id = $test_cuisine->getId(); $name = "Burger Bash"; $phone_number = "555-666-7777"; $address = "8020 Ground Chuck"; $test_restaurant = new Restaurant($name, $phone_number, $address, $id, $test_cuisine_id); $test_restaurant->save(); $name2 = "Pizza Party"; $phone_number2 = "555-666-7747"; $address2 = "1234 Pepperoni Lane"; $test_restaurant2 = new Restaurant($name2, $phone_number2, $address2, $id, $test_cuisine_id); $test_restaurant2->save(); //Act $result = $test_cuisine->getRestaurants(); //Assert $this->assertEquals([$test_restaurant, $test_restaurant2], $result); }
function testGetRestaurants() { $type = "Thai"; $id = null; $test_Cuisine = new Cuisine($type, $id); $test_Cuisine->save(); $test_Restaurant = new Restaurant("Pok Pok", $id, "555-456-2345", "123 abcd street", "http://www.helloworld.com", $test_Cuisine->getId()); $test_Restaurant->save(); $test_Restaurant2 = new Restaurant("Whiskey Soda Lounge", $id, "555-555-5555", "678 DEF street", "http://www.pokpok.com", $test_Cuisine->getId()); $test_Restaurant2->save(); $result = $test_Cuisine->getRestaurants(); $this->assertEquals([$test_Restaurant, $test_Restaurant2], $result); }
function test_getRestaurants() { //Arrange $test_cuisine = new Cuisine("Lebanese", false, 5); $test_cuisine->save(); $test_cuisine_id = $test_cuisine->getId(); $test_restaurant1 = new Restaurant("Bens Bulkogi", 50, "eastside", true, $test_cuisine_id); $test_restaurant1->save(); //var_dump($test_restaurant1); $test_restaurant2 = new Restaurant("Marios Pizza Hole", 35, "Hole", false, $test_cuisine_id); $test_restaurant2->save(); //Act $result = $test_cuisine->getRestaurants(); //Assert $this->assertEquals([$test_restaurant1, $test_restaurant2], $result); //$this->assertEquals([], $result); }
function test_GetRestaurants() { //cuisine $name = "Japanese"; $id = null; $test_cuisine = new Cuisine($name, $id); $test_cuisine->save(); $test_cuisine_id = $test_cuisine->getId(); //restaurant1 $name = "Good Fortune"; $description = "very tasty."; $address = "1111 SW 11th Ave"; $test_restaurant = new Restaurant($name, $id, $test_cuisine_id, $description, $address); $test_restaurant->save(); //restaurant2 $name2 = "Good Luck"; $description2 = "very yummy."; $address2 = "2222 SW 12th Ave"; $test_restaurant2 = new Restaurant($name2, $id, $test_cuisine_id, $description2, $address2); $test_restaurant2->save(); $result = $test_cuisine->getRestaurants(); $this->assertEquals([$test_restaurant, $test_restaurant2], $result); }
function testGetRestaurants() { //Arrange $type = "Italian"; $id = null; $test_cuisine = new Cuisine($type, $id); $test_cuisine->save(); $test_cuisine_id = $test_cuisine->getId(); $description = "OK Chinese food"; $name = "City Chinese"; $test_restaurant = new Restaurant($description, $id, $test_cuisine_id, $name); $test_restaurant->save(); $description2 = "OK Mexican"; $name2 = "City Mexican"; $test_restaurant2 = new Restaurant($description2, $id, $test_cuisine_id, $name2); $test_restaurant2->save(); //Act $result = $test_cuisine->getRestaurants(); //Assert $this->assertEquals([$test_restaurant, $test_restaurant2], $result); }
return $app['twig']->render('index.html.twig', array('cuisines' => Cuisine::getAll())); }); $app->get("/cuisines/{id}", function ($id) use($app) { $cuisine = Cuisine::find($id); return $app['twig']->render('cuisine.html.twig', array('cuisines' => $cuisine, 'restaurants' => $cuisine->getRestaurants())); }); $app->post("/cuisines", function () use($app) { $cuisine = new Cuisine($_POST['type']); $cuisine->save(); return $app['twig']->render('index.html.twig', array('cuisines' => Cuisine::getAll())); }); $app->post("/delete_cuisines", function () use($app) { Cuisine::deleteAll(); return $app['twig']->render('index.html.twig', array('cuisines' => Cuisine::getAll())); }); $app->get("/restaurants/{id}/edit", function ($id) use($app) { // $restaurant = new Restaurant($_POST['name'], $id = null, $cuisine_id, $_POST['price_range'], $_POST['neighborhood']); $restaurant = Restaurant::find($id); return $app['twig']->render('restaurant_edit.html.twig', array('restaurant' => $restaurant)); }); $app->patch("/restaurants/{id}", function ($id) use($app) { $name = $_POST['name']; $price_range = $_POST['price_range']; $neighborhood = $_POST['neighborhood']; $restaurant = Restaurant::find($id); $restaurant->updateName($name); $restaurant->updatePriceRange($price_range); $restaurant->updateNeighborhood($neighborhood); return $app['twig']->render('cuisine.html.twig', array('cuisines' => $cuisine, 'restaurants' => $cuisine->getRestaurants())); }); return $app;
function test_getRestaurants() { $name = "Chinese"; $id = null; $test_cuisine = new Cuisine($name, $id); $test_cuisine->save(); $address = "4234 N Interstate Ave, Portland OR 97217"; $phone = "503-287-9740"; $cuisine_id = $test_cuisine->getId(); $place_name = "Happy House"; $test_restaurant = new Restaurant($place_name, $id, $address, $phone, $cuisine_id); $test_restaurant->save(); $place_name2 = "Golden Dragon"; $test_restaurant2 = new Restaurant($place_name2, $id, $address, $phone, $cuisine_id); $test_restaurant2->save(); $result = $test_cuisine->getRestaurants(); $this->assertEquals([$test_restaurant, $test_restaurant2], $result); }
function test_getRestaurants() { //Arrange $id = null; $cuisine_type = "Italian"; $test_cuisine_type = new Cuisine($id, $cuisine_type); $test_cuisine_type->save(); $test_cuisine_id = $test_cuisine_type->getId(); $name = "Salvatores"; $phone = "(503) 777-9097"; $address = "7000 Beaverton Hillsdale HWY, Portland, OR 97221"; $hours = "7am - 2am"; $test_restaurant = new Restaurant($id, $name, $phone, $address, $hours, $test_cuisine_id); $test_restaurant->save(); $name2 = "Pacinos"; $phone2 = "(453) 324-9094"; $address2 = "74 Beaverton Hillsdale HWY, Portland, OR 97221"; $hours2 = "11am - 10pm"; $test_restaurant2 = new Restaurant($id, $name2, $phone2, $address2, $hours2, $test_cuisine_id); $test_restaurant2->save(); //Act $result = $test_cuisine_type->getRestaurants(); //Assert $this->assertEquals([$test_restaurant, $test_restaurant2], $result); }
function test_GetRestaurants() { //Arrange $type = "french"; $id = null; $test_cuisine = new Cuisine($type, $id); $test_cuisine->save(); $test_type_id = $test_cuisine->getId(); $name = "Petit Provence"; $phone = "555-555-5555"; $price = "\$\$"; $cuisine_id = $test_cuisine->getId(); $test_restaurant = new Restaurant($name, $phone, $price, $cuisine_id); $test_restaurant->save(); $name2 = "Escargot"; $phone2 = "666-666-6666"; $price2 = "\$\$\$"; $test_restaurant2 = new Restaurant($name2, $phone2, $price2, $cuisine_id); $test_restaurant2->save(); //Act $result = $test_cuisine->getRestaurants(); //Assert $this->assertEquals([$test_restaurant, $test_restaurant2], $result); }
function testGetRestaurants() { //Arrange $name = "American"; $id = null; $test_cuisine = new Cuisine($name, $id); $test_cuisine->save(); $test_cuisine_id = $test_cuisine->getId(); $restaurant_name = "VQ"; $phone = '5032277342'; $address = "1220 SW 1st Ave, Portland, OR 97204"; $website = "http://www.veritablequandary.com/"; $test_restaurant = new Restaurant($restaurant_name, $phone, $address, $website, $test_cuisine_id); $test_restaurant->save(); $restaurant_name2 = "Hot Lips Pizza"; $phone2 = '5035952342'; $address2 = "721 NW 9th Ave #150, Portland, OR 97209"; $website2 = "http://hotlipspizza.com/"; $test_restaurant2 = new Restaurant($restaurant_name2, $phone2, $address2, $website2, $test_cuisine_id); $test_restaurant2->save(); //Act $result = $test_cuisine->getRestaurants(); //Assert $this->assertEquals([$test_restaurant, $test_restaurant2], $result); }