You are here

public function BankAccountWithCustomExtensionTest::testBalanceCannotBecomeNegative2 in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/phpunit/phpunit/tests/_files/BankAccountTest.test.php \BankAccountWithCustomExtensionTest::testBalanceCannotBecomeNegative2()

@covers BankAccount::depositMoney @group balanceCannotBecomeNegative @group specification

File

vendor/phpunit/phpunit/tests/_files/BankAccountTest.test.php, line 58

Class

BankAccountWithCustomExtensionTest
Tests for the BankAccount class.

Code

public function testBalanceCannotBecomeNegative2() {
  try {
    $this->ba
      ->depositMoney(-1);
  } catch (BankAccountException $e) {
    $this
      ->assertEquals(0, $this->ba
      ->getBalance());
    return;
  }
  $this
    ->fail();
}