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 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));
 }
 /**
  * Assert that sales rule is not present in cart price rules grid.
  *
  * @param PromoQuoteIndex $promoQuoteIndex
  * @param SalesRule $salesRule
  * @return void
  */
 public function processAssert(PromoQuoteIndex $promoQuoteIndex, SalesRule $salesRule)
 {
     \PHPUnit_Framework_Assert::assertFalse($promoQuoteIndex->getPromoQuoteGrid()->isRowVisible(['name' => $salesRule->getName()]), 'Sales rule \'' . $salesRule->getName() . '\' is present in cart price rules grid.');
 }