/**
  * Assert that product attribute can be used on promo rules conditions.
  *
  * @param CatalogRuleIndex $catalogRuleIndex
  * @param CatalogRuleNew $catalogRuleNew
  * @param CatalogProductAttribute $attribute
  * @return void
  */
 public function processAssert(CatalogRuleIndex $catalogRuleIndex, CatalogRuleNew $catalogRuleNew, CatalogProductAttribute $attribute)
 {
     $catalogRuleIndex->open();
     $catalogRuleIndex->getGridPageActions()->addNew();
     $catalogRuleNew->getEditForm()->openTab('conditions');
     \PHPUnit_Framework_Assert::assertTrue($catalogRuleNew->getEditForm()->isAttributeInConditions($attribute->getFrontendLabel()), 'Product attribute can\'t be used on promo rules conditions.');
 }
 /**
  * Delete Catalog Rule on backend
  *
  * @return array
  */
 public function run()
 {
     $this->catalogRuleIndex->open();
     while ($this->catalogRuleIndex->getCatalogRuleGrid()->isFirstRowVisible()) {
         $this->catalogRuleIndex->getCatalogRuleGrid()->openFirstRow();
         $this->catalogRuleNew->getFormPageActions()->delete();
     }
 }
 /**
  * Assert that customer group is not on catalog price rule page.
  *
  * @param CatalogRuleNew $catalogRuleNew
  * @param CustomerGroup $customerGroup
  * @return void
  */
 public function processAssert(CatalogRuleNew $catalogRuleNew, CustomerGroup $customerGroup)
 {
     $catalogRuleNew->open();
     $catalogRuleNew->getEditForm()->openSection('rule_information');
     /** @var RuleInformation $ruleInformationSection */
     $ruleInformationSection = $catalogRuleNew->getEditForm()->getSection('rule_information');
     \PHPUnit_Framework_Assert::assertFalse($ruleInformationSection->isVisibleCustomerGroup($customerGroup), "Customer group {$customerGroup->getCustomerGroupCode()} is still in catalog price rule page.");
 }
 /**
  * Assert that product attribute can be used on promo rules conditions.
  *
  * @param CatalogRuleIndex $catalogRuleIndex
  * @param CatalogRuleNew $catalogRuleNew
  * @param CatalogProductAttribute $attribute
  * @return void
  */
 public function processAssert(CatalogRuleIndex $catalogRuleIndex, CatalogRuleNew $catalogRuleNew, CatalogProductAttribute $attribute)
 {
     $catalogRuleIndex->open();
     $catalogRuleIndex->getGridPageActions()->addNew();
     $catalogRuleNew->getEditForm()->openSection('conditions');
     /** @var Conditions $conditionsSection */
     $conditionsSection = $catalogRuleNew->getEditForm()->getSection('conditions');
     \PHPUnit_Framework_Assert::assertTrue($conditionsSection->isAttributeInConditions($attribute), 'Product attribute can\'t be used on promo rules conditions.');
 }
 /**
  * Assert that customer group find on catalog price rule page.
  *
  * @param CatalogRuleIndex $catalogRuleIndex
  * @param CatalogRuleNew $catalogRuleNew
  * @param CustomerGroup $customerGroup
  * @return void
  */
 public function processAssert(CatalogRuleIndex $catalogRuleIndex, CatalogRuleNew $catalogRuleNew, CustomerGroup $customerGroup)
 {
     $catalogRuleIndex->open();
     $catalogRuleIndex->getGridPageActions()->addNew();
     $catalogRuleNew->getEditForm()->openTab('rule_information');
     /** @var RuleInformation $ruleInformationTab */
     $ruleInformationTab = $catalogRuleNew->getEditForm()->getTab('rule_information');
     \PHPUnit_Framework_Assert::assertTrue($ruleInformationTab->isVisibleCustomerGroup($customerGroup), "Customer group {$customerGroup->getCustomerGroupCode()} not in catalog price rule page.");
 }
 /**
  * Clear data after test
  *
  * @return void
  */
 public function tearDown()
 {
     foreach ($this->catalogRules as $catalogRule) {
         $filter = ['name' => $catalogRule->getName()];
         $this->catalogRuleIndex->open();
         $this->catalogRuleIndex->getCatalogRuleGrid()->searchAndOpen($filter);
         $this->catalogRuleNew->getFormPageActions()->delete();
     }
     $this->catalogRules = [];
 }
Ejemplo n.º 7
0
 /**
  * Delete Catalog Rule on backend
  *
  * @return array
  */
 public function run()
 {
     $this->catalogRuleIndex->open();
     $this->catalogRuleIndex->getCatalogRuleGrid()->resetFilter();
     while ($this->catalogRuleIndex->getCatalogRuleGrid()->isFirstRowVisible()) {
         $this->catalogRuleIndex->getCatalogRuleGrid()->openFirstRow();
         $this->catalogRuleNew->getFormPageActions()->delete();
         $this->catalogRuleIndex->getSystemMessageDialog()->closePopup();
     }
 }
 /**
  * Delete Catalog Price Rule test
  *
  * @param CatalogRule $catalogPriceRule
  * @return void
  */
 public function testDeleteCatalogPriceRule(CatalogRule $catalogPriceRule)
 {
     // Precondition
     $catalogPriceRule->persist();
     $filter = ['name' => $catalogPriceRule->getName(), 'rule_id' => $catalogPriceRule->getId()];
     // Steps
     $this->catalogRuleIndex->open();
     $this->catalogRuleIndex->getCatalogRuleGrid()->searchAndOpen($filter);
     $this->catalogRuleNew->getFormPageActions()->delete();
 }
 /**
  * Assert that displayed Catalog Price Rule data on edit page equals passed from fixture.
  *
  * @param CatalogRule $catalogPriceRule
  * @param CatalogRuleIndex $pageCatalogRuleIndex
  * @param CatalogRuleNew $pageCatalogRuleNew
  * @param CatalogRule $catalogPriceRuleOriginal
  * @return void
  */
 public function processAssert(CatalogRule $catalogPriceRule, CatalogRuleIndex $pageCatalogRuleIndex, CatalogRuleNew $pageCatalogRuleNew, CatalogRule $catalogPriceRuleOriginal = null)
 {
     $data = $catalogPriceRuleOriginal === null ? $catalogPriceRule->getData() : array_merge($catalogPriceRuleOriginal->getData(), $catalogPriceRule->getData());
     $filter['name'] = $data['name'];
     $pageCatalogRuleIndex->open();
     $pageCatalogRuleIndex->getCatalogRuleGrid()->searchAndOpen($filter);
     $formData = $pageCatalogRuleNew->getEditForm()->getData($catalogPriceRule);
     $fixtureData = $catalogPriceRule->getData();
     //convert discount_amount to float to compare
     if (isset($formData['discount_amount'])) {
         $formData['discount_amount'] = floatval($formData['discount_amount']);
     }
     if (isset($fixtureData['discount_amount'])) {
         $fixtureData['discount_amount'] = floatval($fixtureData['discount_amount']);
     }
     $diff = $this->verifyData($formData, $fixtureData);
     \PHPUnit_Framework_Assert::assertTrue(empty($diff), implode(' ', $diff));
 }