CardHandTest::testGetCardCount()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace App\Card;
4
5
use PHPUnit\Framework\TestCase;
6
7
/**
8
 * Test cases for class CardHand.
9
 */
10
class CardHandTest extends TestCase
11
{
12
    private CardHand $hand;
13
14
    /**
15
     * Setup method creates the input values needed to test CardHand-methods.
16
     */
17
    protected function setUp(): void
18
    {
19
        $values = [["S", "J"], ["D", "A"], ["C", "Q"], ["H", "K"]];
20
        $this->hand = new CardHand();
21
22
        foreach ($values as $value) {
23
            $card = new Card($value);
24
            $this->hand->add($card);
25
        }
26
    }
27
28
    /**
29
     * Construct object without input arguments and verify that the object has the expected
30
     * properties.
31
     */
32
    public function testCreateCardHand(): void
33
    {
34
        $values = [["S", "J"], ["D", "A"], ["C", "Q"], ["H", "K"]];
35
        $res = $this->hand->getValues();
36
        $this->assertEquals($values, $res);
37
    }
38
39
    /**
40
     * Test number of cards, compared with cards used in setup-section.
41
     */
42
    public function testGetCardCount(): void
43
    {
44
        $res = $this->hand->getNumberCards();
45
        $this->assertEquals(4, $res);
46
    }
47
}
48