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
Review
Test
Constraint
AssertProductRatingInProductPage.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Review\Test\Constraint
;
8
9
use
Magento\Catalog\Test\Fixture\CatalogProductSimple
;
10
use Magento\Catalog\Test\Page\Product\CatalogProductView;
11
use Magento\Review\Test\Fixture\Rating;
12
use
Magento\Review\Test\Fixture\Review
;
13
use Magento\Mtf\Client\BrowserInterface;
14
use Magento\Mtf\Constraint\AbstractConstraint;
15
20
class
AssertProductRatingInProductPage
extends
AbstractConstraint
21
{
32
public
function
processAssert
(
33
CatalogProductView $catalogProductView,
34
BrowserInterface $browser,
35
CatalogProductSimple
$product
,
36
Review
$review
=
null
,
37
Rating $productRating =
null
38
) {
39
$browser->open($_ENV[
'app_frontend_url'
] .
$product
->getUrlKey() .
'.html'
);
40
$reviewSummaryBlock = $catalogProductView->getReviewSummary();
41
if
($reviewSummaryBlock->isVisible()) {
42
$reviewSummaryBlock->getAddReviewLink()->click();
43
}
44
$rating
= $productRating ? $productRating :
$review
->getDataFieldConfig(
'ratings'
)[
'source'
]->getRatings()[0];
45
$reviewForm = $catalogProductView->getReviewFormBlock();
46
\PHPUnit\Framework\Assert::assertTrue(
47
$reviewForm->isVisibleRating(
$rating
),
48
'Product rating "'
.
$rating
->getRatingCode() .
'" is not displayed.'
49
);
50
}
51
57
public
function
toString
()
58
{
59
return
'Product rating is displayed.'
;
60
}
61
}
Magento\Review\Test\Fixture\Review
Definition:
EntityId.php:7
Magento\Review\Test\Constraint\AssertProductRatingInProductPage\processAssert
processAssert(CatalogProductView $catalogProductView, BrowserInterface $browser, CatalogProductSimple $product, Review $review=null, Rating $productRating=null)
Definition:
AssertProductRatingInProductPage.php:32
$rating
$rating
Definition:
item.phtml:18
Magento\Catalog\Test\Fixture\CatalogProductSimple
Definition:
CustomAttribute.php:7
Magento\Review\Test\Constraint\AssertProductRatingInProductPage\toString
toString()
Definition:
AssertProductRatingInProductPage.php:57
$review
$review
Definition:
customer_review.php:14
Magento\Review\Test\Constraint\AssertProductRatingInProductPage
Definition:
AssertProductRatingInProductPage.php:20
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22
Magento\Review\Test\Constraint
Definition:
AssertProductRatingInGrid.php:7