Test Failed
Push — master ( ac9ff0...806846 )
by Johan
03:01
created

ScoringTestTrait::testCheckFullRow()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
// php artisan test
4
namespace Tests\Unit;
5
6
use PHPUnit\Framework\TestCase;
7
use Joki20\Http\Controllers\PokerSquares;
8
use Joki20\Http\Controllers\Scoring;
9
/**
10
 * Test cases for trait Scoring.
11
 */
12
class ScoringTestTrait extends TestCase
13
{
14
    // /**
15
    //  * Construct object and verify that the object is instance of class
16
    //  */
17
    public function testCreateObjectPokerSquares()
18
    {
19
        $pokersquares = new PokerSquares();
20
        $this->assertInstanceOf("\Joki20\Http\Controllers\PokerSquares", $pokersquares);
21
    }
22
23
    public function testCheckFullRow()
24
    {
25
        $pokersquares = new PokerSquares();
0 ignored issues
show
Unused Code introduced by
$pokersquares is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
26
27
        $this->currentSession = 234;
0 ignored issues
show
Bug introduced by
The property currentSession does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
28
        $pokerSquares->checkFullRow();
0 ignored issues
show
Bug introduced by
The variable $pokerSquares does not exist. Did you mean $pokersquares?

This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name.

The variable may have been renamed without also renaming all references.

Loading history...
29
30
        var_dump($this->suitsRow);
0 ignored issues
show
Bug introduced by
The property suitsRow does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
Security Debugging Code introduced by
var_dump($this->suitsRow); looks like debug code. Are you sure you do not want to remove it? This might expose sensitive data.
Loading history...
31
32
33
    }
34
}
35