當前位置: 首頁>>代碼示例>>PHP>>正文


PHP InjectableFixture::getStockData方法代碼示例

本文整理匯總了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);
 }
開發者ID:hientruong90,項目名稱:ee_14_installer,代碼行數:35,代碼來源:AssertProductSearchable.php

示例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;
 }
開發者ID:hientruong90,項目名稱:ee_14_installer,代碼行數:11,代碼來源:AssertProductVisibleInCategory.php


注:本文中的Magento\Mtf\Fixture\InjectableFixture::getStockData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。