本文整理汇总了PHP中Magento\Cms\Test\Page\CmsIndex::getCurrencyBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP CmsIndex::getCurrencyBlock方法的具体用法?PHP CmsIndex::getCurrencyBlock怎么用?PHP CmsIndex::getCurrencyBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Cms\Test\Page\CmsIndex
的用法示例。
在下文中一共展示了CmsIndex::getCurrencyBlock方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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.');
}
示例2: 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()->selectCategoryByName($categoryName);
$price = $catalogCategoryView->getListProductBlock()->getProductItem($product)->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 Category page.');
}
示例3: processAssert
/**
* Assert currency rate applied on catalog page.
*
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param CatalogProductSimple $product
* @param CurrencySymbolEntity $currencySymbol
* @param string $basePrice
* @param string $convertedPrice
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductSimple $product, CurrencySymbolEntity $currencySymbol, $basePrice, $convertedPrice)
{
$categoryName = $product->getCategoryIds()[0];
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$priceBlock = $catalogCategoryView->getListProductBlock()->getProductItem($product)->getPriceBlock();
$actualPrice = $priceBlock->getPrice('');
\PHPUnit_Framework_Assert::assertEquals($basePrice, $actualPrice, 'Wrong price is displayed on Category page.');
$cmsIndex->getCurrencyBlock()->switchCurrency($currencySymbol);
$cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$actualPrice = $priceBlock->getPrice('');
\PHPUnit_Framework_Assert::assertEquals($convertedPrice, $actualPrice, 'Wrong price is displayed on Category page.');
}