Ejemplo n.º 1
0
 /**
  * Delete Sales Rule Entity.
  *
  * @param SalesRule $salesRule
  * @return void
  */
 public function testDeleteSalesRule(SalesRule $salesRule)
 {
     // Preconditions
     $salesRule->persist();
     // Steps
     $this->promoQuoteIndex->open();
     $this->promoQuoteIndex->getPromoQuoteGrid()->searchAndOpen(['name' => $salesRule->getName()]);
     $this->promoQuoteEdit->getFormPageActions()->delete();
 }
Ejemplo n.º 2
0
 /**
  * Delete Sales Rule on backend.
  *
  * @return array
  */
 public function run()
 {
     $this->promoQuoteIndex->open();
     $this->promoQuoteIndex->getPromoQuoteGrid()->resetFilter();
     while ($this->promoQuoteIndex->getPromoQuoteGrid()->isFirstRowVisible()) {
         $this->promoQuoteIndex->getPromoQuoteGrid()->openFirstRow();
         $this->promoQuoteEdit->getFormPageActions()->delete();
         $this->promoQuoteIndex->getSystemMessageDialog()->closePopup();
     }
 }
 /**
  * Delete current sales rule.
  *
  * @return void
  */
 public function tearDown()
 {
     $filter = ['name' => $this->salesRuleName];
     $this->promoQuoteIndex->open();
     $this->promoQuoteIndex->getPromoQuoteGrid()->searchAndOpen($filter);
     $this->promoQuoteEdit->getFormPageActions()->delete();
 }
 /**
  * Assert that customer group find on cart price rule page.
  *
  * @param PromoQuoteIndex $promoQuoteIndex
  * @param PromoQuoteNew $promoQuoteNew
  * @param CustomerGroup $customerGroup
  * @return void
  */
 public function processAssert(PromoQuoteIndex $promoQuoteIndex, PromoQuoteNew $promoQuoteNew, CustomerGroup $customerGroup)
 {
     $promoQuoteIndex->open();
     $promoQuoteIndex->getGridPageActions()->addNew();
     $promoQuoteNew->getSalesRuleForm()->openTab('rule_information');
     /** @var RuleInformation $ruleInformationTab */
     $ruleInformationTab = $promoQuoteNew->getSalesRuleForm()->getTab('rule_information');
     \PHPUnit_Framework_Assert::assertTrue($ruleInformationTab->isVisibleCustomerGroup($customerGroup), "Customer group {$customerGroup->getCustomerGroupCode()} not in cart price rule page.");
 }
 /**
  * Assert that displayed sales rule data on edit page(backend) equals passed from fixture.
  *
  * @param PromoQuoteIndex $promoQuoteIndex
  * @param PromoQuoteEdit $promoQuoteEdit
  * @param SalesRule $salesRule
  * @param SalesRule $salesRuleOrigin
  * @return void
  */
 public function processAssert(PromoQuoteIndex $promoQuoteIndex, PromoQuoteEdit $promoQuoteEdit, SalesRule $salesRule, SalesRule $salesRuleOrigin = null)
 {
     $filter = ['name' => $salesRule->hasData('name') ? $salesRule->getName() : $salesRuleOrigin->getName()];
     $promoQuoteIndex->open();
     $promoQuoteIndex->getPromoQuoteGrid()->searchAndOpen($filter);
     $formData = $promoQuoteEdit->getSalesRuleForm()->getData();
     $fixtureData = $salesRuleOrigin != null ? array_merge($salesRuleOrigin->getData(), $salesRule->getData()) : $salesRule->getData();
     $dataDiff = $this->verify($fixtureData, $formData);
     \PHPUnit_Framework_Assert::assertTrue(empty($dataDiff), 'Sales rule data on edit page(backend) not equals to passed from fixture.' . "\nFailed values:\n " . implode(";\n ", $dataDiff));
 }