本文整理汇总了PHP中mage\cms\test\page\CmsIndex类的典型用法代码示例。如果您正苦于以下问题:PHP CmsIndex类的具体用法?PHP CmsIndex怎么用?PHP CmsIndex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CmsIndex类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processAssert
/**
* Assert that products' MAP has been applied before checkout.
*
* @param CatalogCategory $category
* @param Customer $customer
* @param Address $address
* @param CatalogCategoryView $catalogCategoryView
* @param CmsIndex $cmsIndex
* @param CatalogProductView $catalogProductView
* @param CheckoutCart $cart
* @param CheckoutOnepage $checkoutOnePage
* @param array $products
* @return void
*/
public function processAssert(CatalogCategory $category, Customer $customer, Address $address, CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, CatalogProductView $catalogProductView, CheckoutCart $cart, CheckoutOnepage $checkoutOnePage, array $products)
{
for ($i = 0; $i < count($products); $i++) {
$cart->getCartBlock()->clearShoppingCart();
$productName = $products[$i]->getName();
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategory($category->getName());
// Check that price is not present on category page.
$listProductBlock = $catalogCategoryView->getListProductBlock();
$productPriceBlock = $listProductBlock->getProductPriceBlock($productName);
$productPriceBlock->clickForPrice();
\PHPUnit_Framework_Assert::assertFalse($productPriceBlock->getMapBlock()->isPriceVisible(), 'Price is present in MSRP dialog on category page.');
// Check that price is not present on product page.
$listProductBlock->openProductViewPage($productName);
\PHPUnit_Framework_Assert::assertFalse($catalogProductView->getViewBlock()->getPriceBlock()->isRegularPriceVisible(), 'Price is present in View block on product page.');
// Check that price is not present on cart.
$catalogProductView->getViewBlock()->addToCart($products[$i]);
\PHPUnit_Framework_Assert::assertTrue($cart->getCartBlock()->getCartItem($products[$i])->isMsrpVisible(), "MSRP link is not visible in cart.");
// Check that price is present on review block in onepage checkout page.
$cart->getCartBlock()->getProceedToCheckoutBlock()->proceedToCheckout();
$checkoutMethodBlock = $checkoutOnePage->getLoginBlock();
$billingBlock = $checkoutOnePage->getBillingBlock();
$paymentMethodBlock = $checkoutOnePage->getPaymentMethodsBlock();
$shippingBlock = $checkoutOnePage->getShippingMethodBlock();
$checkoutMethodBlock->guestCheckout();
$checkoutMethodBlock->clickContinue();
$billingBlock->fillBilling($address, $customer);
$billingBlock->clickContinue();
$shippingBlock->selectShippingMethod(['shipping_service' => 'Flat Rate', 'shipping_method' => 'Fixed']);
$shippingBlock->clickContinue();
$paymentMethodBlock->selectPaymentMethod(['method' => 'checkmo']);
$paymentMethodBlock->clickContinue();
\PHPUnit_Framework_Assert::assertEquals(number_format($products[$i]->getPrice(), 2), $checkoutOnePage->getReviewBlock()->getTotalBlock()->getData('subtotal'), "Subtotal in checkout one page for {$productName} is not equal to expected.");
}
}
示例2: processAssert
/**
* Assert that Wishlist can't be find by another Customer (or guest) via "Wishlist Search".
*
* @param CustomerAccountLogout $customerAccountLogout
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param SearchResult $searchResult
* @param CatalogCategory $category
* @param Customer $customer
* @param Wishlist $wishlist
* @return void
*/
public function processAssert(CustomerAccountLogout $customerAccountLogout, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, SearchResult $searchResult, CatalogCategory $category, Customer $customer, Wishlist $wishlist)
{
$customerAccountLogout->open();
$cmsIndex->open()->getTopmenu()->selectCategory($category->getName());
$catalogCategoryView->getWishlistSearchBlock()->searchByCustomer($customer);
\PHPUnit_Framework_Assert::assertFalse($searchResult->getWishlistSearchResultBlock()->isWishlistVisibleInGrid($wishlist), "Multiple wishlist is visible on wishlist search result page.");
}
示例3: processAssert
/**
* Assert that created CMS page displays with error message on unassigned store views on frontend.
*
* @param CmsPage $cms
* @param FrontendCmsPage $frontendCmsPage
* @param Browser $browser
* @param CmsIndex $cmsIndex
* @param string|null $notFoundMessage
* @return void
*/
public function processAssert(CmsPage $cms, FrontendCmsPage $frontendCmsPage, Browser $browser, CmsIndex $cmsIndex, $notFoundMessage = null)
{
$browser->open($_ENV['app_frontend_url'] . $cms->getIdentifier());
$notFoundMessage = $notFoundMessage !== null ? $notFoundMessage : self::ERROR_MESSAGE;
$cmsIndex->getHeaderBlock()->selectStore('Default Store View');
\PHPUnit_Framework_Assert::assertContains($notFoundMessage, $frontendCmsPage->getCmsPageContentBlock()->getPageContent(), 'Wrong page content is displayed.');
}
示例4: processAssert
/**
* Assert that apache redirect works by opening category page and asserting index.php in its url.
*
* @param CatalogCategory $category
* @param CmsIndex $homePage
* @param BrowserInterface $browser
*/
public function processAssert(CatalogCategory $category, CmsIndex $homePage, BrowserInterface $browser)
{
$category->persist();
$homePage->open();
$homePage->getTopmenu()->selectCategory($category->getName());
\PHPUnit_Framework_Assert::assertTrue(strpos($browser->getUrl(), 'index.php') === false, 'Apache redirect for category does not work.');
}
示例5: processAssert
/**
* Assert that Magento successfully installed.
*
* @param InstallWizardEnd $installWizardEnd
* @param CmsIndex $cmsIndex
* @param string $successInstallMessage
* @return void
*/
public function processAssert(InstallWizardEnd $installWizardEnd, CmsIndex $cmsIndex, $successInstallMessage)
{
// Check InstallWizardEnd page title text.
\PHPUnit_Framework_Assert::assertEquals($successInstallMessage, $installWizardEnd->getMainBlock()->getTitle());
// Check if header block on CmsIndex page is visible.
$cmsIndex->open();
\PHPUnit_Framework_Assert::assertTrue($cmsIndex->getHeaderBlock()->isVisible());
}
示例6: processAssert
/**
* Assert that Catalog Price Rule is applied for product(s) in Shopping Cart
* according to Priority(Priority/Stop Further Rules Processing).
*
* @param InjectableFixture $product
* @param CatalogProductView $pageCatalogProductView
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param CheckoutCart $pageCheckoutCart
* @param array $prices
* @return void
*/
public function processAssert(InjectableFixture $product, CatalogProductView $pageCatalogProductView, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CheckoutCart $pageCheckoutCart, array $prices)
{
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategory($product->getCategoryIds()[0]);
$catalogCategoryView->getListProductBlock()->openProductViewPage($product->getName());
$pageCatalogProductView->getViewBlock()->addToCart($product);
$actualGrandTotal = $pageCheckoutCart->getCartBlock()->getCartItem($product)->getCartItemTypePrice('price');
\PHPUnit_Framework_Assert::assertEquals($prices['grand_total'], $actualGrandTotal);
}
示例7: 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);
$isVisible = $catalogSearch->hasData('num_results') ? $searchBlock->isSuggestSearchVisible($queryText, $catalogSearch->getNumResults()) : $searchBlock->isSuggestSearchVisible($queryText);
\PHPUnit_Framework_Assert::assertTrue($isVisible, 'Block "Suggest Search" when searching was not found.');
}
示例8: processAssert
/**
* Assert that product is not present in Wishlist on frontend.
*
* @param WishlistIndex $wishlistIndex
* @param CmsIndex $cmsIndex
* @param Customer $customer
* @param FrontendActionsForCustomer $frontendActionsForCustomer
* @param InjectableFixture[] $products
* @return void
*/
public function processAssert(WishlistIndex $wishlistIndex, CmsIndex $cmsIndex, Customer $customer, FrontendActionsForCustomer $frontendActionsForCustomer, array $products)
{
$frontendActionsForCustomer->loginCustomer($customer);
$cmsIndex->getTopLinksBlock()->openAccountLink("My Wishlist");
$itemBlock = $wishlistIndex->getItemsBlock();
foreach ($products as $itemProduct) {
\PHPUnit_Framework_Assert::assertFalse($itemBlock->getItemProductBlock($itemProduct)->isVisible(), "Product '{$itemProduct->getName()}' is present in Wishlist on frontend.");
}
}
示例9: processAssert
/**
* Assert that Catalog Price Rule is applied for product(s) in Catalog
* according to Priority(Priority/Stop Further Rules Processing).
*
* @param InjectableFixture $product
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param array $prices
* @return void
*/
public function processAssert(InjectableFixture $product, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, array $prices)
{
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategory($product->getCategoryIds()[0]);
$formPrices = $this->getFormPrices($product, $catalogCategoryView);
$fixturePrices = $this->prepareFixturePrices($prices);
$diff = $this->verifyData($fixturePrices, $formPrices);
\PHPUnit_Framework_Assert::assertEmpty($diff, $diff . "\n On: " . date('l jS \\of F Y h:i:s A'));
}
示例10: processAssert
/**
* Assert that the correct option details are displayed on the "View Details" tool tip.
*
* @param CmsIndex $cmsIndex
* @param WishlistIndex $wishlistIndex
* @param InjectableFixture $product
* @param FixtureFactory $fixtureFactory
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, WishlistIndex $wishlistIndex, InjectableFixture $product, FixtureFactory $fixtureFactory)
{
$cmsIndex->getTopLinksBlock()->openAccount();
$cmsIndex->getLinksBlock()->openLink("My Wishlist");
$actualOptions = $wishlistIndex->getItemsBlock()->getItemProductBlock($product)->getOptions();
$cartFixture = $fixtureFactory->createByCode('cart', ['data' => ['items' => ['products' => [$product]]]]);
$expectedOptions = $this->prepareOptions($cartFixture);
$errors = $this->verifyData($expectedOptions, $this->sortDataByPath($actualOptions, '::title'));
\PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
}
示例11: 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('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);
}
示例12: processAssert
/**
* Assert that product is absent in the category page.
*
* @param CatalogCategoryView $catalogCategoryView
* @param CmsIndex $cmsIndex
* @param InjectableFixture $product
* @param CatalogCategory $category
* @return void
*/
public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, InjectableFixture $product, CatalogCategory $category)
{
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategory($category->getName());
$isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {
$isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
}
\PHPUnit_Framework_Assert::assertFalse($isProductVisible, 'Product is present on category page.');
}
示例13: processAssert
/**
* Assert that Compare Products block is presented on CMS pages.
* Block contains information about compared products.
*
* @param CmsIndex $cmsIndex
* @param FixtureFactory $fixtureFactory
* @param Browser $browser
* @param array $products
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, FixtureFactory $fixtureFactory, Browser $browser, array $products)
{
$newCmsPage = $fixtureFactory->createByCode('cmsPage', ['dataSet' => '3_column_template']);
$newCmsPage->persist();
$browser->open($_ENV['app_frontend_url'] . $newCmsPage->getIdentifier());
foreach ($products as &$product) {
$product = strtolower($product->getName());
}
\PHPUnit_Framework_Assert::assertEquals($products, $cmsIndex->getCompareBlock()->getProducts(), 'Compare product block contains NOT valid information about compared products.');
}
示例14: processAssert
/**
* Assert that products are present in custom wishlist.
*
* @param CmsIndex $cmsIndex
* @param Wishlist $multipleWishlist
* @param WishlistIndex $wishlistIndex
* @param InjectableFixture[] $products
* @param int[]|null $qtyToAction
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, Wishlist $multipleWishlist, WishlistIndex $wishlistIndex, array $products, $qtyToAction = null)
{
$this->wishlistIndex = $wishlistIndex;
$cmsIndex->getTopLinksBlock()->openAccount();
$cmsIndex->getLinksBlock()->openLink("My Wishlist");
$wishlistIndex->getManagementBlock()->selectWishlist($multipleWishlist);
foreach ($products as $key => $product) {
$expectedQty = $qtyToAction !== null && isset($qtyToAction[$key]) ? $qtyToAction[$key] : null;
$this->verifyItemProduct($product, $expectedQty);
}
}
示例15: processAssert
/**
* Assert that after applying changes, currency symbol changed on Catalog page.
*
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param CatalogProductSimple $product
* @param CurrencySymbolEntity $currencySymbol
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductSimple $product, CurrencySymbolEntity $currencySymbol)
{
$categoryName = $product->getCategoryIds()[0];
$cmsIndex->open();
$cmsIndex->getCurrencyBlock()->switchCurrency($currencySymbol);
$cmsIndex->getTopmenu()->selectCategory($categoryName);
$price = $catalogCategoryView->getListProductBlock()->getPrice($product->getId());
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 Category page.');
}