Пример #1
0
 function test_getCuisineId()
 {
     $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();
     $result = $test_restaurant->getCuisineId();
     $this->assertEquals(true, is_numeric($result));
 }
 function test_getCuisineId()
 {
     $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();
     $result = $test_restaurant->getCuisineId();
     $this->assertEquals(true, is_numeric($result));
 }
Пример #3
0
 function testGetCuisineId()
 {
     //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();
     //Act
     $result = $test_restaurant->getCuisineId();
     //Assert
     $this->assertEquals(true, is_numeric($result));
 }
 function test_getCuisineId()
 {
     //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();
     //Act
     $result = $test_restaurant->getCuisineId();
     //Assert
     $this->assertEquals(true, is_numeric($result));
 }
Пример #5
0
 function test_getCuisineId()
 {
     //cuisine
     $name = "Japanese";
     $id = null;
     $test_cuisine = new Cuisine($name, $id);
     $test_cuisine->save();
     //restaurant
     $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();
     $result = $test_restaurant->getCuisineId();
     $this->assertEquals(true, is_numeric($result));
 }
 function test_getCuisineId()
 {
     //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();
     //Act
     $result = $test_restaurant->getCuisineId();
     //Assert
     $this->assertEquals(true, is_numeric($result));
 }
 function test_getCuisineId()
 {
     //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();
     $test_restaurant = new Restaurant($name, $phone, $price, $cuisine_id);
     $test_restaurant->save();
     //Act
     $result = $test_restaurant->getCuisineId();
     //Assert
     $this->assertEquals(true, is_numeric($result));
 }
 function test_getCategoryId()
 {
     //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();
     //Act
     $result = $test_restaurant->getCuisineId();
     //Assert
     $this->assertEquals(true, is_numeric($result));
 }
Пример #9
0
 function test_getCuisineId()
 {
     //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();
     //act
     $result = $test_restaurant->getCuisineId();
     //assert
     $this->assertEquals(true, is_numeric($result));
 }
Пример #10
0
 function test_getCuisineId()
 {
     $type = "Thai";
     $id = null;
     $test_Cuisine = new Cuisine($type, $id);
     $test_Cuisine->save();
     $name = "Pok Pok";
     $phone = "555-456-2345";
     $address = "123 abcd street";
     $website = "http://www.helloworld.com";
     $cuisine_id = $test_Cuisine->getId();
     $test_Restaurant = new Restaurant($name, $id, $phone, $address, $website, $cuisine_id);
     $result = $test_Restaurant->getCuisineId();
     $this->assertEquals($cuisine_id, $result);
 }
Пример #11
0
 function test_restaurant_update()
 {
     //Arrange
     $style = "Thai";
     $test_cuisine = new Cuisine($style);
     $test_cuisine->save();
     $name = "Pok Pok";
     $cuisine_id = $test_cuisine->getId();
     $stars = 4;
     $website = "www.pokpokpdx.com";
     $phone = "503 232 1387";
     $tr = new Restaurant($name, $cuisine_id, $stars, $website, $phone);
     $tr->save();
     $new_name = "Pok Pok Noi";
     $new_cuisine_id = $test_cuisine->getId();
     $new_id = $new_stars = 7;
     $new_website = "balls";
     $new_phone = "503 555 5555";
     //Act
     $tr->updateRestaurant($new_name, $tr->getCuisineId(), $tr->getID(), $new_stars, $new_website, $new_phone);
     //Assert
     $this->assertEquals(7, $tr->getStars(), "OH NO");
 }
Пример #12
0
 function test_getCuisineId()
 {
     //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 = 1;
     $id = null;
     $test_restaurant = new Restaurant($restaurant_name, $phone, $address, $website, $cuisine_id, $id);
     //Act
     $result = $test_restaurant->getCuisineId();
     //Assert
     $this->assertEquals(true, is_numeric($result));
 }
Пример #13
0
    return $app['twig']->render('cuisine_edit.html.twig', array('cuisine' => $cuisine));
});
$app->patch("/cuisines/{id}", function ($id) use($app) {
    $cuisine = Cuisine::find($id);
    $cuisine->update($_POST['type']);
    return $app['twig']->render('cuisine.html.twig', array('cuisine' => $cuisine, 'restaurants' => Restaurant::getAll()));
});
$app->delete("/cuisines/{id}", function ($id) use($app) {
    $cuisine = Cuisine::find($id);
    $cuisine->delete();
    return $app['twig']->render('index.html.twig', array('cuisines' => Cuisine::getAll()));
});
$app->post("/restaurants", function () use($app) {
    $restaurant = new Restaurant($_POST['name'], $_POST['location'], $_POST['description'], $_POST['price'], $_POST['cuisine_id']);
    $restaurant->save();
    $cuisine = Cuisine::find($restaurant->getCuisineId());
    return $app['twig']->render('cuisine.html.twig', array('cuisine' => $cuisine, 'restaurants' => Restaurant::getAll()));
});
$app->get("/restaurants/{id}", function ($id) use($app) {
    $restaurant = Restaurant::find($id);
    return $app['twig']->render('restaurant.html.twig', array('restaurant' => $restaurant, 'reviews' => Review::getAll()));
});
$app->get("/restaurants/{id}/edit", function ($id) use($app) {
    $restaurant = Restaurant::find($id);
    return $app['twig']->render('restaurant_edit.html.twig', array('restaurant' => $restaurant));
});
$app->patch("/restaurants/{id}", function ($id) use($app) {
    $restaurant = Restaurant::find($id);
    $restaurant->update($_POST['name'], $_POST['location'], $_POST['description'], $_POST['price'], $_POST['cuisine_id']);
    return $app['twig']->render('restaurant.html.twig', array('restaurant' => $restaurant, 'reviews' => Review::getAll()));
});
 function test_getCuisineId()
 {
     //Arrange
     $cuisine_type = "Italian";
     $id = null;
     $test_cuisine = new Cuisine($cuisine_type, $id);
     $test_cuisine->save();
     $id2 = null;
     $name = "Taco Restaurant";
     $phone = "(503) 777-9097";
     $address = "7000 Beaverton Hillsdale HWY, Portland, OR 97221";
     $hours = "7am - 2am";
     $cuisine_id = $test_cuisine->getId();
     $test_restaurant = new Restaurant($id2, $name, $phone, $address, $hours, $cuisine_id);
     $test_restaurant->save();
     //Act
     $result = $test_restaurant->getCuisineId();
     //Assert
     $this->assertEquals(true, is_numeric($result));
 }