Browse Source

Add unit tests for issue #6542

PGBarrow 11 years ago
parent
commit
c4c3cf71ba

+ 8 - 2
tests/TestCase/Shell/Task/ExtractTaskTest.php

@@ -108,8 +108,14 @@ class ExtractTaskTest extends TestCase
         $this->assertContains('msgid "double \\"quoted\\""', $result, 'Strings with quotes not handled correctly');
         $this->assertContains("msgid \"single 'quoted'\"", $result, 'Strings with quotes not handled correctly');
 
-        $pattern = '/\#: (\\\\|\/)extract\.ctp:31\n';
-        $pattern .= 'msgctxt "mail"/';
+        $pattern = '/\#: (\\\\|\/)extract\.ctp:\d+\n';
+        $pattern .= 'msgctxt "mail"\n';
+        $pattern .= 'msgid "letter"/';
+        $this->assertRegExp($pattern, $result);
+
+        $pattern = '/\#: (\\\\|\/)extract\.ctp:\d+\n';
+        $pattern .= 'msgctxt "alphabet"\n';
+        $pattern .= 'msgid "letter"/';
         $this->assertRegExp($pattern, $result);
 
         // extract.ctp - reading the domain.pot

+ 3 - 0
tests/test_app/TestApp/Template/Pages/extract.ctp

@@ -29,3 +29,6 @@ __('Hot features!'
 
 // Context
 echo __x('mail', 'letter');
+
+// Duplicated message with different context
+echo __x('alphabet', 'letter');