From 904db06f5ed09db910aaec643023faa90e28e5d5 Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Sat, 8 Aug 2015 12:03:20 +1000 Subject: [PATCH] Write tests that verify truth of #1272 Content files with .txt extensions should not be interpreted as HTML --- .../themes/test/content/html-content.htm | 1 + .../themes/test/content/markdown-content.md | 1 + .../themes/test/content/text-content.txt | 1 + tests/unit/cms/classes/ContentTest.php | 36 +++++++++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 tests/fixtures/themes/test/content/html-content.htm create mode 100644 tests/fixtures/themes/test/content/markdown-content.md create mode 100644 tests/fixtures/themes/test/content/text-content.txt create mode 100644 tests/unit/cms/classes/ContentTest.php diff --git a/tests/fixtures/themes/test/content/html-content.htm b/tests/fixtures/themes/test/content/html-content.htm new file mode 100644 index 000000000..9fca008a9 --- /dev/null +++ b/tests/fixtures/themes/test/content/html-content.htm @@ -0,0 +1 @@ +Stephen Saucier changed his profile picture — 7 hrs ago \ No newline at end of file diff --git a/tests/fixtures/themes/test/content/markdown-content.md b/tests/fixtures/themes/test/content/markdown-content.md new file mode 100644 index 000000000..58429128e --- /dev/null +++ b/tests/fixtures/themes/test/content/markdown-content.md @@ -0,0 +1 @@ +Be brave, be **bold**, live *italic* \ No newline at end of file diff --git a/tests/fixtures/themes/test/content/text-content.txt b/tests/fixtures/themes/test/content/text-content.txt new file mode 100644 index 000000000..c055462e5 --- /dev/null +++ b/tests/fixtures/themes/test/content/text-content.txt @@ -0,0 +1 @@ +Pen is than the sword, HTML is than the text \ No newline at end of file diff --git a/tests/unit/cms/classes/ContentTest.php b/tests/unit/cms/classes/ContentTest.php new file mode 100644 index 000000000..05eac5e82 --- /dev/null +++ b/tests/unit/cms/classes/ContentTest.php @@ -0,0 +1,36 @@ +assertEquals('Be brave, be **bold**, live *italic*', $content->markup); + $this->assertEquals('

Be brave, be bold, live italic

', $content->parsedMarkup); + } + + public function testTextContent() + { + $theme = Theme::load('test'); + $content = Content::load($theme, 'text-content.txt'); + + $this->assertEquals('Pen is than the sword, HTML is than the text', $content->markup); + $this->assertEquals('Pen is <mightier> than the sword, HTML is <richer> than the text', $content->parsedMarkup); + } + + public function testHtmlContent() + { + $theme = Theme::load('test'); + $content = Content::load($theme, 'html-content.htm'); + + $this->assertEquals('Stephen Saucier changed his profile picture — 7 hrs ago', $content->markup); + $this->assertEquals('Stephen Saucier changed his profile picture — 7 hrs ago', $content->parsedMarkup); + } + +} \ No newline at end of file