public function testGiroAccountTransaction() { $a = new \OOP\GiroAccount(); $a->setCredit(2000); $a->deposit(220); $a->withdraw(1500); $this->assertEquals(-1280, $a->getAccountBalance()); $this->assertEquals(false, $a->withdraw(1500)); }
<?php require __DIR__ . '/vendor/autoload.php'; /** * Create Account */ $myAccount = new OOP\Account(); $balance = $myAccount->getAccountBalance(); echo "Balance: " . $balance . "\n"; $myAccount->deposit(300); if ($myAccount->withdraw(100)) { echo 'Abgehoben'; } echo "Balance: " . $balance . "\n"; /** * Create Giro Account */ $myGiroAccount = new OOP\GiroAccount(); $myGiroAccount->setCredit(2000); $myGiroAccount->withdraw(5000); echo $myGiroAccount->getAccountBalance();