function it_handles_create_account_command(AccountingInterface $accounting) { $accounting->addAccount(Argument::type(Account::class))->shouldBeCalled(); $accounting->commit()->shouldBeCalled(); $command = new OpenAccountCommand('123ABC'); $this->beConstructedWith($accounting); $this->handle($command); }
function it_handles_deposit_command(AccountingInterface $accounting, Account $account) { $account->deposit(Argument::type(Deposit::class))->shouldBeCalled(); $accounting->getAccount(Argument::type(AccountNumber::class))->willReturn($account); $accounting->commit()->shouldBeCalled(); $command = new DepositCommand('123ABC', 100); $this->beConstructedWith($accounting); $this->handle($command); }
function it_handles_transfer_withdraw_command(AccountingInterface $accounting, Account $account) { $account->withdraw(Argument::type(Withdraw::class))->shouldBeCalled(); $accounting->getAccount(Argument::type(AccountNumber::class))->willReturn($account); $accounting->commit()->shouldBeCalled(); $command = new TransferWithdrawCommand('123ABC', 100, Transaction::fromString('000')); $this->beConstructedWith($accounting); $this->handle($command); }