silverstripe-blog/tests/BlogTagTest.php

27 lines
717 B
PHP
Raw Normal View History

2013-10-10 00:09:28 +02:00
<?php
class BlogTagTest extends SapphireTest {
static $fixture_file = "blog.yml";
public function setUp() {
SS_Datetime::set_mock_now("2013-10-10 20:00:00");
parent::setUp();
}
2014-03-23 15:40:53 +01:00
/**
* Tests that any blog posts returned from $tag->BlogPosts() many_many are published,
* both by normal 'save & publish' functionality and by publish date.
**/
2013-10-10 00:09:28 +02:00
public function testBlogPosts() {
2014-03-23 15:40:53 +01:00
// Ensure the user is not logged in as admin (or anybody)
2013-10-10 00:09:28 +02:00
$member = Member::currentUser();
if($member) $member->logout();
$post = $this->objFromFixture("BlogPost", "blogpost1");
$tag = $this->objFromFixture("BlogTag", "firsttag");
2014-03-23 15:40:53 +01:00
$this->assertEquals(1, $tag->BlogPosts()->count(), "Tag blog post count");
2013-10-10 00:09:28 +02:00
}
}