ProductDocDataExtensionTest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 51
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetProductsList() 0 4 1
A testLink() 0 4 1
A testGetIsProductDoc() 0 4 1
A testGetProductsCt() 0 4 1
A testGetCMSFields() 0 5 1
1
<?php
2
3
namespace Dynamic\ProductCatalog\Test;
4
5
use Dynamic\ProductCatalog\Docs\CareCleaningDoc;
6
use SilverStripe\Dev\SapphireTest;
7
use SilverStripe\Forms\FieldList;
8
9
class ProductDocDataExtensionTest extends SapphireTest
10
{
11
    /**
12
     * @var string
13
     */
14
    protected static $fixture_file = 'fixtures.yml';
15
16
    /**
17
     *
18
     */
19
    public function testGetProductsCt()
20
    {
21
        $object = $this->objFromFixture(CareCleaningDoc::class, 'one');
22
        $this->assertEquals($object->getProductsCt(), 1);
23
    }
24
25
    /**
26
     *
27
     */
28
    public function testGetProductsList()
29
    {
30
        $object = $this->objFromFixture(CareCleaningDoc::class, 'one');
31
        $this->assertEquals($object->getProductsList(), 'Product One');
32
    }
33
34
    /**
35
     *
36
     */
37
    public function testGetCMSFields()
38
    {
39
        $object = $this->objFromFixture(CareCleaningDoc::class, 'one');
40
        $fields = $object->getCMSFields();
41
        $this->assertInstanceOf(FieldList::class, $fields);
42
    }
43
44
    /**
45
     *
46
     */
47
    public function testLink()
48
    {
49
        $object = $this->objFromFixture(CareCleaningDoc::class, 'one');
50
        $this->assertEquals($object->Link(), $object->Download()->URL);
51
    }
52
53
    /**
54
     *
55
     */
56
    public function testGetIsProductDoc()
57
    {
58
        $object = $this->objFromFixture(CareCleaningDoc::class, 'one');
59
        $this->assertEquals($object->getIsProductDoc(), true);
60
    }
61
}
62