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

DeckTraitTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 19.44 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 7
loc 36
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testCreateObjectPokerSquares() 0 5 1
A testTraitDeckName() 0 7 1
A testTraitDeckDeckSize() 7 7 1
A testTraitDeckReturnDeck() 0 8 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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 DeckTraitTest 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 testTraitDeckName()
24
    {
25
        $pokersquares = new PokerSquares();
26
27
        $exp = strlen($pokersquares->name());
28
        $this->assertEquals($exp, 265);
29
    }
30
31 View Code Duplication
    public function testTraitDeckDeckSize()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
32
    {
33
        $pokersquares = new PokerSquares();
34
35
        $exp = $pokersquares->deckSize(['<div class="card rank08C">8 <br/> &clubs;</div>','<div class="card rank09C">9 <br/> &clubs;</div>',]);
36
        $this->assertEquals($exp, 2);
37
    }
38
39
    public function testTraitDeckReturnDeck()
40
    {
41
        $pokersquares = new PokerSquares();
42
43
        $exp = 52;
44
        $res = count($pokersquares->returnDeck());
45
        $this->assertEquals($exp, $res);
46
    }
47
}
48