本文整理汇总了PHP中Magento\Mtf\Fixture\InjectableFixture::getStockData方法的典型用法代码示例。如果您正苦于以下问题:PHP InjectableFixture::getStockData方法的具体用法?PHP InjectableFixture::getStockData怎么用?PHP InjectableFixture::getStockData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Mtf\Fixture\InjectableFixture
的用法示例。
在下文中一共展示了InjectableFixture::getStockData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: verifySearchResult
/**
* Process assert search result.
*
* @param CatalogsearchResult $catalogSearchResult
* @param CmsIndex $cmsIndex
* @param InjectableFixture $product
* @param string $param
* @throws \Exception
* @return void
*
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
protected function verifySearchResult(CatalogsearchResult $catalogSearchResult, CmsIndex $cmsIndex, InjectableFixture $product, $param)
{
$cmsIndex->open();
$searchValue = $product->hasData($param) !== false ? $product->getData($param) : null;
if ($searchValue === null) {
throw new \Exception("Product '{$product->getName}()' doesn't have '{$param}' parameter.");
}
$param = strtoupper($param);
$this->errorMessage = sprintf($this->formatForErrorMessage, $param);
$this->successfulMessage = sprintf($this->formatForSuccessfulMessage, $param);
$cmsIndex->getSearchBlock()->search($searchValue);
$quantityAndStockStatus = $product->getStockData();
$stockStatus = isset($quantityAndStockStatus['is_in_stock']) ? $quantityAndStockStatus['is_in_stock'] : null;
$isVisible = $catalogSearchResult->getListProductBlock()->isProductVisible($product);
while (!$isVisible && $catalogSearchResult->getBottomToolbar()->nextPage()) {
$isVisible = $catalogSearchResult->getListProductBlock()->isProductVisible($product);
}
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);
}
示例2: getStockStatus
/**
* Getting is in stock status.
*
* @param InjectableFixture $product
* @return string|null
*/
protected function getStockStatus(InjectableFixture $product)
{
$quantityAndStockStatus = $product->getStockData();
return isset($quantityAndStockStatus['is_in_stock']) ? $quantityAndStockStatus['is_in_stock'] : null;
}