function testBeforeDelete() { Model1::addEvent('before_delete', array($this, 'on_delete')); $m1 = new Model1(); $m1->a = rand(); $m1->save(); $id = (string) $m1->getId(); $m1->delete(); $this->assertEquals($id, $this->deleted); }