/** * Assert that created CMS block can be found in grid via: title, identifier, status. * * @param CmsBlock $cmsBlock * @param CmsBlockIndex $cmsBlockIndex * @return void */ public function processAssert(CmsBlock $cmsBlock, CmsBlockIndex $cmsBlockIndex) { $cmsBlockIndex->open(); $data = $cmsBlock->getData(); $filter = ['title' => $data['title'], 'identifier' => $data['identifier'], 'is_active' => $data['is_active']]; $cmsBlockIndex->getCmsBlockGrid()->search($filter); \PHPUnit_Framework_Assert::assertTrue($cmsBlockIndex->getCmsBlockGrid()->isRowVisible($filter, false, false)); }
/** * Assert that created CMS block displayed on frontend category page (in order to assign block to category: * go to category page> Display settings> CMS Block). * * @param CmsIndex $cmsIndex * @param CmsBlock $cmsBlock * @param CatalogCategoryView $catalogCategoryView * @param FixtureFactory $fixtureFactory * @return void */ public function processAssert(CmsIndex $cmsIndex, CmsBlock $cmsBlock, CatalogCategoryView $catalogCategoryView, FixtureFactory $fixtureFactory) { $category = $fixtureFactory->createByCode('catalogCategory', ['dataSet' => 'default_subcategory', 'data' => ['display_mode' => 'Static block and products', 'landing_page' => $cmsBlock->getTitle()]]); $category->persist(); $cmsIndex->open(); $cmsIndex->getTopmenu()->selectCategory($category->getName()); $categoryViewContent = $catalogCategoryView->getViewBlock()->getText(); $cmsBlockContent = explode("\n", $categoryViewContent); \PHPUnit_Framework_Assert::assertContains($cmsBlock->getContent(), $cmsBlockContent); }