mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
c57ce5f1a4
ENHANCEMENT Using CliDebugView to report errors on ajax requests (with plaintext output) ENHANCEMENT Removed "ERROR:" prefix hack for ajax error responses - clientside evaluation should inspect HTTP status codes instead git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@62467 467b73ca-7a2a-4603-9d3b-597d59a354a9
41 lines
814 B
PHP
41 lines
814 B
PHP
<?php
|
|
/**
|
|
* @package sapphire
|
|
* @subpackage tests
|
|
*/
|
|
class SQLFormatterTest extends SapphireTest {
|
|
|
|
function testNewlineHanding() {
|
|
$formatter = new SQLFormatter();
|
|
|
|
$sqlBefore = <<<SQL
|
|
SELECT Test.Foo, Test.Bar FROM Test WHERE 'From' = "Where"
|
|
SQL;
|
|
$sqlAfter = <<<SQL
|
|
SELECT Test.Foo, Test.Bar
|
|
FROM Test
|
|
WHERE 'From' = "Where"
|
|
SQL;
|
|
$this->assertEquals($formatter->formatPlain($sqlBefore), $sqlAfter,
|
|
'correct replacement of newlines and don\'t replace non-uppercase tokens'
|
|
);
|
|
|
|
$sqlBefore = <<<SQL
|
|
SELECT Test.Foo, Test.Bar
|
|
FROM Test
|
|
WHERE
|
|
'From' = "Where"
|
|
SQL;
|
|
$sqlAfter = <<<SQL
|
|
SELECT Test.Foo, Test.Bar
|
|
FROM Test
|
|
WHERE
|
|
'From' = "Where"
|
|
SQL;
|
|
$this->assertEquals($formatter->formatPlain($sqlBefore), $sqlAfter,
|
|
'Leave existing newlines and indentation in place'
|
|
);
|
|
}
|
|
|
|
}
|
|
?>
|