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


PHP Restaurant::delete方法代码示例

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


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

示例1: Restaurant

 function test_delete()
 {
     // arrange
     $name = "Taco Hell";
     $test_restaurant = new Restaurant($name);
     $test_restaurant->save();
     $name2 = "Puff the Magic Dragon";
     $test_restaurant2 = new Restaurant($name2);
     $test_restaurant2->save();
     // act
     $test_restaurant2->delete();
     $result = Restaurant::getAll();
     // assert
     $this->assertEquals([$test_restaurant], $result);
 }
开发者ID:ben-pritchard,项目名称:allergen_avoider,代码行数:15,代码来源:RestaurantTest.php

示例2: isValidID

require_once "classes/Restaurant.class.php";
require_once "classes/DBUtils.class.php";
$restaurant_id = isValidID($_GET['restaurant_id']) ? $_GET['restaurant_id'] : 0;
if ($restaurant_id && !$SMObj->checkAccessLevel("EDITOR")) {
    // Figure out who the owner of this restaurant is, Editors can edit anyones items
    $sql = "SELECT restaurant_user FROM {$db_table_restaurants} WHERE restaurant_id = " . $DB_LINK->addq($restaurant_id, get_magic_quotes_gpc());
    $rc = $DB_LINK->Execute($sql);
    // If the recipe is owned by someone else then do not allow editing
    if ($rc->fields['restaurant_user'] != "" && $rc->fields['restaurant_user'] != $SMObj->getUserID()) {
        die($LangUI->_('You are not the owner of this restaurant, you are not allowed to delete it'));
    }
}
// clean up the old picture if we are suppose to
if ($g_rb_database_type == "postgres") {
    $sql = "SELECT restaurant_picture FROM {$db_table_restaurants} WHERE restaurant_id=" . $DB_LINK->addq($restaurant_id, get_magic_quotes_gpc());
    $rc = $DB_LINK->Execute($sql);
    if (trim($rc->fields['restaurant_picture']) != "") {
        $rc = $DB_LINK->BlobDelete($rc->fields['restaurant_picture']);
        DBUtils::checkResult($rc, $LangUI->_('Picture successfully deleted'), NULL, $sql);
    }
}
// In Postgres everything will be cleaned up with one delete
$RestaurantObj = new Restaurant($restaurant_id);
$RestaurantObj->delete();
?>
<I><?php 
echo $LangUI->_('Restaurant Deleted');
?>
</I>
<P>
开发者ID:pjflameboy,项目名称:phprecipebook,代码行数:30,代码来源:delete.php

示例3: Cuisine

 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 = "yoloswag1959";
     $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);
 }
开发者ID:juliocesardiaz,项目名称:Best-restaurants,代码行数:39,代码来源:RestaurantTest.php

示例4: Cuisine

 function test_delete()
 {
     //Arrange
     //r 1
     $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();
     //r 2
     $test_name2 = "bobs Tomatos ";
     $test_seats2 = 13335;
     $test_location2 = "feild";
     $test_evenings2 = true;
     $test_cuisine2 = new Cuisine("Appalachian\\'s", false, 1);
     $test_cuisine2->save();
     $test_restaurant2 = new Restaurant($test_name2, $test_seats2, $test_location2, $test_evenings2, $test_cuisine2->getId());
     $test_restaurant2->save();
     //Act
     $test_restaurant2->delete();
     //Assert
     $this->assertEquals([$test_restaurant], Restaurant::getAll());
 }
开发者ID:neostoic,项目名称:food_finder,代码行数:26,代码来源:RestaurantTest.php

示例5: 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

示例6: Cuisine

 function test_deleteRestaurant()
 {
     //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($id, $name, $phone, $price, $cuisine_id);
     $test_restaurant->save();
     //Act
     $test_restaurant->delete();
     //Assert
     $this->assertEquals([], Restaurant::getAll());
 }
开发者ID:kylepratuch,项目名称:restaurants_by_cuisine,代码行数:18,代码来源:RestaurantTest.php

示例7: testDelete

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

示例8: Cuisine

 function test_restaurant_delete()
 {
     //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 = "Dicks";
     $category_id2 = $test_cuisine->getId();
     $test_restaurant2 = new Restaurant($name2, $category_id);
     $test_restaurant2->save();
     //Act
     $test_restaurant->delete();
     //Assert
     $this->assertEquals([$test_restaurant2], Restaurant::getAll());
 }
开发者ID:umamiMike,项目名称:restaurantApp,代码行数:19,代码来源:RestaurantTest.php

示例9: Restaurant

 function test_delete()
 {
     $address = "4234 N Interstate Ave, Portland OR 97217";
     $phone = "503-287-9740";
     $cuisine_id = 2;
     $place_name = "Happy House";
     $id = null;
     $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();
     $test_restaurant->delete();
     $this->assertEquals([$test_restaurant2], Restaurant::getAll());
 }
开发者ID:jschold,项目名称:Best_Restaurants,代码行数:15,代码来源:RestaurantTest.php

示例10: testBehaviorDeleteCallbacks

 /**
  * testBehaviorDeleteCallbacks method
  *
  * @return void
  */
 public function testBehaviorDeleteCallbacks()
 {
     $Apple = new Restaurant();
     $Apple->Behaviors->load('Test', array('beforeFind' => 'off', 'beforeDelete' => 'off'));
     $this->assertTrue($Apple->delete(6));
     $Apple->Behaviors->load('Test', array('beforeDelete' => 'on'));
     $this->assertFalse($Apple->delete(4));
     $Apple->Behaviors->load('Test', array('beforeDelete' => 'test2'));
     ob_start();
     $results = $Apple->delete(4);
     $this->assertSame(trim(ob_get_clean()), 'beforeDelete success (cascading)');
     $this->assertTrue($results);
     ob_start();
     $results = $Apple->delete(3, false);
     $this->assertSame(trim(ob_get_clean()), 'beforeDelete success');
     $this->assertTrue($results);
     $Apple->Behaviors->load('Test', array('beforeDelete' => 'off', 'afterDelete' => 'on'));
     ob_start();
     $results = $Apple->delete(2, false);
     $this->assertSame(trim(ob_get_clean()), 'afterDelete success');
     $this->assertTrue($results);
 }
开发者ID:nogikko,项目名称:yumyum,代码行数:27,代码来源:BehaviorCollectionTest.php

示例11: Cuisine

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

示例12: testDelete

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

示例13: Cuisine

 function test_DeleteRestaurants()
 {
     //Arrange
     $id = null;
     $cuisine_type = "Brazilian";
     $test_cuisine_type = new Cuisine($id, $cuisine_type);
     $test_cuisine_type->save();
     $name = "Peles Brazilian Buffet";
     $phone = "510-814-2012";
     $address = "190b Mississippi St, Portland, OR 97221";
     $hours = "9am - ?";
     $test_cuisine_type_id = $test_cuisine_type->getId();
     $test_restaurant = new Restaurant($id, $name, $phone, $address, $hours, $test_cuisine_type_id);
     $test_restaurant->save();
     $name2 = "Olive Garden";
     $phone2 = "(403) 232-1091";
     $address2 = "101 Olive Garden Way, Portland, OR 97221";
     $hours2 = "8am - 10pm";
     $test_restaurant2 = new Restaurant($id, $name2, $phone2, $address2, $hours2, $test_cuisine_type_id);
     $test_restaurant2->save();
     //Act
     $test_restaurant->delete();
     //Assert
     $result = Restaurant::getAll();
     $this->assertEquals([$test_restaurant2], $result);
 }
开发者ID:austinblanchard,项目名称:best_restaurants,代码行数:26,代码来源:RestaurantTest.php


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