本文整理汇总了PHP中Magento\Cms\Test\Page\CmsIndex::getSearchBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP CmsIndex::getSearchBlock方法的具体用法?PHP CmsIndex::getSearchBlock怎么用?PHP CmsIndex::getSearchBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Cms\Test\Page\CmsIndex
的用法示例。
在下文中一共展示了CmsIndex::getSearchBlock方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isNotDisplayingOnFrontendAssert
/**
* Verify product displaying on frontend
*
* @param FixtureInterface $product
* @return array
*/
protected function isNotDisplayingOnFrontendAssert(FixtureInterface $product)
{
$errors = [];
// Check the product page is not available
// TODO fix initialization url for frontend page
$this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$titleBlock = $this->catalogProductView->getTitleBlock();
if ($titleBlock->getTitle() !== self::NOT_FOUND_MESSAGE) {
$errors[] = '- the headline on the page does not match, the text should be -> "' . self::NOT_FOUND_MESSAGE . '".';
}
$this->cmsIndex->open();
$this->cmsIndex->getSearchBlock()->search($product->getSku());
if ($this->catalogSearchResult->getListProductBlock()->isProductVisible($product->getName())) {
$errors[] = '- successful product search.';
}
$categoryName = $product->hasData('category_ids') ? $product->getCategoryIds()[0] : $this->category->getName();
$this->cmsIndex->open();
$this->cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$isProductVisible = $this->catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
while (!$isProductVisible && $this->catalogCategoryView->getBottomToolbar()->nextPage()) {
$isProductVisible = $this->catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
}
if ($isProductVisible) {
$errors[] = "- product with name '{$product->getName()}' is found in this category.";
}
return $errors;
}
示例2: test
/**
* Run test creation for advanced search entity.
*
* @param CatalogProductSimple $productSearch
* @param CmsIndex $cmsIndex
* @param AdvancedSearch $searchPage
* @return void
*/
public function test(CatalogProductSimple $productSearch, CmsIndex $cmsIndex, AdvancedSearch $searchPage)
{
$cmsIndex->open();
$cmsIndex->getSearchBlock()->clickAdvancedSearchButton();
$searchForm = $searchPage->getForm();
$searchForm->fill($productSearch);
$searchForm->submit();
}
示例3: testSearch
/**
* Run test creation for advanced search entity
*
* @param array $products
* @param CatalogProductSimple $productSearch
* @param CmsIndex $cmsIndex
* @param AdvancedSearch $searchPage
* @return void
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function testSearch(array $products, CatalogProductSimple $productSearch, CmsIndex $cmsIndex, AdvancedSearch $searchPage)
{
$this->markTestIncomplete('MAGETWO-27664');
$cmsIndex->open();
$cmsIndex->getSearchBlock()->clickAdvancedSearchButton();
$searchForm = $searchPage->getForm();
$searchForm->fill($productSearch);
$searchForm->submit();
}
示例4: processAssert
/**
* Assert that product attribute is searchable on Frontend.
*
* @param CatalogProductAttribute $attribute
* @param CmsIndex $cmsIndex
* @param InjectableFixture $product
* @param CatalogsearchResult $catalogSearchResult
* @return void
*/
public function processAssert(CatalogProductAttribute $attribute, CmsIndex $cmsIndex, InjectableFixture $product, CatalogsearchResult $catalogSearchResult)
{
$searchValue = $this->getSearchValue($attribute);
$cmsIndex->open();
$cmsIndex->getSearchBlock()->search($searchValue);
$isVisible = $catalogSearchResult->getListProductBlock()->getProductItem($product)->isVisible();
while (!$isVisible && $catalogSearchResult->getBottomToolbar()->nextPage()) {
$isVisible = $catalogSearchResult->getListProductBlock()->getProductItem($product)->isVisible();
}
\PHPUnit_Framework_Assert::assertTrue($isVisible, 'Product attribute is not searchable on Frontend.');
}
示例5: processAssert
/**
* Check that after input some text(e.g. product name) into search field, drop-down window is appeared.
* Window contains requested entity and number of quantity.
*
* @param CmsIndex $cmsIndex
* @param CatalogSearchQuery $catalogSearch
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, CatalogSearchQuery $catalogSearch)
{
$cmsIndex->open();
$searchBlock = $cmsIndex->getSearchBlock();
$queryText = $catalogSearch->getQueryText();
$searchBlock->fillSearch($queryText);
if ($catalogSearch->hasData('num_results')) {
$isVisible = $searchBlock->isSuggestSearchVisible($queryText, $catalogSearch->getNumResults());
} else {
$isVisible = $searchBlock->isSuggestSearchVisible($queryText);
}
\PHPUnit_Framework_Assert::assertTrue($isVisible, 'Block "Suggest Search" when searching was not found');
}
示例6: processAssert
/**
* Assert that product can be searched via Quick Search using searchable product attributes (Search by SKU)
*
* @param CatalogsearchResult $catalogSearchResult
* @param CmsIndex $cmsIndex
* @param FixtureInterface $product
* @return void
*/
public function processAssert(CatalogsearchResult $catalogSearchResult, CmsIndex $cmsIndex, FixtureInterface $product)
{
$cmsIndex->open();
$cmsIndex->getSearchBlock()->search($product->getSku());
$isInStock = $product->getQuantityAndStockStatus();
if ($product->getVisibility() === 'Catalog' || isset($isInStock['is_in_stock']) && $isInStock['is_in_stock'] === 'Out of Stock') {
$isVisible = !$catalogSearchResult->getListProductBlock()->isProductVisible($product->getName());
$this->errorMessage = 'Product successfully found by SKU.';
$this->successfulMessage = 'The product has not been found by SKU.';
} else {
$isVisible = $catalogSearchResult->getListProductBlock()->isProductVisible($product->getName());
}
\PHPUnit_Framework_Assert::assertTrue($isVisible, $this->errorMessage);
}
示例7: processAssert
/**
* Assert that locale options can be changed and checks new text on index page.
*
* @param SystemConfig $systemConfig
* @param Store $store
* @param CmsIndex $cmsIndex
* @param string $locale
* @param string $welcomeText
* @return void
*/
public function processAssert(SystemConfig $systemConfig, Store $store, CmsIndex $cmsIndex, $locale, $welcomeText)
{
// Set locale options
$systemConfig->open();
$systemConfig->getPageActions()->selectStore($store->getGroupId() . "/" . $store->getName());
$configGroup = $systemConfig->getForm()->getGroup('Locale Options');
$configGroup->open();
$configGroup->setValue('select-groups-locale-fields-code-value', $locale);
$systemConfig->getPageActions()->save();
$systemConfig->getMessagesBlock()->waitSuccessMessage();
// Check presents income text on index page
$cmsIndex->open();
$cmsIndex->getStoreSwitcherBlock()->selectStoreView($store->getName());
\PHPUnit_Framework_Assert::assertTrue($cmsIndex->getSearchBlock()->isPlaceholderContains($welcomeText), "Locale not applied.");
}
示例8: processAssert
/**
* Assert that product can be searched via Quick Search using searchable product attributes (Search by SKU)
*
* @param CatalogsearchResult $catalogSearchResult
* @param CmsIndex $cmsIndex
* @param FixtureInterface $product
* @return void
*
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function processAssert(CatalogsearchResult $catalogSearchResult, CmsIndex $cmsIndex, FixtureInterface $product)
{
$cmsIndex->open();
$sku = $product->hasData('sku') !== false ? $product->getSku() : $product->getName();
$cmsIndex->getSearchBlock()->search($sku);
$quantityAndStockStatus = $product->getQuantityAndStockStatus();
$stockStatus = isset($quantityAndStockStatus['is_in_stock']) ? $quantityAndStockStatus['is_in_stock'] : null;
$isVisible = $catalogSearchResult->getListProductBlock()->getProductItem($product)->isVisible();
while (!$isVisible && $catalogSearchResult->getBottomToolbar()->nextPage()) {
$isVisible = $catalogSearchResult->getListProductBlock()->getProductItem($product)->isVisible();
}
if ($product->getVisibility() === 'Catalog' || $stockStatus === 'Out of Stock') {
$isVisible = !$isVisible;
list($this->errorMessage, $this->successfulMessage) = [$this->successfulMessage, $this->errorMessage];
}
\PHPUnit_Framework_Assert::assertTrue($isVisible, $this->errorMessage);
}
示例9: processAssert
/**
* Assert that products generated during configurable product creation - are not visible on frontend(by default).
*
* @param CatalogSearchResult $catalogSearchResult
* @param CmsIndex $cmsIndex
* @param ConfigurableProduct $product
* @return void
*/
public function processAssert(CatalogsearchResult $catalogSearchResult, CmsIndex $cmsIndex, ConfigurableProduct $product)
{
$configurableAttributesData = $product->getConfigurableAttributesData();
$errors = [];
$cmsIndex->open();
foreach ($configurableAttributesData['matrix'] as $variation) {
$cmsIndex->getSearchBlock()->search($variation['sku']);
$isVisibleProduct = $catalogSearchResult->getListProductBlock()->isProductVisible($variation['name']);
while (!$isVisibleProduct && $catalogSearchResult->getBottomToolbar()->nextPage()) {
$isVisibleProduct = $catalogSearchResult->getListProductBlock()->isProductVisible($product->getName());
}
if ($isVisibleProduct) {
$errors[] = sprintf("\nChild product with sku: \"%s\" is visible on frontend(by default).", $variation['sku']);
}
}
\PHPUnit_Framework_Assert::assertEmpty($errors, implode(' ', $errors));
}
示例10: processAssert
/**
* Assert that locale options can be changed and checks new text on index page.
*
* @param SystemConfig $systemConfig
* @param Store $store
* @param CmsIndex $cmsIndex
* @param AdminCache $adminCache
* @param string $locale
* @param string $welcomeText
*/
public function processAssert(SystemConfig $systemConfig, Store $store, CmsIndex $cmsIndex, AdminCache $adminCache, $locale, $welcomeText)
{
// Set locale options
$systemConfig->open();
$systemConfig->getPageActions()->selectStore($store->getGroupId() . "/" . $store->getName());
$systemConfig->getModalBlock()->acceptAlert();
$configGroup = $systemConfig->getForm()->getGroup('general', 'locale', 'code');
$configGroup->setValue('general', 'locale', 'code', $locale);
$systemConfig->getPageActions()->save();
$systemConfig->getMessagesBlock()->waitSuccessMessage();
// Flush cache
$adminCache->open();
$adminCache->getActionsBlock()->flushMagentoCache();
$adminCache->getMessagesBlock()->waitSuccessMessage();
// Check presents income text on index page
$cmsIndex->open();
if ($cmsIndex->getFooterBlock()->isStoreGroupSwitcherVisible() && $cmsIndex->getFooterBlock()->isStoreGroupVisible($store)) {
$cmsIndex->getFooterBlock()->selectStoreGroup($store);
}
$cmsIndex->getStoreSwitcherBlock()->selectStoreView($store->getName());
\PHPUnit_Framework_Assert::assertTrue($cmsIndex->getSearchBlock()->isPlaceholderContains($welcomeText), "Locale not applied.");
}
示例11: test
/**
* Run searching result test.
*
* @param CatalogSearchQuery $catalogSearch
* @return void
*/
public function test(CatalogSearchQuery $catalogSearch)
{
$this->cmsIndex->open();
$this->cmsIndex->getSearchBlock()->search($catalogSearch->getQueryText());
}
示例12: processAssert
/**
* Assert that product cannot be found via Quick Search using searchable product attributes.
*
* @param CatalogsearchResult $catalogSearchResult
* @param CmsIndex $cmsIndex
* @param FixtureInterface $product
* @return void
*/
public function processAssert(CatalogsearchResult $catalogSearchResult, CmsIndex $cmsIndex, FixtureInterface $product)
{
$cmsIndex->open();
$cmsIndex->getSearchBlock()->search($product->getSku());
\PHPUnit_Framework_Assert::assertFalse($catalogSearchResult->getListProductBlock()->getProductItem($product)->isVisible(), 'Product was found by SKU.');
}
示例13: searchProducts
/**
* Search products.
*
* @param string $productName
* @param int $countSearch
* @return void
*/
protected function searchProducts($productName, $countSearch)
{
for ($i = 0; $i < $countSearch; $i++) {
$this->cmsIndex->getSearchBlock()->search($productName);
}
}
示例14: testSearch
/**
* Run suggest searching result test
*
* @param CmsIndex $cmsIndex
* @param CatalogSearchQuery $catalogSearch
* @return void
*/
public function testSearch(CmsIndex $cmsIndex, CatalogSearchQuery $catalogSearch)
{
$cmsIndex->open();
$cmsIndex->getSearchBlock()->search($catalogSearch->getQueryText());
}