function testNonDirtyObjectIsNotUpdated() { $object = new TestOneTableObjectWithHooks(); $object->setContent('whatever'); ob_start(); $object->save(); $str = ob_get_contents(); ob_end_clean(); $this->assertEqual($str, '|on_before_save||on_before_create||on_validate||on_save||on_create||on_after_create||on_after_save|'); ob_start(); $object->save(); $str = ob_get_contents(); ob_end_clean(); $this->assertEqual($str, '|on_before_save||on_after_save|'); }
function testProperOrderOfDestroyHooksCalls() { $object = new TestOneTableObjectWithHooks(); $object->setContent('whatever'); ob_start(); $object->save(); ob_clean(); $object->destroy(); $str = ob_get_contents(); ob_end_clean(); $this->assertEqual($str, '|on_before_destroy||on_after_destroy|'); }