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
|
|
|
|