PlayerRoundTest.php
1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace FootyRoom\Tests\Unit\Predictor;
use DateTime;
use FootyRoom\Tests\TestCase;
use FootyRoom\Core\CoreException;
use FootyRoom\Core\Predictor\Player;
use FootyRoom\Core\Predictor\RoundId;
use FootyRoom\Core\Predictor\PlayerRound;
class PlayerRoundTest extends TestCase
{
protected const USER_ID = 1;
protected const USERNAME = 'user1';
protected const ROUND_ID = '2018-W43';
public function setUp()
{
$this->player = new Player(self::USER_ID, self::USERNAME);
$this->playerRound = new PlayerRound($this->player, new RoundId(new DateTime(self::ROUND_ID)));
parent::setUp();
}
public function test_it_returns_userId()
{
$this->assertEquals(self::USER_ID, $this->playerRound->getUserId());
}
public function test_it_doesnt_let_you_bet_more_than_rounds_limit()
{
$this->playerRound->bet(2000);
$this->expectException(CoreException::class);
$this->playerRound->bet(1);
}
public function test_it_records_total_bet()
{
$this->playerRound->bet(1000);
$this->assertEquals(1000, $this->playerRound->getStake());
}
public function test_it_records_locked_amount()
{
$this->playerRound->bet(1000);
$this->assertEquals(1000, $this->playerRound->getLocked());
}
}