mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Added unit test for BlogHolder_Controller's custom checkAccessAction function
This commit is contained in:
parent
6eebbb217c
commit
67d8a8b423
@ -142,7 +142,7 @@ class BlogHolder_Controller extends BlogTree_Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: this is an urgent fix to work with archive link (e.g. 2009/04) for Nelsoncc project. Replace this with something better.
|
||||
* TODO: this is an urgent fix to work with archive link (e.g. page_url/2009/04). Replace this with something better.
|
||||
*/
|
||||
function checkAccessAction($action) {
|
||||
if (preg_match('/[0-9]{4}/', $action))
|
||||
|
@ -52,6 +52,18 @@ class BlogHolderTest extends SapphireTest {
|
||||
$this->assertContains($entry->URLSegment, $expectedEntries);
|
||||
}
|
||||
}
|
||||
|
||||
function testcheckAccessAction() {
|
||||
$blogHolder = new BlogHolder_Controller();
|
||||
|
||||
$this->assertTrue($blogHolder->checkAccessAction('2009'));
|
||||
$this->assertTrue($blogHolder->checkAccessAction('0001'));
|
||||
$this->assertTrue($blogHolder->checkAccessAction('12345'));
|
||||
|
||||
$this->assertFalse($blogHolder->checkAccessAction('209'));
|
||||
$this->assertFalse($blogHolder->checkAccessAction('123A'));
|
||||
$this->assertFalse($blogHolder->checkAccessAction('ab01a'));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user