| @@ 37-52 (lines=16) @@ | ||
| 34 | * Tests that any blog posts returned from $category->BlogPosts() many_many are published, | |
| 35 | * both by normal 'save & publish' functionality and by publish date. | |
| 36 | */ | |
| 37 | public function testBlogPosts() | |
| 38 |     { | |
| 39 | $member = Member::currentUser(); | |
| 40 | ||
| 41 |         if ($member) { | |
| 42 | $member->logout(); | |
| 43 | } | |
| 44 | ||
| 45 |         $this->objFromFixture('BlogPost', 'FirstBlogPost'); | |
| 46 | ||
| 47 | /** | |
| 48 | * @var BlogCategory $category | |
| 49 | */ | |
| 50 |         $category = $this->objFromFixture('BlogCategory', 'FirstCategory'); | |
| 51 | ||
| 52 | $this->assertEquals(5, $category->BlogPosts()->count(), 'Category blog post count'); | |
| 53 | } | |
| 54 | ||
| 55 | /** | |
| @@ 27-44 (lines=18) @@ | ||
| 24 | parent::tearDown(); | |
| 25 | } | |
| 26 | ||
| 27 | public function testFilter() | |
| 28 |     { | |
| 29 | $member = Member::currentUser(); | |
| 30 | ||
| 31 |         if ($member) { | |
| 32 | $member->logout(); | |
| 33 | } | |
| 34 | ||
| 35 | /** | |
| 36 | * @var Blog $blog | |
| 37 | */ | |
| 38 |         $blog = $this->objFromFixture('Blog', 'FirstBlog'); | |
| 39 | ||
| 40 | $this->assertEquals(3, $blog->AllChildren()->Count(), 'Filtered blog posts'); | |
| 41 | ||
| 42 |         SS_Datetime::set_mock_now('2020-01-01 00:00:00'); | |
| 43 | ||
| 44 | $this->assertEquals(5, $blog->AllChildren()->Count(), 'Unfiltered blog posts'); | |
| 45 | } | |
| 46 | } | |
| 47 | ||
| @@ 37-52 (lines=16) @@ | ||
| 34 | * Tests that any blog posts returned from $tag->BlogPosts() many_many are published, both by | |
| 35 | * normal 'save & publish' functionality and by publish date. | |
| 36 | */ | |
| 37 | public function testBlogPosts() | |
| 38 |     { | |
| 39 | $member = Member::currentUser(); | |
| 40 | ||
| 41 |         if ($member) { | |
| 42 | $member->logout(); | |
| 43 | } | |
| 44 | ||
| 45 |         $this->objFromFixture('BlogPost', 'FirstBlogPost'); | |
| 46 | ||
| 47 | /** | |
| 48 | * @var BlogTag $tag | |
| 49 | */ | |
| 50 |         $tag = $this->objFromFixture('BlogTag', 'FirstTag'); | |
| 51 | ||
| 52 | $this->assertEquals(1, $tag->BlogPosts()->count(), 'Tag blog post count'); | |
| 53 | } | |
| 54 | ||
| 55 | /** | |