/**
  * @param ObjectManager $manager
  * @param string $name
  * @return CustomerGroup
  */
 protected function createGroup(ObjectManager $manager, $name)
 {
     $group = new CustomerGroup();
     $group->setName($name);
     $manager->persist($group);
     $this->addReference($name, $group);
     return $group;
 }
 /**
  * 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);
         }
     }
 }
 /**
  * @return array
  */
 public function submitDataProvider()
 {
     $groupName = 'customer_group_name';
     $alteredGroupName = 'altered_group_name';
     $defaultGroup = new CustomerGroup();
     $defaultGroup->setName($groupName);
     /** @var CustomerGroup $existingGroupBefore */
     $existingGroupBefore = $this->getEntity(self::DATA_CLASS, 1);
     $existingGroupBefore->setName($groupName);
     $existingGroupAfter = clone $existingGroupBefore;
     $existingGroupAfter->setName($alteredGroupName);
     return ['empty' => ['options' => [], 'defaultData' => null, 'viewData' => null, 'submittedData' => ['name' => $groupName], 'expectedData' => $defaultGroup], 'existing' => ['options' => [], 'defaultData' => $existingGroupBefore, 'viewData' => $existingGroupBefore, 'submittedData' => ['name' => $alteredGroupName], 'expectedData' => $existingGroupAfter]];
 }
 /**
  * @param string $name
  * @return CustomerGroup
  */
 protected function createCustomerGroup($name)
 {
     $customerGroup = new CustomerGroup();
     $customerGroup->setName($name);
     return $customerGroup;
 }
 /**
  * @param string $html
  * @param string $name
  * @param Customer $parent
  * @param CustomerGroup $group
  */
 protected function assertViewPage($html, $name, Customer $parent, CustomerGroup $group, AbstractEnumValue $internalRating)
 {
     $this->assertContains($name, $html);
     $this->assertContains($parent->getName(), $html);
     $this->assertContains($group->getName(), $html);
     $this->assertContains($internalRating->getName(), $html);
 }