public function testProcessValidData() { /** @var Customer $appendedCustomer */ $appendedCustomer = $this->getEntity('OroB2B\\Bundle\\CustomerBundle\\Entity\\Customer', 1); /** @var Customer $removedCustomer */ $removedCustomer = $this->getEntity('OroB2B\\Bundle\\CustomerBundle\\Entity\\Customer', 2); $this->entity->addCustomer($removedCustomer); /** @var CustomerGroup $appendedCustomerGroup */ $appendedCustomerGroup = $this->getEntity('OroB2B\\Bundle\\CustomerBundle\\Entity\\CustomerGroup', 1); /** @var CustomerGroup $removedCustomerGroup */ $removedCustomerGroup = $this->getEntity('OroB2B\\Bundle\\CustomerBundle\\Entity\\CustomerGroup', 2); $this->entity->addCustomerGroup($removedCustomerGroup); /** @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([['appendCustomers', $this->getFormForEntity($appendedCustomer)], ['removeCustomers', $this->getFormForEntity($removedCustomer)], ['appendCustomerGroups', $this->getFormForEntity($appendedCustomerGroup)], ['removeCustomerGroups', $this->getFormForEntity($removedCustomerGroup)], ['appendWebsites', $this->getFormForEntity($appendedWebsite)], ['removeWebsites', $this->getFormForEntity($removedWebsite)]]); $this->prepareServices(); $this->assertTrue($this->handler->process($this->entity)); $this->assertFalse($this->entity->getCustomers()->contains($removedCustomer)); $this->assertFalse($this->entity->getCustomerGroups()->contains($removedCustomerGroup)); $this->assertFalse($this->entity->getWebsites()->contains($removedWebsite)); $this->assertTrue($this->entity->getCustomers()->contains($appendedCustomer)); $this->assertTrue($this->entity->getCustomerGroups()->contains($appendedCustomerGroup)); $this->assertTrue($this->entity->getWebsites()->contains($appendedWebsite)); }