BlockLinkField_ReadonlyTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
dl 0
loc 26
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testReadonlyFieldIsReturnedFromTransformation() 0 3 1
A setUp() 0 12 1
1
<?php
2
3
namespace SilverStripe\ElementalBannerBlock\Tests\Form;
4
5
use SilverStripe\CMS\Model\SiteTree;
6
use SilverStripe\Dev\SapphireTest;
7
use SilverStripe\ElementalBannerBlock\Form\BlockLinkField;
8
use SilverStripe\ElementalBannerBlock\Form\BlockLinkField_Readonly;
9
10
class BlockLinkField_ReadonlyTest extends SapphireTest
11
{
12
    protected static $fixture_file = 'BlockLinkFieldTest.yml';
13
14
    /**
15
     * @var BlockLinkField_Readonly
16
     */
17
    protected $field;
18
19
    protected function setUp()
20
    {
21
        parent::setUp();
22
23
        $this->field = (new BlockLinkField('Foo'))
24
            ->setValue(json_encode([
25
                'PageID' => $this->idFromFixture(SiteTree::class, 'a_page'),
26
                'Text' => 'Some text here',
27
                'Description' => 'Do not touch the monkey',
28
                'TargetBlank' => true,
29
            ]))
30
            ->performReadonlyTransformation();
31
    }
32
33
    public function testReadonlyFieldIsReturnedFromTransformation()
34
    {
35
        $this->assertInstanceOf(BlockLinkField_Readonly::class, $this->field);
36
    }
37
}
38