Conditions | 1 |
Paths | 1 |
Total Lines | 17 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | public function testCallToActionLink() |
||
17 | { |
||
18 | $block = new BannerBlock; |
||
19 | $this->assertNull($block->CallToActionLink(), 'No link data set returns null'); |
||
20 | |||
21 | $block->CallToActionLink = json_encode([ |
||
|
|||
22 | 'PageID' => $this->idFromFixture(SiteTree::class, 'test_page'), |
||
23 | 'Text' => 'Click here', |
||
24 | 'Description' => 'Link title text', |
||
25 | 'TargetBlank' => true, |
||
26 | ]); |
||
27 | |||
28 | $result = $block->CallToActionLink(); |
||
29 | $this->assertInstanceOf(ArrayData::class, $result, 'ArrayData object is returned'); |
||
30 | $this->assertEquals($this->idFromFixture(SiteTree::class, 'test_page'), $result->Page->ID, 'Page is attached'); |
||
31 | $this->assertInstanceOf(SiteTree::class, $result->Page); |
||
32 | $this->assertSame('Link title text', $result->Description, 'Link attributes are available'); |
||
33 | } |
||
35 |