commit 68690ed706b21f628077e368d0df989050f1beab Author: Joel Pittet Date: Wed Feb 19 21:44:34 2014 -0800 add without filter tests diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigFilterTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigFilterTest.php index e69de29..4f58b4d 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigFilterTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigFilterTest.php @@ -0,0 +1,85 @@ + 'Twig Filters', + 'description' => 'Test Drupal\'s Twig filters.', + 'group' => 'Theme', + ); + } + + /** + * Test Twig "trans" tags. + */ + public function testTwigTransTags() { + $this->drupalGet('/twig-theme-test/filter'); + + $elements = array( + array( + 'expected' => '
No author: You can only find truth with logic if you have already found truth without it.1874-1936.
', + 'message' => '"No author" was successfully rendered.', + ), + array( + 'expected' => '
Complete quote after without: You can only find truth with logic if you have already found truth without it.Gilbert Keith Chesterton1874-1936.
', + 'message' => '"Complete quote after without" was successfully rendered.', + ), + array( + 'expected' => '
Only author: Gilbert Keith Chesterton.
', + 'message' => '"Only author:" was successfully rendered.', + ), + array( + 'expected' => '
No author or date: You can only find truth with logic if you have already found truth without it..
', + 'message' => '"No author or date" was successfully rendered.', + ), + array( + 'expected' => '
Only date: 1874-1936.
', + 'message' => '"Only date" was successfully rendered.', + ), + array( + 'expected' => '
Complete quote again for good measure: You can only find truth with logic if you have already found truth without it.Gilbert Keith Chesterton1874-1936.
', + 'message' => '"Complete quote again for good measure" was successfully rendered.', + ), + array( + 'expected' => '
Marked-up: +
+

You can only find truth with logic if you have already found truth without it.

+ +
', + 'message' => '"Marked-up quote" was successfully rendered.', + ), + ); + + foreach ($elements as $element) { + $this->assertRaw($element['expected'], $element['message']); + } + } + +} diff --git a/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.filter.html.twig b/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.filter.html.twig index 55d68a4..ce4c405 100644 --- a/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.filter.html.twig +++ b/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.filter.html.twig @@ -1,29 +1,10 @@ -

- No author: {{ quote|without('author') }} -

- -

- Complete quote after without: {{ quote }} -

- -

- Only author: {{ quote.author }} -

- -

- No author or date: {{ quote|without('date', 'author') }} -

- -

- Only date: {{ quote.date }} -

- -

- Complete quote again for good measure: {{ quote }} -

- -
- Marked-up: +
No author: {{ quote|without('author') }}.
+
Complete quote after without: {{ quote }}.
+
Only author: {{ quote.author }}.
+
No author or date: {{ quote|without('date', 'author') }}.
+
Only date: {{ quote.date }}.
+
Complete quote again for good measure: {{ quote }}.
+
Marked-up:

{{ quote.content }}