Passed
Push — main ( 7235e9...235833 )
by Peter
04:12
created

CardTest::testGetAsString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Card;
4
5
use PHPUnit\Framework\TestCase;
6
7
/**
8
 * Test cases for class Dice.
9
 */
10
class CardTest extends TestCase
11
{
12
    /**
13
     * Construct object and verify that the object has the expected
14
     * properties.
15
    */
16
    public function testCreateCard()
17
    {
18
        $card = new Card('Hearts', 'King');
19
        $this->assertInstanceOf(Card::class, $card);
20
        $this->assertEquals('Hearts', $card->getSuit());
21
        $this->assertEquals('King', $card->getValue());
22
    }
23
24
    /**
25
     * Test getBlackjackValue.
26
     */
27
    public function testGetBlackjackValue()
28
    {
29
        $cardSuit = new Card('Clubs', 'Jack');
30
        $cardNum = new Card('Hearts', '2');
31
        $cardAce = new Card('Diamonds', 'Ace');
32
33
        $this->assertEquals(10, $cardSuit->getBlackjackValue());
34
        $this->assertEquals(2, $cardNum->getBlackjackValue());
35
        $this->assertEquals(11, $cardAce->getBlackjackValue());
36
    }
37
38
    /**
39
     * Test getAsString.
40
     */
41
    public function testGetAsString()
42
    {
43
        $card = new Card('Hearts', 'King');
44
        $this->assertEquals('King of Hearts', $card->getAsString());
45
    }
46
}
47