/** * Remove users from business unit * * @param CustomerGroup $group * @param Customer[] $customers */ protected function removeFromGroup(CustomerGroup $group, array $customers) { foreach ($customers as $customer) { if ($customer->getGroup()->getId() === $group->getId()) { $customer->setGroup(null); $this->manager->persist($customer); } } }
/** * @param Crawler $crawler * @param string $name * @param Customer $parent * @param CustomerGroup $group */ protected function assertCustomerSave(Crawler $crawler, $name, Customer $parent, CustomerGroup $group, AbstractEnumValue $internalRating) { $form = $crawler->selectButton('Save and Close')->form(['orob2b_customer_type[name]' => $name, 'orob2b_customer_type[parent]' => $parent->getId(), 'orob2b_customer_type[group]' => $group->getId(), 'orob2b_customer_type[internal_rating]' => $internalRating->getId()]); $this->client->followRedirects(true); $crawler = $this->client->submit($form); $result = $this->client->getResponse(); $this->assertHtmlResponseStatusCodeEquals($result, 200); $html = $crawler->html(); $this->assertContains('Customer has been saved', $html); $this->assertViewPage($html, $name, $parent, $group, $internalRating); }