2013-10-10 00:09:28 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class BlogPostFilterTest extends SapphireTest {
|
|
|
|
|
|
|
|
static $fixture_file = "blog.yml";
|
|
|
|
|
|
|
|
public function setUp() {
|
|
|
|
SS_Datetime::set_mock_now("2013-10-10 20:00:00");
|
|
|
|
parent::setUp();
|
|
|
|
}
|
|
|
|
|
2015-02-08 08:03:55 +01:00
|
|
|
public function tearDown() {
|
|
|
|
SS_Datetime::clear_mock_now();
|
|
|
|
parent::tearDown();
|
|
|
|
}
|
|
|
|
|
2013-10-10 00:09:28 +02:00
|
|
|
public function testFilter() {
|
|
|
|
$member = Member::currentUser();
|
|
|
|
if($member) $member->logout();
|
|
|
|
|
2015-03-06 03:52:07 +01:00
|
|
|
$blog = $this->objFromFixture('Blog', 'firstblog');
|
|
|
|
|
|
|
|
$count = $blog->AllChildren()->Count();
|
2013-10-10 00:09:28 +02:00
|
|
|
$this->assertEquals(3, $count, "Filtered blog posts");
|
|
|
|
|
|
|
|
SS_Datetime::set_mock_now("2020-01-01 00:00:00");
|
2015-03-06 03:52:07 +01:00
|
|
|
$count = $blog->AllChildren()->Count();
|
2013-10-10 00:09:28 +02:00
|
|
|
$this->assertEquals(5, $count, "Unfiltered blog posts");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|