Passed
Push — master ( 5d914a...ea5826 )
by Jason
04:12
created

ElementAccordionTest::testGetSummary()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Dynamic\Elements\Accordion\Tests;
4
5
use Dynamic\Elements\Accordion\Elements\ElementAccordion;
6
use SilverStripe\Core\Injector\Injector;
7
use SilverStripe\Dev\SapphireTest;
8
use SilverStripe\Forms\FieldList;
9
10
class ElementAccordionTest 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(ElementAccordion::class, 'one');
23
        $fields = $object->getCMSFields();
24
        $this->assertInstanceOf(FieldList::class, $fields);
25
        $this->assertNotNull($fields->dataFieldByName('Panels'));
26
    }
27
28
    /**
29
     *
30
     */
31
    public function testGetSummary()
32
    {
33
        $object = $this->objFromFixture(ElementAccordion::class, 'one');
34
        $this->assertEquals($object->getSummary(), '2 panels');
35
    }
36
37
    /**
38
     *
39
     */
40
    public function testGetType()
41
    {
42
        $object = Injector::inst()->create(ElementAccordion::class);
43
        $this->assertEquals($object->getType(), 'Accordion');
44
    }
45
}
46