Issues (99)

test/Mvc/ModuleTest.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * DronePHP (http://www.dronephp.com)
4
 *
5
 * @link      http://github.com/Pleets/DronePHP
6
 * @copyright Copyright (c) 2016-2018 Pleets. (http://www.pleets.org)
7
 * @license   http://www.dronephp.com/license
8
 * @author    Darío Rivera <[email protected]>
9
 */
10
11
namespace DroneTest\Util;
12
13
use Drone\Mvc\ModuleFactory;
14
use PHPUnit\Framework\TestCase;
15
16
class ModuleTest extends TestCase
17
{
18
    /**
19
     * Tests getting module configuration
20
     *
21
     * @return null
22
     */
23
    public function testGettingConfiguration()
24
    {
25
        include "test-skeleton/module/Master/Module.php";
26
27
        $module = ModuleFactory::create("Master", [
0 ignored issues
show
Are you sure the assignment to $module is correct as Drone\Mvc\ModuleFactory:...er/config/config.php')) targeting Drone\Mvc\ModuleFactory::create() 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...
28
            "config"  => 'test-skeleton/module/Master/config/config.php',
29
        ]);
30
31
        $this->assertSame(
32
            'test-skeleton/module/Master/config/config.php',
33
            $module->getConfigFile()
34
        );
35
36
        $this->assertSame(["baz" => "foo"], $module->getConfig());
37
    }
38
}
39