当前位置: 首页>>代码示例>>PHP>>正文


PHP CmsIndex::getSearchBlock方法代码示例

本文整理汇总了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;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:33,代码来源:AssertProductIsNotDisplayingOnFrontend.php

示例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();
 }
开发者ID:nja78,项目名称:magento2,代码行数:16,代码来源:AdvancedSearchEntityTest.php

示例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();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:20,代码来源:AdvancedSearchEntityTest.php

示例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.');
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:20,代码来源:AssertAttributeSearchableByLabel.php

示例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');
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:21,代码来源:AssertSuggestSearchingResult.php

示例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);
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:22,代码来源:AssertProductSearchableBySku.php

示例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.");
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:25,代码来源:AssertStoreCanBeLocalized.php

示例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);
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:27,代码来源:AssertProductSearchableBySku.php

示例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));
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:25,代码来源:AssertChildProductIsNotDisplayedSeparately.php

示例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.");
 }
开发者ID:rafaelstz,项目名称:magento2,代码行数:32,代码来源:AssertStoreCanBeLocalized.php

示例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());
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:11,代码来源:SearchEntityResultsTest.php

示例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.');
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:14,代码来源:AssertProductNotSearchableBySku.php

示例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);
     }
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:13,代码来源:SearchTermsReportEntityTest.php

示例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());
 }
开发者ID:aiesh,项目名称:magento2,代码行数:12,代码来源:SuggestSearchingResultEntityTest.php


注:本文中的Magento\Cms\Test\Page\CmsIndex::getSearchBlock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。