当前位置: 首页>>代码示例>>PHP>>正文


PHP Restaurant::getId方法代码示例

本文整理汇总了PHP中Restaurant::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Restaurant::getId方法的具体用法?PHP Restaurant::getId怎么用?PHP Restaurant::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Restaurant的用法示例。


在下文中一共展示了Restaurant::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Cuisine

 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);
 }
开发者ID:alexdbrown,项目名称:best_restaurant,代码行数:25,代码来源:RestaurantTest.php

示例2: Restaurant

 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);
 }
开发者ID:ben-pritchard,项目名称:allergen_avoider,代码行数:15,代码来源:RestaurantTest.php

示例3: Cuisine

 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);
 }
开发者ID:anniehoogendoorn,项目名称:BestRestaurants,代码行数:21,代码来源:RestaurantTest.php

示例4: testGetId

 function testGetId()
 {
     //arrange
     $id = 1;
     $name = "Taco Hell";
     $test_restaurant = new Restaurant($name, $id);
     //act
     $result = $test_restaurant->getId();
     //assert
     $this->assertEquals(1, $result);
 }
开发者ID:Camolot,项目名称:allergen_avoider,代码行数:11,代码来源:RestaurantTest.php

示例5: Restaurant

 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);
 }
开发者ID:kellimargaret,项目名称:restaurants,代码行数:14,代码来源:RestaurantTest.php

示例6: removeRestaurant

 /**
  * 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;
         }
     }
 }
开发者ID:chougron,项目名称:LOG210,代码行数:19,代码来源:Restaurateur.php

示例7: Cuisine

 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));
 }
开发者ID:jschold,项目名称:Best_Restaurants,代码行数:15,代码来源:RestaurantTest.php

示例8: Cuisine

 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));
 }
开发者ID:jeffaustin81,项目名称:Restaurants,代码行数:15,代码来源:RestaurantTest.php

示例9: Cuisine

 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));
 }
开发者ID:nathanhwyoung,项目名称:restaurant,代码行数:18,代码来源:RestaurantTest.php

示例10: Cuisine

 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);
 }
开发者ID:neostoic,项目名称:food_finder,代码行数:16,代码来源:RestaurantTest.php

示例11: testUpdateAnswer

 function testUpdateAnswer()
 {
     //Arrange
     //We need a User and a User saved
     //Arrange
     //We need a User and a User saved
     $user = "HIST100";
     $password = "Abeer";
     $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]);
 }
开发者ID:AbeerKhakwani,项目名称:attending-,代码行数:33,代码来源:UserTest.php

示例12: testDelete

 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());
 }
开发者ID:JordanNavratil,项目名称:Best_Restaurant,代码行数:19,代码来源:RestaurantTest.php

示例13: Cuisine

 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 = "Ben";
     $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());
 }
开发者ID:Camolot,项目名称:restaurants,代码行数:27,代码来源:ReviewTest.php

示例14: testUpdate

 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);
 }
开发者ID:kylepratuch,项目名称:restaurants_by_cuisine,代码行数:27,代码来源:RestaurantTest.php

示例15: Cuisine

 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);
 }
开发者ID:sammartinez,项目名称:restaurant_project,代码行数:24,代码来源:RestaurantTest.php


注:本文中的Restaurant::getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。