function test_deleteAll() { //Arrange $id = null; $name = "Taco Restaurant"; $phone = "(503) 777-9097"; $address = "7000 Beaverton Hillsdale HWY, Portland, OR 97221"; $hours = "7am - 2am"; $cuisine_id = 7; $test_restaurant = new Restaurant($id, $name, $phone, $address, $hours, $cuisine_id); $test_restaurant->save(); $id2 = null; $name2 = "Taco Johns"; $phone2 = "(717) 792-1012"; $address2 = "901 Mississippi St, Portland, OR 97221"; $hours2 = "8am - 10pm"; $cuisine_id2 = 3; $test_restaurant2 = new Restaurant($id2, $name2, $phone2, $address2, $hours2, $cuisine_id2); $test_restaurant2->save(); //Act Restaurant::deleteAll(); //Assert $result = Restaurant::getAll(); $this->assertEquals([], $result); }
function test_deleteAll() { //Arrange $restaurant_name = "Joes Burgers"; $restaurant_name2 = "McDonalds"; $test_Restaurant = new Restaurant($restaurant_name); $test_Restaurant->save(); $test_Restaurant2 = new Restaurant($restaurant_name2); $test_Restaurant2->save(); //Act Restaurant::deleteAll(); $result = Restaurant::getAll(); //Assert $this->assertEquals([], $result); }
function test_restaurant_deleteAll() { //Arrange $style = "Thai"; $test_cuisine = new Cuisine($style); $test_cuisine->save(); $name = "Pok Pok"; $category_id = $test_cuisine->getId(); $test_restaurant = new Restaurant($name, $category_id); $test_restaurant->save(); $name2 = "Mai Thai"; $category_id = $test_cuisine->getId(); $test_restaurant2 = new Restaurant($name2, $category_id); $test_restaurant2->save(); //Act Restaurant::deleteAll(); //Assert $result = Restaurant::getAll(); $this->assertEquals([], $result); }
function test_deleteAll() { $name = "Asian"; $id = null; $test_cuisine = new Cuisine($name, $id); $test_cuisine->save(); $restaurant_name = "The Golden Duck"; $location = "898 SW 5th Ave, Portland, OR"; $description = "A Chill Asian experince"; $price = "\$\$"; $cuisine_id = $test_cuisine->getId(); $test_restaurant = new Restaurant($restaurant_name, $location, $description, $price, $cuisine_id); $test_restaurant->save(); $restaurant_name2 = "The Red Dragon"; $location2 = "899 SW 5th Ave, Portland, OR"; $description2 = "A Intense Asian experince"; $price2 = "\$\$\$"; $cuisine_id2 = $test_cuisine->getId(); $test_restaurant2 = new Restaurant($restaurant_name2, $location2, $description2, $price2, $cuisine_id2); $test_restaurant2->save(); Restaurant::deleteAll(); $result = Restaurant::getAll(); $this->assertEquals([], $result); }
protected function tearDown() { User::deleteAll(); Response::deleteAll(); Restaurant::deleteAll(); }
function test_deleteAll() { //Arrange $flavor = "Burgers"; $id = null; $test_cuisine = new Cuisine($flavor, $id); $test_cuisine->save(); $name = "Burger Bash"; $phone_number = "555-666-7777"; $address = "8020 Ground Chuck"; $cuisine_id = $test_cuisine->getId(); $test_restaurant = new Restaurant($name, $phone_number, $address, $id, $cuisine_id); $test_restaurant->save(); $name2 = "Pizza Party"; $phone_number2 = "555-666-7747"; $address2 = "1234 Pepperoni Lane"; $cuisine_id = $test_cuisine->getId(); $test_restaurant2 = new Restaurant($name2, $phone_number2, $address2, $id, $cuisine_id); $test_restaurant2->save(); //Act Restaurant::deleteAll(); //Assert $result = Restaurant::getAll(); $this->assertEquals([], $result); }
protected function tearDown() { Allergen::deleteAll(); Restaurant::deleteAll(); }
function test_deleteAll() { //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(); $test_restaurant = new Restaurant($restaurant, $address, $phone, $cuisine_id, $id); $test_restaurant->save(); $restaurant2 = "HobNob"; $address2 = "999 somewhere"; $phone2 = "234-555-5555"; $cuisine_id2 = $test_Cuisine->getId(); $test_restaurant2 = new Restaurant($restaurant, $address, $phone, $cuisine_id, $id); $test_restaurant2->save(); //Act Restaurant::deleteAll(); //Assert $result = Restaurant::getAll(); $this->assertEquals([], $result); }
function test_deleteAll() { //arrange $type = "Tacos"; $id = null; $test_cuisine = new Cuisine($type, $id); $test_cuisine->save(); $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"; $price_range = 2; $neighborhood = "Buckman"; $cuisine_id = $test_cuisine->getId(); $test_restaurant2 = new Restaurant($name2, $id, $cuisine_id, $price_range, $neighborhood); $test_restaurant2->save(); //act Restaurant::deleteAll(); //assert $result = Restaurant::getAll(); $this->assertEquals([], $result); }
function test_deleteAll() { $name = "Chinese"; $id = null; $test_cuisine = new Cuisine($name, $id); $test_cuisine->save(); $place_name = "Happy House"; $address = "4234 N Interstate Ave, Portland OR 97217"; $phone = "503-287-9740"; $cuisine_id = $test_cuisine->getId(); $test_restaurant = new Restaurant($place_name, $id, $address, $phone, $cuisine_id); $test_restaurant->save(); $place_name2 = "Golden Dragon"; $address2 = "324 SW 3rd Ave, Portland, OR 97204"; $phone2 = "503-274-1900"; $cuisine_id = $test_cuisine->getId(); $test_restaurant2 = new Restaurant($place_name2, $id, $address2, $phone2, $cuisine_id); $test_restaurant2->save(); Restaurant::deleteAll(); $result = Restaurant::getAll(); $this->assertEquals([], $result); }
function test_deleteAll() { //Arrange $name = "Italian"; $id = null; $test_cuisine = new Cuisine($name, $id); $test_cuisine->save(); $name = "Piazza Italia"; $rating = 1; $cuisine_id = $test_cuisine->getId(); $test_restaurant = new Restaurant($name, $id, $cuisine_id, $rating); $test_restaurant->save(); $name2 = "Ristorante Roma"; $rating = 1; $test_restaurant2 = new Restaurant($name2, $id, $cuisine_id, $rating); $test_restaurant2->save(); //Act Restaurant::deleteAll(); //Assert $result = Restaurant::getAll(); $this->assertEquals([], $result); }
function testDeleteAll() { //Arrange $type = "Italian"; $id = null; $test_cuisine = new Cuisine($type, $id); $test_cuisine->save(); $name = "City Chinese"; $description = "OK Chinese food"; $cuisine_id = $test_cuisine->getId(); $test_restaurant = new Restaurant($description, $id, $cuisine_id, $name); $test_restaurant->save(); $name2 = "City Mexican"; $description2 = "OK Mexican food"; $test_restaurant2 = new Restaurant($description2, $id, $cuisine_id, $name2); $test_restaurant2->save(); //Assert Restaurant::deleteAll(); //Assert $result = Restaurant::getAll(); $this->assertEquals([], $result); }
function test_deleteAll() { //Arrange $restaurant_name = "VQ"; $phone = '5032277342'; $address = "1220 SW 1st Ave, Portland, OR 97204"; $website = "http://www.veritablequandary.com/"; $id = null; $cuisine_id = null; $test_restaurant = new Restaurant($restaurant_name, $phone, $address, $website, $cuisine_id, $id); $test_restaurant->save(); $restaurant_name2 = "Hot Lips Pizza"; $phone2 = '5035952342'; $address2 = "721 NW 9th Ave #150, Portland, OR 97209"; $website2 = "http://hotlipspizza.com/"; $id2 = null; $cuisine_id2 = null; $test_restaurant2 = new Restaurant($restaurant_name2, $phone2, $address2, $website2, $cuisine_id2, $id2); $test_restaurant2->save(); //Act Restaurant::deleteAll(); //Assert $result = Restaurant::getAll(); $this->assertEquals([], $result); }
function test_deleteAll() { //cuisine $name = "Japanese"; $id = null; $test_cuisine = new Cuisine($name, $id); $test_cuisine->save(); //restaurant1 $name = "Good Fortune"; $description = "very tasty."; $address = "1111 SW 11th Ave"; $cuisine_id = $test_cuisine->getId(); $test_restaurant = new Restaurant($name, $id, $cuisine_id, $description, $address); $test_restaurant->save(); //restaurant2 $name2 = "Good Luck"; $description2 = "very yummy."; $address2 = "2222 SW 12th Ave"; $cuisine_id = $test_cuisine->getId(); $test_restaurant2 = new Restaurant($name2, $id, $cuisine_id, $description2, $address2); $test_restaurant2->save(); Restaurant::deleteAll(); $result = Restaurant::getAll(); $this->AssertEquals([], $result); }
protected function tearDown() { Cuisine::deleteAll(); Restaurant::deleteAll(); Review::deleteAll(); }
return $app['twig']->render('cuisines.html.twig', array('cuisines' => $cuisine, 'restaurants' => $cuisine->getRestaurants())); }); //brings user to a page that allows a specific restaurant to be edited $app->get('/restaurant/{id}/edit', function ($id) use($app) { $restaurant = Restaurant::find($id); return $app['twig']->render('restaurant_edit.html.twig', array('restaurants' => $restaurant)); }); //posts edited data to the database to update a property in the existing restaurant $app->patch('/restaurant/{id}', function ($id) use($app) { $restaurant = Restaurant::find($id); $cuisine = Cuisine::find($_POST['cuisine_id']); foreach ($_POST as $key => $value) { if (!empty($value)) { $restaurant->update($key, $value); } } return $app['twig']->render('cuisines.html.twig', array('cuisines' => $cuisine, 'restaurants' => $cuisine->getRestaurants())); }); //delete all restaurants in a specific cuisine $app->post('/delete_restaurants', function () use($app) { Restaurant::deleteAll(); return $app['twig']->render('index.html.twig', array('restaurants' => Restaurant::getAll())); }); //deletes specific restaurant $app->delete('/restaurant/{id}', function ($id) use($app) { $restaurant = Restaurant::find($id); $cuisine = Cuisine::find($_POST['cuisine_id']); $restaurant->delete(); return $app['twig']->render('cuisines.html.twig', array('cuisines' => $cuisine, 'restaurants' => $cuisine->getRestaurants())); }); return $app;
function test_deleteAll() { //arrange $name = "Taco Hell"; $id = null; $test_restaurant = new Restaurant($name, $id); $test_restaurant->save(); $name2 = "Burger Queen"; $test_restaurant2 = new Restaurant($name2, $id); $test_restaurant2->save(); //act Restaurant::deleteAll(); //assert $result = Restaurant::getAll(); $this->assertEquals([], $result); }