Ejemplo n.º 1
0
 function test_deleteCuisineVenue()
 {
     //Arrange
     $type = "Italian";
     $id = null;
     $test_cuisine = new Cuisine($type, $id);
     $test_cuisine->save();
     $name = "Montage";
     $cuisine_id = $test_cuisine->getId();
     $rating = 4;
     $address = "1139 NW Elm Street";
     $description = "Yum yum for my tum tum";
     $test_venue = new Venue($name, $cuisine_id, $id, $rating, $address, $description);
     $test_venue->save();
     //Act
     $test_cuisine->deleteCuisine();
     //Assert
     $this->assertEquals([], Venue::getAll());
 }
Ejemplo n.º 2
0
 function test_Delete()
 {
     //Arrange
     $name = "American";
     $id = null;
     $test_cuisine = new Cuisine($name, $id);
     $test_cuisine->save();
     $restaurant_name = "VQ";
     $phone = '5032277342';
     $address = "1220 SW 1st Ave, Portland, OR 97204";
     $website = "http://www.veritablequandary.com/";
     $cuisine_id = $test_cuisine->getId();
     $test_restaurant = new Restaurant($restaurant_name, $phone, $address, $website, $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, $cuisine_id);
     $test_restaurant2->save();
     //Act
     $test_restaurant->delete();
     //Assert
     $this->assertEquals([$test_restaurant2], Restaurant::getAll());
 }
Ejemplo n.º 3
0
 function test_GetReviews()
 {
     //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();
     //review1
     $username = "******";
     $date = '0000-00-00';
     $rating = 5;
     $comment = "good one.";
     $restaurant_id = $test_restaurant->getId();
     $test_review = new Review($username, $date, $rating, $comment, $restaurant_id, $id);
     $test_review->save();
     //review2
     $username2 = "Jen";
     $date2 = '1111-00-00';
     $rating2 = 2;
     $comment2 = "Bad one.";
     $restaurant_id = $test_restaurant->getId();
     $test_review2 = new Review($username2, $date2, $rating2, $comment2, $restaurant_id, $id);
     $test_review2->save();
     $result = $test_restaurant->getReviews();
     $this->assertEquals([$test_review, $test_review2], $result);
 }
 function testUpdate()
 {
     //Arrange
     $type = "french";
     $id = null;
     $test_cuisine = new Cuisine($type, $id);
     $test_cuisine->save();
     $name = "Petit Provence";
     $phone = "555-555-5555";
     $price = "\$\$";
     $cuisine_id = $test_cuisine->getId();
     // $id = null;
     $test_restaurant = new Restaurant($name, $phone, $price, $cuisine_id);
     $test_restaurant->save();
     $new_name = "Escargot";
     $new_phone = "666-666-6666";
     $new_price = "\$\$\$";
     // $cuisine_id = 1;
     // $new_id = null;
     $new_test_restaurant = new Restaurant($new_name, $new_phone, $new_price, $cuisine_id, $test_restaurant->getId());
     // $new_test_restaurant->save();
     // var_dump($new_test_restaurant);
     //Act
     $test_restaurant->update($new_name, $new_phone, $new_price);
     //Assert
     $this->assertEquals($test_restaurant, $new_test_restaurant);
 }
Ejemplo n.º 5
0
$app['debug'] = true;
$server = 'mysql:host=localhost;dbname=best_restaurant';
$username = '******';
$password = '******';
$DB = new PDO($server, $username, $password);
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views'));
use Symfony\Component\HttpFoundation\Request;
Request::enableHttpMethodParameterOverride();
//landing page which displays all cuisines
$app->get("/", function () use($app) {
    return $app['twig']->render('index.html.twig', array('cuisines' => Cuisine::getAll()));
});
//creates a new cuisine, saves it to the database, and displays it on the homepage
$app->post('/cuisines', function () use($app) {
    $cuisine = new Cuisine($_POST['name']);
    $cuisine->save();
    return $app['twig']->render('index.html.twig', array('cuisines' => Cuisine::getAll()));
});
//brings user to specific cuisine page
$app->get("/cuisines/{id}", function ($id) use($app) {
    $cuisine = Cuisine::find($id);
    return $app['twig']->render('cuisines.html.twig', array('cuisines' => $cuisine, 'restaurants' => $cuisine->getRestaurants()));
});
//brings user to a page that allows a specific cuisine to be edited
$app->get('/cuisines/{id}/edit', function ($id) use($app) {
    $cuisine = Cuisine::find($id);
    return $app['twig']->render('cuisine_edit.html.twig', array('cuisines' => $cuisine));
});
//posts edited data to the database to update a property in the existing cuisine
$app->patch("/cuisines/{id}", function ($id) use($app) {
    $name = $_POST['name'];
Ejemplo n.º 6
0
 function test_DeleteCuisineRestaurants()
 {
     //Arrange
     //cuisine
     $name = "Japanese";
     $id = null;
     $test_cuisine = new Cuisine($name, $id);
     $test_cuisine->save();
     //restaurant
     $name = "Good Fortune";
     $cuisine_id = $test_cuisine->getId();
     $description = "very tasty.";
     $address = "1111 SW 11th Ave";
     $test_restaurant = new Restaurant($name, $id, $cuisine_id, $description, $address);
     $test_restaurant->save();
     //Act
     $test_cuisine->delete();
     //Assert
     $this->assertEquals([], Restaurant::getAll());
 }
 function testDeleteCuisineRestaurants()
 {
     //Arrange
     $name = "Italian";
     $id = null;
     $test_cuisine = new Cuisine($name, $id);
     $test_cuisine->save();
     $name = "Piazza Italia";
     $cuisine_id = $test_cuisine->getId();
     $test_restaurant = new Restaurant($name, $id, $cuisine_id, $rating);
     $test_restaurant->save();
     //Act
     $test_cuisine->delete();
     //Assert
     $this->assertEquals([], Restaurant::getAll());
 }
 function test_RestarauntDelete()
 {
     //Arrange
     $cuisine_name = "Italian";
     $id = null;
     $test_cuisine = new Cuisine($cuisine_name, $id);
     $test_cuisine->save();
     $restaraunt_name = "Mamas Home Country Cookin";
     $cuisine_id = $test_cuisine->getId();
     $test_restaraunt = new Restaraunt($restaraunt_name, $id, $cuisine_id);
     $test_restaraunt->save();
     $restaraunt_name2 = "Big Bobs Fried Alligator";
     $test_restaraunt2 = new Restaraunt($restaraunt_name2, $id, $cuisine_id);
     $test_restaraunt2->save();
     //Act
     $test_restaraunt->delete();
     //Assert
     $this->assertEquals([$test_restaraunt2], Restaraunt::getAll());
 }
 function test_Update()
 {
     //Arrange
     $id = null;
     $cuisine_type = "Itilian";
     $test_cuisine_type = new Cuisine($id, $cuisine_type);
     $test_cuisine_type->save();
     $new_cuisine_type = "Italian";
     //Act
     $test_cuisine_type->update($new_cuisine_type);
     //Assert
     $this->assertEquals("Italian", $test_cuisine_type->getCuisineType());
 }
Ejemplo n.º 10
0
 function testDeleteCuisineRestaurants()
 {
     //Arrange
     $flavor = "Pizza";
     $id = null;
     $test_cuisine = new Cuisine($flavor, $id);
     $test_cuisine->save();
     $name = "Pizza Party";
     $phone_number = "123-123-1234";
     $address = "1234 Pepporoni Lane";
     $cuisine_id = $test_cuisine->getId();
     $test_restaurant = new Restaurant($name, $phone_number, $address, $id, $cuisine_id);
     $test_restaurant->save();
     //Act
     $test_cuisine->delete();
     //Assert
     $this->assertEquals([], Restaurant::getAll());
 }
Ejemplo n.º 11
0
 function test_deleteVenue()
 {
     //Arrange
     $type = "Thai";
     $id = null;
     $test_cuisine = new Cuisine($type, $id);
     $test_cuisine->save();
     $test_cuisine_id = $test_cuisine->getId();
     $name = "Mai Thai";
     $address = "1139 NW Elm Street";
     $description = "Yum yum for my tum tum";
     $rating = 3;
     $name2 = "Screen Door";
     $address2 = "19849 SW Santee Court";
     $description2 = "Huge lines.  Not worth it.";
     $rating2 = 4;
     $test_venue = new Venue($name, $test_cuisine_id, $id, $rating, $address, $description);
     $test_venue2 = new Venue($name2, $test_cuisine_id, $id, $rating2, $address2, $description2);
     $test_venue->save();
     $test_venue2->save();
     //Act
     $test_venue->deleteVenue();
     //Assert
     $this->assertEquals([$test_venue2], Venue::getAll());
 }
Ejemplo n.º 12
0
 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);
 }
Ejemplo n.º 13
0
 function test_find()
 {
     //Arrange
     $test_name = "Toms Tomatos ";
     $test_seats = 15;
     $test_location = "Farmville";
     $test_evenings = true;
     $test_cuisine = new Cuisine("Mexican", true, 1);
     $test_cuisine->save();
     $test_restaurant = new Restaurant($test_name, $test_seats, $test_location, $test_evenings, $test_cuisine->getId());
     $test_restaurant->save();
     //Act
     $result = Restaurant::find($test_restaurant->getId());
     //Assert
     $this->assertEquals($test_restaurant, $result);
 }
Ejemplo n.º 14
0
 function test_update()
 {
     $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();
     $new_place_name = "Very Happy House";
     $new_address = "5000 N Interstate Ave, Portland OR 97217";
     $new_phone = "503-287-9000";
     $test_restaurant->update($new_place_name, $new_address, $new_phone);
     $this->assertEquals("Very Happy House", $test_restaurant->getPlaceName());
     $this->assertEquals("5000 N Interstate Ave, Portland OR 97217", $test_restaurant->getAddress());
     $this->assertEquals("503-287-9000", $test_restaurant->getPhone());
 }
Ejemplo n.º 15
0
 function test_restaurant_getStars()
 {
     //Arrange
     $style = "Thai";
     $test_cuisine = new Cuisine($style);
     $test_cuisine->save();
     $name = "Pok Pok";
     $category_id = $test_cuisine->getId();
     $stars = 5;
     $test_restaurant = new Restaurant($name, $category_id, null, $stars);
     $test_restaurant->save();
     $name2 = "Dicks";
     $stars2 = 3;
     $category_id2 = $test_cuisine->getId();
     $test_restaurant2 = new Restaurant($name2, $category_id, null, $stars2);
     $test_restaurant2->save();
     //Act
     $result = Restaurant::getAll();
     //Assert
     $this->assertEquals(5, $result[0]->getStars());
 }
Ejemplo n.º 16
0
 function testDelete()
 {
     //Arrange
     $name = "burgers";
     $id = null;
     $test_cuisine = new Cuisine($name, $id);
     $test_cuisine->save();
     $name2 = "sushi";
     $test_cuisine2 = new Cuisine($name2, $id);
     $test_cuisine2->save();
     //Act
     $test_cuisine->delete();
     //Assert
     $this->assertEquals([$test_cuisine2], Cuisine::getAll());
 }
Ejemplo n.º 17
0
 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);
 }
Ejemplo n.º 18
0
 function testDelete()
 {
     //Arrange
     $restaurant_name = "McDonalds";
     $id = null;
     $test_restaurant = new Restaurant($restaurant_name, $id);
     $test_restaurant->save();
     $restaurant_id = $test_restaurant->getId();
     $cuisine_name = "burgers";
     $test_cuisine = new Cuisine($cuisine_name, $id, $restaurant_id);
     $test_cuisine->save();
     //Act
     $test_cuisine->deleteOne();
     //Assert
     $this->assertEquals([], Cuisine::getAll());
 }
Ejemplo n.º 19
0
 function test_delete()
 {
     //Arrange
     $test_cuisine = new Cuisine("american", false, 4);
     $test_cuisine->save();
     //Act
     $test_cuisine->delete();
     $result = Cuisine::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
Ejemplo n.º 20
0
 function test_update()
 {
     //Arrange
     $cuisine = "Pizza";
     $test_cuisine = new Cuisine($cuisine);
     $test_cuisine->save();
     //Act
     $result = Cuisine::find($test_cuisine->getID());
     $result->setCuisineType("Burgers");
     $result->update();
     $result = $result->getCuisineType();
     //Assert
     $this->assertEquals("Burgers", $result);
 }
Ejemplo n.º 21
0
 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 testDelete()
 {
     //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
     $test_restaurant->delete();
     //Assert
     $this->assertEquals([$test_restaurant2], Restaurant::getAll());
 }
 function test_deleteReviews()
 {
     $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();
     $user = "******";
     $stars = 3;
     $headline = "It is aight.";
     $body = "Yeah, pretty aight bro";
     $restaurant_id = $test_restaurant->getId();
     $test_review = new Review($user, $stars, $headline, $body, $restaurant_id);
     $test_review->save();
     $user2 = "6969babygirl";
     $stars2 = 3;
     $headline2 = "XOXO";
     $body2 = "I cant even";
     $restaurant_id2 = $test_restaurant->getId();
     $test_review2 = new Review($user2, $stars2, $headline2, $body2, $restaurant_id2);
     $test_review2->save();
     $test_restaurant->delete();
     $result = Review::getAll();
     //var_dump($result);
     $this->assertEquals([], $result);
 }
Ejemplo n.º 24
0
 function testDelete()
 {
     //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";
     $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
     $test_restaurant->delete();
     //Assert
     $this->assertEquals([$test_restaurant2], Restaurant::getAll());
 }
Ejemplo n.º 25
0
 function test_cuisine_delete()
 {
     $style = "Thai";
     $test_cuisine = new Cuisine($style);
     $test_cuisine->save();
     $style2 = "burgers";
     $test_cuisine2 = new Cuisine($style2);
     $test_cuisine2->save();
     $name = "Pok Pok";
     $category_id = $test_cuisine->getId();
     $test_restaurant = new Restaurant($name, $category_id);
     $test_restaurant->save();
     $name2 = "Dicks";
     $category_id2 = $test_cuisine2->getId();
     $test_restaurant2 = new Restaurant($name2, $category_id2);
     $test_restaurant2->save();
     //Act
     $test_cuisine->delete();
     //Assert
     $this->assertEquals([$test_restaurant2], Restaurant::getAll());
 }
Ejemplo n.º 26
0
 function test_DeleteCuisineRestaurantsReviews()
 {
     //Arrange
     //cuisine
     $name = "Japanese";
     $id = null;
     $test_cuisine = new Cuisine($name, $id);
     $test_cuisine->save();
     //restaurant
     $name = "Good Fortune";
     $cuisine_id = $test_cuisine->getId();
     $description = "very tasty.";
     $address = "1111 SW 11th Ave";
     $test_restaurant = new Restaurant($name, $id, $cuisine_id, $description, $address);
     $test_restaurant->save();
     //review
     $username = "******";
     $date = 00 - 00 - 00;
     $rating = 5;
     $comment = "good one.";
     $restaurant_id = $test_restaurant->getId();
     $test_review = new Review($username, $date, $rating, $comment, $restaurant_id, $id);
     //Act
     $test_cuisine->delete();
     //Assert
     $this->assertEquals([], Review::getAll());
 }
Ejemplo n.º 27
0
 function testDeleteCuisineRestaraunts()
 {
     //Arrange
     $cuisine_name = "Italian";
     $id = null;
     $test_cuisine = new Cuisine($cuisine_name, $id);
     $test_cuisine->save();
     $restaraunt_name = "Big Bubba/'s Tuscan Pizza";
     $cuisine_id = $test_cuisine->getId();
     $test_restaraunt = new Restaraunt($restaraunt_name, $id, $cuisine_id);
     $test_restaraunt->save();
     //Act
     $test_cuisine->delete();
     //Assert
     $this->assertEquals([], Restaraunt::getAll());
 }
 function test_find()
 {
     //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
     $result = Restaurant::find($test_restaurant->getId());
     //Assert
     $this->assertEquals($test_restaurant, $result);
 }
 function testUpdate()
 {
     //Arrange
     $type = "french";
     $id = null;
     $test_cuisine = new Cuisine($type, $id);
     $test_cuisine->save();
     $new_type = "mexican";
     //Act
     $test_cuisine->update($new_type);
     //Assert
     $this->assertEquals("mexican", $test_cuisine->getCuisineType());
 }
 function test_find()
 {
     //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
     $result = Restaurant::find($test_restaurant->getId());
     //Assert
     $this->assertEquals($test_restaurant, $result);
 }