8000 Merge branch '2.6' into 2.7 · symfony/symfony@99f95ac · GitHub
[go: up one dir, main page]

Skip to content

Commit 99f95ac

Browse files
committed
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
2 parents 17387fd + f0045de commit 99f95ac

File tree

5 files changed

+39
-7
lines changed

5 files changed

+39
-7
lines changed

src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ public function getExtractData()
7272
}
7373

7474
/**
75-
* @expectedException \Twig_Error
76-
* @expectedExceptionMessage Unclosed "block" in "extractor/syntax_error.twig" at line 1
75+
* @expectedException \Twig_Error
76+
* @expectedExceptionMessageRegExp /Unclosed "block" in "extractor(\/|\\)syntax_error\.twig" at line 1/
7777
*/
7878
public function testExtractSyntaxError()
7979
{

src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class RouterDebugCommandTest extends \PHPUnit_Framework_TestCase
2222
public function testDebugAllRoutes()
2323
{
2424
$tester = $this->createCommandTester();
25-
$ret = $tester->execute(array('name' => null));
25+
$ret = $tester->execute(array('name' => null), array('decorated' => false));
2626

2727
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
2828
$this->assertContains('[router] Current routes', $tester->getDisplay());
@@ -31,7 +31,7 @@ public function testDebugAllRoutes()
3131
public function testDebugSingleRoute()
3232
{
3333
$tester = $this->createCommandTester();
34-
$ret = $tester->execute(array('name' => 'foo'));
34+
$ret = $tester->execute(array('name' => 'foo'), array('decorated' => false));
3535

3636
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
3737
$this->assertContains('[router] Route "foo"', $tester->getDisplay());

src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class RouterMatchCommandTest extends \PHPUnit_Framework_TestCase
2424
public function testWithMatchPath()
2525
{
2626
$tester = $this->createCommandTester();
27-
$ret = $tester->execute(array('path_info' => '/foo', 'foo'));
27+
$ret = $tester->execute(array('path_info' => '/foo', 'foo'), array('decorated' => false));
2828

2929
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
3030
$this->assertContains('[router] Route "foo"', $tester->getDisplay());
@@ -33,7 +33,7 @@ public function testWithMatchPath()
3333
public function testWithNotMatchPath()
3434
{
3535
$tester = $this->createCommandTester();
36-
$ret = $tester->execute(array('path_info' => '/test', 'foo'));
36+
$ret = $tester->execute(array('path_info' => '/test', 'foo'), array('decorated' => false));
3737

3838
$this->assertEquals(1, $ret, 'Returns 1 in case of failure');
3939
$this->assertContains('None of the routes match the path "/test"', $tester->getDisplay());

src/Symfony/Component/Translation/MessageSelector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function choose($message, $number, $locale)
5757
foreach ($parts as $part) {
5858
$part = trim($part);
5959

60-
if (preg_match('/^(?P<interval>'.Interval::getIntervalRegexp().')\s*(?P<message>.*?)$/x', $part, $matches)) {
60+
if (preg_match('/^(?P<interval>'.Interval::getIntervalRegexp().')\s*(?P<message>.*?)$/xs', $part, $matches)) {
6161
$explicitRules[$matches['interval']] = $matches['message'];
6262
} elseif (preg_match('/^\w+\:\s*(.*?)$/', $part, $matches)) {
6363
$standardRules[] = $matches[1];

src/Symfony/Component/Translation/Tests/MessageSelectorTest.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,38 @@ public function getChooseTests()
9393
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),
9494
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),
9595
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),
96+
97+
// Test texts with new-lines
98+
// with double-quotes and \n in id & double-quotes and actual newlines in text
99+
array("This is a text with a\n new-line in it. Selector = 0.", '{0}This is a text with a
100+
new-line in it. Selector = 0.|{1}This is a text with a
101+
new-line in it. Selector = 1.|[1,Inf]This is a text with a
102+
new-line in it. Selector > 1.', 0),
103+
// with double-quotes and \n in id and single-quotes and actual newlines in text
104+
array("This is a text with a\n new-line in it. Selector = 1.", '{0}This is a text with a
105+
new-line in it. Selector = 0.|{1}This is a text with a
106+
new-line in it. Selector = 1.|[1,Inf]This is a text with a
107+
new-line in it. Selector > 1.', 1),
108+
array("This is a text with a\n new-line in it. Selector > 1.", '{0}This is a text with a
109+
new-line in it. Selector = 0.|{1}This is a text with a
110+
new-line in it. Selector = 1.|[1,Inf]This is a text with a
111+
new-line in it. Selector > 1.', 5),
112+
// with double-quotes and id split accros lines
113+
array('This is a text with a
114+
new-line in it. Selector = 1.', '{0}This is a text with a
115+
new-line in it. Selector = 0.|{1}This is a text with a
116+
new-line in it. Selector = 1.|[1,Inf]This is a text with a
117+
new-line in it. Selector > 1.', 1),
118+
// with single-quotes and id split accros lines
119+
array('This is a text with a
120+
new-line in it. Selector > 1.', '{0}This is a text with a
121+
new-line in it. Selector = 0.|{1}This is a text with a
122+
new-line in it. Selector = 1.|[1,Inf]This is a text with a
123+
new-line in it. Selector > 1.', 5),
124+
// with single-quotes and \n in text
125+
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),
126+
// with double-quotes and id split accros lines
127+
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),
96128
);
97129
}
98130
}

0 commit comments

Comments
 (0)
0