/** * testBehaviorDeleteCallbacks method * * @access public * @return void */ function testBehaviorDeleteCallbacks() { $Apple = new Apple(); $Apple->Behaviors->attach('Test', array('beforeFind' => 'off', 'beforeDelete' => 'off')); $this->assertIdentical($Apple->del(6), true); $Apple->Behaviors->attach('Test', array('beforeDelete' => 'on')); $this->assertIdentical($Apple->delete(4), false); $Apple->Behaviors->attach('Test', array('beforeDelete' => 'test2')); if (ob_start()) { $results = $Apple->del(4); $this->assertIdentical(trim(ob_get_clean()), 'beforeDelete success (cascading)'); $this->assertIdentical($results, true); } if (ob_start()) { $results = $Apple->del(3, false); $this->assertIdentical(trim(ob_get_clean()), 'beforeDelete success'); $this->assertIdentical($results, true); } $Apple->Behaviors->attach('Test', array('beforeDelete' => 'off', 'afterDelete' => 'on')); if (ob_start()) { $results = $Apple->del(2, false); $this->assertIdentical(trim(ob_get_clean()), 'afterDelete success'); $this->assertIdentical($results, true); } }