Skip to content

Commit 0422d05

Browse files
committed
Merge branch '2.2' into 2.3
* 2.2: [FrameworkBundle] added support for double-quoted strings in the extractor (closes #8797) [SecurityBundle] Move format-dependent tests from SecurityExtensionTest Conflicts: src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php
2 parents 94ca5e2 + bd6f66a commit 0422d05

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
This template is used for translation message extraction tests
2-
<?php echo $view['translator']->trans('new key') ?>
2+
<?php echo $view['translator']->trans('single-quoted key') ?>
3+
<?php echo $view['translator']->trans("double-quoted key") ?>

Tests/Translation/PhpExtractorTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ public function testExtraction()
2828
$extractor->extract(__DIR__.'/../Fixtures/Resources/views/', $catalogue);
2929

3030
// Assert
31-
$this->assertCount(1, $catalogue->all('messages'), '->extract() should find 1 translation');
32-
$this->assertTrue($catalogue->has('new key'), '->extract() should find at leat "new key" message');
33-
$this->assertEquals('prefixnew key', $catalogue->get('new key'), '->extract() should apply "prefix" as prefix');
31+
$this->assertCount(2, $catalogue->all('messages'), '->extract() should find 1 translation');
32+
$this->assertTrue($catalogue->has('single-quoted key'), '->extract() should find the "single-quoted key" message');
33+
$this->assertTrue($catalogue->has('double-quoted key'), '->extract() should find the "double-quoted key" message');
34+
$this->assertEquals('prefixsingle-quoted key', $catalogue->get('single-quoted key'), '->extract() should apply "prefix" as prefix');
3435
}
3536
}

Translation/PhpExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ protected function parseTokens($tokens, MessageCatalogue $catalog)
111111
}
112112
}
113113

114-
$message = trim($message, '\'');
114+
$message = trim($message, '\'"');
115115

116116
if ($message) {
117117
$catalog->set($message, $this->prefix.$message);

0 commit comments

Comments
 (0)