Completed
Pull Request — master (#3)
by Jason
13:36
created

ElementSectionNavigationTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 43
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetElementSummary() 0 5 1
A testGetType() 0 4 1
A testGetSectionNavigation() 0 4 1
A testGetPage() 0 5 1
1
<?php
2
3
namespace Dynamic\Elements\Section\Tests;
4
5
use DNADesign\Elemental\Models\ElementalArea;
6
use Dynamic\Elements\Section\Elements\ElementSectionNavigation;
7
use SilverStripe\Core\Injector\Injector;
8
use SilverStripe\Dev\Debug;
9
use SilverStripe\Dev\SapphireTest;
10
use SilverStripe\ORM\FieldType\DBField;
11
12
/**
13
 * Class ElementSectionNavigationTest.
14
 */
15
class ElementSectionNavigationTest extends SapphireTest
16
{
17
    /**
18
     * @var string
19
     */
20
    protected static $fixture_file = '../fixtures.yml';
21
22
    /**
23
     *
24
     */
25
    public function testGetPage()
26
    {
27
        $nav = $this->objFromFixture(ElementSectionNavigation::class, "one");
28
        Debug::show($nav->getPage());
29
        $this->assertInstanceOf(ElementalArea::class, $nav->getPage());
30
    }
31
32
    /**
33
     * Tests getSectionNavigation().
34
     */
35
    public function testGetSectionNavigation()
36
    {
37
        $nav = $this->objFromFixture(ElementSectionNavigation::class, "one");
38
        $this->assertFalse($nav->getSectionNavigation());
39
    }
40
41
    /**
42
     *
43
     */
44
    public function testGetElementSummary()
45
    {
46
        $object = $this->objFromFixture(ElementSectionNavigation::class, "one");
47
        $expected = DBField::create_field('HTMLText', '<p>Section Navigation</p>')->Summary(20);
48
        $this->assertEquals($object->ElementSummary(), $expected);
49
    }
50
51
    /**
52
     *
53
     */
54
    public function testGetType()
55
    {
56
        $object = $this->objFromFixture(ElementSectionNavigation::class, "one");
57
        $this->assertEquals($object->getType(), 'Section Navigation');
58
    }
59
}
60