Passed
Push — master ( 25ca2a...86c16b )
by Robbie
02:46
created

CWPCarouselItemExtensionTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 23
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testHasCallToActionFields() 0 7 1
A testCaptionIsReplacedByContent() 0 6 1
1
<?php
2
3
class CWPCarouselItemExtensionTest extends SapphireTest
4
{
5
    /**
6
     * Ensure that the caption is replaced by a HTML editor for content
7
     */
8
    public function testCaptionIsReplacedByContent()
9
    {
10
        $carouselItem = new CarouselItem;
11
        $fields = $carouselItem->getCMSFields();
12
        $this->assertInstanceOf('HtmlEditorField', $fields->fieldByName('Content'));
13
        $this->assertNull($fields->fieldByName('Caption'));
14
    }
15
16
    /**
17
     * Ensure that we have a primary and secondary call to action link/label
18
     */
19
    public function testHasCallToActionFields()
20
    {
21
        $carouselItem = new CarouselItem;
22
        $fields = $carouselItem->getCMSFields();
23
24
        $this->assertInstanceOf('TextField', $fields->fieldByName('PrimaryCallToActionLabel'));
25
        $this->assertInstanceOf('TextField', $fields->fieldByName('SecondaryCallToActionLabel'));
26
    }
27
}
28