function testUsePre() { SqlFormatter::$use_pre = false; $actual = SqlFormatter::highlight("test"); $expected = '<span style="color: #333;">test</span>'; $this->assertEquals($actual, $expected); SqlFormatter::$use_pre = true; $actual = SqlFormatter::highlight("test"); $expected = '<pre style="color: black; background-color: white;"><span style="color: #333;">test</span></pre>'; $this->assertEquals($actual, $expected); }
function sy_format_sql($query, array $data = null) { if (!empty($data)) { foreach ($data as $name => $value) { $query = str_replace(':' . $name, \Simplify::db()->quote($value), $query); } } \SqlFormatter::$reserved_attributes = 'style="color: #F00; font-weight: bold;"'; \SqlFormatter::$word_attributes = 'style="color: #00F;"'; \SqlFormatter::$use_pre = false; return "\n" . \SqlFormatter::format($query) . "\n"; }