Code Duplication    Length = 13-13 lines in 4 locations

tests/RecentBlogPostsBlockTest.php 2 locations

@@ 28-40 (lines=13) @@
25
    /**
26
     *
27
     */
28
    public function testCanView()
29
    {
30
        $object = $this->objFromFixture('RecentBlogPostsBlock', 'one');
31
        $admin = $this->objFromFixture('Member', 'admin');
32
        $member = $this->objFromFixture('Member', 'default');
33
        if (class_exists('Blog')) {
34
            $this->assertTrue($object->canView($admin));
35
            $this->assertTrue($object->canView($member));
36
        } else {
37
            $this->assertFalse($object->canView($admin));
38
            $this->assertFalse($object->canView($member));
39
        }
40
    }
41
42
    /**
43
     *
@@ 45-57 (lines=13) @@
42
    /**
43
     *
44
     */
45
    public function testCanCreate()
46
    {
47
        $object = $this->objFromFixture('RecentBlogPostsBlock', 'one');
48
        $admin = $this->objFromFixture('Member', 'admin');
49
        $member = $this->objFromFixture('Member', 'default');
50
        if (class_exists('Blog')) {
51
            $this->assertTrue($object->canCreate($admin));
52
            $this->assertTrue($object->canCreate($member));
53
        } else {
54
            $this->assertFalse($object->canCreate($admin));
55
            $this->assertFalse($object->canCreate($member));
56
        }
57
    }
58
}

tests/FormBlockTest.php 2 locations

@@ 43-55 (lines=13) @@
40
    /**
41
     *
42
     */
43
    public function testCanView()
44
    {
45
        $object = $this->objFromFixture('FormBlock', 'one');
46
        $admin = $this->objFromFixture('Member', 'admin');
47
        $member = $this->objFromFixture('Member', 'default');
48
        if (class_exists('UserDefinedForm')) {
49
            $this->assertTrue($object->canView($admin));
50
            $this->assertTrue($object->canView($member));
51
        } else {
52
            $this->assertFalse($object->canView($admin));
53
            $this->assertFalse($object->canView($member));
54
        }
55
    }
56
57
    /**
58
     *
@@ 60-72 (lines=13) @@
57
    /**
58
     *
59
     */
60
    public function testCanCreate()
61
    {
62
        $object = $this->objFromFixture('FormBlock', 'one');
63
        $admin = $this->objFromFixture('Member', 'admin');
64
        $member = $this->objFromFixture('Member', 'default');
65
        if (class_exists('UserDefinedForm')) {
66
            $this->assertTrue($object->canCreate($admin));
67
            $this->assertTrue($object->canCreate($member));
68
        } else {
69
            $this->assertFalse($object->canCreate($admin));
70
            $this->assertFalse($object->canCreate($member));
71
        }
72
    }
73
}