add myCalendar into
[awl.git] / vendor / phpunit / php-code-coverage / Tests / _files / BankAccountTest.php
blob827cd2452021f605acfd60d1e80b2a87b49b37bc
1 <?php
2 require_once 'BankAccount.php';
4 class BankAccountTest extends PHPUnit_Framework_TestCase
6 protected $ba;
8 protected function setUp()
10 $this->ba = new BankAccount;
13 /**
14 * @covers BankAccount::getBalance
16 public function testBalanceIsInitiallyZero()
18 $this->assertEquals(0, $this->ba->getBalance());
21 /**
22 * @covers BankAccount::withdrawMoney
24 public function testBalanceCannotBecomeNegative()
26 try {
27 $this->ba->withdrawMoney(1);
30 catch (RuntimeException $e) {
31 $this->assertEquals(0, $this->ba->getBalance());
33 return;
36 $this->fail();
39 /**
40 * @covers BankAccount::depositMoney
42 public function testBalanceCannotBecomeNegative2()
44 try {
45 $this->ba->depositMoney(-1);
48 catch (RuntimeException $e) {
49 $this->assertEquals(0, $this->ba->getBalance());
51 return;
54 $this->fail();
57 /**
58 * @covers BankAccount::getBalance
59 * @covers BankAccount::depositMoney
60 * @covers BankAccount::withdrawMoney
62 public function testDepositWithdrawMoney()
64 $this->assertEquals(0, $this->ba->getBalance());
65 $this->ba->depositMoney(1);
66 $this->assertEquals(1, $this->ba->getBalance());
67 $this->ba->withdrawMoney(1);
68 $this->assertEquals(0, $this->ba->getBalance());