diff options
author | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-08-04 17:50:34 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-08-04 17:50:34 +0200 |
commit | 46b77928f746a4231d064774b5b67fd892c7ce86 (patch) | |
tree | e3ea690b3f0def1744ddae758923cf92171ef985 /vendor/symfony/twig-bridge/Symfony/Bridge/Twig/Tests/NodeVisitor/TranslationNodeVisitorTest.php | |
parent | 68abd9c71b1d2f7bb2e9d21819584d1d15005b25 (diff) | |
download | wallabag-46b77928f746a4231d064774b5b67fd892c7ce86.tar.gz wallabag-46b77928f746a4231d064774b5b67fd892c7ce86.tar.zst wallabag-46b77928f746a4231d064774b5b67fd892c7ce86.zip |
rm vendor
Diffstat (limited to 'vendor/symfony/twig-bridge/Symfony/Bridge/Twig/Tests/NodeVisitor/TranslationNodeVisitorTest.php')
-rw-r--r-- | vendor/symfony/twig-bridge/Symfony/Bridge/Twig/Tests/NodeVisitor/TranslationNodeVisitorTest.php | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/vendor/symfony/twig-bridge/Symfony/Bridge/Twig/Tests/NodeVisitor/TranslationNodeVisitorTest.php b/vendor/symfony/twig-bridge/Symfony/Bridge/Twig/Tests/NodeVisitor/TranslationNodeVisitorTest.php deleted file mode 100644 index 4e3ee6fd..00000000 --- a/vendor/symfony/twig-bridge/Symfony/Bridge/Twig/Tests/NodeVisitor/TranslationNodeVisitorTest.php +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Bridge\Twig\Tests\NodeVisitor; | ||
13 | |||
14 | use Symfony\Bridge\Twig\NodeVisitor\TranslationNodeVisitor; | ||
15 | use Symfony\Bridge\Twig\Tests\TestCase; | ||
16 | |||
17 | class TranslationNodeVisitorTest extends TestCase | ||
18 | { | ||
19 | /** @dataProvider getMessagesExtractionTestData */ | ||
20 | public function testMessagesExtraction(\Twig_Node $node, array $expectedMessages) | ||
21 | { | ||
22 | $env = new \Twig_Environment(new \Twig_Loader_String(), array('cache' => false, 'autoescape' => false, 'optimizations' => 0)); | ||
23 | $visitor = new TranslationNodeVisitor(); | ||
24 | $visitor->enable(); | ||
25 | $visitor->enterNode($node, $env); | ||
26 | $visitor->leaveNode($node, $env); | ||
27 | $this->assertEquals($expectedMessages, $visitor->getMessages()); | ||
28 | } | ||
29 | |||
30 | public function testMessageExtractionWithInvalidDomainNode() | ||
31 | { | ||
32 | $message = 'new key'; | ||
33 | |||
34 | $node = new \Twig_Node_Expression_Filter( | ||
35 | new \Twig_Node_Expression_Constant($message, 0), | ||
36 | new \Twig_Node_Expression_Constant('trans', 0), | ||
37 | new \Twig_Node(array( | ||
38 | new \Twig_Node_Expression_Array(array(), 0), | ||
39 | new \Twig_Node_Expression_Name('variable', 0), | ||
40 | )), | ||
41 | 0 | ||
42 | ); | ||
43 | |||
44 | $this->testMessagesExtraction($node, array(array($message, TranslationNodeVisitor::UNDEFINED_DOMAIN))); | ||
45 | } | ||
46 | |||
47 | public function getMessagesExtractionTestData() | ||
48 | { | ||
49 | $message = 'new key'; | ||
50 | $domain = 'domain'; | ||
51 | |||
52 | return array( | ||
53 | array(TwigNodeProvider::getTransFilter($message), array(array($message, null))), | ||
54 | array(TwigNodeProvider::getTransChoiceFilter($message), array(array($message, null))), | ||
55 | array(TwigNodeProvider::getTransTag($message), array(array($message, null))), | ||
56 | array(TwigNodeProvider::getTransFilter($message, $domain), array(array($message, $domain))), | ||
57 | array(TwigNodeProvider::getTransChoiceFilter($message, $domain), array(array($message, $domain))), | ||
58 | array(TwigNodeProvider::getTransTag($message, $domain), array(array($message, $domain))), | ||
59 | ); | ||
60 | } | ||
61 | } | ||