mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Merge pull request #322 from camfindlay/hotfix/fix-titlebug
FIX Title bug due to #320
This commit is contained in:
commit
ee9cca0788
@ -736,7 +736,7 @@ class Blog_Controller extends Page_Controller {
|
||||
if(preg_match('/^[0-9]{4}$/', $year = $this->request->param('Year'))) {
|
||||
return (int) $year;
|
||||
}
|
||||
} else {
|
||||
} elseif($this->request->param('Action') == 'archive') {
|
||||
return SS_Datetime::now()->Year();
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,6 @@ class BlogTest extends SapphireTest {
|
||||
|
||||
$link = Controller::join_links($blog->Link('archive'));
|
||||
$this->assertEquals(200, $this->getStatusOf($link), 'HTTP Status should be 200');
|
||||
$this->assertEquals('2013', ModelAsController::controller_for($blog)->getArchiveYear(), 'Defaults to current year');
|
||||
|
||||
$link = Controller::join_links($blog->Link('archive'), 'invalid-year');
|
||||
|
||||
@ -126,6 +125,16 @@ class BlogTest extends SapphireTest {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Test archive year
|
||||
*/
|
||||
public function testArchiveYear(){
|
||||
$blog = $this->objFromFixture('Blog', 'FirstBlog');
|
||||
$controller = new Blog_Controller($blog);
|
||||
$this->requestURL($controller, 'first-post/archive/');
|
||||
$this->assertEquals(2013, $controller->getArchiveYear(), 'getArchiveYear should return 2013');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $link
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user