From 61966f4cdf6923ba182341cf7f3a6734a29cccca Mon Sep 17 00:00:00 2001 From: Ed Chipman Date: Sat, 20 Feb 2016 14:20:00 -0400 Subject: [PATCH] Added test to verify that a url with a .md extension redirects to the absolute url minus the extension --- tests/DocumentationViewerTest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/DocumentationViewerTest.php b/tests/DocumentationViewerTest.php index 2e557c3..570a170 100755 --- a/tests/DocumentationViewerTest.php +++ b/tests/DocumentationViewerTest.php @@ -217,4 +217,17 @@ class DocumentationViewerTest extends FunctionalTest $response = $this->get('dev/docs/all/'); $this->assertEquals(404, $response->getStatusCode()); } + + + public function testRedirectStripExtension() + { + // get url with .md extension + $response = $this->get('dev/docs/en/doc_test/3.0/tutorials.md'); + + // response should be a 301 redirect + $this->assertEquals(301, $response->getStatusCode()); + + // redirect should have been to the absolute url minus the .md extension + $this->assertEquals(Director::absoluteURL('dev/docs/en/doc_test/3.0/tutorials/'), $response->getHeader('Location')); + } }