phpmyadmin/test/libraries/common/PMA_formatSql_test.php
Michal Čihař 32b33a9e26 Incorporate truncating into PMA_Util::formatSql
It is used quite often as well.
2013-08-06 12:29:27 +02:00

41 lines
918 B
PHP

<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
** Test for PMA_Util::formatSql from Util.class.php
*
* @package PhpMyAdmin-test
* @group common.lib-tests
*/
/*
* Include to test.
*/
require_once 'libraries/Util.class.php';
require_once 'libraries/sqlparser.lib.php';
class PMA_FormatSql_Test extends PHPUnit_Framework_TestCase
{
function testFormatSQL()
{
$this->assertEquals(
'<span class="inner_sql"><pre>' . "\n"
. 'SELECT 1 &lt; 2' . "\n"
. '</pre></span>',
PMA_Util::formatSql('SELECT 1 < 2')
);
}
function testFormatSQLTruncate()
{
$GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] = 6;
$this->assertEquals(
'<span class="inner_sql"><pre>' . "\n"
. 'SELECT[...]' . "\n"
. '</pre></span>',
PMA_Util::formatSql('SELECT 1 < 2', true)
);
}
}