Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
dev
tests
functional
tests
app
Magento
Catalog
Test
Constraint
AssertProductSpecialPriceOnProductPage.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Catalog\Test\Constraint
;
8
9
use
Magento\Catalog\Test\Block\Product\View
;
10
use Magento\Catalog\Test\Page\Product\CatalogProductView;
11
use Magento\Mtf\Client\BrowserInterface;
12
use Magento\Mtf\Constraint\AbstractConstraint;
13
use Magento\Mtf\Fixture\FixtureInterface;
14
18
class
AssertProductSpecialPriceOnProductPage
extends
AbstractConstraint implements
AssertPriceOnProductPageInterface
19
{
25
protected
$errorMessage
=
'Assert that displayed special price on product page NOT equals to passed from fixture.'
;
26
35
public
function
processAssert
(
36
CatalogProductView $catalogProductView,
37
BrowserInterface $browser,
38
FixtureInterface
$product
39
) {
40
$browser->open($_ENV[
'app_frontend_url'
] .
$product
->getUrlKey() .
'.html'
);
41
42
//Process assertions
43
$this->
assertPrice
($product, $catalogProductView->getViewBlock());
44
}
45
52
public
function
setErrorMessage
(
$errorMessage
)
53
{
54
$this->errorMessage =
$errorMessage
;
55
}
56
64
public
function
assertPrice
(FixtureInterface
$product
,
View
$productViewBlock)
65
{
66
$fields
=
$product
->getData();
67
$specialPrice = $productViewBlock->
getPriceBlock
(
$product
)->getSpecialPrice();
68
if
(isset(
$fields
[
'special_price'
])) {
69
\PHPUnit\Framework\Assert::assertEquals(
70
number_format(
$fields
[
'special_price'
], 2),
71
$specialPrice,
72
$this->errorMessage
73
);
74
}
75
}
76
82
public
function
toString
()
83
{
84
return
"Assert that displayed special price on product page equals passed from fixture."
;
85
}
86
}
Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage\processAssert
processAssert(CatalogProductView $catalogProductView, BrowserInterface $browser, FixtureInterface $product)
Definition:
AssertProductSpecialPriceOnProductPage.php:35
Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage
Definition:
AssertProductSpecialPriceOnProductPage.php:18
$fields
$fields
Definition:
details.phtml:14
Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage\assertPrice
assertPrice(FixtureInterface $product, View $productViewBlock)
Definition:
AssertProductSpecialPriceOnProductPage.php:64
Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage\$errorMessage
$errorMessage
Definition:
AssertProductSpecialPriceOnProductPage.php:25
Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage\setErrorMessage
setErrorMessage($errorMessage)
Definition:
AssertProductSpecialPriceOnProductPage.php:52
Magento\Catalog\Test\Constraint
Definition:
AssertAbsenceDeleteAttributeButton.php:7
Magento\Catalog\Test\Constraint\AssertPriceOnProductPageInterface
Definition:
AssertPriceOnProductPageInterface.php:16
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22
Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage\toString
toString()
Definition:
AssertProductSpecialPriceOnProductPage.php:82
Magento\Catalog\Test\Block\Product\View
Definition:
View.php:22
Magento\Catalog\Test\Block\Product\View\getPriceBlock
getPriceBlock(FixtureInterface $product=null)
Definition:
View.php:250
Magento\Catalog\Test\Block\Product\View
Definition:
CustomOptions.php:7