本文整理汇总了PHP中Magento\Cms\Test\Page\CmsIndex类的典型用法代码示例。如果您正苦于以下问题:PHP CmsIndex类的具体用法?PHP CmsIndex怎么用?PHP CmsIndex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CmsIndex类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: processAssert
/**
* Assert that you will be redirected to url from dataset
*
* @param CmsIndex $cmsIndex
* @param BrowserInterface $browser
* @param CatalogSearchQuery $searchTerm
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, BrowserInterface $browser, CatalogSearchQuery $searchTerm)
{
$cmsIndex->open()->getSearchBlock()->search($searchTerm->getSynonymFor());
$windowUrl = $browser->getUrl();
$redirectUrl = $searchTerm->getRedirect();
\PHPUnit_Framework_Assert::assertEquals($windowUrl, $redirectUrl, 'Redirect by synonym was not executed.' . PHP_EOL . "Expected: " . $redirectUrl . PHP_EOL . "Actual: " . $windowUrl);
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:15,代码来源:AssertSearchTermSynonymOnFrontend.php
示例2: processAssert
/**
* Assert that apache redirect works by opening category page and asserting index.php in its url
*
* @param Category $category
* @param CmsIndex $homePage
* @param BrowserInterface $browser
*/
public function processAssert(Category $category, CmsIndex $homePage, BrowserInterface $browser)
{
$category->persist();
$homePage->open();
$homePage->getTopmenu()->selectCategoryByName($category->getName());
\PHPUnit_Framework_Assert::assertTrue(strpos($browser->getUrl(), 'index.php') === false, 'Apache redirect for category does not work.');
}
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:14,代码来源:AssertRewritesEnabled.php
示例3: processAssert
/**
* Assert that the category cannot be accessed from the navigation bar in the frontend
*
* @param CmsIndex $cmsIndex
* @param Category $category
* @param BrowserInterface $browser
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, Category $category, BrowserInterface $browser)
{
$cmsIndex->open();
\PHPUnit_Framework_Assert::assertFalse($cmsIndex->getTopmenu()->isCategoryVisible($category->getName()), 'Category can be accessed from the navigation bar in the frontend.');
$browser->open($_ENV['app_frontend_url'] . $category->getUrlKey() . '.html');
\PHPUnit_Framework_Assert::assertEquals(self::NOT_FOUND_MESSAGE, $cmsIndex->getTitleBlock()->getTitle(), 'Wrong page is displayed.');
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:15,代码来源:AssertCategoryIsNotActive.php
示例4: processAssert
/**
* Assert that video is displayed on category page on Store front.
*
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param InjectableFixture $initialProduct
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, InjectableFixture $initialProduct)
{
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategoryByName($initialProduct->getCategoryIds()[0]);
$src = $catalogCategoryView->getListProductBlock()->getProductItem($initialProduct)->getBaseImageSource();
\PHPUnit_Framework_Assert::assertFalse(strpos($src, '/placeholder/') !== false, 'Video preview image is not displayed on category view when it should.');
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:15,代码来源:AssertVideoCategoryView.php
示例5: processAssert
/**
* Check whether the attribute filter is displayed on the frontend in Layered navigation.
*
* @param CatalogCategoryView $catalogCategoryView
* @param InjectableFixture $product
* @param CatalogProductAttribute $attribute
* @param CmsIndex $cmsIndex
* @param FixtureFactory $fixtureFactory
* @return void
*/
public function processAssert(CatalogCategoryView $catalogCategoryView, InjectableFixture $product, CatalogProductAttribute $attribute, CmsIndex $cmsIndex, FixtureFactory $fixtureFactory)
{
$fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'product_with_category_with_anchor', 'data' => ['category_ids' => ['presets' => null, 'category' => $product->getDataFieldConfig('category_ids')['source']->getCategories()[0]]]])->persist();
$cmsIndex->open()->getTopmenu()->selectCategoryByName($product->getCategoryIds()[0]);
$label = $attribute->hasData('manage_frontend_label') ? $attribute->getManageFrontendLabel() : $attribute->getFrontendLabel();
\PHPUnit_Framework_Assert::assertTrue(in_array($label, $catalogCategoryView->getLayeredNavigationBlock()->getFilters()), 'Attribute is absent in layered navigation on category page.');
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:17,代码来源:AssertProductAttributeIsFilterable.php
示例6: processAssert
/**
* Assert that prices on order review and customer order pages are equal to specified in dataset.
*
* @param array $prices
* @param InjectableFixture $product
* @param CheckoutCart $checkoutCart
* @param CheckoutOnepage $checkoutOnepage
* @param CheckoutOnepageSuccess $checkoutOnepageSuccess
* @param CustomerOrderView $customerOrderView
* @param CmsIndex $cmsIndex
* @return void
*/
public function processAssert(array $prices, InjectableFixture $product, CheckoutCart $checkoutCart, CheckoutOnepage $checkoutOnepage, CheckoutOnepageSuccess $checkoutOnepageSuccess, CustomerOrderView $customerOrderView, CmsIndex $cmsIndex)
{
$this->checkoutOnepage = $checkoutOnepage;
$this->customerOrderView = $customerOrderView;
$checkoutCart->getProceedToCheckoutBlock()->proceedToCheckout();
$cmsIndex->getCmsPageBlock()->waitPageInit();
$shippingMethod = ['shipping_service' => 'Flat Rate', 'shipping_method' => 'Fixed'];
$checkoutOnepage->getShippingMethodBlock()->selectShippingMethod($shippingMethod);
$checkoutOnepage->getShippingMethodBlock()->clickContinue();
$checkoutOnepage->getPaymentBlock()->selectPaymentMethod(['method' => 'checkmo']);
$actualPrices = [];
$actualPrices = $this->getReviewPrices($actualPrices, $product);
$actualPrices = $this->getReviewTotals($actualPrices);
$prices = $this->preparePrices($prices);
//Order review prices verification
$message = 'Prices on order review should be equal to defined in dataset.';
\PHPUnit_Framework_Assert::assertEquals(array_diff_key($prices, ['cart_item_price_excl_tax' => null, 'cart_item_price_incl_tax' => null]), $actualPrices, $message);
$checkoutOnepage->getPaymentBlock()->placeOrder();
$checkoutOnepageSuccess->getSuccessBlock()->getGuestOrderId();
$checkoutOnepageSuccess->getSuccessBlock()->openOrder();
$actualPrices = [];
$actualPrices = $this->getOrderPrices($actualPrices, $product);
$actualPrices = $this->getOrderTotals($actualPrices);
//Frontend order prices verification
$message = 'Prices on order view page should be equal to defined in dataset.';
\PHPUnit_Framework_Assert::assertEquals($prices, $actualPrices, $message);
}
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:39,代码来源:AbstractAssertTaxCalculationAfterCheckout.php
示例7: processAssert
/**
* Assert configurable product, corresponds to the category page
*
* @param CatalogCategoryView $catalogCategoryView
* @param CmsIndex $cmsIndex
* @param CatalogProductConfigurable $configurable
* @param CatalogCategory $category
* @return void
*/
public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, CatalogProductConfigurable $configurable, CatalogCategory $category)
{
//Open category view page
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategoryByName($category->getName());
//process asserts
$this->assertPrice($configurable, $catalogCategoryView);
}
开发者ID:aiesh,项目名称:magento2,代码行数:17,代码来源:AssertConfigurableInCategory.php
示例8: processAssert
/**
* Assert product is present on mini shopping cart
*
* @param CmsIndex $cmsIndex
* @param array $products
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, array $products)
{
$cmsIndex->open();
foreach ($products as $product) {
$cmsIndex->getCartSidebarBlock()->openMiniCart();
\PHPUnit_Framework_Assert::assertTrue($cmsIndex->getCartSidebarBlock()->getCartItem($product)->isVisible(), 'Product ' . $product->getName() . ' is absent in Mini Shopping Cart.');
}
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:15,代码来源:AssertProductPresentInMiniShoppingCart.php
示例9: processAssert
/**
* Assert check URL rewrite custom redirect
*
* @param UrlRewrite $urlRewrite
* @param BrowserInterface $browser
* @param CmsIndex $cmsIndex
* @return void
*/
public function processAssert(UrlRewrite $urlRewrite, BrowserInterface $browser, CmsIndex $cmsIndex)
{
$browser->open($_ENV['app_frontend_url'] . $urlRewrite->getRequestPath());
$entity = $urlRewrite->getDataFieldConfig('target_path')['source']->getEntity();
$title = $entity->hasData('name') ? $entity->getName() : $entity->getContentHeading();
$pageTitle = $cmsIndex->getTitleBlock()->getTitle();
\PHPUnit_Framework_Assert::assertEquals($pageTitle, $title, 'URL rewrite product redirect false.' . "\nExpected: " . $title . "\nActual: " . $pageTitle);
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:16,代码来源:AssertUrlRewriteCustomRedirect.php
示例10: 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)
{
$cmsIndex->open();
$cmsIndex->getSearchBlock()->clickAdvancedSearchButton();
$searchForm = $searchPage->getForm();
$searchForm->fill($productSearch);
$searchForm->submit();
}
开发者ID:Atlis,项目名称:docker-magento2,代码行数:19,代码来源:AdvancedSearchEntityTest.php
示例11: processAssert
/**
* Assert that product is displayed in related products section
*
* @param CatalogProductSimple $product1
* @param CatalogProductSimple $product2
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param CatalogProductView $catalogProductView
* @return void
*/
public function processAssert(CatalogProductSimple $product1, CatalogProductSimple $product2, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView)
{
$categoryName = $product1->getCategoryIds()[0];
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$catalogCategoryView->getListProductBlock()->openProductViewPage($product1->getName());
\PHPUnit_Framework_Assert::assertTrue($catalogProductView->getRelatedProductBlock()->isRelatedProductVisible($product2->getName()), 'Product \'' . $product2->getName() . '\' is absent in related products.');
}
开发者ID:aiesh,项目名称:magento2,代码行数:18,代码来源:AssertRelatedProductsSection.php
示例12: processAssert
/**
* Assert that link "Compare Products..." on top menu of page
*
* @param array $products
* @param CmsIndex $cmsIndex
* @return void
*/
public function processAssert(array $products, CmsIndex $cmsIndex)
{
$productQty = count($products);
$qtyOnPage = $cmsIndex->getLinksBlock()->getQtyInCompareList();
\PHPUnit_Framework_Assert::assertEquals($productQty, $qtyOnPage, 'Qty is not correct in "Compare Products" link.');
$compareProductUrl = '/catalog/product_compare/';
\PHPUnit_Framework_Assert::assertTrue(strpos($cmsIndex->getLinksBlock()->getLinkUrl('Compare Products'), $compareProductUrl) !== false, 'Compare product link isn\'t lead to Compare Product Page.');
}
开发者ID:aiesh,项目名称:magento2,代码行数:15,代码来源:AssertProductCompareItemsLink.php
示例13: processAssert
/**
* Assert that created CMS page with 'Status' - Disabled displays with '404 Not Found' message on Frontend.
*
* @param CmsPage $cms
* @param FrontCmsIndex $frontCmsIndex
* @param CmsPageIndex $cmsIndex
* @param BrowserInterface $browser
* @return void
*/
public function processAssert(CmsPage $cms, FrontCmsIndex $frontCmsIndex, CmsPageIndex $cmsIndex, BrowserInterface $browser)
{
$cmsIndex->open();
$filter = ['title' => $cms->getTitle()];
$cmsIndex->getCmsPageGridBlock()->searchAndPreview($filter);
$browser->selectWindow();
\PHPUnit_Framework_Assert::assertEquals(self::NOT_FOUND_MESSAGE, $frontCmsIndex->getTitleBlock()->getTitle(), 'Wrong page is displayed.');
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:17,代码来源:AssertCmsPageDisabledOnFrontend.php
示例14: processAssert
/**
* Assert that product is not displayed in up-sell section
*
* @param CatalogProductSimple $product1
* @param CatalogProductSimple $product2
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param CatalogProductView $catalogProductView
* @return void
*/
public function processAssert(CatalogProductSimple $product1, CatalogProductSimple $product2, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView)
{
$categoryName = $product1->getCategoryIds()[0]['name'];
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$catalogCategoryView->getListProductBlock()->openProductViewPage($product1->getName());
\PHPUnit_Framework_Assert::assertFalse($catalogProductView->getUpsellBlock()->isUpsellProductVisible($product2->getName()), 'Product \'' . $product2->getName() . '\' is exist in up-sells products.');
}
开发者ID:Atlis,项目名称:docker-magento2,代码行数:18,代码来源:AssertNoUpSellsProductsSection.php
示例15: 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->getFooterBlock()->openAdvancedSearch();
$searchForm = $searchPage->getForm();
$searchForm->fill($productSearch);
$searchForm->submit();
}
开发者ID:Doability,项目名称:magento2dev,代码行数:16,代码来源:AdvancedSearchEntityTest.php
示例16: processAssert
/**
* 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('category', ['dataset' => 'default_subcategory', 'data' => ['display_mode' => 'Static block and products', 'landing_page' => $cmsBlock->getTitle()]]);
$category->persist();
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategoryByName($category->getName());
$categoryViewContent = $catalogCategoryView->getViewBlock()->getContent();
\PHPUnit_Framework_Assert::assertEquals($cmsBlock->getContent(), $categoryViewContent, 'Wrong block content on category is displayed.');
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:19,代码来源:AssertCmsBlockOnCategoryPage.php
示例17: processAssert
/**
* Assert that product is not present in Wishlist on Frontend
*
* @param CustomerAccountIndex $customerAccountIndex
* @param WishlistIndex $wishlistIndex
* @param InjectableFixture $product
* @param CustomerInjectable $customer
* @param CmsIndex $cmsIndex
* @param CustomerAccountLogin $customerAccountLogin
* @param CustomerAccountLogout $customerAccountLogout
* @return void
*/
public function processAssert(CustomerAccountIndex $customerAccountIndex, WishlistIndex $wishlistIndex, InjectableFixture $product, CustomerInjectable $customer, CmsIndex $cmsIndex, CustomerAccountLogin $customerAccountLogin, CustomerAccountLogout $customerAccountLogout)
{
$productName = $product->getName();
$customerAccountLogout->open();
$cmsIndex->getLinksBlock()->openLink('Log In');
$customerAccountLogin->getLoginBlock()->login($customer);
$customerAccountIndex->open()->getAccountMenuBlock()->openMenuItem("My Wish List");
\PHPUnit_Framework_Assert::assertFalse($wishlistIndex->getWishlistBlock()->getProductItemsBlock()->isProductPresent($productName), 'Product \'' . $productName . '\' is present in Wishlist on Frontend.');
}
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:21,代码来源:AssertProductIsAbsentInWishlist.php
示例18: processAssert
/**
* Assert that created widget is absent on frontend on Home page
*
* @param CmsIndex $cmsIndex
* @param Widget $widget
* @param AdminCache $adminCache
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, Widget $widget, AdminCache $adminCache)
{
// Flush cache
$adminCache->open();
$adminCache->getActionsBlock()->flushMagentoCache();
$adminCache->getMessagesBlock()->waitSuccessMessage();
$cmsIndex->open();
$widgetText = $widget->getParameters()['anchor_text'];
\PHPUnit_Framework_Assert::assertFalse($cmsIndex->getWidgetView()->isWidgetVisible($widget, $widgetText), 'Widget is present on Home page.');
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:18,代码来源:AssertWidgetAbsentOnFrontendHome.php
示例19: processAssert
/**
* Assert that after applying changes, currency symbol changed on Product Details Page.
*
* @param CatalogProductSimple $product
* @param BrowserInterface $browser
* @param CmsIndex $cmsIndex
* @param CatalogProductView $catalogProductView
* @param CurrencySymbolEntity $currencySymbol
* @return void
*/
public function processAssert(CatalogProductSimple $product, BrowserInterface $browser, CmsIndex $cmsIndex, CatalogProductView $catalogProductView, CurrencySymbolEntity $currencySymbol)
{
$cmsIndex->open();
$cmsIndex->getCurrencyBlock()->switchCurrency($currencySymbol);
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$price = $catalogProductView->getViewBlock()->getPriceBlock()->getPrice();
preg_match('`(.*?)\\d`', $price, $matches);
$symbolOnPage = isset($matches[1]) ? $matches[1] : null;
\PHPUnit_Framework_Assert::assertEquals($currencySymbol->getCustomCurrencySymbol(), $symbolOnPage, 'Wrong Currency Symbol is displayed on Product page.');
}
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:20,代码来源:AssertCurrencySymbolOnProductPage.php
示例20: processAssert
/**
* Assert that product is displayed in cross-sell section
*
* @param CatalogProductSimple $product1
* @param CatalogProductSimple $product2
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param CatalogProductView $catalogProductView
* @param CheckoutCart $checkoutCart
* @return void
*/
public function processAssert(CatalogProductSimple $product1, CatalogProductSimple $product2, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart)
{
$categoryName = $product1->getCategoryIds()[0];
$checkoutCart->open();
$checkoutCart->getCartBlock()->clearShoppingCart();
$cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$catalogCategoryView->getListProductBlock()->openProductViewPage($product1->getName());
$catalogProductView->getViewBlock()->addToCart($product1);
\PHPUnit_Framework_Assert::assertTrue($checkoutCart->getCrosssellBlock()->verifyProductCrosssell($product2), 'Product \'' . $product2->getName() . '\' is absent in cross-sell section.');
}
开发者ID:aiesh,项目名称:magento2,代码行数:21,代码来源:AssertCrossSellsProductsSection.php
注:本文中的Magento\Cms\Test\Page\CmsIndex类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论