commit c069961bc1cb633f656e9a8ace29015c4b4f99ec Author: Joel Pittet Date: Wed Feb 19 01:34:16 2014 -0800 moving tests and making them nice diff --git a/core/modules/system/tests/modules/twig_extension_test/lib/Drupal/twig_extension_test/TwigExtension/TestExtension.php b/core/modules/system/tests/modules/twig_extension_test/lib/Drupal/twig_extension_test/TwigExtension/TestExtension.php index 93da633..3c2b851 100644 --- a/core/modules/system/tests/modules/twig_extension_test/lib/Drupal/twig_extension_test/TwigExtension/TestExtension.php +++ b/core/modules/system/tests/modules/twig_extension_test/lib/Drupal/twig_extension_test/TwigExtension/TestExtension.php @@ -8,7 +8,6 @@ namespace Drupal\twig_extension_test\TwigExtension; use Drupal\Core\Template\TwigExtension; -use Drupal\Core\Template\TwigReferenceFunction; /** * A test Twig extension that adds a custom function and a custom filter. diff --git a/core/modules/system/tests/modules/twig_filter_test/lib/Drupal/twig_filter_test/TwigFilterTestController.php b/core/modules/system/tests/modules/twig_filter_test/lib/Drupal/twig_filter_test/TwigFilterTestController.php deleted file mode 100644 index 6d6b750..0000000 --- a/core/modules/system/tests/modules/twig_filter_test/lib/Drupal/twig_filter_test/TwigFilterTestController.php +++ /dev/null @@ -1,31 +0,0 @@ - 'twig_filter_test_filter', - '#body' => array( - 'arms' => array('#markup' => ' arms.'), - 'legs' => array('#markup' => ' legs.'), - 'head' => array('#markup' => ' head.'), - 'stomach' => array('#markup' => ' stomach.'), - ), - ); - } - -} diff --git a/core/modules/system/tests/modules/twig_filter_test/templates/twig_filter_test.filter.html.twig b/core/modules/system/tests/modules/twig_filter_test/templates/twig_filter_test.filter.html.twig deleted file mode 100644 index 3da1dd4..0000000 --- a/core/modules/system/tests/modules/twig_filter_test/templates/twig_filter_test.filter.html.twig +++ /dev/null @@ -1,23 +0,0 @@ -
- I have no legs: {{ body|without('legs') }} -
- -
- Complete with: {{ body }} -
- -
- Ok legs only: {{ body.legs }} -
- -
- I have no legs or arms: {{ body|without('legs', 'arms') }} -
- -
- Ok legs only: {{ body.legs }} -
- -
- Complete again: {{ body }} -
diff --git a/core/modules/system/tests/modules/twig_filter_test/twig_filter_test.info.yml b/core/modules/system/tests/modules/twig_filter_test/twig_filter_test.info.yml deleted file mode 100644 index 5fff058..0000000 --- a/core/modules/system/tests/modules/twig_filter_test/twig_filter_test.info.yml +++ /dev/null @@ -1,7 +0,0 @@ -name: 'Twig Filter Test' -type: module -description: 'Support module for testing Twig filters.' -package: Testing -version: VERSION -core: 8.x -# hidden: true diff --git a/core/modules/system/tests/modules/twig_filter_test/twig_filter_test.module b/core/modules/system/tests/modules/twig_filter_test/twig_filter_test.module deleted file mode 100644 index d4d960a..0000000 --- a/core/modules/system/tests/modules/twig_filter_test/twig_filter_test.module +++ /dev/null @@ -1,19 +0,0 @@ - array( - 'variables' => array('body' => NULL), - 'template' => 'twig_filter_test.filter', - ), - ); -} - diff --git a/core/modules/system/tests/modules/twig_filter_test/twig_filter_test.routing.yml b/core/modules/system/tests/modules/twig_filter_test/twig_filter_test.routing.yml deleted file mode 100644 index 72b649c..0000000 --- a/core/modules/system/tests/modules/twig_filter_test/twig_filter_test.routing.yml +++ /dev/null @@ -1,6 +0,0 @@ -twig_filter_test.filter: - path: '/twig-filter-test/filter' - defaults: - _content: '\Drupal\twig_filter_test\TwigFilterTestController::testFilterRender' - requirements: - _permission: 'access content' diff --git a/core/modules/system/tests/modules/twig_theme_test/lib/Drupal/twig_theme_test/TwigThemeTestController.php b/core/modules/system/tests/modules/twig_theme_test/lib/Drupal/twig_theme_test/TwigThemeTestController.php index 45654ea..ba2a718 100644 --- a/core/modules/system/tests/modules/twig_theme_test/lib/Drupal/twig_theme_test/TwigThemeTestController.php +++ b/core/modules/system/tests/modules/twig_theme_test/lib/Drupal/twig_theme_test/TwigThemeTestController.php @@ -28,4 +28,19 @@ public function transBlockRender() { ); } + /** + * Menu callback for filters in a Twig template. + */ + public function testFilterRender() { + return array( + '#theme' => 'twig_theme_test_filter', + '#quote' => array( + 'content' => array('#markup' => 'You can only find truth with logic if you have already found truth without it.'), + 'author' => array('#markup' => 'Gilbert Keith Chesterton'), + 'date' => array('#markup' => '1874-1936'), + ), + ); + } + } + 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 new file mode 100644 index 0000000..55d68a4 --- /dev/null +++ b/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.filter.html.twig @@ -0,0 +1,33 @@ +

+ 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 }}

+ +
+
diff --git a/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module b/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module index 6edb6f6..e47b30c 100644 --- a/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module +++ b/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module @@ -4,6 +4,10 @@ * Implements hook_theme(). */ function twig_theme_test_theme($existing, $type, $theme, $path) { + $items['twig_theme_test_filter'] = array( + 'variables' => array('quote' => array()), + 'template' => 'twig_theme_test.filter', + ); $items['twig_theme_test_php_variables'] = array( 'template' => 'twig_theme_test.php_variables', ); diff --git a/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.routing.yml b/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.routing.yml index 96befd4..c187bc2 100644 --- a/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.routing.yml +++ b/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.routing.yml @@ -11,3 +11,10 @@ twig_theme_test.trans: _content: '\Drupal\twig_theme_test\TwigThemeTestController::transBlockRender' requirements: _access: 'TRUE' + +twig_theme_test.filter: + path: '/twig-theme-test/filter' + defaults: + _content: '\Drupal\twig_theme_test\TwigThemeTestController::testFilterRender' + requirements: + _access: 'TRUE'