本文整理汇总了PHP中Magento\Mtf\Fixture\FixtureInterface::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP FixtureInterface::getName方法的具体用法?PHP FixtureInterface::getName怎么用?PHP FixtureInterface::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Mtf\Fixture\FixtureInterface
的用法示例。
在下文中一共展示了FixtureInterface::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processAssert
/**
* Assert that product is present in products grid and can be found by sku, type, status and attribute set.
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productIndex
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productIndex)
{
$this->product = $product;
$productIndex->open();
$productIndex->getProductGrid()->resetFilter();
\PHPUnit_Framework_Assert::assertTrue($productIndex->getProductGrid()->isRowVisible($this->prepareFilter()), 'Product \'' . $this->product->getName() . '\' is absent in Products grid.');
}
示例2: verifyName
/**
* Verify displayed product name on product page(front-end) equals passed from fixture
*
* @return string|null
*/
protected function verifyName()
{
$fixtureProductName = $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}.";
}
示例3: processAssert
/**
* Assert that product is not visible in the assigned category
*
* @param CatalogCategoryView $catalogCategoryView
* @param CmsIndex $cmsIndex
* @param FixtureInterface $product
* @param Category|null $category
* @return void
*/
public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, FixtureInterface $product, Category $category = null)
{
$categoryName = $category ? $category->getName() : $product->getCategoryIds()[0];
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {
$isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
}
\PHPUnit_Framework_Assert::assertFalse($isProductVisible, 'Product is exist on category page.');
}
示例4: prepareData
/**
* Prepare data from text to values
*
* @param FixtureInterface $fixture
* @return array
*/
protected function prepareData(FixtureInterface $fixture)
{
$categoryId = $fixture->getDataFieldConfig('root_category_id')['source']->getCategory()->getId();
$websiteId = $fixture->getDataFieldConfig('website_id')['source']->getWebsite()->getWebsiteId();
$data = ['group' => ['name' => $fixture->getName(), 'root_category_id' => $categoryId, 'website_id' => $websiteId, 'group_id' => $fixture->hasData('group_id') ? $fixture->getGroupId() : ''], 'store_action' => 'add', 'store_type' => 'group'];
return $data;
}
示例5: processAssert
/**
* Assert that product is visible in the assigned category
*
* @param CatalogCategoryView $catalogCategoryView
* @param CmsIndex $cmsIndex
* @param FixtureInterface $product
* @param Category|null $category
* @return void
*
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, FixtureInterface $product, Category $category = null)
{
$categoryName = $product->hasData('category_ids') ? $product->getCategoryIds()[0] : $category->getName();
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {
$isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
}
if ($product->getVisibility() === 'Search' || $this->getStockStatus($product) === '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);
}
示例6: 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);
}
示例7: processAssert
/**
* Assert that duplicated product is found by sku and has correct product type, product template,
* product status disabled and out of stock
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productGrid
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid)
{
$config = $product->getDataConfig();
$filter = ['name' => $product->getName(), 'visibility' => $product->getVisibility(), 'status' => 'Disabled', 'sku' => $product->getSku() . '-1', 'type' => ucfirst($config['create_url_params']['type']) . ' Product', 'price_to' => number_format($product->getPrice(), 2)];
$productGrid->open()->getProductGrid()->search($filter);
$filter['price_to'] = '$' . $filter['price_to'];
\PHPUnit_Framework_Assert::assertTrue($productGrid->getProductGrid()->isRowVisible($filter, false), 'Product duplicate is absent in Products grid.');
}
示例8: fill
/**
* Fill the product form.
*
* @param FixtureInterface $product
* @param SimpleElement|null $element [optional]
* @param FixtureInterface|null $category [optional]
* @return $this
*/
public function fill(FixtureInterface $product, SimpleElement $element = null, FixtureInterface $category = null)
{
$sections = $this->getFixtureFieldsByContainers($product);
ksort($sections);
if ($category) {
$sections['product-details']['category_ids']['value'] = $category->getName();
}
return $this->fillContainers($sections, $element);
}
示例9: fill
/**
* Fill the product form
*
* @param FixtureInterface $product
* @param SimpleElement|null $element [optional]
* @param FixtureInterface|null $category [optional]
* @return FormTabs
*/
public function fill(FixtureInterface $product, SimpleElement $element = null, FixtureInterface $category = null)
{
$tabs = $this->getFieldsByTabs($product);
ksort($tabs);
if ($category) {
$tabs['product-details']['category_ids']['value'] = $category->getName();
}
$this->showAdvancedSettings();
return $this->fillTabs($tabs, $element);
}
示例10: processAssert
/**
* Assert the product is not displayed on Compare Products page
*
* @param CatalogProductCompare $comparePage
* @param FixtureInterface $product
* @param int $countProducts [optional]
* @return void
*/
public function processAssert(CatalogProductCompare $comparePage, FixtureInterface $product, $countProducts = 0)
{
$comparePage->open();
$compareBlock = $comparePage->getCompareProductsBlock();
if ($countProducts > 1) {
\PHPUnit_Framework_Assert::assertFalse($compareBlock->isProductVisibleInCompareBlock($product->getName()), 'The product displays on Compare Products page.');
} else {
\PHPUnit_Framework_Assert::assertEquals(self::SUCCESS_MESSAGE, $compareBlock->getEmptyMessage(), 'The product displays on Compare Products page.');
}
}
示例11: selectEntityInGrid
/**
* Select entity in grid on layout tab.
*
* @param FixtureInterface $product
* @return void
*/
protected function selectEntityInGrid(FixtureInterface $product)
{
$this->_rootElement->find($this->chooser, Locator::SELECTOR_XPATH)->click();
$this->getTemplateBlock()->waitLoader();
/** @var Grid $productGrid */
$productGrid = $this->blockFactory->create('Magento\\Widget\\Test\\Block\\Adminhtml\\Widget\\Instance\\Edit\\Tab\\WidgetInstanceType\\Product\\Grid', ['element' => $this->_rootElement->find($this->productGrid, Locator::SELECTOR_XPATH)]);
$productGrid->searchAndSelect(['name' => $product->getName()]);
$this->getTemplateBlock()->waitLoader();
$this->_rootElement->find($this->apply, Locator::SELECTOR_XPATH)->click();
}
示例12: processAssert
/**
* Assert the product is not displayed on Compare Products block on my account page
*
* @param CmsIndex $cmsIndex
* @param CustomerAccountIndex $customerAccountIndex
* @param int $countProducts [optional]
* @param FixtureInterface $product [optional]
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, CustomerAccountIndex $customerAccountIndex, $countProducts = 0, FixtureInterface $product = null)
{
$cmsIndex->open();
$cmsIndex->getLinksBlock()->openLink("My Account");
$compareBlock = $customerAccountIndex->getCompareProductsBlock();
if ($countProducts > 1 && $product !== null) {
\PHPUnit_Framework_Assert::assertFalse($compareBlock->isProductVisibleInCompareBlock($product->getName()), 'The product displays on Compare Products block on my account page.');
} else {
\PHPUnit_Framework_Assert::assertEquals(self::SUCCESS_MESSAGE, $compareBlock->getEmptyMessage(), 'The product displays on Compare Products block on my account page.');
}
}
示例13: verifyFullImage
/**
* Verify full image on product page(front-end) is displayed correctly
*
* @return string|null
*/
protected function verifyFullImage()
{
// click base image to see full image
$this->productView->clickBaseImage();
if (!$this->productView->isFullImageVisible()) {
return 'Full image for product ' . $this->product->getName() . ' should be visible after click on base one';
}
if (!$this->isImageLoaded($this->productView->getFullImageSource())) {
return 'Full image file is corrupted or does not exist for product ' . $this->product->getName();
}
$this->productView->closeFullImage();
return null;
}
示例14: getCartItem
/**
* Get cart item block
*
* @param FixtureInterface $product
* @return CartItem
*/
public function getCartItem(FixtureInterface $product)
{
$dataConfig = $product->getDataConfig();
$typeId = isset($dataConfig['type_id']) ? $dataConfig['type_id'] : null;
$cartItem = null;
if ($this->hasRender($typeId)) {
$cartItem = $this->callRender($typeId, 'getCartItem', ['product' => $product]);
} else {
$cartItemBlock = $this->_rootElement->find(sprintf($this->cartItemByProductName, $product->getName()), Locator::SELECTOR_XPATH);
$cartItem = $this->blockFactory->create('Magento\\Weee\\Test\\Block\\Cart\\CartItem', ['element' => $cartItemBlock]);
}
return $cartItem;
}
示例15: assertPrice
/**
* Verify product price on category view page.
*
* @param FixtureInterface $bundle
* @param CatalogCategoryView $catalogCategoryView
* @return void
*/
protected function assertPrice(FixtureInterface $bundle, CatalogCategoryView $catalogCategoryView)
{
/** @var BundleProduct $bundle */
$priceData = $bundle->getDataFieldConfig('price')['source']->getPreset();
//Price from/to verification
$priceBlock = $catalogCategoryView->getListProductBlock()->getProductPriceBlock($bundle->getName());
if ($bundle->hasData('special_price') || $bundle->hasData('group_price')) {
$priceLow = $priceBlock->getFinalPrice();
} else {
$priceLow = $bundle->getPriceView() == 'Price Range' ? $priceBlock->getPriceFrom() : $priceBlock->getRegularPrice();
}
\PHPUnit_Framework_Assert::assertEquals($priceData['price_from'], $priceLow, 'Bundle price From on category page is not correct.');
if ($bundle->getPriceView() == 'Price Range') {
\PHPUnit_Framework_Assert::assertEquals($priceData['price_to'], $priceBlock->getPriceTo(), 'Bundle price To on category page is not correct.');
}
}