Completed
Branch master (9dcfc4)
by Daniel
24:32
created

DevCheckControllerTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testIndexCreatesChecker() 0 8 1
1
<?php
2
3
namespace SilverStripe\EnvironmentCheck\Tests\Controllers;
4
5
use SilverStripe\Control\HTTPRequest;
6
use SilverStripe\Dev\SapphireTest;
7
use SilverStripe\EnvironmentCheck\Controllers\DevCheckController;
8
use SilverStripe\EnvironmentCheck\EnvironmentChecker;
9
10
/**
11
 * Class DevCheckControllerTest
12
 *
13
 * @mixin PHPUnit_Framework_TestCase
14
 *
15
 * @package environmentcheck
16
 */
17
class DevCheckControllerTest extends SapphireTest
18
{
19
    /**
20
     * {@inheritDoc}
21
     * @var array
22
     */
23
    protected $usesDatabase = true;
24
25
    public function testIndexCreatesChecker()
26
    {
27
        $controller = new DevCheckController();
28
29
        $request = new HTTPRequest('GET', 'example.com');
30
31
        $this->assertInstanceOf(EnvironmentChecker::class, $controller->index($request));
0 ignored issues
show
Documentation introduced by
$request is of type object<SilverStripe\Control\HTTPRequest>, but the function expects a object<SilverStripe\Envi...ontrollers\HTTPRequest>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
32
    }
33
}
34