mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 09:05:56 +00:00
Added test to verify that a url with a .md extension redirects to the absolute url minus the extension
This commit is contained in:
parent
5e72a42f13
commit
61966f4cdf
@ -217,4 +217,17 @@ class DocumentationViewerTest extends FunctionalTest
|
|||||||
$response = $this->get('dev/docs/all/');
|
$response = $this->get('dev/docs/all/');
|
||||||
$this->assertEquals(404, $response->getStatusCode());
|
$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'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user