public function BankAccountTest::testBalanceCannotBecomeNegative

Same name in this branch
  1. 8.x drupal/core/vendor/phpunit/php-code-coverage/Tests/_files/BankAccountTest.php \BankAccountTest::testBalanceCannotBecomeNegative()
  2. 8.x drupal/core/vendor/phpunit/phpunit/Tests/_files/BankAccountTest.php \BankAccountTest::testBalanceCannotBecomeNegative()

@covers BankAccount::withdrawMoney @group balanceCannotBecomeNegative @group specification

File

drupal/core/vendor/phpunit/phpunit/Tests/_files/BankAccountTest.php, line 82

Class

BankAccountTest
Tests for the BankAccount class.

Code

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