diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php index 20ccc2b..73a4eb6 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php @@ -174,7 +174,7 @@ function testThemeGetSetting() { * Ensures the theme registry is rebuilt when modules are disabled/enabled. */ function testRegistryRebuild() { - $this->assertIdentical(theme('theme_test_foo', array('foo' => 'a')), 'a', 'The theme registry contains theme_test_foo.'); + $this->assertIdentical(trim(theme('theme_test_foo', array('foo' => 'a'))), 'a', 'The theme registry contains theme_test_foo.'); module_disable(array('theme_test'), FALSE); // After enabling/disabling a module during a test, we need to rebuild the @@ -190,7 +190,7 @@ function testRegistryRebuild() { // throws an exception. $this->rebuildContainer(); $this->container->get('module_handler')->loadAll(); - $this->assertIdentical(theme('theme_test_foo', array('foo' => 'c')), 'c', 'The theme registry contains theme_test_foo again after re-enabling the module.'); + $this->assertIdentical(trim(theme('theme_test_foo', array('foo' => 'c'))), 'c', 'The theme registry contains theme_test_foo again after re-enabling the module.'); } /** diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTestTwig.php b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTestTwig.php index c62f7c3..87b9fcd 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTestTwig.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTestTwig.php @@ -63,8 +63,8 @@ function testFindThemeTemplates() { $this->assertEqual($cache['node']['template_file'], 'core/modules/node/templates/node.html.twig', 'Node is using node.html.twig as template file'); $this->assertEqual($cache['node']['engine'], 'twig', 'Node is using twig engine'); - $this->assertEqual($cache['theme_test_template_test']['template_file'], 'core/modules/system/tests/modules/theme_test/templates/theme_test.template_test.tpl.php', 'theme_test is using theme_test.template_test.tpl.php as template file'); - $this->assertEqual($cache['theme_test_template_test']['engine'], 'phptemplate', 'theme_test is using phptemplate as engine.'); + $this->assertEqual($cache['theme_test_template_test']['template_file'], 'core/modules/system/tests/modules/theme_test/templates/theme_test.template_test.html.twig', 'theme_test is using theme_test.template_test.html.twig as template file'); + $this->assertEqual($cache['theme_test_template_test']['engine'], 'twig', 'theme_test is using twig as engine.'); $templates = drupal_find_theme_templates($cache, '.html.twig', drupal_get_path('theme', 'test_theme_twig')); $this->assertEqual($templates['node__1']['template'], 'node--1', 'Template node--1.html.twig was found in test_theme_twig.'); diff --git a/core/modules/system/tests/modules/theme_test/templates/theme-test-foo.html.twig b/core/modules/system/tests/modules/theme_test/templates/theme-test-foo.html.twig new file mode 100644 index 0000000..c4e8f72 --- /dev/null +++ b/core/modules/system/tests/modules/theme_test/templates/theme-test-foo.html.twig @@ -0,0 +1,14 @@ +{# +/** + * @file + * Default theme implementation for the 'theme_test_foo' theme hook. + * + * Available variables: + * - foo: Dummy text to display. + * + * @see template_preprocess() + * + * @ingroup themeable + */ +#} +{{ foo }} diff --git a/core/modules/system/tests/modules/theme_test/templates/theme-test.html.twig b/core/modules/system/tests/modules/theme_test/templates/theme-test.html.twig new file mode 100644 index 0000000..c5c9b8d --- /dev/null +++ b/core/modules/system/tests/modules/theme_test/templates/theme-test.html.twig @@ -0,0 +1,15 @@ +{# +/** + * @file + * Default theme implementation for the 'theme_test' theme hook. + * + * Available variables: + * - foo: Dummy text to display. + * + * @see template_preprocess() + * @see template_preprocess_theme_test() + * + * @ingroup themeable + */ +#} +Theme hook implementor=theme_theme_test(). Foo={{ foo }} diff --git a/core/modules/system/tests/modules/theme_test/templates/theme_test.template_test.html.twig b/core/modules/system/tests/modules/theme_test/templates/theme_test.template_test.html.twig new file mode 100644 index 0000000..cde8faa --- /dev/null +++ b/core/modules/system/tests/modules/theme_test/templates/theme_test.template_test.html.twig @@ -0,0 +1,2 @@ + +Fail: Template not overridden. diff --git a/core/modules/system/tests/modules/theme_test/templates/theme_test.template_test.tpl.php b/core/modules/system/tests/modules/theme_test/templates/theme_test.template_test.tpl.php deleted file mode 100644 index cde8faa..0000000 --- a/core/modules/system/tests/modules/theme_test/templates/theme_test.template_test.tpl.php +++ /dev/null @@ -1,2 +0,0 @@ - -Fail: Template not overridden. diff --git a/core/modules/system/tests/modules/theme_test/theme_test.inc b/core/modules/system/tests/modules/theme_test/theme_test.inc index 6cde683..99043fe 100644 --- a/core/modules/system/tests/modules/theme_test/theme_test.inc +++ b/core/modules/system/tests/modules/theme_test/theme_test.inc @@ -1,14 +1,13 @@ 'theme_test.inc', 'variables' => array('foo' => ''), + 'template' => 'theme-test', ); $items['theme_test_template_test'] = array( 'template' => 'theme_test.template_test', @@ -16,6 +17,7 @@ function theme_test_theme($existing, $type, $theme, $path) { ); $items['theme_test_foo'] = array( 'variables' => array('foo' => NULL), + 'template' => 'theme-test-foo', ); return $items; } @@ -164,11 +166,3 @@ function theme_test_preprocess_html(&$variables) { $variables['html_attributes']['theme_test_html_attribute'] = 'theme test html attribute value'; $variables['attributes']['theme_test_body_attribute'] = 'theme test body attribute value'; } - -/** - * Theme function for testing theme('theme_test_foo'). - */ -function theme_theme_test_foo($variables) { - return $variables['foo']; -} -