Issues (24)

tests/Card/CardHandTest.php (1 issue)

1
<?php
2
3
namespace App\Card;
4
5
use PHPUnit\Framework\TestCase;
6
7
/**
8
 * Test cases for class Game21.
9
 */
10
class CardHandTest extends TestCase
11
{
12
    public function testCardHand(): void
13
    {
14
        $hand = new CardHand();
15
        foreach ([1,12,23,34,45] as $i) {
16
            $card = new CardGraphic();
17
            $res = $card->set($i);
0 ignored issues
show
The assignment to $res is dead and can be removed.
Loading history...
18
            $hand->add($card);
19
        }
20
        //        $this->assertInstanceOf("\App\Card\CardHand", $hand);
21
        $res = $hand->getNumberCards();
22
        $exp = 5;
23
        $this->assertEquals($exp, $res);
24
25
        $res = $hand->getValues();
26
        $exp = [1, 12, 23, 34, 45];
27
        $this->assertEquals($exp, $res);
28
29
        $res = $hand->getString();
30
        $exp = ['2♠', 'K♠','J♥','9♦','7♣'];
31
        $this->assertEquals($exp, $res);
32
    }
33
34
    public function testCardGraphic(): void
35
    {
36
        $card = new CardGraphic();
37
        //        $this->assertInstanceOf("\App\Card\CardGraphic", $card);
38
39
        $res = $card->getValue();
40
        $exp = null;
41
        $this->assertEquals($exp, $res);
42
43
        $res = $card->set(10);
44
        $exp = 10;
45
        $this->assertEquals($exp, $res);
46
47
        $res = $card->getAsString();
48
        $exp = 'J♠';
49
        $this->assertEquals($exp, $res);
50
    }
51
52
}
53