Completed
Pull Request — master (#62)
by Jason
12:01
created

testGetCMSFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
dl 10
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
namespace Dynamic\DynamicBlocks\Test;
4
5
use Dynamic\DynamicBlocks\ORM\DynamicContentBlockDataExtension;
6
use SheaDawson\Blocks\Model\ContentBlock;
7
use SilverStripe\Dev\SapphireTest;
8
use SilverStripe\Forms\FieldList;
9
10 View Code Duplication
class DynamicContentBlockDataExtensionTest 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...
11
{
12
    /**
13
     * @var string
14
     */
15
    protected static $fixture_file = 'dynamic-blocks/tests/Fixtures.yml';
16
17
    /**
18
     *
19
     */
20
    public function testGetCMSFields()
21
    {
22
        $object = $this->objFromFixture(ContentBlock::class, 'one');
23
        $fields = $object->getCMSFields();
24
        $extension = new DynamicContentBlockDataExtension();
25
        $extension->updateCMSFields($fields);
26
27
        $this->assertInstanceOf(FieldList::class, $fields);
28
        $this->assertNotNull($fields->dataFieldByName('Image'));
29
    }
30
}