public function testEventsTriggering()
 {
     //model
     $ctx = $this->setUpEventHandlers('construct', 'model.construct');
     $m = new Book();
     $this->assertEventTriggered('On new model construct', $ctx, 1, 1);
     $ctx = $this->setUpEventHandlers('model.insert.post', 'model.insert.pre', 'model.save.pre', 'model.save.post');
     $m->save();
     $this->assertEventTriggered('On new model insert', $ctx, 1, 1, 1, 1);
     $ctx = $this->setUpEventHandlers('model.update.post', 'model.update.pre', 'model.save.pre', 'model.save.post', 'update.pre', 'update.post');
     $m->setTitle('title');
     $m->save();
     $this->assertEventTriggered('On model update', $ctx, 1, 1, 1, 1, 1, 1);
     $ctx = $this->setUpEventHandlers('model.delete.post', 'model.delete.pre', 'delete.pre', 'delete.post');
     $m->delete();
     $this->assertEventTriggered('On model delete', $ctx, 1, 1, 2, 2);
     // 2,2 for pre/postDelete from Query object
     //query
     $ctx = $this->setUpEventHandlers('construct', 'query.construct');
     $q = new BookQuery();
     $this->assertEventTriggered('On new query construct', $ctx, 1, 1);
     $ctx = $this->setUpEventHandlers('query.update.post', 'query.update.pre', 'update.pre', 'update.post');
     $q->update(array('Title' => 'the title'));
     $this->assertEventTriggered('On query update', $ctx, 1, 1, 1, 1);
     $ctx = $this->setUpEventHandlers('query.delete.post', 'query.delete.pre', 'delete.pre', 'delete.post');
     $q->filterByTitle('test')->delete();
     $this->assertEventTriggered('On query delete', $ctx, 1, 1, 1, 1);
     $ctx = $this->setUpEventHandlers('query.select.pre');
     $q->find();
     $this->assertEventTriggered('On query select', $ctx, 1);
     //connection
     $ctx = $this->setUpEventHandlers('connection.create');
     $con = new EventPropelPDO("sqlite::memory:");
     $this->assertEventTriggered('On connection create', $ctx, 1);
     $ctx = $this->setUpEventHandlers('connection.commit.pre', 'connection.commit.post');
     $con = \Propel::getConnection();
     $con->beginTransaction();
     $con->beginTransaction();
     $con->commit();
     $this->assertEventTriggered('On connection nested commt', $ctx, 0, 0);
     $con->commit();
     $this->assertEventTriggered('On connection commt', $ctx, 1, 1);
     $ctx = $this->setUpEventHandlers('connection.rollback.pre', 'connection.rollback.post');
     $con = \Propel::getConnection();
     $con->beginTransaction();
     $con->beginTransaction();
     $con->rollBack();
     $this->assertEventTriggered('On connection nested rollback', $ctx, 0, 0);
     $con->rollBack();
     $this->assertEventTriggered('On connection rollback', $ctx, 1, 1);
 }