| @@ 49-65 (lines=17) @@ | ||
| 46 | * Tests that any blog posts returned from $category->BlogPosts() many_many are published, |
|
| 47 | * both by normal 'save & publish' functionality and by publish date. |
|
| 48 | */ |
|
| 49 | public function testBlogPosts() |
|
| 50 | { |
|
| 51 | $member = Member::currentUser(); |
|
| 52 | ||
| 53 | if ($member) { |
|
| 54 | $member->logout(); |
|
| 55 | } |
|
| 56 | ||
| 57 | $this->objFromFixture(BlogPost::class, 'FirstBlogPost'); |
|
| 58 | ||
| 59 | /** |
|
| 60 | * @var BlogCategory $category |
|
| 61 | */ |
|
| 62 | $category = $this->objFromFixture(BlogCategory::class, 'FirstCategory'); |
|
| 63 | ||
| 64 | $this->assertEquals(5, $category->BlogPosts()->count(), 'Category blog post count'); |
|
| 65 | } |
|
| 66 | ||
| 67 | /** |
|
| 68 | * @see https://github.com/silverstripe/silverstripe-blog/issues/376 |
|
| @@ 49-65 (lines=17) @@ | ||
| 46 | * Tests that any blog posts returned from $tag->BlogPosts() many_many are published, both by |
|
| 47 | * normal 'save & publish' functionality and by publish date. |
|
| 48 | */ |
|
| 49 | public function testBlogPosts() |
|
| 50 | { |
|
| 51 | $member = Member::currentUser(); |
|
| 52 | ||
| 53 | if ($member) { |
|
| 54 | $member->logout(); |
|
| 55 | } |
|
| 56 | ||
| 57 | $this->objFromFixture(BlogPost::class, 'FirstBlogPost'); |
|
| 58 | ||
| 59 | /** |
|
| 60 | * @var BlogTag $tag |
|
| 61 | */ |
|
| 62 | $tag = $this->objFromFixture(BlogTag::class, 'FirstTag'); |
|
| 63 | ||
| 64 | $this->assertEquals(1, $tag->BlogPosts()->count(), 'Tag blog post count'); |
|
| 65 | } |
|
| 66 | ||
| 67 | /** |
|
| 68 | * @see https://github.com/silverstripe/silverstripe-blog/issues/376 |
|