本文整理汇总了PHP中Magento\Catalog\Test\Fixture\CatalogProductSimple::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP CatalogProductSimple::getName方法的具体用法?PHP CatalogProductSimple::getName怎么用?PHP CatalogProductSimple::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Test\Fixture\CatalogProductSimple
的用法示例。
在下文中一共展示了CatalogProductSimple::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkRecentlyViewedBlockOnCategory
/**
* Check that block Recently Viewed contains product on category page
*
* @param CatalogProductSimple $productSimple
* @param Category $category
* @return void
*/
protected function checkRecentlyViewedBlockOnCategory(CatalogProductSimple $productSimple, Category $category)
{
$this->cmsIndex->open();
$this->cmsIndex->getTopmenu()->selectCategoryByName($category->getName());
$products = $this->catalogCategoryView->getViewBlock()->getProductsFromRecentlyViewedBlock();
\PHPUnit_Framework_Assert::assertTrue(in_array($productSimple->getName(), $products), 'Product' . $productSimple->getName() . ' is absent on Recently Viewed block on Category page.');
}
示例2: processAssert
/**
* Assert that product is displayed in related products section
*
* @param CatalogProductSimple $product1
* @param CatalogProductSimple $product2
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param CatalogProductView $catalogProductView
* @return void
*/
public function processAssert(CatalogProductSimple $product1, CatalogProductSimple $product2, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView)
{
$categoryName = $product1->getCategoryIds()[0];
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$catalogCategoryView->getListProductBlock()->openProductViewPage($product1->getName());
\PHPUnit_Framework_Assert::assertTrue($catalogProductView->getRelatedProductBlock()->isRelatedProductVisible($product2->getName()), 'Product \'' . $product2->getName() . '\' is absent in related products.');
}
示例3: processAssert
/**
* Assert that product is not displayed in up-sell section
*
* @param CatalogProductSimple $product1
* @param CatalogProductSimple $product2
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param CatalogProductView $catalogProductView
* @return void
*/
public function processAssert(CatalogProductSimple $product1, CatalogProductSimple $product2, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView)
{
$categoryName = $product1->getCategoryIds()[0]['name'];
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$catalogCategoryView->getListProductBlock()->openProductViewPage($product1->getName());
\PHPUnit_Framework_Assert::assertFalse($catalogProductView->getUpsellBlock()->isUpsellProductVisible($product2->getName()), 'Product \'' . $product2->getName() . '\' is exist in up-sells products.');
}
示例4: addToCardPresentOnProduct
/**
* "Add to cart" button is display on Product page
*
* @return void
*/
protected function addToCardPresentOnProduct()
{
$this->cmsIndex->open();
$this->cmsIndex->getTopmenu()->selectCategoryByName($this->product->getCategoryIds()[0]);
$this->catalogCategoryView->getListProductBlock()->openProductViewPage($this->product->getName());
\PHPUnit_Framework_Assert::assertTrue($this->catalogProductView->getViewBlock()->checkAddToCardButton(), "Button 'Add to Card' is absent on Product page.");
}
示例5: isProductVisible
/**
* Check if ordered product is in grid
*
* @param CatalogProductSimple $product
* @return bool
*/
public function isProductVisible(CatalogProductSimple $product)
{
$filter = [$product->getName(), $product->getPrice(), $product->getCheckoutData()['qty']];
$rows = [];
foreach ($filter as $value) {
$rows[] = sprintf($this->rowTemplate, $value);
}
$location = $this->location . '[' . implode(' and ', $rows) . ']';
return $this->_rootElement->find($location, Locator::SELECTOR_XPATH)->isVisible();
}
示例6: processAssert
/**
* Assert that products are displayed in up-sell section.
*
* @param BrowserInterface $browser
* @param CatalogProductView $catalogProductView
* @param CatalogProductSimple $product
* @param InjectableFixture[]|null $promotedProducts
* @return void
*/
public function processAssert(BrowserInterface $browser, CatalogProductView $catalogProductView, CatalogProductSimple $product, 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::assertTrue($catalogProductView->getUpsellBlock()->getProductItem($promotedProduct)->isVisible(), 'Product \'' . $promotedProduct->getName() . '\' is absent in up-sells products of a product \'' . $product->getName() . '\'.');
}
}
示例7: processAssert
/**
* Assert that product is displayed in cross-sell section
*
* @param CatalogProductSimple $product1
* @param CatalogProductSimple $product2
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param CatalogProductView $catalogProductView
* @param CheckoutCart $checkoutCart
* @return void
*/
public function processAssert(CatalogProductSimple $product1, CatalogProductSimple $product2, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart)
{
$categoryName = $product1->getCategoryIds()[0];
$checkoutCart->open();
$checkoutCart->getCartBlock()->clearShoppingCart();
$cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$catalogCategoryView->getListProductBlock()->openProductViewPage($product1->getName());
$catalogProductView->getViewBlock()->addToCart($product1);
\PHPUnit_Framework_Assert::assertTrue($checkoutCart->getCrosssellBlock()->verifyProductCrosssell($product2), 'Product \'' . $product2->getName() . '\' is absent in cross-sell section.');
}
示例8: isProductVisible
/**
* Check that product visible in grid
*
* @param CatalogProductSimple $product
* @param string $carts
* @return bool
*/
public function isProductVisible(CatalogProductSimple $product, $carts)
{
$result = false;
$productRowSelector = sprintf($this->productRow, $product->getName());
$productPrice = sprintf($this->productPrice, $product->getPrice());
$productRow = $this->_rootElement->find($productRowSelector, Locator::SELECTOR_XPATH);
if ($productRow->isVisible()) {
$result = $productRow->find($productPrice, Locator::SELECTOR_XPATH)->isVisible() && $productRow->find(sprintf($this->productCarts, $carts), Locator::SELECTOR_XPATH)->isVisible();
}
return $result;
}
示例9: getPricesForCustomers
/**
* Login with each provided customer and get product prices
*
* @param CatalogProductSimple $product
* @param array $customers
* @return array
*/
protected function getPricesForCustomers(CatalogProductSimple $product, $customers)
{
$prices = [];
foreach ($customers as $customer) {
$this->loginCustomer($customer);
$productName = $product->getName();
$this->openCategory($product);
$actualPrices = [];
$actualPrices = $this->getCategoryPrice($productName, $actualPrices);
$this->catalogCategoryView->getListProductBlock()->openProductViewPage($productName);
$actualPrices = $this->addToCart($product, $actualPrices);
$actualPrices = $this->getCartPrice($product, $actualPrices);
$prices[] = $actualPrices;
$this->clearShoppingCart();
}
return $prices;
}
示例10: assertOnProductView
/**
* Assert data on the product view page
*
* @param CatalogProductSimple $product
* @param CatalogProductView $catalogProductView
* @return void
*/
protected function assertOnProductView(CatalogProductSimple $product, CatalogProductView $catalogProductView)
{
$viewBlock = $catalogProductView->getViewBlock();
$price = $viewBlock->getPriceBlock()->getPrice();
$name = $viewBlock->getProductName();
$sku = $viewBlock->getProductSku();
\PHPUnit_Framework_Assert::assertEquals($product->getName(), $name, 'Product name on product view page is not correct.');
\PHPUnit_Framework_Assert::assertEquals($product->getSku(), $sku, 'Product sku on product view page is not correct.');
if (isset($price['price_regular_price'])) {
\PHPUnit_Framework_Assert::assertEquals(number_format($product->getPrice(), 2), $price['price_regular_price'], 'Product regular price on product view page is not correct.');
}
$priceComparing = false;
if ($specialPrice = $product->getSpecialPrice()) {
$priceComparing = $specialPrice;
}
if ($priceComparing && isset($price['price_special_price'])) {
\PHPUnit_Framework_Assert::assertEquals(number_format($priceComparing, 2), $price['price_special_price'], 'Product special price on product view page is not correct.');
}
}
示例11: processAssert
/**
* Assert that product quantity in the mini shopping cart is equals to expected quantity from data set
*
* @param CmsIndex $cmsIndex
* @param Cart $cart
* @param CatalogProductSimple $product
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, Cart $cart, CatalogProductSimple $product)
{
$productQtyInMiniCart = $cmsIndex->open()->getCartSidebarBlock()->getProductQty($product->getName());
\PHPUnit_Framework_Assert::assertEquals($productQtyInMiniCart, $cart->getQty(), 'Mini shopping cart product qty: \'' . $productQtyInMiniCart . '\' not equals with qty from data set: \'' . $cart->getQty() . '\'');
}
示例12: processAssert
/**
* Assert that product with Low Stock is present in Low Stock grid
*
* @param CatalogProductSimple $product
* @param ProductLowStock $productLowStock
* @return void
*/
public function processAssert(CatalogProductSimple $product, ProductLowStock $productLowStock)
{
$productLowStock->open();
\PHPUnit_Framework_Assert::assertTrue($productLowStock->getLowStockGrid()->isRowVisible(['name' => $product->getName()]), 'Product with Low Stock is absent in Low Stock grid.');
}
示例13: processAssert
/**
* Assert that price in the shopping cart equals to expected price from data set
*
* @param CheckoutCart $checkoutCart
* @param Cart $cart
* @param CatalogProductSimple $product
* @return void
*/
public function processAssert(CheckoutCart $checkoutCart, Cart $cart, CatalogProductSimple $product)
{
$cartProductPrice = $checkoutCart->open()->getCartBlock()->getProductPriceByName($product->getName());
\PHPUnit_Framework_Assert::assertEquals($cartProductPrice, $cart->getPrice(), 'Shopping cart product price: \'' . $cartProductPrice . '\' not equals with price from data set: \'' . $cart->getPrice() . '\'');
}
示例14: getPrices
/**
* Get prices with fpt on category, product and cart pages
*
* @param CatalogProductSimple $product
* @return array
*/
protected function getPrices(CatalogProductSimple $product)
{
$actualPrices = [];
$productName = $product->getName();
// Get prices with fpt on category page
$this->cmsIndex->open();
$this->cmsIndex->getTopmenu()->selectCategoryByName($product->getCategoryIds()[0]);
$actualPrices = $this->getCategoryPrice($productName, $actualPrices);
// Get prices with fpt on product page
$this->catalogCategoryView->getListProductBlock()->openProductViewPage($productName);
$actualPrices = $this->addToCart($product, $actualPrices);
// Get prices with fpt on cart page
$actualPrices = $this->getCartPrice($product, $actualPrices);
return $actualPrices;
}
示例15: processAssert
/**
* Assert that subtotal total in the shopping cart is equals to expected total from data set
*
* @param CheckoutCart $checkoutCart
* @param Cart $cart
* @param CatalogProductSimple $product
* @return void
*/
public function processAssert(CheckoutCart $checkoutCart, Cart $cart, CatalogProductSimple $product)
{
$cartProductSubtotal = $checkoutCart->open()->getCartBlock()->getCartItemSubTotalByProductName($product->getName());
\PHPUnit_Framework_Assert::assertEquals($cartProductSubtotal, $cart->getRowTotal(), 'Shopping cart subtotal: \'' . $cartProductSubtotal . '\' not equals with total from data set: \'' . $cart->getRowTotal() . '\'');
}