/** * Delete all Catalog Events on backend. * * @return void */ public function run() { $this->catalogEventIndex->open(); $this->catalogEventIndex->getEventGrid()->resetFilter(); while ($this->catalogEventIndex->getEventGrid()->isFirstRowVisible()) { $this->catalogEventIndex->getEventGrid()->openFirstRow(); $this->catalogEventEdit->getPageActions()->deleteAndAcceptAlert(); } }
/** * Assert that catalog event is presented in the "Events" grid. * * @param CatalogEvent $catalogEvent * @param CatalogProductSimple $product * @param CatalogEventIndex $catalogEventIndex * @return void */ public function processAssert(CatalogEvent $catalogEvent, CatalogProductSimple $product, CatalogEventIndex $catalogEventIndex) { $categoryName = $product->getDatafieldConfig('category_ids')['source']->getProductCategory()->getName(); $dateStart = strtotime($catalogEvent->getDateStart()); $dateEnd = strtotime($catalogEvent->getDateEnd()); $this->catalogEvent = $catalogEvent->getData(); if (!empty($this->catalogEvent['sort_order'])) { $sortOrder = $this->catalogEvent['sort_order'] < 0 ? 0 : $this->catalogEvent['sort_order']; } else { $sortOrder = ""; } $filter = ['category_name' => $categoryName, 'start_on' => $this->prepareDate($dateStart), 'end_on' => $this->prepareDate($dateEnd), 'status' => $this->getStatus($dateStart, $dateEnd), 'countdown_ticker' => $this->prepareDisplayStateForFilter(), 'sort_order' => $sortOrder]; $catalogEventIndex->getEventGrid()->search(['category_name' => $filter['category_name']]); \PHPUnit_Framework_Assert::assertTrue($catalogEventIndex->getEventGrid()->isRowVisible($filter, false, false), "Event on Category Name {$categoryName} is absent in Events grid by next filter:\n" . print_r($filter, true)); }
/** * Run delete Catalog Event test. * * @param CatalogProductSimple $product * @return void */ public function test(CatalogProductSimple $product) { //Steps $this->catalogEventIndex->open(); $this->catalogEventIndex->getEventGrid()->searchAndOpen(['category_name' => $product->getCategoryIds()[0]]); $this->catalogEventNew->getPageActions()->deleteAndAcceptAlert(); }