Completed
Pull Request — master (#62)
by Jason
11:55
created

PageSectionBlockTest::testGetPluralName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 5
Ratio 100 %

Importance

Changes 0
Metric Value
dl 5
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace Dynamic\DynamicBlocks\Test;
4
5
use Dynamic\DynamicBlocks\Block\PageSectionBlock;
6
use SilverStripe\Dev\SapphireTest;
7
use SilverStripe\Forms\FieldList;
8
9
/**
10
 * Class PageSectionBlockTest
11
 */
12 View Code Duplication
class PageSectionBlockTest extends SapphireTest
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
{
14
15
    /**
16
     * @var string
17
     */
18
    protected static $fixture_file = 'dynamic-blocks/tests/Fixtures.yml';
19
20
    /**
21
     *
22
     */
23
    public function testGetPluralName()
24
    {
25
        $object = singleton(PageSectionBlock::class);
26
        $this->assertEquals('Page Sections Blocks', $object->plural_name());
27
    }
28
29
    /**
30
     *
31
     */
32
    public function testGetCMSFields()
33
    {
34
        $object = $this->objFromFixture(PageSectionBlock::class, 'one');
35
        $fields = $object->getCMSFields();
36
        $this->assertInstanceOf(FieldList::class, $fields);
37
        $this->assertNotNull($fields->dataFieldByName('Sections'));
38
    }
39
40
    /**
41
     *
42
     */
43
    public function testGetPageSections()
44
    {
45
        $object = $this->objFromFixture(PageSectionBlock::class, 'one');
46
        $expected = $object->Sections()->sort('SortOrder');
47
        $this->assertEquals($expected, $object->getPageSections());
48
    }
49
50
}