/** * 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(); }
/** * 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 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)); }