/** * Assert that displayed banner data on edit page equals passed from fixture. * * @param Banner $banner * @param BannerIndex $bannerIndex * @param BannerEdit $bannerEdit * @return void */ public function processAssert(Banner $banner, BannerIndex $bannerIndex, BannerEdit $bannerEdit) { $bannerIndex->open(); $bannerIndex->getGrid()->searchAndOpen(['name' => $banner->getName()]); $fixtureData = $banner->getData(); $formData = $bannerEdit->getBannerForm()->getData($banner); $errors = $this->verifyData($fixtureData, $formData); \PHPUnit_Framework_Assert::assertEmpty($errors, $errors); }
/** * Assert that created banner is found by name and has correct banner types, visibility, status. * * @param Banner $banner * @param BannerIndex $bannerIndex * @return void */ public function processAssert(Banner $banner, BannerIndex $bannerIndex) { $bannerIndex->open(); $filter = ['name' => $banner->getName(), 'active' => $banner->getIsEnabled()]; $isStoreContents = $banner->getStoreContents(); if (isset($isStoreContents['store_views'])) { $filter['visibility'] = $banner->getDataFieldConfig('store_contents')['source']->getStore(); } $bannerIndex->getGrid()->search($filter); if ($banner->hasData('types')) { $filter['types'] = implode(', ', $banner->getTypes()); } unset($filter['visibility']); \PHPUnit_Framework_Assert::assertTrue($bannerIndex->getGrid()->isRowVisible($filter, false), 'Banner is absent in grid.'); }
/** * Create Widget. * * @param string $widget * @param Banner $banner * @return BannerWidget */ protected function createWidget($widget, Banner $banner) { $widget = $this->fixtureFactory->create('Enterprise\\Banner\\Test\\Fixture\\BannerWidget', ['dataSet' => $widget, 'data' => ['parameters' => ['banner_ids' => $banner->getBannerId(), 'display_mode' => 'fixed']]]); $widget->persist(); return $widget; }
/** * Check Widget Banners. * * @param Banner $banner * @return bool */ public function checkWidgetBanners(Banner $banner) { return $this->_rootElement->find(sprintf($this->widgetBanner, $banner->getStoreContents()['store_content']), Locator::SELECTOR_XPATH)->isVisible(); }