ChecShortcodeTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testBuyNowButton() 0 6 1
A setUp() 0 4 1
1
<?php
2
3
namespace Robbie\SilverstripeChec\Tests;
4
5
use SilverStripe\CMS\Model\SiteTree;
6
use SilverStripe\Dev\FunctionalTest;
7
use SilverStripe\View\Parsers\ShortcodeParser;
8
9
class ChecShortcodeTest extends FunctionalTest
10
{
11
    protected static $fixture_file = 'ChecShortcodeTest.yml';
12
13
    /**
14
     * @var SiteTree
15
     */
16
    private $page;
17
18
    protected function setUp()
19
    {
20
        parent::setUp();
21
        $this->page = $this->objFromFixture(SiteTree::class, 'test');
22
    }
23
24
    /**
25
     * Tests that the shortcode gets parsed
26
     */
27
    public function testBuyNowButton()
28
    {
29
        $text = $this->page->Content;
30
        $parsed = ShortcodeParser::get_active()->parse($text);
31
        $this->assertContains('<a href="https://checkout.chec.io/AbC1Y3', $parsed);
32
        $this->assertContains('">Buy Now', $parsed);
33
    }
34
}
35