/** * 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 getAssignedPartyOfAccountCachesParty() { $this->mockPersistenceManager->expects($this->any())->method('getIdentifierByObject')->will($this->returnValue('723e3913-f803-42c8-a44c-fd7115f555c3')); $this->mockPartyRepository->expects($this->once())->method('findOneHavingAccount')->with($this->account)->will($this->returnValue($this->party)); $this->party->addAccount($this->account); $assignedParty = $this->partyService->getAssignedPartyOfAccount($this->account); $this->assertSame($this->party, $assignedParty); $assignedParty = $this->partyService->getAssignedPartyOfAccount($this->account); $this->assertSame($this->party, $assignedParty); }
/** * @test */ public function getAccountsReturnsAccounts() { $this->assertSame($this->mockAccounts, $this->abstractParty->getAccounts()); }
/** * Constructs this Person * */ public function __construct() { parent::__construct(); $this->electronicAddresses = new ArrayCollection(); }