本文整理汇总了PHP中Magento\Catalog\Test\Fixture\CatalogProductSimple::hasData方法的典型用法代码示例。如果您正苦于以下问题:PHP CatalogProductSimple::hasData方法的具体用法?PHP CatalogProductSimple::hasData怎么用?PHP CatalogProductSimple::hasData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Test\Fixture\CatalogProductSimple
的用法示例。
在下文中一共展示了CatalogProductSimple::hasData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processAssert
/**
* Assert that product is not displayed in up-sell section.
*
* @param BrowserInterface $browser
* @param CatalogProductSimple $product
* @param CatalogProductView $catalogProductView
* @param InjectableFixture[]|null $promotedProducts
* @return void
*/
public function processAssert(BrowserInterface $browser, CatalogProductSimple $product, CatalogProductView $catalogProductView, array $promotedProducts = null)
{
if (!$promotedProducts) {
$promotedProducts = $product->hasData('up_sell_products') ? $product->getDataFieldConfig('up_sell_products')['source']->getProducts() : [];
}
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
foreach ($promotedProducts as $promotedProduct) {
\PHPUnit_Framework_Assert::assertFalse($catalogProductView->getUpsellBlock()->getProductItem($promotedProduct)->isVisible(), 'Product \'' . $promotedProduct->getName() . '\' is exist in up-sells products.');
}
}
示例2: test
/**
* Run update product simple entity test
*
* @param CatalogProductSimple $initialProduct
* @param CatalogProductSimple $product
* @return array
*/
public function test(CatalogProductSimple $initialProduct, CatalogProductSimple $product)
{
// Preconditions
$initialProduct->persist();
$initialCategory = $initialProduct->hasData('category_ids') ? $initialProduct->getDataFieldConfig('category_ids')['source']->getCategories()[0] : null;
$category = $product->hasData('category_ids') && $product->getCategoryIds()[0] ? $product->getDataFieldConfig('category_ids')['source']->getCategories()[0] : $initialCategory;
// Steps
$filter = ['sku' => $initialProduct->getSku()];
$this->productGrid->open();
$this->productGrid->getProductGrid()->searchAndOpen($filter);
$this->editProductPage->getProductForm()->fill($product);
$this->editProductPage->getFormPageActions()->save();
return ['category' => $category];
}
示例3: processAssert
/**
* Assert that product is not displayed in cross-sell section.
*
* @param BrowserInterface $browser
* @param CatalogProductSimple $product
* @param CatalogProductView $catalogProductView
* @param CheckoutCart $checkoutCart
* @param InjectableFixture[]|null $promotedProducts
* @return void
*/
public function processAssert(BrowserInterface $browser, CatalogProductSimple $product, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, array $promotedProducts = null)
{
if (!$promotedProducts) {
$promotedProducts = $product->hasData('cross_sell_products') ? $product->getDataFieldConfig('cross_sell_products')['source']->getProducts() : [];
}
$checkoutCart->open();
$checkoutCart->getCartBlock()->clearShoppingCart();
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$catalogProductView->getViewBlock()->addToCart($product);
$catalogProductView->getMessagesBlock()->waitSuccessMessage();
$checkoutCart->open();
foreach ($promotedProducts as $promotedProduct) {
\PHPUnit_Framework_Assert::assertFalse($checkoutCart->getCrosssellBlock()->getProductItem($promotedProduct)->isVisible(), 'Product \'' . $promotedProduct->getName() . '\' is exist in cross-sell section.');
}
}
示例4: test
/**
* Create product URL Rewrite.
*
* @param CatalogProductSimple $product
* @param UrlRewrite $urlRewrite
* @return void
*/
public function test(CatalogProductSimple $product, UrlRewrite $urlRewrite)
{
//Precondition
$product->persist();
$filter = ['id' => $product->getId()];
//Steps
$this->urlRewriteIndex->open();
$this->urlRewriteIndex->getPageActionsBlock()->addNew();
$this->urlRewriteEdit->getFormBlock()->fill($urlRewrite);
$this->urlRewriteEdit->getProductGridBlock()->searchAndOpen($filter);
$category = $product->hasData('category_ids') ? $product->getDataFieldConfig('category_ids')['source']->getCategories()[0] : null;
$this->urlRewriteEdit->getTreeBlock()->selectCategory($category);
$this->urlRewriteEdit->getFormBlock()->fill($urlRewrite);
$this->urlRewriteEdit->getPageMainActions()->save();
}
示例5: test
/**
* Run update product simple entity test.
*
* @param CatalogProductSimple $initialProduct
* @param CatalogProductSimple $product
* @param string $configData
* @return array
*/
public function test(CatalogProductSimple $initialProduct, CatalogProductSimple $product, $configData = '')
{
$this->configData = $configData;
// Preconditions
$initialProduct->persist();
$initialCategory = $initialProduct->hasData('category_ids') ? $initialProduct->getDataFieldConfig('category_ids')['source']->getCategories()[0] : null;
$category = $product->hasData('category_ids') && $product->getCategoryIds()[0] ? $product->getDataFieldConfig('category_ids')['source']->getCategories()[0] : $initialCategory;
$this->objectManager->create('Magento\\Config\\Test\\TestStep\\SetupConfigurationStep', ['configData' => $configData])->run();
// Steps
$filter = ['sku' => $initialProduct->getSku()];
$this->productGrid->open();
$this->productGrid->getProductGrid()->searchAndOpen($filter);
$this->editProductPage->getProductForm()->fill($product);
$this->editProductPage->getFormPageActions()->save();
return ['category' => $category];
}