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

CardTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
dl 0
loc 35
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetBlackjackValue() 0 9 1
A testCreateCard() 0 6 1
A testGetAsString() 0 4 1
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