ProductDocDataExtensionTest::testGetIsProductDoc()   A
last analyzed

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