2008-09-12 01:36:15 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class BlogHolderTest extends SapphireTest {
|
|
|
|
static $fixture_file = 'blog/tests/BlogTest.yml';
|
|
|
|
|
|
|
|
function testGetAllBlogEntries() {
|
2009-07-08 02:28:29 +02:00
|
|
|
$mainblog = $this->objFromFixture('BlogHolder', 'mainblog');
|
2009-08-03 06:18:35 +02:00
|
|
|
|
|
|
|
$this->assertNotNull($mainblog->Entries());
|
2008-09-12 01:36:15 +02:00
|
|
|
$this->assertEquals($mainblog->Entries()->Count(), 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
function testEntriesByMonth() {
|
2009-07-08 02:28:29 +02:00
|
|
|
$mainblog = $this->objFromFixture('BlogHolder', 'mainblog');
|
2008-09-12 01:36:15 +02:00
|
|
|
|
|
|
|
$entries = $mainblog->Entries('', '', '2008-01');
|
|
|
|
$this->assertEquals($entries->Count(), 2);
|
|
|
|
$expectedEntries = array(
|
|
|
|
'test-post-2',
|
|
|
|
'test-post-3'
|
|
|
|
);
|
|
|
|
|
|
|
|
foreach($entries as $entry) {
|
|
|
|
$this->assertContains($entry->URLSegment, $expectedEntries);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function textEntriesByYear() {
|
2009-07-08 02:28:29 +02:00
|
|
|
$mainblog = $this->objFromFixture('BlogHolder', 'mainblog');
|
2008-09-12 01:36:15 +02:00
|
|
|
|
|
|
|
$entries = $mainblog->Entries('', '', '2007');
|
|
|
|
$this->assertEquals($entries->Count(), 1);
|
|
|
|
$expectedEntries = array(
|
|
|
|
'test-post'
|
|
|
|
);
|
|
|
|
|
|
|
|
foreach($entries as $entry) {
|
|
|
|
$this->assertContains($entry->URLSegment, $expectedEntries);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function testEntriesByTag() {
|
2009-07-08 02:28:29 +02:00
|
|
|
$mainblog = $this->objFromFixture('BlogHolder', 'mainblog');
|
2008-09-12 01:36:15 +02:00
|
|
|
|
|
|
|
$entries = $mainblog->Entries('', 'tag1');
|
|
|
|
$this->assertEquals($entries->Count(), 2);
|
|
|
|
$expectedEntries = array(
|
|
|
|
'test-post',
|
|
|
|
'test-post-3'
|
|
|
|
);
|
|
|
|
|
|
|
|
foreach($entries as $entry) {
|
|
|
|
$this->assertContains($entry->URLSegment, $expectedEntries);
|
|
|
|
}
|
|
|
|
}
|
2009-07-22 05:16:06 +02:00
|
|
|
|
2008-09-12 01:36:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|