Completed
Push — master ( 8ab7cc...28fbef )
by Garion
03:38
created

NewsPageTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testGetNewsPageAuthor() 0 14 1
1
<?php
2
3
namespace CWP\CWP\Tests\PageTypes;
4
5
use CWP\CWP\PageTypes\NewsHolder;
6
use CWP\CWP\PageTypes\NewsPage;
7
use SilverStripe\Dev\SapphireTest;
8
use SilverStripe\ORM\FieldType\DBField;
9
10
class NewsPageTest extends SapphireTest
11
{
12
    protected $usesDatabase = true;
13
14
    public function testGetNewsPageAuthor()
15
    {
16
        $holder = new NewsHolder();
17
        $holder->Title = 'Holder';
18
        $holder->write();
19
20
        $page = new NewsPage();
21
        $page->Author = 'Leslie Lawless';
22
        $page->ParentID = $holder->ID;
23
        $page->write();
24
25
        $field = $page->getNewsPageAuthor();
26
        $this->assertInstanceOf(DBField::class, $field);
27
        $this->assertSame('Leslie Lawless', $field->getValue());
28
    }
29
}
30