Add test to check that populate defaults works as expected

This commit is contained in:
Morven Lewis-Everley 2014-08-06 15:37:42 +01:00 committed by Damian Mooyman
parent fcdf9d325a
commit 638b309b69
1 changed files with 23 additions and 0 deletions

View File

@ -6,6 +6,29 @@
*/
class BlogEntryTest extends SapphireTest {
static $fixture_file = 'blog/tests/BlogTest.yml';
/**
* Tests that the blog entry populate defaults works
*/
public function testPopulateDefaults() {
$member = $this->objFromFixture("Member", "blogOwner1");
$member->logIn();
// Create manually, as from fixture seems to create entries
// multiple times
$entry = BlogEntry::create();
$entry->Title = "Test post";
$entry->URLSegment = "test-post";
$entry->Tags = "tag1,tag2";
// We cant test by the second, as that will most likely fail
$now = date('Y-m-d', strtotime('now'));
$this->assertContains($now, $entry->Date);
$this->assertEquals($member->getName(), $entry->Author);
$member->logOut();
}
/**
* Tests BBCode functionality