-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBankAccountTest.php
50 lines (40 loc) · 1.12 KB
/
BankAccountTest.php
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
50
<?php
class BankAccountTest extends PHPUnit_Framework_Festcase
{
/** @test */
function get_balance()
{
$account = new BankAccount;
$balance = $account->getBalance();
$this->assertEquals(0, $balance);
}
/** @test */
function it_can_initialize_the_balance_via_constructor()
{
$account = new BankAccount(100);
$balance = $account->getBalance();
$this->assertEquals(100, $balance);
}
/** @test */
function it_can_make_a_deposit_to_the_account()
{
$account = new BankAccount(100);
$account->deposit(50);
$balance = $account->getBalance();
$this->assertEquals(150, $balance);
}
/** @test */
function it_can_perform_a_withdrawal()
{
$account = new BankAccount(100);
$account->withdrawal(25);
$this->assertEquals(75, $balance);
}
/** @test */
function withdraw_more_than_the_available_throws_an_exception()
{
$this->expectException(InsuficientBalanceException::class);
$account = new BankAccount(100);
$account->withdrawal(200);
}
}