Completed
Push — master ( ed4843...c0d0bb )
by Vincenzo
02:12
created

testConfigHelperWillCastToNullIfConfigKeyIsNotSpecified()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
4
use App\Lib\Helpers\Config;
5
6
class ConfigTest extends PHPUnit_Framework_TestCase
7
{
8
    /**
9
     * @group Helpers
10
     * @group Config
11
     */
12
    public function testConfigHelperWillLoadtheRightFile()
13
    {
14
        $expected = require 'config/configSample.php';
15
        $val = Config::get('configSample.stuff');
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $val is correct as \App\Lib\Helpers\Config:...t('configSample.stuff') (which targets App\Lib\Helpers\Config::get()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
16
        $this->assertEquals($expected['stuff'], $val);
17
    }
18
19
    /**
20
     * @group Helpers
21
     * @group Config
22
     * @group configwillcasttonullifkeynotspecified
23
     */
24
    public function testConfigHelperWillCastToNullIfConfigKeyIsNotSpecified()
25
    {
26
        $val = Config::get('configSample');
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $val is correct as \App\Lib\Helpers\Config::get('configSample') (which targets App\Lib\Helpers\Config::get()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
27
        $this->assertNull($val);
28
    }
29
30
    /**
31
     * @group Helpers
32
     * @group Config
33
     * @group configwillcasttonull
34
     */
35
    public function testConfigHelperWillCastToNullIfConfigKeyIsNotThere()
36
    {
37
        $val = Config::get('configSample.aConfigKeyWhichIsNotThere');
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $val is correct as \App\Lib\Helpers\Config:...figKeyWhichIsNotThere') (which targets App\Lib\Helpers\Config::get()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
38
        $this->assertNull($val);
39
    }
40
    /**
41
     * @group Helpers
42
     * @group Config
43
     * @group configwillcasttonulliffiledoesnotexist
44
     */
45
    public function testConfigHelperWillCastToNullIfConfigFileDoesNotExist()
46
    {
47
        $val = Config::get('aConfigFileWhichIsNotThere.aConfigKeyWhichIsNotThere');
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $val is correct as \App\Lib\Helpers\Config:...figKeyWhichIsNotThere') (which targets App\Lib\Helpers\Config::get()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
48
        $this->assertNull($val);
49
    }
50
51
52
}
53