Passed
Push — master ( 687bd4...e86274 )
by Johan
03:49
created

PokerSquaresCreateObjectTest::testTraitSetupName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
ccs 5
cts 5
cp 1
cc 1
nc 1
nop 0
crap 1
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\Setup;
9
/**
10
 * Test cases for class Guess.
11
 */
12
class PokerSquaresCreateObjectTest extends TestCase
13
{
14
    // /**
15
    //  * Construct object and verify that the object is instance of class
16
    //  */
17 1
    public function testCreateObjectPokerSquares()
18
    {
19 1
        $pokersquares = new PokerSquares();
20 1
        $this->assertInstanceOf("\Joki20\Http\Controllers\PokerSquares", $pokersquares);
21 1
    }
22
23
    // /**
24
    //  * Test empty $_POST array
25
    //  */
26 1
    public function testEmptyPost()
27
    {
28 1
        $pokersquares = new PokerSquares();
29 1
        $this->assertInstanceOf("\Joki20\Http\Controllers\PokerSquares", $pokersquares);
30
31 1
        $exp = $pokersquares->game();
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $exp is correct as $pokersquares->game() (which targets Joki20\Http\Controllers\PokerSquares::game()) 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...
32 1
        $this->assertEquals($exp, null);
33 1
    }
34
35 1
    public function testTraitDeckName()
36
    {
37 1
        $pokersquares = new PokerSquares();
38
39 1
        $exp = strlen($pokersquares->name());
40 1
        $this->assertEquals($exp, 265);
41 1
    }
42
43 1
    public function testTraitDeckDeckSize()
44
    {
45 1
        $pokersquares = new PokerSquares();
46
47 1
        $exp = $pokersquares->deckSize(['<div class="card rank08C">8 <br/> &clubs;</div>','<div class="card rank09C">9 <br/> &clubs;</div>',]);
48 1
        $this->assertEquals($exp, 2);
49 1
    }
50
51 1
    public function testTraitDeckReturnDeck()
52
    {
53 1
        $pokersquares = new PokerSquares();
54
55 1
        $exp = count($pokersquares->returnDeck());
56 1
        $deck = 52;
0 ignored issues
show
Unused Code introduced by
$deck 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...
57 1
        $this->assertEquals($exp, 52);
58 1
    }
59
60 1
    public function testTraitSetupName()
61
    {
62 1
        $pokersquares = new PokerSquares();
63
64 1
        $exp = strlen($pokersquares->name());
65 1
        $this->assertEquals($exp, 265);
66 1
    }
67
68
    // public function testTraitSetupShuffleDeck()
69
    // {
70
    //     $pokersquares = new PokerSquares();
71
    //
72
    //     $pokersquares->shuffleDeck();
73
74
        // $exp = 52;
75
        // $res = count(session('deck'));
76
        //
77
        // $this->assertEquals($exp, 52);
78
    //
79
    // }
80
81
}
82