/** * Test if callback query log callback is working properly. */ public function testQueryLogCallback() { $log = []; $this->connection->onLogQuery(function ($sql, $execution_time) use(&$log) { $log[] = ['sql' => $sql, 'exec_time' => $execution_time]; }); $this->connection->execute('SHOW TABLES LIKE ?', 'my_awesome_table_prefix_%'); $this->assertCount(1, $log); $this->assertNotEmpty($log[0]['exec_time']); $this->assertEquals("SHOW TABLES LIKE 'my_awesome_table_prefix_%'", $log[0]['sql']); }