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


PHP FixtureInterface::getQuantityAndStockStatus方法代碼示例

本文整理匯總了PHP中Mtf\Fixture\FixtureInterface::getQuantityAndStockStatus方法的典型用法代碼示例。如果您正苦於以下問題:PHP FixtureInterface::getQuantityAndStockStatus方法的具體用法?PHP FixtureInterface::getQuantityAndStockStatus怎麽用?PHP FixtureInterface::getQuantityAndStockStatus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Mtf\Fixture\FixtureInterface的用法示例。


在下文中一共展示了FixtureInterface::getQuantityAndStockStatus方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: processAssert

 /**
  * Assert that product can be searched via Quick Search using searchable product attributes (Search by SKU)
  *
  * @param CatalogsearchResult $catalogSearchResult
  * @param CmsIndex $cmsIndex
  * @param FixtureInterface $product
  * @return void
  */
 public function processAssert(CatalogsearchResult $catalogSearchResult, CmsIndex $cmsIndex, FixtureInterface $product)
 {
     $cmsIndex->open();
     $cmsIndex->getSearchBlock()->search($product->getSku());
     $isInStock = $product->getQuantityAndStockStatus();
     if ($product->getVisibility() === 'Catalog' || isset($isInStock['is_in_stock']) && $isInStock['is_in_stock'] === 'Out of Stock') {
         $isVisible = !$catalogSearchResult->getListProductBlock()->isProductVisible($product->getName());
         $this->errorMessage = 'Product successfully found by SKU.';
         $this->successfulMessage = 'The product has not been found by SKU.';
     } else {
         $isVisible = $catalogSearchResult->getListProductBlock()->isProductVisible($product->getName());
     }
     \PHPUnit_Framework_Assert::assertTrue($isVisible, $this->errorMessage);
 }
開發者ID:Atlis,項目名稱:docker-magento2,代碼行數:22,代碼來源:AssertProductSearchableBySku.php

示例2: processAssert

 /**
  * Assert that product is visible in the assigned category
  *
  * @param CatalogCategoryView $catalogCategoryView
  * @param CmsIndex $cmsIndex
  * @param FixtureInterface $product
  * @param CatalogCategory $category
  * @return void
  */
 public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, FixtureInterface $product, CatalogCategory $category)
 {
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategoryByName($category->getName());
     $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
     while (!$isProductVisible && $catalogCategoryView->getToolbar()->nextPage()) {
         $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
     }
     $isInStock = $product->getQuantityAndStockStatus();
     if ($product->getVisibility() === 'Search' || isset($isInStock['is_in_stock']) && $isInStock['is_in_stock'] === 'Out of Stock') {
         $isProductVisible = !$isProductVisible;
         $this->errorMessage = 'Product found in this category.';
         $this->successfulMessage = 'Asserts that the product could not be found in this category.';
     }
     \PHPUnit_Framework_Assert::assertTrue($isProductVisible, $this->errorMessage);
 }
開發者ID:Atlis,項目名稱:docker-magento2,代碼行數:25,代碼來源:AssertProductVisibleInCategory.php

示例3: processAssert

 /**
  * Assert that product can be searched via Quick Search using searchable product attributes (Search by SKU)
  *
  * @param CatalogsearchResult $catalogSearchResult
  * @param CmsIndex $cmsIndex
  * @param FixtureInterface $product
  * @return void
  *
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function processAssert(CatalogsearchResult $catalogSearchResult, CmsIndex $cmsIndex, FixtureInterface $product)
 {
     $cmsIndex->open();
     $sku = $product->hasData('sku') !== false ? $product->getSku() : $product->getName();
     $cmsIndex->getSearchBlock()->search($sku);
     $quantityAndStockStatus = $product->getQuantityAndStockStatus();
     $stockStatus = isset($quantityAndStockStatus['is_in_stock']) ? $quantityAndStockStatus['is_in_stock'] : null;
     $isVisible = $catalogSearchResult->getListProductBlock()->isProductVisible($product->getName());
     while (!$isVisible && $catalogSearchResult->getBottomToolbar()->nextPage()) {
         $isVisible = $catalogSearchResult->getListProductBlock()->isProductVisible($product->getName());
     }
     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:buskamuza,項目名稱:magento2-skeleton,代碼行數:27,代碼來源:AssertProductSearchableBySku.php

示例4: getStockStatus

 /**
  * Getting is in stock status
  *
  * @param FixtureInterface $product
  * @return string|null
  */
 protected function getStockStatus(FixtureInterface $product)
 {
     $quantityAndStockStatus = $product->getQuantityAndStockStatus();
     return isset($quantityAndStockStatus['is_in_stock']) ? $quantityAndStockStatus['is_in_stock'] : null;
 }
開發者ID:buskamuza,項目名稱:magento2-skeleton,代碼行數:11,代碼來源:AssertProductVisibleInCategory.php


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