public function testCollect()
 {
     $collector = new DatabaseDataCollector();
     $event = new DatabaseEvent('SELECT * FROM MY_TABLE', 0.12, array('bind' => 'binds'));
     $request = Request::create('/');
     $collector->setRequest($request);
     $result = array('/' => array(array('query' => $event->getQuery(), 'executionTime' => $event->getExecutionTime(), 'bind' => 'binds'), array('query' => $event->getQuery(), 'executionTime' => $event->getExecutionTime(), 'bind' => 'binds')));
     $collector->onPostQueryExecute($event);
     $collector->onPostQueryExecute($event);
     $collector->collect();
     $this->assertEquals($result, $collector->getData());
 }
Example #2
0
 /**
  * @param DatabaseEvent $event
  */
 public function onPostQueryExecute(DatabaseEvent $event)
 {
     $data = $event->getData();
     self::$collectedData[] = array('query' => $event->getQuery(), 'executionTime' => $event->getExecutionTime(), 'bind' => $data['bind']);
 }
Example #3
0
 public function onPostQueryExecute(DatabaseEvent $event)
 {
     self::$data[] = $this->getDataFormatter()->formatVar(array('query' => $event->getQuery(), 'data' => $event->getData()));
 }