/** * Assigns an Account to a Party * * @param Account $account * @param AbstractParty $party * @return void */ public function assignAccountToParty(Account $account, AbstractParty $party) { if ($party->getAccounts()->contains($account)) { return; } $party->addAccount($account); $accountIdentifier = $this->persistenceManager->getIdentifierByObject($account); $this->accountsInPartyRuntimeCache[$accountIdentifier] = $party; }
/** * @test */ public function getAccountsReturnsAccounts() { $this->assertSame($this->mockAccounts, $this->abstractParty->getAccounts()); }
/** * @test */ public function assignAccountToPartyAddsAccount() { $this->partyService->assignAccountToParty($this->account, $this->party); $this->assertContains($this->account, $this->party->getAccounts()); }