/** * Mass assign customer group * * @param Customer $customer * @param CustomerGroup $customerGroup * @return void */ public function test(Customer $customer, CustomerGroup $customerGroup) { // Steps $customerGroup->persist(); $this->customerIndex->open(); $this->customerIndex->getCustomerGridBlock()->massaction([['email' => $customer->getEmail()]], [$this->customersGridActions => $customerGroup->getCustomerGroupCode()]); }
/** * 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); }
/** * Assert that customer group form equals to fixture data * * @param CustomerGroupIndex $customerGroupIndex * @param CustomerGroupNew $customerGroupNew * @param CustomerGroup $customerGroup * @param CustomerGroup $customerGroupOriginal * @return void */ public function processAssert(CustomerGroupIndex $customerGroupIndex, CustomerGroupNew $customerGroupNew, CustomerGroup $customerGroup, CustomerGroup $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 CustomerGroup $customerGroup * @return void */ public function test(CustomerGroup $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 CustomerGroup $customerGroupOriginal * @param CustomerGroup $customerGroup * @return void */ public function test(CustomerGroup $customerGroupOriginal, CustomerGroup $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 CustomerGroup $customerGroup * @param CustomerIndexNew $customerIndexNew * @param CustomerIndex $customerIndex * @return void */ public function processAssert(FixtureFactory $fixtureFactory, CustomerGroup $customerGroup, CustomerIndexNew $customerIndexNew, CustomerIndex $customerIndex) { /** @var Customer $customer */ $customer = $fixtureFactory->createByCode('customer', ['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 account information page."); }
/** * Check whether Customer Group is visible. * * @param CustomerGroup $customerGroup * @return bool */ public function isVisibleCustomerGroup(CustomerGroup $customerGroup) { $this->_rootElement->find($this->buttonFormLocator)->click(); $options = $this->_rootElement->find($this->customerGroup, Locator::SELECTOR_XPATH)->getText(); return false !== strpos($options, $customerGroup->getCustomerGroupCode()); }
/** * Assert that customer group not in grid * * @param CustomerGroup $customerGroup * @param CustomerGroupIndex $customerGroupIndex * @return void */ public function processAssert(CustomerGroup $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.'); }
/** * Check whether Customer Group is visible. * * @param CustomerGroup $customerGroup * @return bool */ public function isVisibleCustomerGroup(CustomerGroup $customerGroup) { $options = $this->_rootElement->find($this->customerGroup)->getText(); return false !== strpos($options, $customerGroup->getCustomerGroupCode()); }
/** * Assert that customer group is set to default on customer form. * * @param Customer $customer * @param CustomerGroup $defaultCustomerGroup * @param CustomerIndexNew $customerIndexNew * @param CustomerIndexNew $customerIndexEdit * @return void */ public function processAssert(Customer $customer, CustomerGroup $defaultCustomerGroup, CustomerIndexNew $customerIndexNew, CustomerIndexNew $customerIndexEdit) { $customerIndexEdit->open(['id' => $customer->getId()]); $customerFormData = $customerIndexNew->getCustomerForm()->getData(); \PHPUnit_Framework_Assert::assertTrue($customerFormData['group_id'] == $defaultCustomerGroup->getCustomerGroupCode(), "Customer group not set to default after group was deleted."); }