ElementFeaturesTest::testGetType()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Dynamic\Elements\Features\Tests;
4
5
use Dynamic\Elements\Features\Elements\ElementFeatures;
6
use SilverStripe\Dev\SapphireTest;
7
use SilverStripe\Forms\FieldList;
8
use SilverStripe\ORM\DataList;
9
10
class ElementFeaturesTest extends SapphireTest
11
{
12
    /**
13
     * @var string
14
     */
15
    protected static $fixture_file = '../fixtures.yml';
16
17
    /**
18
     *
19
     */
20
    public function testGetCMSFields()
21
    {
22
        $object = $this->objFromFixture(ElementFeatures::class, 'one');
23
        $fields = $object->getCMSFields();
24
        $this->assertInstanceOf(FieldList::class, $fields);
25
    }
26
27
    /**
28
     *
29
     */
30
    public function testGetFeaturesList()
31
    {
32
        $object = $this->objFromFixture(ElementFeatures::class, 'one');
33
        $this->assertInstanceOf(DataList::class, $object->getFeaturesList());
34
        $this->assertEquals($object->getFeaturesList(), $object->Features()->sort('Sort'));
35
    }
36
37
    /**
38
     *
39
     */
40
    public function testGetSummary()
41
    {
42
        $object = $this->objFromFixture(ElementFeatures::class, 'one');
43
        $result = 'A Feature';
44
        $this->assertEquals($object->getSummary(), $result);
45
    }
46
47
    /**
48
     *
49
     */
50
    public function testGetType()
51
    {
52
        $object = $this->objFromFixture(ElementFeatures::class, 'one');
53
        $this->assertEquals($object->getType(), 'Features');
54
    }
55
}
56