/** * Fill store view field. * * @param Sitemap $sitemap * @return void */ protected function fillStoreView(Sitemap $sitemap) { $storeViewField = $this->_rootElement->find($this->storeView, Locator::SELECTOR_CSS, 'selectstore'); if ($storeViewField->isVisible() && !$sitemap->hasData('store_id')) { $storeViewField->setValue('Main Website/Main Website Store/Default Store View'); } }
/** * Assert that sitemap.xml file contains correct content according to dataset: * - product url * - category url * - CMS page url * * @param CatalogProductSimple $product * @param CatalogCategory $category * @param CmsPage $cmsPage * @param Sitemap $sitemap * @param SitemapIndex $sitemapIndex * @return void */ public function processAssert(CatalogProductSimple $product, CatalogCategory $category, CmsPage $cmsPage, Sitemap $sitemap, SitemapIndex $sitemapIndex) { $sitemapIndex->open()->getSitemapGrid()->sortGridByField('sitemap_id'); $filter = ['sitemap_filename' => $sitemap->getSitemapFilename(), 'sitemap_path' => $sitemap->getSitemapPath()]; $sitemapIndex->getSitemapGrid()->search($filter); $content = file_get_contents($sitemapIndex->getSitemapGrid()->getLinkForGoogle()); $frontendUrl = str_replace('index.php/', '', $_ENV['app_frontend_url']); $urls = [$frontendUrl . $product->getUrlKey() . '.html', $frontendUrl . $category->getUrlKey() . '.html', $frontendUrl . $cmsPage->getIdentifier()]; \PHPUnit_Framework_Assert::assertTrue($this->checkContent($content, $urls), "File '{$sitemap->getSitemapFilename()}' does not contains correct content."); }
/** * Assert that sitemap is present in sitemap grid. * * @param Sitemap $sitemap * @param SitemapIndex $sitemapIndex * @return void */ public function processAssert(Sitemap $sitemap, SitemapIndex $sitemapIndex) { $sitemapIndex->open()->getSitemapGrid()->sortGridByField('sitemap_id'); $filter = ['sitemap_filename' => $sitemap->getSitemapFilename(), 'sitemap_path' => $sitemap->getSitemapPath()]; \PHPUnit_Framework_Assert::assertTrue($sitemapIndex->getSitemapGrid()->isRowVisible($filter), 'Sitemap is absent in grid.'); }
/** * Assert that error message is displayed after creating sitemap with wrong path. * * @param SitemapIndex $sitemapIndex * @param Sitemap $sitemap * @return void */ public function processAssert(SitemapIndex $sitemapIndex, Sitemap $sitemap) { \PHPUnit_Framework_Assert::assertEquals(sprintf(self::FAIL_PATH_MESSAGE, $sitemap->getSitemapFilename()), $sitemapIndex->getMessagesBlock()->getErrorMessages()); }
/** * Assert that success messages are displayed after sitemap generate. * * @param SitemapIndex $sitemapIndex * @param Sitemap $sitemap * @return void */ public function processAssert(SitemapIndex $sitemapIndex, Sitemap $sitemap) { $actualMessages = $sitemapIndex->getMessagesBlock()->getSuccessMessages(); \PHPUnit_Framework_Assert::assertTrue(in_array(self::SUCCESS_SAVE_MESSAGE, $actualMessages) && in_array(sprintf(self::SUCCESS_GENERATE_MESSAGE, $sitemap->getSitemapFilename()), $actualMessages), "The messages about the successful sitemap creation and generation are not present."); }