ENHANCEMENT Added unit tests for i18nTextCollector handling of newlines in entity values

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@65051 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-11-01 18:55:27 +00:00
parent 0e71937ae6
commit 4f1d3913e1

View File

@ -239,6 +239,39 @@ PHP;
); );
} }
function testNewlinesInEntityValues() {
$c = new i18nTextCollector();
$php = <<<PHP
_t(
'Test.NEWLINESINGLEQUOTE',
'Line 1
Line 2'
);
PHP;
$this->assertEquals(
$c->collectFromCode($php, 'mymodule'),
array(
'Test.NEWLINESINGLEQUOTE' => array("Line 1\nLine 2",null,null)
)
);
$php = <<<PHP
_t(
'Test.NEWLINEDOUBLEQUOTE',
"Line 1
Line 2"
);
PHP;
$this->assertEquals(
$c->collectFromCode($php, 'mymodule'),
array(
'Test.NEWLINEDOUBLEQUOTE' => array("Line 1\nLine 2",null,null)
)
);
}
/** /**
* Input for langArrayCodeForEntitySpec() should be suitable for insertion * Input for langArrayCodeForEntitySpec() should be suitable for insertion
* into single-quoted strings, so needs to be escaped already. * into single-quoted strings, so needs to be escaped already.