コード例 #1
0
 /**
  * @covers FireflyIII\Repositories\Account\AccountRepository::destroy
  * @covers FireflyIII\Providers\EventServiceProvider::boot
  * @covers FireflyIII\Providers\EventServiceProvider::registerDeleteEvents
  */
 public function testDestroy()
 {
     // create account:
     $account = FactoryMuffin::create('FireflyIII\\Models\\Account');
     // create some transactions and attach them to the account:
     for ($i = 0; $i < 5; $i++) {
         $transaction = FactoryMuffin::create('FireflyIII\\Models\\Transaction');
         $transaction->account_id = $account->id;
         $transaction->save();
     }
     $accountId = $account->id;
     $this->be($account->user);
     $this->object->destroy($account);
     // cannot find account:
     $this->assertCount(0, Account::whereId($accountId)->whereNotNull('deleted_at')->get());
 }