for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Tests\Game\BlackJack;
use App\Cards\Card;
use App\Game\BlackJack\Player;
use PHPUnit\Framework\TestCase;
/**
* Test cases for class Player.
*/
class PlayerTest extends TestCase
{
* testCreateObject
*
* Construct object and verify that the object has the expected
* properties, use no arguments.
* @return void
public function testCreateObject(): void
$player = new Player();
$this->assertInstanceOf(Player::class, $player);
}
* testBooleans
* Test the boolean values
public function testBooleans(): void
$card = new Card('K', 'Spades');
$player->addCard($card);
$bust = $player->isBust();
$this->assertFalse($bust);
$this->assertTrue($bust);
* testGet
* Test the get function
public function testGet(): void
$handValue = $player->getHandValue();
$this->assertEquals(20, $handValue);