Code Duplication    Length = 17-17 lines in 2 locations

tests/BlogTagTest.php 1 location

@@ 41-57 (lines=17) @@
38
     * Tests that any blog posts returned from $tag->BlogPosts() many_many are published, both by
39
     * normal 'save & publish' functionality and by publish date.
40
     */
41
    public function testBlogPosts()
42
    {
43
        $member = Security::getCurrentUser();
44
45
        if ($member) {
46
            Security::setCurrentUser(null);
47
        }
48
49
        $this->objFromFixture(BlogPost::class, 'FirstBlogPost');
50
51
        /**
52
         * @var BlogTag $tag
53
         */
54
        $tag = $this->objFromFixture(BlogTag::class, 'FirstTag');
55
56
        $this->assertEquals(1, $tag->BlogPosts()->count(), 'Tag blog post count');
57
    }
58
59
    /**
60
     * @see https://github.com/silverstripe/silverstripe-blog/issues/376

tests/BlogCategoryTest.php 1 location

@@ 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 = Security::getCurrentUser();
52
53
        if ($member) {
54
            Security::setCurrentUser(null);
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