HasFunctionCheckTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testCheckReportsFoundFunctions() 0 10 1
A testCheckReportsMissingFunctions() 0 10 1
1
<?php
2
3
namespace SilverStripe\EnvironmentCheck\Tests\Checks;
4
5
use SilverStripe\EnvironmentCheck\Checks\HasFunctionCheck;
6
use SilverStripe\EnvironmentCheck\EnvironmentCheck;
7
use SilverStripe\Dev\SapphireTest;
8
9
/**
10
 * Class HasFunctionCheckTest
11
 *
12
 * @mixin PHPUnit_Framework_TestCase
13
 *
14
 * @package environmentcheck
15
 */
16
class HasFunctionCheckTest extends SapphireTest
17
{
18
    public function testCheckReportsMissingFunctions()
19
    {
20
        $check = new HasFunctionCheck('foo');
21
22
        $expected = [
23
            EnvironmentCheck::ERROR,
24
            'foo() doesn\'t exist'
25
        ];
26
27
        $this->assertEquals($expected, $check->check());
28
    }
29
30
    public function testCheckReportsFoundFunctions()
31
    {
32
        $check = new HasFunctionCheck('class_exists');
33
34
        $expected = [
35
            EnvironmentCheck::OK,
36
            'class_exists() exists'
37
        ];
38
39
        $this->assertEquals($expected, $check->check());
40
    }
41
}
42