Completed
Push — master ( b28dd3...cc924e )
by Robbie
03:15
created

ChecIOExtensionTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 3
eloc 11
c 2
b 0
f 1
dl 0
loc 33
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetChecIOJs() 0 5 1
A setUp() 0 4 1
A testGetChecIOJsIgnoresIfFalsy() 0 5 1
1
<?php
2
3
class ChecIOExtensionTest extends SapphireTest
0 ignored issues
show
Bug introduced by
The type SapphireTest was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
4
{
5
    protected static $fixture_file = 'ChecIOShortcodeTest.yml';
6
7
    /**
8
     * @var Page
0 ignored issues
show
Bug introduced by
The type Page was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
     */
10
    private $page;
11
12
    public function setUp()
13
    {
14
        parent::setUp();
15
        $this->page = $this->objFromFixture('SiteTree', 'test');
16
    }
17
18
    /**
19
     * Tests that a non-empty result is returned.
20
     */
21
    public function testGetChecIOJs()
22
    {
23
        $result = $this->page->getChecIOJs();
24
        $this->assertNotNull($result);
25
        $this->assertContains('<script type="text/javascript', $result);
26
    }
27
28
    /**
29
     * Allow the JS to be disabled if desired
30
     */
31
    public function testGetChecIOJsIgnoresIfFalsy()
32
    {
33
        Config::inst()->update('ChecIOShortcode', 'third-party-js', '');
0 ignored issues
show
Bug introduced by
The type Config was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
34
        $result = $this->page->getChecIOJs();
35
        $this->assertNotContains('<script type="text/javascript', $result);
36
    }
37
}
38