diff --git a/app/Template/analytic/layout.php b/app/Template/analytic/layout.php new file mode 100644 index 0000000..7159094 --- /dev/null +++ b/app/Template/analytic/layout.php @@ -0,0 +1,14 @@ + + + + projectHeader->render($project, 'TaskListController', 'show') ?> + + diff --git a/tests/units/Core/TemplateTest.php b/tests/units/Core/TemplateTest.php new file mode 100644 index 0000000..a065aa8 --- /dev/null +++ b/tests/units/Core/TemplateTest.php @@ -0,0 +1,85 @@ +container['helper']); + + $this->assertStringEndsWith( + implode(DIRECTORY_SEPARATOR, array('app', 'Core', '..', 'Template', 'a', 'b.php')), + $template->getTemplateFile('a'.DIRECTORY_SEPARATOR.'b') + ); + + $this->assertStringEndsWith( + implode(DIRECTORY_SEPARATOR, array('app', 'Core', '..', 'Template', 'a', 'b.php')), + $template->getTemplateFile('kanboard:a'.DIRECTORY_SEPARATOR.'b') + ); + } + + public function testGetPluginTemplateFile() + { + $template = new Template($this->container['helper']); + $this->assertStringEndsWith( + implode(DIRECTORY_SEPARATOR, array(PLUGINS_DIR, 'Myplugin', 'Template', 'a', 'b.php')), + $template->getTemplateFile('myplugin:a'.DIRECTORY_SEPARATOR.'b') + ); + } + + public function testGetOverridedTemplateFile() + { + $template = new Template($this->container['helper']); + $template->setTemplateOverride('a'.DIRECTORY_SEPARATOR.'b', 'myplugin:c'); + + $this->assertStringEndsWith( + implode(DIRECTORY_SEPARATOR, array(PLUGINS_DIR, 'Myplugin', 'Template', 'c.php')), + $template->getTemplateFile('a'.DIRECTORY_SEPARATOR.'b') + ); + + $this->assertStringEndsWith( + implode(DIRECTORY_SEPARATOR, array('app', 'Core', '..', 'Template', 'd.php')), + $template->getTemplateFile('d') + ); + } + + public function testCommentReplyEscapesTemplateClosingTags() + { + $_SESSION['user'] = array( + 'id' => 2, + 'role' => Role::APP_USER, + ); + + $html = $this->container['template']->render('comment/show', array( + 'comment' => array( + 'id' => 1, + 'user_id' => 1, + 'username' => 'alice', + 'name' => 'Alice', + 'email' => '', + 'avatar_path' => '', + 'date_creation' => 0, + 'date_modification' => 0, + 'visibility' => Role::APP_USER, + 'comment' => '', + ), + 'task' => array('id' => 1), + 'editable' => false, + 'hide_actions' => true, + )); + + $this->assertStringNotContainsString( + '', + $html + ); + $this->assertStringContainsString( + '</textarea></template><base href="http://127.0.0.1:8899/">', + $html + ); + } +}