/** * Assert that custom system variable not in cms page form. * * @param CmsPageNew $cmsPageNew * @param SystemVariable $systemVariable * @return void */ public function processAssert(CmsPageNew $cmsPageNew, SystemVariable $systemVariable) { $customVariableName = $systemVariable->getName(); $cmsPageNew->open(); $cmsPageForm = $cmsPageNew->getPageForm(); $variables = $cmsPageForm->getSystemVariables(); \PHPUnit_Framework_Assert::assertFalse(in_array($customVariableName, $variables), 'Custom System Variable "' . $customVariableName . '" is present in Cms Page Form.'); }
/** * Delete Custom System Variable Entity test. * * @param SystemVariable $systemVariable * @return void */ public function test(SystemVariable $systemVariable) { // Precondition $systemVariable->persist(); // Steps $filter = ['code' => $systemVariable->getCode(), 'name' => $systemVariable->getName()]; $this->systemVariableIndexPage->open(); $this->systemVariableIndexPage->getSystemVariableGrid()->searchAndOpen($filter); $this->systemVariableNewPage->getFormPageActions()->delete(); }
/** * Get html value. * * @param SystemVariable $customVariable * @param SystemVariable $customVariableOrigin * @return string */ protected function getHtmlValue(SystemVariable $customVariable, SystemVariable $customVariableOrigin) { $data = array_merge($customVariableOrigin->getData(), $customVariable->getData()); if ($customVariable->getHtmlValue() == "" && $customVariableOrigin->getHtmlValue() == "") { $htmlValue = $data['plain_value'] == "" ? $customVariableOrigin->getPlainValue() : $data['plain_value']; } else { $htmlValue = $customVariableOrigin == null ? $customVariable->getHtmlValue() : $customVariableOrigin->getHtmlValue(); $htmlValue = strip_tags($htmlValue); } return $htmlValue; }
/** * Update Custom System Variable Entity test. * * @param FixtureFactory $fixtureFactory * @param SystemVariable $customVariable * @param SystemVariable $customVariableOrigin * @param string $saveAction * @return array */ public function test(FixtureFactory $fixtureFactory, SystemVariable $customVariable, SystemVariable $customVariableOrigin, $saveAction) { $this->store = $fixtureFactory->createByCode('store', ['dataset' => 'custom']); $this->store->persist(); $customVariableOrigin->persist(); $filter = ['code' => $customVariableOrigin->getCode()]; // Steps $this->systemVariableIndexPage->open(); $this->systemVariableIndexPage->getSystemVariableGrid()->searchAndOpen($filter); $this->systemVariableNewPage->getFormPageActions()->selectStoreView($this->store->getData('name')); $this->systemVariableNewPage->getSystemVariableForm()->fill($customVariable); $this->systemVariableNewPage->getFormPageActions()->{$saveAction}(); return ['storeOrigin' => $this->store, 'customVariableOrigin' => $customVariableOrigin]; }
/** * Assert that data at the form corresponds to the fixture data. * * @param SystemVariable $customVariable * @param SystemVariableIndex $systemVariableIndex * @param SystemVariableNew $systemVariableNew * @param Store $storeOrigin * @param SystemVariable $customVariableOrigin * @return void * * @SuppressWarnings(PHPMD.NPathComplexity) */ public function processAssert(SystemVariable $customVariable, SystemVariableIndex $systemVariableIndex, SystemVariableNew $systemVariableNew, Store $storeOrigin = null, SystemVariable $customVariableOrigin = null) { // Prepare data $data = $customVariableOrigin === null ? $customVariable->getData() : array_merge($customVariableOrigin->getData(), $customVariable->getData()); if ($customVariableOrigin !== null) { $dataOrigin = $this->arrayCopy($data); $dataOrigin['html_value'] = $customVariableOrigin->getHtmlValue(); $dataOrigin['plain_value'] = $customVariableOrigin->getPlainValue(); } else { $dataOrigin = $this->arrayCopy($data); } if ($data['html_value'] == '') { $data['html_value'] = $customVariableOrigin->getHtmlValue(); $data['use_default_value'] = 'Yes'; } $data['plain_value'] = $data['plain_value'] == '' ? $customVariableOrigin->getPlainValue() : $data['plain_value']; // Perform assert $systemVariableIndex->open(); $systemVariableIndex->getSystemVariableGrid()->searchAndOpen(['code' => $data['code']]); $formData = $systemVariableNew->getSystemVariableForm()->getData(); $errors = $this->verifyData($dataOrigin, $formData); \PHPUnit_Framework_Assert::assertEmpty($errors, $errors); if ($storeOrigin !== null) { $systemVariableNew->getFormPageActions()->selectStoreView($storeOrigin->getName()); $formData = $systemVariableNew->getSystemVariableForm()->getData(); $errors = $this->verifyData($data, $formData); \PHPUnit_Framework_Assert::assertEmpty($errors, $errors); } }
/** * Update Custom System Variable Entity test. * * @param SystemVariable $customVariable * @param SystemVariable $customVariableOrigin * @param Store $storeOrigin * @param string $saveAction * @return void */ public function test(SystemVariable $customVariable, SystemVariable $customVariableOrigin, Store $storeOrigin, $saveAction) { $filter = ['code' => $customVariableOrigin->getCode()]; // Steps $this->systemVariableIndexPage->open(); $this->systemVariableIndexPage->getSystemVariableGrid()->searchAndOpen($filter); $this->systemVariableNewPage->getFormPageActions()->selectStoreView($storeOrigin->getData('name')); $this->systemVariableNewPage->getSystemVariableForm()->fill($customVariable); $this->systemVariableNewPage->getFormPageActions()->{$saveAction}(); }
/** * Assert Custom System Variable not available in System Variable grid * * @param SystemVariableIndex $systemVariableIndexNew * @param SystemVariable $systemVariable * @return void */ public function processAssert(SystemVariableIndex $systemVariableIndexNew, SystemVariable $systemVariable) { $filter = ['code' => $systemVariable->getCode(), 'name' => $systemVariable->getName()]; $systemVariableIndexNew->open(); \PHPUnit_Framework_Assert::assertFalse($systemVariableIndexNew->getSystemVariableGrid()->isRowVisible($filter), 'Custom System Variable with code \'' . $filter['code'] . '\' is present in System Variable grid.'); }