本文整理匯總了PHP中Mtf\Fixture\FixtureInterface::getName方法的典型用法代碼示例。如果您正苦於以下問題:PHP FixtureInterface::getName方法的具體用法?PHP FixtureInterface::getName怎麽用?PHP FixtureInterface::getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Mtf\Fixture\FixtureInterface
的用法示例。
在下文中一共展示了FixtureInterface::getName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: processAssert
/**
* Assert that product is not visible in the assigned category
*
* @param CatalogCategoryView $catalogCategoryView
* @param CmsIndex $cmsIndex
* @param FixtureInterface $product
* @param CatalogCategory|null $category
* @return void
*/
public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, FixtureInterface $product, CatalogCategory $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.');
}
示例2: 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);
}
示例3: assertOnShoppingCart
/**
* Assert prices on the shopping cart
*
* @param FixtureInterface $product
* @param CheckoutCart $checkoutCart
* @return void
*/
protected function assertOnShoppingCart(FixtureInterface $product, CheckoutCart $checkoutCart)
{
$cartBlock = $checkoutCart->getCartBlock();
$productName = $product->getName();
$productOptions = $product->getCustomOptions();
$priceComparing = $product->getPrice();
if ($groupPrice = $product->getGroupPrice()) {
$groupPrice = reset($groupPrice);
$priceComparing = $groupPrice['price'];
}
if ($specialPrice = $product->getSpecialPrice()) {
$priceComparing = $specialPrice;
}
if (!empty($productOptions)) {
$productOption = reset($productOptions);
$optionsData = reset($productOption['options']);
$optionName = $cartBlock->getCartItemOptionsNameByProductName($productName);
$optionValue = $cartBlock->getCartItemOptionsValueByProductName($productName);
\PHPUnit_Framework_Assert::assertTrue(trim($optionName) === $productOption['title'] && trim($optionValue) === $optionsData['title'], 'In the cart wrong option product.');
if ($optionsData['price_type'] === 'Percent') {
$priceComparing = $priceComparing * (1 + $optionsData['price'] / 100);
} else {
$priceComparing += $optionsData['price'];
}
}
$price = $checkoutCart->getCartBlock()->getProductPriceByName($productName);
\PHPUnit_Framework_Assert::assertEquals(number_format($priceComparing, 2), $price, 'Product price in shopping cart is not correct.');
}
示例4: processAssert
/**
* Assert that product is visible in the assigned category
*
* @param CatalogCategoryView $catalogCategoryView
* @param CmsIndex $cmsIndex
* @param FixtureInterface $product
* @param CatalogCategory|null $category
* @return void
*
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, FixtureInterface $product, CatalogCategory $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);
}
示例5: 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);
}
示例6: 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.');
}
示例7: 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);
}
示例8: prepareData
/**
* Prepare array for assert
*
* @param CatalogProductView $catalogProductView
* @return array
*/
protected function prepareData(CatalogProductView $catalogProductView)
{
$viewBlock = $catalogProductView->getViewBlock();
$price = $viewBlock->getProductPriceBlock()->getPrice();
$data = ['onPage' => ['name' => $viewBlock->getProductName(), 'sku' => $viewBlock->getProductSku()], 'fixture' => ['name' => $this->product->getName(), 'sku' => $this->product->getSku()]];
list($priceOnPage, $priceFixture) = $this->preparePrice($price);
$data['onPage'] += $priceOnPage;
$data['fixture'] += $priceFixture;
if ($productShortDescription = $this->product->getShortDescription()) {
$data['fixture']['short_description'] = $productShortDescription;
$data['onPage']['short_description'] = $viewBlock->getProductShortDescription();
}
if ($productDescription = $this->product->getDescription()) {
$data['fixture']['description'] = $productDescription;
$data['onPage']['description'] = $viewBlock->getProductDescription();
}
return $data;
}
示例9: assertOnProductView
/**
* Assert prices on the product view page
*
* @param CatalogProductView $catalogProductView
* @return void
*/
protected function assertOnProductView(CatalogProductView $catalogProductView)
{
$viewBlock = $catalogProductView->getViewBlock();
$price = $viewBlock->getProductPriceBlock()->getPrice();
$errorsMessages = ['name' => '- product name on product view page is not correct.', 'sku' => '- product sku on product view page is not correct.', 'regular_price' => '- product regular price on product view page is not correct.', 'short_description' => '- product short description on product view page is not correct.', 'description' => '- product description on product view page is not correct.'];
$dataOnPage = ['name' => $viewBlock->getProductName(), 'sku' => $viewBlock->getProductSku(), 'regular_price' => $price['price_regular_price']];
$compareData = ['name' => $this->product->getName(), 'sku' => $this->product->getSku(), 'regular_price' => number_format($this->product->getPrice(), 2)];
if ($productShortDescription = $this->product->getShortDescription()) {
$compareData['short_description'] = $productShortDescription;
$dataOnPage['short_description'] = $viewBlock->getProductShortDescription();
}
if ($productDescription = $this->product->getDescription()) {
$compareData['description'] = $productDescription;
$dataOnPage['description'] = $viewBlock->getProductDescription();
}
$badValues = array_diff($dataOnPage, $compareData);
$errorsMessages = array_merge($this->assertSpecialPrice($price), array_intersect_key($errorsMessages, array_keys($badValues)));
\PHPUnit_Framework_Assert::assertTrue(empty($errorsMessages), PHP_EOL . 'Found the following errors:' . PHP_EOL . implode(' ' . PHP_EOL, $errorsMessages));
}
示例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: 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.');
}
}
示例12: getCartItem
/**
* Get cart item block
*
* @param FixtureInterface $product
* @return \Magento\Checkout\Test\Block\Cart\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\\Checkout\\Test\\Block\\Cart\\CartItem', ['element' => $cartItemBlock]);
}
return $cartItem;
}
示例13: isNotDisplayingOnFrontendAssert
/**
* Verify product displaying on frontend
*
* @param FixtureInterface $product
* @return array
*/
protected function isNotDisplayingOnFrontendAssert(FixtureInterface $product)
{
$errors = [];
// Check the product page is not available
// TODO fix initialization url for frontend page
$this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$titleBlock = $this->catalogProductView->getTitleBlock();
if ($titleBlock->getTitle() !== self::NOT_FOUND_MESSAGE) {
$errors[] = '- the headline on the page does not match, the text should be -> "' . self::NOT_FOUND_MESSAGE . '".';
}
$this->cmsIndex->open();
$this->cmsIndex->getSearchBlock()->search($product->getSku());
if ($this->catalogSearchResult->getListProductBlock()->isProductVisible($product->getName())) {
$errors[] = '- successful product search.';
}
$categoryName = $product->hasData('category_ids') ? $product->getCategoryIds()[0] : $this->category->getName();
$this->cmsIndex->open();
$this->cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$isProductVisible = $this->catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
while (!$isProductVisible && $this->catalogCategoryView->getBottomToolbar()->nextPage()) {
$isProductVisible = $this->catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
}
if ($isProductVisible) {
$errors[] = '- product with name "{$product->getName()}" is found in this category.';
}
return $errors;
}
示例14: getCartItem
/**
* Get cart item block
*
* @param FixtureInterface $product
* @return \Magento\Checkout\Test\Block\Cart\CartItem
*/
public function getCartItem(FixtureInterface $product)
{
$cartItem = $this->_rootElement->find(sprintf($this->cartItemByProductName, $product->getName()), Locator::SELECTOR_XPATH);
return $this->blockFactory->create('Magento\\Checkout\\Test\\Block\\Cart\\CartItem', ['element' => $cartItem]);
}
示例15: assertPrice
/**
* Verify product price on category view page
*
* @param FixtureInterface $product
* @param CatalogCategoryView $catalogCategoryView
* @return void
*/
protected function assertPrice(FixtureInterface $product, CatalogCategoryView $catalogCategoryView)
{
$price = $catalogCategoryView->getListProductBlock()->getProductPriceBlock($product->getName())->getRegularPrice();
\PHPUnit_Framework_Assert::assertEquals(number_format($product->getPrice(), 2), $price, 'Product regular price on category page is not correct.');
}