/**
  * @dataProvider highlightCliData
  */
 function testCliHighlight($sql, $html)
 {
     SqlFormatter::$cli = true;
     $this->assertEquals(trim($html), trim(SqlFormatter::format($sql)));
     SqlFormatter::$cli = false;
 }
Exemplo n.º 2
0
<?php

require __DIR__ . '/../lib/SqlFormatter.php';
// Force SqlFormatter to run in non-CLI mode for tests
SqlFormatter::$cli = false;
class SqlFormatterTest extends PHPUnit_Framework_TestCase
{
    protected $sqlData;
    /**
     * @dataProvider formatHighlightData
     */
    function testFormatHighlight($sql, $html)
    {
        $this->assertEquals(trim($html), trim(SqlFormatter::format($sql)));
    }
    /**
     * @dataProvider formatData
     */
    function testFormat($sql, $html)
    {
        $this->assertEquals(trim($html), trim(SqlFormatter::format($sql, false)));
    }
    /**
     * @dataProvider highlightData
     */
    function testHighlight($sql, $html)
    {
        $this->assertEquals(trim($html), trim(SqlFormatter::highlight($sql)));
    }
    function testUsePre()
    {