/** * Check unavailable field in Customer Group. * * @param CustomerGroup $customerGroup * @return void */ public function test(CustomerGroup $customerGroup) { $filter = ['code' => $customerGroup->getCustomerGroupCode()]; // Steps $this->customerGroupIndex->open(); $this->customerGroupIndex->getCustomerGroupGrid()->searchAndOpen($filter); }
/** * Create customer group * * @param CustomerGroup $customerGroup */ public function testCreateCustomerGroup(CustomerGroup $customerGroup) { //Steps $this->customerGroupIndex->open(); $this->customerGroupIndex->getGridPageActions()->addNew(); $this->customerGroupNew->getPageMainForm()->fill($customerGroup); $this->customerGroupNew->getPageMainActions()->save(); }
/** * 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(); }
/** * Delete Customer Group. * * @param CustomerGroup $customerGroup * @param Customer $customer [optional] * @return array */ public function test(CustomerGroup $customerGroup, Customer $customer = null) { // Precondition if ($customer !== null) { $customer->persist(); $customerGroup = $customer->getDataFieldConfig('group_id')['source']->getCustomerGroup(); } else { $customerGroup->persist(); } // Steps $filter = ['code' => $customerGroup->getCustomerGroupCode()]; $this->customerGroupIndex->open(); $this->customerGroupIndex->getCustomerGroupGrid()->searchAndOpen($filter); $this->customerGroupNew->getPageMainActions()->delete(); $this->customerGroupNew->getModalBlock()->acceptAlert(); return ['customer' => $customer, 'customerGroup' => $customerGroup]; }
/** * 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)); }
/** * 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.'); }