本文整理汇总了PHP中Model_Order::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Order::delete方法的具体用法?PHP Model_Order::delete怎么用?PHP Model_Order::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_Order
的用法示例。
在下文中一共展示了Model_Order::delete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_saved_order_is_fixed
/**
* Tests to ensure that a saved order cannot have new products added to it
*
* @return null
*/
public function test_saved_order_is_fixed()
{
// Create a new product first
$product = new Model_Vendo_Product();
$product->set_fields(array('name' => 'Unit Test', 'price' => '9.99', 'description' => 'This is a unit test.', 'order' => '1'));
$product->save();
$order = new Model_Order();
$order->user_id = self::$user->id;
$order->address_id = self::$user->address_id;
$order->contact_id = self::$contact->id;
$order->add_product($product, 1);
$order->save();
try {
$order->add_product($product, 1);
} catch (Exception $e) {
$this->assertEquals('Saved orders cannot be modified!', $e->getMessage());
$order->delete();
$product->delete();
return;
}
$order->delete();
$product->delete();
$this->fail('Orders cannot be modified once saved.');
}