本文整理匯總了PHP中Magento\Catalog\Test\Page\Product\CatalogProductView::getDownloadableViewBlock方法的典型用法代碼示例。如果您正苦於以下問題:PHP CatalogProductView::getDownloadableViewBlock方法的具體用法?PHP CatalogProductView::getDownloadableViewBlock怎麽用?PHP CatalogProductView::getDownloadableViewBlock使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Catalog\Test\Page\Product\CatalogProductView
的用法示例。
在下文中一共展示了CatalogProductView::getDownloadableViewBlock方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: processAssert
/**
* Assert Link block for downloadable product on front-end
*
* @param CatalogProductView $downloadableProductView
* @param CatalogProductDownloadable $product
* @param Browser $browser
* @return void
*/
public function processAssert(CatalogProductView $downloadableProductView, CatalogProductDownloadable $product, Browser $browser)
{
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$linksBlock = $downloadableProductView->getDownloadableViewBlock()->getDownloadableLinksBlock();
$fields = $product->getData();
// Title for for Link block
\PHPUnit_Framework_Assert::assertEquals($linksBlock->getTitleForLinkBlock(), $fields['downloadable_links']['title'], 'Title for for Link block for downloadable product on front-end is not correct.');
$this->sortDownloadableArray($fields['downloadable_links']['downloadable']['link']);
foreach ($fields['downloadable_links']['downloadable']['link'] as $index => $link) {
$index++;
// Titles for each links
// Links are displaying according to Sort Order
\PHPUnit_Framework_Assert::assertEquals($linksBlock->getItemTitle($index), $link['title'], 'Link item ' . $index . ' with title "' . $link['title'] . '" is not visible.');
// If Links can be Purchase Separately, check-nob is presented near each link
// If Links CANNOT be Purchase Separately, check-nob is not presented near each link
if ($fields['downloadable_links']['links_purchased_separately'] == "Yes") {
\PHPUnit_Framework_Assert::assertTrue($linksBlock->isVisibleItemCheckbox($index), 'Item ' . $index . ' link block CANNOT be Purchase Separately.');
// Price is equals passed according to fixture
$link['price'] = sprintf('$%1.2f', $link['price']);
\PHPUnit_Framework_Assert::assertEquals($linksBlock->getItemPrice($index), $link['price'], 'Link item ' . $index . ' price is not visible.');
} elseif ($fields['downloadable_links']['links_purchased_separately'] == "No") {
\PHPUnit_Framework_Assert::assertFalse($linksBlock->isVisibleItemCheckbox($index), 'Item ' . $index . ' link block can be Purchase Separately.');
}
}
}
示例2: processAssert
/**
* Assert Sample block for downloadable product on front-end
*
* @param CatalogProductView $productView
* @param CatalogProductDownloadable $product
* @param Browser $browser
* @return void
*/
public function processAssert(CatalogProductView $productView, CatalogProductDownloadable $product, Browser $browser)
{
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$sampleBlock = $productView->getDownloadableViewBlock()->getDownloadableSamplesBlock();
$fields = $product->getData();
// Title for for sample block
\PHPUnit_Framework_Assert::assertEquals($sampleBlock->getTitleForSampleBlock(), $fields['downloadable_sample']['title'], 'Title for for Samples block for downloadable product on front-end is not correct.');
$this->sortDownloadableArray($fields['downloadable_sample']['downloadable']['sample']);
foreach ($fields['downloadable_sample']['downloadable']['sample'] as $index => $sample) {
// Titles for each sample
// Samples are displaying according to Sort Order
\PHPUnit_Framework_Assert::assertEquals($sampleBlock->getItemTitle(++$index), $sample['title'], 'Sample item ' . $index . ' with title "' . $sample['title'] . '" is not visible.');
}
}