public function testProcessValidData() { /** @var Account $appendedAccount */ $appendedAccount = $this->getEntity('OroB2B\\Bundle\\AccountBundle\\Entity\\Account', 1); /** @var Account $removedAccount */ $removedAccount = $this->getEntity('OroB2B\\Bundle\\AccountBundle\\Entity\\Account', 2); $this->entity->addAccount($removedAccount); /** @var AccountGroup $appendedAccountGroup */ $appendedAccountGroup = $this->getEntity('OroB2B\\Bundle\\AccountBundle\\Entity\\AccountGroup', 1); /** @var AccountGroup $removedAccountGroup */ $removedAccountGroup = $this->getEntity('OroB2B\\Bundle\\AccountBundle\\Entity\\AccountGroup', 2); $this->entity->addAccountGroup($removedAccountGroup); /** @var Website $appendedWebsite */ $appendedWebsite = $this->getEntity('OroB2B\\Bundle\\WebsiteBundle\\Entity\\Website', 1); /** @var Website $removedWebsite */ $removedWebsite = $this->getEntity('OroB2B\\Bundle\\WebsiteBundle\\Entity\\Website', 2); $this->entity->addWebsite($removedWebsite); $this->form->expects($this->atLeastOnce())->method('get')->willReturnMap([['appendAccounts', $this->getFormForEntity($appendedAccount)], ['removeAccounts', $this->getFormForEntity($removedAccount)], ['appendAccountGroups', $this->getFormForEntity($appendedAccountGroup)], ['removeAccountGroups', $this->getFormForEntity($removedAccountGroup)], ['appendWebsites', $this->getFormForEntity($appendedWebsite)], ['removeWebsites', $this->getFormForEntity($removedWebsite)]]); $this->prepareServices(); $this->assertTrue($this->handler->process($this->entity)); $this->assertFalse($this->entity->getAccounts()->contains($removedAccount)); $this->assertFalse($this->entity->getAccountGroups()->contains($removedAccountGroup)); $this->assertFalse($this->entity->getWebsites()->contains($removedWebsite)); $this->assertTrue($this->entity->getAccounts()->contains($appendedAccount)); $this->assertTrue($this->entity->getAccountGroups()->contains($appendedAccountGroup)); $this->assertTrue($this->entity->getWebsites()->contains($appendedWebsite)); }