Merge branch '2.6' into 2.7
* 2.6: fixed CS Allow new lines in Messages translated with transchoice() (replacement for #14867) [2.3] Fix tests on Windows
This commit is contained in:
commit
99f95ac212
@ -72,8 +72,8 @@ class TwigExtractorTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Twig_Error
|
* @expectedException \Twig_Error
|
||||||
* @expectedExceptionMessage Unclosed "block" in "extractor/syntax_error.twig" at line 1
|
* @expectedExceptionMessageRegExp /Unclosed "block" in "extractor(\/|\\)syntax_error\.twig" at line 1/
|
||||||
*/
|
*/
|
||||||
public function testExtractSyntaxError()
|
public function testExtractSyntaxError()
|
||||||
{
|
{
|
||||||
|
@ -22,7 +22,7 @@ class RouterDebugCommandTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testDebugAllRoutes()
|
public function testDebugAllRoutes()
|
||||||
{
|
{
|
||||||
$tester = $this->createCommandTester();
|
$tester = $this->createCommandTester();
|
||||||
$ret = $tester->execute(array('name' => null));
|
$ret = $tester->execute(array('name' => null), array('decorated' => false));
|
||||||
|
|
||||||
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
|
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
|
||||||
$this->assertContains('[router] Current routes', $tester->getDisplay());
|
$this->assertContains('[router] Current routes', $tester->getDisplay());
|
||||||
@ -31,7 +31,7 @@ class RouterDebugCommandTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testDebugSingleRoute()
|
public function testDebugSingleRoute()
|
||||||
{
|
{
|
||||||
$tester = $this->createCommandTester();
|
$tester = $this->createCommandTester();
|
||||||
$ret = $tester->execute(array('name' => 'foo'));
|
$ret = $tester->execute(array('name' => 'foo'), array('decorated' => false));
|
||||||
|
|
||||||
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
|
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
|
||||||
$this->assertContains('[router] Route "foo"', $tester->getDisplay());
|
$this->assertContains('[router] Route "foo"', $tester->getDisplay());
|
||||||
|
@ -24,7 +24,7 @@ class RouterMatchCommandTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testWithMatchPath()
|
public function testWithMatchPath()
|
||||||
{
|
{
|
||||||
$tester = $this->createCommandTester();
|
$tester = $this->createCommandTester();
|
||||||
$ret = $tester->execute(array('path_info' => '/foo', 'foo'));
|
$ret = $tester->execute(array('path_info' => '/foo', 'foo'), array('decorated' => false));
|
||||||
|
|
||||||
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
|
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
|
||||||
$this->assertContains('[router] Route "foo"', $tester->getDisplay());
|
$this->assertContains('[router] Route "foo"', $tester->getDisplay());
|
||||||
@ -33,7 +33,7 @@ class RouterMatchCommandTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testWithNotMatchPath()
|
public function testWithNotMatchPath()
|
||||||
{
|
{
|
||||||
$tester = $this->createCommandTester();
|
$tester = $this->createCommandTester();
|
||||||
$ret = $tester->execute(array('path_info' => '/test', 'foo'));
|
$ret = $tester->execute(array('path_info' => '/test', 'foo'), array('decorated' => false));
|
||||||
|
|
||||||
$this->assertEquals(1, $ret, 'Returns 1 in case of failure');
|
$this->assertEquals(1, $ret, 'Returns 1 in case of failure');
|
||||||
$this->assertContains('None of the routes match the path "/test"', $tester->getDisplay());
|
$this->assertContains('None of the routes match the path "/test"', $tester->getDisplay());
|
||||||
|
@ -57,7 +57,7 @@ class MessageSelector
|
|||||||
foreach ($parts as $part) {
|
foreach ($parts as $part) {
|
||||||
$part = trim($part);
|
$part = trim($part);
|
||||||
|
|
||||||
if (preg_match('/^(?P<interval>'.Interval::getIntervalRegexp().')\s*(?P<message>.*?)$/x', $part, $matches)) {
|
if (preg_match('/^(?P<interval>'.Interval::getIntervalRegexp().')\s*(?P<message>.*?)$/xs', $part, $matches)) {
|
||||||
$explicitRules[$matches['interval']] = $matches['message'];
|
$explicitRules[$matches['interval']] = $matches['message'];
|
||||||
} elseif (preg_match('/^\w+\:\s*(.*?)$/', $part, $matches)) {
|
} elseif (preg_match('/^\w+\:\s*(.*?)$/', $part, $matches)) {
|
||||||
$standardRules[] = $matches[1];
|
$standardRules[] = $matches[1];
|
||||||
|
@ -93,6 +93,38 @@ class MessageSelectorTest extends \PHPUnit_Framework_TestCase
|
|||||||
array('There are no apples', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0),
|
array('There are no apples', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0),
|
||||||
array('There are no apples', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0.0),
|
array('There are no apples', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0.0),
|
||||||
array('There are no apples', '{0.0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0),
|
array('There are no apples', '{0.0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0),
|
||||||
|
|
||||||
|
// Test texts with new-lines
|
||||||
|
// with double-quotes and \n in id & double-quotes and actual newlines in text
|
||||||
|
array("This is a text with a\n new-line in it. Selector = 0.", '{0}This is a text with a
|
||||||
|
new-line in it. Selector = 0.|{1}This is a text with a
|
||||||
|
new-line in it. Selector = 1.|[1,Inf]This is a text with a
|
||||||
|
new-line in it. Selector > 1.', 0),
|
||||||
|
// with double-quotes and \n in id and single-quotes and actual newlines in text
|
||||||
|
array("This is a text with a\n new-line in it. Selector = 1.", '{0}This is a text with a
|
||||||
|
new-line in it. Selector = 0.|{1}This is a text with a
|
||||||
|
new-line in it. Selector = 1.|[1,Inf]This is a text with a
|
||||||
|
new-line in it. Selector > 1.', 1),
|
||||||
|
array("This is a text with a\n new-line in it. Selector > 1.", '{0}This is a text with a
|
||||||
|
new-line in it. Selector = 0.|{1}This is a text with a
|
||||||
|
new-line in it. Selector = 1.|[1,Inf]This is a text with a
|
||||||
|
new-line in it. Selector > 1.', 5),
|
||||||
|
// with double-quotes and id split accros lines
|
||||||
|
array('This is a text with a
|
||||||
|
new-line in it. Selector = 1.', '{0}This is a text with a
|
||||||
|
new-line in it. Selector = 0.|{1}This is a text with a
|
||||||
|
new-line in it. Selector = 1.|[1,Inf]This is a text with a
|
||||||
|
new-line in it. Selector > 1.', 1),
|
||||||
|
// with single-quotes and id split accros lines
|
||||||
|
array('This is a text with a
|
||||||
|
new-line in it. Selector > 1.', '{0}This is a text with a
|
||||||
|
new-line in it. Selector = 0.|{1}This is a text with a
|
||||||
|
new-line in it. Selector = 1.|[1,Inf]This is a text with a
|
||||||
|
new-line in it. Selector > 1.', 5),
|
||||||
|
// with single-quotes and \n in text
|
||||||
|
array('This is a text with a\nnew-line in it. Selector = 0.', '{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.', 0),
|
||||||
|
// with double-quotes and id split accros lines
|
||||||
|
array("This is a text with a\nnew-line in it. Selector = 1.", "{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.", 1),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user