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

testGetChecIOJsIgnoresIfFalsy()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 0
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