Example #1
0
 public function testSetEntry()
 {
     $entry = new Consolari\Entries\Query();
     $entry->setSql('select * from table');
     $entry->setGroupName('Query');
     $data = $entry->format();
     $this->assertEquals('select * from table', $data['value']['sql']);
     $this->assertEquals(Consolari\Entries\EntryType::SQL, $data['type']);
     $this->assertEquals('Query', $data['group']);
     $this->assertTrue(!empty($data['time']));
     $this->assertTrue(!empty($data['memory']));
 }
Example #2
0
 public function testMergeEntries()
 {
     $log = new Consolari\Logger();
     $sql = 'select * from table';
     $query = new Consolari\Entries\Query();
     $query->setSql($sql);
     $log->mergeEntry($query);
     $entries = $log->getEntries();
     $this->assertEquals($entries[0]['value'][0]['sql'], $sql);
     $log->mergeEntry($query);
     $entries = $log->getEntries();
     $this->assertEquals($entries[0]['value'][0]['sql'], $sql);
     $this->assertEquals($entries[0]['value'][1]['sql'], $sql);
 }