本文整理汇总了PHP中CallbackPostTestModel类的典型用法代码示例。如果您正苦于以下问题:PHP CallbackPostTestModel类的具体用法?PHP CallbackPostTestModel怎么用?PHP CallbackPostTestModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CallbackPostTestModel类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testBeforeSaveSaveAbortion
/**
* test that beforeSave returning false can abort saves.
*
* @return void
*/
public function testBeforeSaveSaveAbortion()
{
$this->loadFixtures('Post');
$Model = new CallbackPostTestModel();
$Model->beforeSaveReturn = false;
$data = array('title' => 'new article', 'body' => 'this is some text.');
$Model->create();
$result = $Model->save($data);
$this->assertFalse($result);
}
示例2: testBeforeDeleteDeleteAbortion
/**
* test that beforeDelete returning false can abort deletion.
*
* @return void
*/
public function testBeforeDeleteDeleteAbortion()
{
$this->loadFixtures('Post');
$Model = new CallbackPostTestModel();
$Model->beforeDeleteReturn = false;
$result = $Model->delete(1);
$this->assertFalse($result);
$exists = $Model->findById(1);
$this->assertTrue(is_array($exists));
}