/**
  * Mass assign customer group
  *
  * @param Customer $customer
  * @param CustomerGroupInjectable $customerGroup
  * @return void
  */
 public function test(Customer $customer, CustomerGroupInjectable $customerGroup)
 {
     // Steps
     $customerGroup->persist();
     $this->customerIndex->open();
     $this->customerIndex->getCustomerGridBlock()->massaction([['email' => $customer->getEmail()]], [$this->customersGridActions => $customerGroup->getCustomerGroupCode()]);
 }
 /**
  * Assert that customer group form equals to fixture data
  *
  * @param CustomerGroupIndex $customerGroupIndex
  * @param CustomerGroupNew $customerGroupNew
  * @param CustomerGroupInjectable $customerGroup
  * @param CustomerGroupInjectable $customerGroupOriginal
  * @return void
  */
 public function processAssert(CustomerGroupIndex $customerGroupIndex, CustomerGroupNew $customerGroupNew, CustomerGroupInjectable $customerGroup, CustomerGroupInjectable $customerGroupOriginal = null)
 {
     $data = $customerGroupOriginal !== null ? array_merge($customerGroupOriginal->getData(), $customerGroup->getData()) : $customerGroup->getData();
     $filter = ['code' => $data['customer_group_code']];
     $customerGroupIndex->open();
     $customerGroupIndex->getCustomerGroupGrid()->searchAndOpen($filter);
     $formData = $customerGroupNew->getPageMainForm()->getData();
     $dataDiff = $this->verifyForm($formData, $data);
     \PHPUnit_Framework_Assert::assertTrue(empty($dataDiff), 'Customer Group form was filled incorrectly.' . "\nLog:\n" . implode(";\n", $dataDiff));
 }
 /**
  * Delete Customer Group
  *
  * @param CustomerGroupInjectable $customerGroup
  * @return void
  */
 public function test(CustomerGroupInjectable $customerGroup)
 {
     // Precondition
     $customerGroup->persist();
     // Steps
     $filter = ['code' => $customerGroup->getCustomerGroupCode()];
     $this->customerGroupIndex->open();
     $this->customerGroupIndex->getCustomerGroupGrid()->searchAndOpen($filter);
     $this->customerGroupNew->getPageMainActions()->delete();
 }
 /**
  * Update Customer Group
  *
  * @param CustomerGroupInjectable $customerGroupOriginal
  * @param CustomerGroupInjectable $customerGroup
  * @return void
  */
 public function test(CustomerGroupInjectable $customerGroupOriginal, CustomerGroupInjectable $customerGroup)
 {
     // Precondition
     $customerGroupOriginal->persist();
     $filter = ['code' => $customerGroupOriginal->getCustomerGroupCode()];
     // Steps
     $this->customerGroupIndex->open();
     $this->customerGroupIndex->getCustomerGroupGrid()->searchAndOpen($filter);
     $this->customerGroupNew->getPageMainForm()->fill($customerGroup);
     $this->customerGroupNew->getPageMainActions()->save();
 }
 /**
  * Assert that customer group find on account information page
  *
  * @param FixtureFactory $fixtureFactory
  * @param CustomerGroupInjectable $customerGroup
  * @param CustomerIndexNew $customerIndexNew
  * @param CustomerIndex $customerIndex
  * @return void
  */
 public function processAssert(FixtureFactory $fixtureFactory, CustomerGroupInjectable $customerGroup, CustomerIndexNew $customerIndexNew, CustomerIndex $customerIndex)
 {
     /** @var CustomerInjectable $customer */
     $customer = $fixtureFactory->createByCode('customerInjectable', ['dataSet' => 'defaultBackend', 'data' => ['group_id' => ['customerGroup' => $customerGroup]]]);
     $filter = ['email' => $customer->getEmail()];
     $customerIndexNew->open();
     $customerIndexNew->getCustomerForm()->fillCustomer($customer);
     $customerIndexNew->getPageActionsBlock()->save();
     $customerIndex->getCustomerGridBlock()->searchAndOpen($filter);
     $customerFormData = $customerIndexNew->getCustomerForm()->getData($customer);
     $customerFixtureData = $customer->getData();
     $diff = array_diff($customerFixtureData, $customerFormData);
     \PHPUnit_Framework_Assert::assertTrue(empty($diff), "Customer group {$customerGroup->getCustomerGroupCode()} not in customer form.");
 }
 /**
  * Assert that customer group not in grid
  *
  * @param CustomerGroupInjectable $customerGroup
  * @param CustomerGroupIndex $customerGroupIndex
  * @return void
  */
 public function processAssert(CustomerGroupInjectable $customerGroup, CustomerGroupIndex $customerGroupIndex)
 {
     $customerGroupIndex->open();
     $filter = ['code' => $customerGroup->getCustomerGroupCode()];
     \PHPUnit_Framework_Assert::assertFalse($customerGroupIndex->getCustomerGroupGrid()->isRowVisible($filter), 'Group with name \'' . $customerGroup->getCustomerGroupCode() . '\' in customer groups grid.');
 }