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()); }
/** * @param DatabaseEvent $event */ public function onPostQueryExecute(DatabaseEvent $event) { $data = $event->getData(); self::$collectedData[] = array('query' => $event->getQuery(), 'executionTime' => $event->getExecutionTime(), 'bind' => $data['bind']); }
public function onPostQueryExecute(DatabaseEvent $event) { self::$data[] = $this->getDataFormatter()->formatVar(array('query' => $event->getQuery(), 'data' => $event->getData())); }