Passed
Pull Request — master (#191)
by Corey
03:34
created

FsaControllerTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
eloc 6
c 1
b 0
f 1
dl 0
loc 11
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testgetTimeThreshold() 0 7 1
1
<?php
2
3
namespace console\tests\unit\controllers;
4
5
use Yii;
6
use \console\controllers\FsaController;
7
8
class FsaControllerTest extends \Codeception\Test\Unit
9
{
10
    use \Codeception\Specify;
11
12
    public function testgetTimeThreshold()
13
    {
14
        $expire = \Yii::$app->params['user.verifyAccountTokenExpire'];
0 ignored issues
show
Unused Code introduced by
The assignment to $expire is dead and can be removed.
Loading history...
15
16
        $controller = new FsaController('fsa', 'console');
0 ignored issues
show
Bug introduced by
'console' of type string is incompatible with the type yii\base\Module expected by parameter $module of console\controllers\FsaController::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

16
        $controller = new FsaController('fsa', /** @scrutinizer ignore-type */ 'console');
Loading history...
17
        $controller->getTimeThreshold();
18
        expect('asdf', $this->assertTrue(false));
0 ignored issues
show
Unused Code introduced by
The call to expect() has too many arguments starting with $this->assertTrue(false). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

18
        /** @scrutinizer ignore-call */ 
19
        expect('asdf', $this->assertTrue(false));

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
Bug introduced by
Are you sure the usage of $this->assertTrue(false) targeting PHPUnit\Framework\Assert::assertTrue() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

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

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

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

Loading history...
19
    }
20
}
21
22