本文整理汇总了PHP中Magento\Mtf\Fixture\InjectableFixture::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP InjectableFixture::getName方法的具体用法?PHP InjectableFixture::getName怎么用?PHP InjectableFixture::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Mtf\Fixture\InjectableFixture
的用法示例。
在下文中一共展示了InjectableFixture::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processAssert
/**
* Assert that products added to wishlist are present on Customers account on backend.
*
* @param CustomerIndex $customerIndex
* @param Customer $customer
* @param CustomerIndexEdit $customerIndexEdit
* @param InjectableFixture $product
* @return void
*/
public function processAssert(CustomerIndex $customerIndex, Customer $customer, CustomerIndexEdit $customerIndexEdit, InjectableFixture $product)
{
$customerIndex->open();
$customerIndex->getCustomerGridBlock()->searchAndOpen(['email' => $customer->getEmail()]);
$customerIndexEdit->getCustomerForm()->openTab('wishlist');
/** @var \Magento\Wishlist\Test\Block\Adminhtml\Customer\Edit\Tab\Wishlist\Grid $wishlistGrid */
$wishlistGrid = $customerIndexEdit->getCustomerForm()->getTab('wishlist')->getSearchGridBlock();
\PHPUnit_Framework_Assert::assertTrue($wishlistGrid->isRowVisible(['product_name' => $product->getName()]), $product->getName() . " is not visible in customer wishlist on backend.");
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:18,代码来源:AssertProductIsPresentInCustomerBackendWishlist.php
示例2: processAssert
/**
* Assert that "Add to cart" button is present on page.
*
* @param InjectableFixture $product
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param CatalogProductView $catalogProductView
* @param Category $category [optional]
*
* @return void
*/
public function processAssert(InjectableFixture $product, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView, Category $category = null)
{
$cmsIndex->open();
$categoryName = $category === null ? $product->getCategoryIds()[0] : $category->getName();
$cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {
$isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
}
\PHPUnit_Framework_Assert::assertTrue($isProductVisible, 'Product is absent on category page.');
\PHPUnit_Framework_Assert::assertTrue($catalogCategoryView->getListProductBlock()->getProductItem($product)->isVisibleAddToCardButton(), "Button 'Add to Card' is absent on Category page.");
$catalogCategoryView->getListProductBlock()->openProductViewPage($product->getName());
\PHPUnit_Framework_Assert::assertTrue($catalogProductView->getViewBlock()->isVisibleAddToCardButton(), "Button 'Add to Card' is absent on Product page.");
}
示例3: getFormPrices
/**
* Get form prices.
*
* @param InjectableFixture $product
* @param CatalogCategoryView $catalogCategoryView
* @return array
*/
protected function getFormPrices(InjectableFixture $product, CatalogCategoryView $catalogCategoryView)
{
$productPriceBlock = $catalogCategoryView->getListProductBlock()->getProductPriceBlock($product->getName());
$actualPrices = ['regular' => $productPriceBlock->getRegularPrice(), 'special' => $productPriceBlock->getSpecialPrice()];
$actualPrices['discount_amount'] = number_format($actualPrices['regular'] - $actualPrices['special'], 2);
return $actualPrices;
}
示例4: getPrice
/**
* Returns the item price for the specified product.
*
* @param InjectableFixture $product
* @return array|string
*/
public function getPrice(InjectableFixture $product)
{
$productName = $product->getName();
if ($product instanceof ConfigurableProduct) {
// Find the price for the specific configurable product that was purchased
$attributesData = $product->getConfigurableAttributesData()['attributes_data'];
$matrix = $product->getConfigurableAttributesData()['matrix'];
$checkoutOptions = $product->getCheckoutData()['options']['configurable_options'];
$optionsDetails = [];
$matrixKey = [];
$optionsPrice = 0;
foreach ($checkoutOptions as $checkoutOption) {
$titleKey = $checkoutOption['title'];
$valueKey = $checkoutOption['value'];
$attributeName = $attributesData[$titleKey]['frontend_label'];
$optionLabel = $attributesData[$titleKey]['options'][$valueKey]['label'];
$optionsDetails[] = "{$attributeName}{$optionLabel}";
$matrixKey[] = "{$titleKey}:{$valueKey}";
$optionsPrice += $attributesData[$titleKey]['options'][$valueKey]['pricing_value'];
}
$optionsDetails = implode(' ', $optionsDetails);
$matrixKey = implode(' ', $matrixKey);
$productDisplay = $productName . 'SKU: ' . $matrix[$matrixKey]['sku'] . $optionsDetails;
} else {
$productDisplay = $productName . 'SKU: ' . $product->getSku();
}
$selector = '//tr[normalize-space(td)="' . $productDisplay . '"]' . $this->priceSelector;
return $this->escapeCurrency($this->_rootElement->find($selector, Locator::SELECTOR_XPATH)->getText());
}
示例5: processAssert
/**
* Assert that duplicated product can be found in grid by type, template, status and stock status.
*
* @param InjectableFixture $product
* @param CatalogProduct $productGrid
* @return void
*/
public function processAssert(InjectableFixture $product, CatalogProduct $productGrid)
{
$config = $product->getDataConfig();
$filter = ['name' => $product->getName(), 'visibility' => $product->getVisibility(), 'status' => 'Disabled', 'type' => ucfirst($config['create_url_params']['type']) . ' Product', 'price_to' => number_format($product->getPrice(), 2)];
$productGrid->open()->getProductGrid()->search($filter);
\PHPUnit_Framework_Assert::assertTrue($productGrid->getProductGrid()->isRowVisible($filter, false, false), 'Product duplicate is absent in Products grid.');
}
示例6: processAssert
/**
* Assert that redirect from newCategory/oldProduct is correct to new product.
*
* @param InjectableFixture $product
* @param InjectableFixture $initialProduct
* @param Browser $browser
* @param CatalogProductView $catalogProductView
* @return void
*/
public function processAssert(InjectableFixture $product, InjectableFixture $initialProduct, Browser $browser, CatalogProductView $catalogProductView)
{
$category = $product->getDataFieldConfig('category_ids')['source']->getProductCategory();
$productUrl = $_ENV['app_frontend_url'] . $category->getUrlKey() . '/' . $initialProduct->getUrlKey() . '.html';
$browser->open($productUrl);
\PHPUnit_Framework_Assert::assertEquals($catalogProductView->getViewBlock()->getProductName(), strtoupper($product->getName()));
}
示例7: processAssert
/**
* Assert that Catalog Price Rule is applied for product(s) in Shopping Cart
* according to Priority(Priority/Stop Further Rules Processing).
*
* @param InjectableFixture $product
* @param CatalogProductView $pageCatalogProductView
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param CheckoutCart $pageCheckoutCart
* @param array $prices
* @return void
*/
public function processAssert(InjectableFixture $product, CatalogProductView $pageCatalogProductView, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CheckoutCart $pageCheckoutCart, array $prices)
{
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategory($product->getCategoryIds()[0]);
$catalogCategoryView->getListProductBlock()->openProductViewPage($product->getName());
$pageCatalogProductView->getViewBlock()->addToCart($product);
$actualGrandTotal = $pageCheckoutCart->getCartBlock()->getCartItem($product)->getCartItemTypePrice('price');
\PHPUnit_Framework_Assert::assertEquals($prices['grand_total'], $actualGrandTotal);
}
示例8: verifyName
/**
* Verify displayed product name on product page(front-end) equals passed from fixture.
*
* @return string|null
*/
protected function verifyName()
{
$fixtureProductName = strtoupper($this->product->getName());
$formProductName = $this->productView->getProductName();
if ($fixtureProductName == $formProductName) {
return null;
}
return "Displayed product name on product page(front-end) not equals passed from fixture. " . "Actual: {$formProductName}, expected: {$fixtureProductName}.";
}
示例9: getItemBlockElement
/**
* Get item block.
*
* @param InjectableFixture $product
* @param int $itemIndex
* @return ElementInterface
*/
public function getItemBlockElement(InjectableFixture $product, $itemIndex)
{
$itemBlockSelector = sprintf($this->itemBlock, $product->getName());
++$itemIndex;
$itemBlockElement = $this->_rootElement->find($itemBlockSelector . "[{$itemIndex}]", Locator::SELECTOR_XPATH);
if (!$itemBlockElement->isVisible()) {
$itemBlockElement = $this->_rootElement->find($itemBlockSelector, Locator::SELECTOR_XPATH);
}
return $itemBlockElement;
}
示例10: getProductPrice
/**
* Fill options, get price and add to cart.
*
* @return array
*/
protected function getProductPrice()
{
$prices = [];
$this->catalogCategoryView->getListProductBlock()->openProductViewPage($this->product->getName());
$priceBlock = $this->catalogProductView->getWeeeViewBlock()->getPriceBlock();
$this->catalogProductView->getViewBlock()->fillOptions($this->product);
foreach ($this->expectedPrices['product'] as $key => $type) {
$prices[$key] = $this->getPrice($priceBlock, $key);
}
return $prices;
}
示例11: processAssert
/**
* Assert form data equals fixture data.
*
* @param InjectableFixture $product
* @param CatalogProduct $productGrid
* @param CatalogProductEdit $productPage
* @param string $urlKeyFormat [optional]
* @return void
*/
public function processAssert(InjectableFixture $product, CatalogProduct $productGrid, CatalogProductEdit $productPage, $urlKeyFormat = '%s')
{
$this->product = $product;
$this->urlKeyFormat = $urlKeyFormat;
$this->catalogProductEdit = $productPage;
$filter = ['name' => $product->getName(), 'status' => 'Disabled'];
$productGrid->open()->getProductGrid()->searchAndOpen($filter);
$formData = $productPage->getProductForm()->getData($product);
$fixtureData = $this->prepareFixtureData($product->getData());
$errors = $this->verifyData($fixtureData, $formData);
\PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
}
示例12: processAssert
/**
* Assert that Catalog Price Rule is applied & it impacts on product's discount price on Product page.
*
* @param InjectableFixture $product
* @param CatalogProductView $pageCatalogProductView
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param array $prices
* @return void
*/
public function processAssert(InjectableFixture $product, CatalogProductView $pageCatalogProductView, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, array $prices)
{
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategory($product->getCategoryIds()[0]);
$catalogCategoryView->getListProductBlock()->openProductViewPage($product->getName());
$productPriceBlock = $pageCatalogProductView->getViewBlock()->getPriceBlock();
$actualPrices['regular'] = $productPriceBlock->getRegularPrice();
$actualPrices['special'] = $productPriceBlock->getSpecialPrice();
$actualPrices['discount_amount'] = number_format($actualPrices['regular'] - $actualPrices['special'], 2);
$diff = $this->verifyData($actualPrices, $prices);
\PHPUnit_Framework_Assert::assertEmpty($diff, $diff);
}
示例13: getPrice
/**
* Returns the item price for the specified product.
*
* @param InjectableFixture $product
* @return array|string
*/
public function getPrice(InjectableFixture $product)
{
$productName = $product->getName();
if ($product instanceof ConfigurableProduct) {
// Find the price for the specific configurable product that was purchased
$configurableAttributes = $product->getConfigurableAttributes();
$productOptions = $product->getCheckoutData()['options']['configurable_options'];
$checkoutOption = reset($productOptions);
$attributeKey = $checkoutOption['title'];
$optionKey = $checkoutOption['value'];
$attributeValue = $configurableAttributes[$attributeKey]['label']['value'];
$optionValue = $configurableAttributes[$attributeKey][$optionKey]['option_label']['value'];
$productDisplay = $productName . ' SKU: ' . $product->getVariationSku($checkoutOption);
$productDisplay .= ' ' . $attributeValue . ' ' . $optionValue;
} else {
$productDisplay = $productName . ' SKU: ' . $product->getSku();
}
$selector = '//tr[normalize-space(td)="' . $productDisplay . '"]' . $this->priceSelector;
return $this->_rootElement->find($selector, Locator::SELECTOR_XPATH)->getText();
}
示例14: processAssert
/**
* Assert that specified prices are actual on category, product and cart pages.
*
* @param InjectableFixture $product
* @param array $prices
* @param int $qty
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param CatalogProductView $catalogProductView
* @param CheckoutCart $checkoutCart
* @param FixtureFactory $fixtureFactory
* @return void
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function processAssert(InjectableFixture $product, array $prices, $qty, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, FixtureFactory $fixtureFactory)
{
$this->cmsIndex = $cmsIndex;
$this->catalogCategoryView = $catalogCategoryView;
$this->catalogProductView = $catalogProductView;
$this->checkoutCart = $checkoutCart;
$actualPrices = [];
//Assertion steps
$productName = $product->getName();
$productCategory = $product->getCategoryIds()[0];
$this->openCategory($productCategory);
$actualPrices = $this->getCategoryPrices($productName, $actualPrices);
$catalogCategoryView->getListProductBlock()->openProductViewPage($productName);
$catalogProductView->getViewBlock()->fillOptions($product);
$actualPrices = $this->getProductPagePrices($actualPrices);
$catalogProductView->getViewBlock()->clickAddToCart();
$actualPrices = $this->getCartPrices($product, $actualPrices);
$actualPrices = $this->getTotals($actualPrices);
//Prices verification
$message = 'Prices from dataset should be equal to prices on frontend';
\PHPUnit_Framework_Assert::assertEquals($prices, $actualPrices, $message);
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:37,代码来源:AbstractAssertTaxRuleIsAppliedToAllPricesDownloadable.php
示例15: getItemProduct
/**
* Get item product block.
*
* @param InjectableFixture $product
* @return ItemProduct
*/
public function getItemProduct(InjectableFixture $product)
{
return $this->blockFactory->create('Magento\\GiftMessage\\Test\\Block\\Adminhtml\\Order\\Create\\Items\\ItemProduct', ['element' => $this->browser->find(sprintf($this->itemProduct, $product->getName()), Locator::SELECTOR_XPATH)]);
}