コード例 #1
1
 function test_find()
 {
     //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
     $result = Restaurant::find($test_restaurant2->getId());
     //assert
     $this->assertEquals($test_restaurant2, $result);
 }
コード例 #2
1
 function test_find()
 {
     //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
     $result = Restaurant::find($test_restaurant->getId());
     //Assert
     $this->assertEquals($test_restaurant, $result);
 }
コード例 #3
0
 function testGetId()
 {
     //arrange
     $id = 1;
     $name = "Taco Hell";
     $test_restaurant = new Restaurant($name, $id);
     //act
     $result = $test_restaurant->getId();
     //assert
     $this->assertEquals(1, $result);
 }
コード例 #4
0
 function test_find()
 {
     //Arrange
     $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();
     //Act
     $result = Restaurant::find($test_Restaurant->getId());
     //Assert
     $this->assertEquals($test_Restaurant, $result);
 }
コード例 #5
0
ファイル: Restaurateur.php プロジェクト: chougron/LOG210
 /**
  * Remove a Restaurant from the list
  * @param \App\Model\Restaurant $restaurant
  */
 public function removeRestaurant(Restaurant $restaurant)
 {
     $id = $restaurant->getId();
     //If the object doesn't have an id, return
     if (is_null($id)) {
         return;
     }
     //We search the $id and remove it if we find it
     foreach ($this->_restaurants as $key => $idRestaurant) {
         if ($id->__toString() == $idRestaurant->__toString()) {
             unset($this->_restaurants[$key]);
             return;
         }
     }
 }
コード例 #6
0
 function test_getId()
 {
     $type = "Thai";
     $id = 1;
     $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->getId();
     $this->assertEquals(true, is_numeric($result));
 }
コード例 #7
0
 function test_getId()
 {
     $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->getId();
     $this->assertEquals(true, is_numeric($result));
 }
コード例 #8
0
 function test_getId()
 {
     //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->getId();
     //assert
     $this->assertEquals(true, is_numeric($result));
 }
コード例 #9
0
 function testDelete()
 {
     //Arrange
     $name = "Pizza Party";
     $phone_number = "123-456-7890";
     $address = "1234 Pepperoni Lane";
     $id = null;
     $cuisine_id = 4;
     $test_restaurant = new Restaurant($name, $phone_number, $address, $id, $cuisine_id);
     $restaurant_id = $test_restaurant->getId();
     $test_restaurant->save();
     $name2 = "Burger Bash ";
     $test_restaurant2 = new Restaurant($name2, $phone_number, $address, $id, $cuisine_id);
     $test_restaurant2->save();
     //Act
     $test_restaurant->delete();
     //Assert
     $this->assertEquals([$test_restaurant2], Restaurant::getAll());
 }
コード例 #10
0
ファイル: ReviewTest.php プロジェクト: Camolot/restaurants
 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());
 }
コード例 #11
0
 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);
 }
コード例 #12
0
 function test_find()
 {
     //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
     $result = Restaurant::find($test_restaurant->getId());
     //Assert
     $this->assertEquals($test_restaurant, $result);
 }
コード例 #13
0
 function test_restaurant_find()
 {
     //Arrange
     $style = "Thai";
     $test_cuisine = new Cuisine($style);
     $test_cuisine->save();
     $style2 = "asian fusion";
     $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 = "Mai Thai";
     $category_id2 = $test_cuisine2->getId();
     $test_restaurant2 = new Restaurant($name2, $category_id2);
     $test_restaurant2->save();
     //Act
     $id = $test_restaurant->getId();
     $result = Restaurant::find($id);
     //Assert
     $this->assertEquals($test_restaurant, $result);
 }
コード例 #14
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());
 }
コード例 #15
0
ファイル: UserTest.php プロジェクト: AbeerKhakwani/attending-
 function testUpdateAnswer()
 {
     //Arrange
     //We need a User and a User saved
     //Arrange
     //We need a User and a User saved
     $user = "******";
     $password = "******";
     $id = null;
     $vegie = 0;
     $admin = 1;
     $test_User = new User($user, $password, $vegie, $admin, $id);
     $test_User->save();
     $name = "Little Big Burger";
     $address = "123 NW 23rd Ave.";
     $phone = "971-289-8000";
     $price = 1;
     $vegie = 0;
     $opentime = 00;
     $closetime = 2100;
     $id = 1;
     $test_restaurant = new Restaurant($name, $address, $phone, $price, $vegie, $opentime, $closetime, $id);
     $test_restaurant->save();
     $answer = 0;
     $restaurant_id = 1;
     $user_id = 1;
     $id2 = 1;
     $test_response = new Response($answer, $restaurant_id, $user_id, $id2);
     $test_response->save();
     $test_User->addAnswer($test_User->getId(), $test_restaurant->getId(), $test_response->getAnswer());
     $test_User->updateAnswer(2, 1);
     $this->assertEquals($test_User->getDisLikes(), [$test_restaurant]);
 }
コード例 #16
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);
 }
コード例 #17
0
 function testFind()
 {
     //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();
     //Act
     $result = Restaurant::find($test_restaurant->getId());
     //Assert
     $this->assertEquals($test_restaurant, $result);
 }
コード例 #18
0
 function test_save()
 {
     $restaurant = new Restaurant("Pok Pok", 2, "5", "1", "website", 2);
     $name = "Bob";
     $id = null;
     $rating = 3;
     $review_text = "B";
     $review_date = "2015-10-10";
     $restaurant_id = $restaurant->getId();
     $test_Review = new Review($name, $id, $rating, $review_text, $review_date, $restaurant_id);
     $test_Review->save();
     $result = Review::getAll();
     $this->assertEquals($test_Review, $result[0]);
 }
コード例 #19
0
 function test_find()
 {
     //Arrange
     $cuisine_type = "Italian";
     $id = null;
     $test_cuisine = new Cuisine($cuisine_type, $id);
     $test_cuisine->save();
     $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($id, $name, $phone, $address, $hours, $cuisine_id);
     $test_restaurant->save();
     $name2 = "Olive Garden";
     $phone2 = "(403) 232-1091";
     $address2 = "101 Olive Garden Way, Portland, OR 97221";
     $hours2 = "8am - 10pm";
     $cuisine_id2 = $test_cuisine->getId();
     $test_restaurant2 = new Restaurant($id, $name2, $phone2, $address2, $hours2, $cuisine_id2);
     $test_restaurant2->save();
     //Act
     $result = Restaurant::find($test_restaurant->getId());
     //Assert
     $this->assertEquals($test_restaurant, $result);
 }
コード例 #20
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);
 }
コード例 #21
0
 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);
 }
コード例 #22
-1
 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);
 }