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
TestCase
ManageProductReviewFromCustomerPageTest.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Review\Test\TestCase
;
8
9
use
Magento\Catalog\Test\Fixture\CatalogProductSimple
;
10
use Magento\Catalog\Test\Page\Product\CatalogProductView;
11
use
Magento\Customer\Test\Fixture\Customer
;
12
use Magento\Customer\Test\Page\Adminhtml\CustomerIndex;
13
use Magento\Customer\Test\Page\Adminhtml\CustomerIndexEdit;
14
use
Magento\Review\Test\Fixture\Review
;
15
use Magento\Review\Test\Page\Adminhtml\RatingEdit;
16
use Magento\Review\Test\Page\Adminhtml\RatingIndex;
17
use Magento\Review\Test\Page\Adminhtml\ReviewEdit;
18
use Magento\Mtf\Client\BrowserInterface;
19
use Magento\Mtf\TestCase\Injectable;
20
42
class
ManageProductReviewFromCustomerPageTest
extends
Injectable
43
{
44
/* tags */
45
const
MVP
=
'no'
;
46
const
TO_MAINTAIN
=
'yes'
;
47
/* end tags */
48
54
protected
$customerIndex
;
55
61
protected
$customerIndexEdit
;
62
68
protected
$catalogProductView
;
69
75
protected
$browser
;
76
82
protected
$ratingIndex
;
83
89
protected
$ratingEdit
;
90
96
protected
$reviewInitial
;
97
103
protected
$reviewEdit
;
104
111
public
function
__prepare
(Customer
$customer
)
112
{
113
$customer
->persist();
114
return
[
'customer'
=>
$customer
];
115
}
116
129
public
function
__inject
(
130
CustomerIndexEdit
$customerIndexEdit
,
131
CustomerIndex
$customerIndex
,
132
CatalogProductView
$catalogProductView
,
133
BrowserInterface
$browser
,
134
RatingIndex
$ratingIndex
,
135
RatingEdit
$ratingEdit
,
136
ReviewEdit
$reviewEdit
137
) {
138
$this->customerIndexEdit =
$customerIndexEdit
;
139
$this->customerIndex =
$customerIndex
;
140
$this->catalogProductView =
$catalogProductView
;
141
$this->browser =
$browser
;
142
$this->ratingIndex =
$ratingIndex
;
143
$this->ratingEdit =
$ratingEdit
;
144
$this->reviewEdit =
$reviewEdit
;
145
}
146
155
public
function
test(
156
Review
$reviewInitial
,
157
Review
$review
,
158
Customer
$customer
159
) {
160
// Preconditions
161
$this->
login
($customer);
163
$product
=
$reviewInitial
->getDataFieldConfig(
'entity_id'
)[
'source'
]->getEntity();
164
$this->browser->open($_ENV[
'app_frontend_url'
] .
$product
->getUrlKey() .
'.html'
);
165
$this->catalogProductView->getReviewSummary()->getAddReviewLink()->click();
166
$this->catalogProductView->getReviewFormBlock()->fill(
$reviewInitial
);
167
$this->catalogProductView->getReviewFormBlock()->submit();
168
$this->reviewInitial =
$reviewInitial
;
169
// Steps
170
$this->customerIndex->open();
171
$this->customerIndex->getCustomerGridBlock()->searchAndOpen([
'email'
=>
$customer
->getEmail()]);
172
$this->customerIndexEdit->getCustomerForm()->openTab(
'product_reviews'
);
173
$filter = [
174
'title'
=>
$reviewInitial
->getTitle(),
175
'sku'
=>
$product
->getSku(),
176
];
177
$this->customerIndexEdit->getCustomerForm()->getTab(
'product_reviews'
)->getReviewsGrid()
178
->searchAndOpen($filter);
179
$this->reviewEdit->getReviewForm()->fill(
$review
);
180
$this->reviewEdit->getPageActions()->save();
181
182
return
[
'reviewInitial'
=>
$reviewInitial
,
'product'
=>
$product
];
183
}
184
191
protected
function
login
(Customer
$customer
)
192
{
193
$this->objectManager->create(
194
\
Magento
\Customer\Test\TestStep\LoginCustomerOnFrontendStep::class,
195
[
'customer'
=>
$customer
]
196
)->run();
197
}
198
204
public
function
tearDown
()
205
{
206
$this->ratingIndex->open();
207
if
($this->reviewInitial instanceof Review) {
208
foreach
($this->reviewInitial->getRatings() as
$rating
) {
209
$this->ratingIndex->getRatingGrid()->searchAndOpen([
'rating_code'
=>
$rating
[
'title'
]]);
210
$this->ratingEdit->getPageActions()->delete();
211
$this->ratingEdit->getModalBlock()->acceptAlert();
212
}
213
}
214
}
215
}
Magento\Review\Test\Fixture\Review
Definition:
EntityId.php:7
Magento\Review\Test\TestCase\ManageProductReviewFromCustomerPageTest\login
login(Customer $customer)
Definition:
ManageProductReviewFromCustomerPageTest.php:191
Magento\Review\Test\TestCase\ManageProductReviewFromCustomerPageTest
Definition:
ManageProductReviewFromCustomerPageTest.php:42
Magento\Review\Test\TestCase\ManageProductReviewFromCustomerPageTest\tearDown
tearDown()
Definition:
ManageProductReviewFromCustomerPageTest.php:204
$customer
$customer
Definition:
customers.php:11
Magento\Review\Test\TestCase\ManageProductReviewFromCustomerPageTest\$reviewEdit
$reviewEdit
Definition:
ManageProductReviewFromCustomerPageTest.php:103
$rating
$rating
Definition:
item.phtml:18
Magento\Review\Test\TestCase\ManageProductReviewFromCustomerPageTest\$ratingEdit
$ratingEdit
Definition:
ManageProductReviewFromCustomerPageTest.php:89
Magento\Review\Test\TestCase\ManageProductReviewFromCustomerPageTest\$browser
$browser
Definition:
ManageProductReviewFromCustomerPageTest.php:75
Magento\Review\Test\TestCase\ManageProductReviewFromCustomerPageTest\$ratingIndex
$ratingIndex
Definition:
ManageProductReviewFromCustomerPageTest.php:82
Magento\Review\Test\TestCase\ManageProductReviewFromCustomerPageTest\$customerIndexEdit
$customerIndexEdit
Definition:
ManageProductReviewFromCustomerPageTest.php:61
Magento\Review\Test\TestCase\ManageProductReviewFromCustomerPageTest\MVP
const MVP
Definition:
ManageProductReviewFromCustomerPageTest.php:45
Magento\Review\Test\TestCase\ManageProductReviewFromCustomerPageTest\$reviewInitial
$reviewInitial
Definition:
ManageProductReviewFromCustomerPageTest.php:96
Magento\Catalog\Test\Fixture\CatalogProductSimple
Definition:
CustomAttribute.php:7
Magento\Review\Test\TestCase\ManageProductReviewFromCustomerPageTest\$catalogProductView
$catalogProductView
Definition:
ManageProductReviewFromCustomerPageTest.php:68
$review
$review
Definition:
customer_review.php:14
Magento\Review\Test\TestCase\ManageProductReviewFromCustomerPageTest\__inject
__inject(CustomerIndexEdit $customerIndexEdit, CustomerIndex $customerIndex, CatalogProductView $catalogProductView, BrowserInterface $browser, RatingIndex $ratingIndex, RatingEdit $ratingEdit, ReviewEdit $reviewEdit)
Definition:
ManageProductReviewFromCustomerPageTest.php:129
Magento
Magento\Review\Test\TestCase
Definition:
CreateProductRatingEntityTest.php:7
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22
Magento\Review\Test\TestCase\ManageProductReviewFromCustomerPageTest\$customerIndex
$customerIndex
Definition:
ManageProductReviewFromCustomerPageTest.php:54
Magento\Review\Test\TestCase\ManageProductReviewFromCustomerPageTest\__prepare
__prepare(Customer $customer)
Definition:
ManageProductReviewFromCustomerPageTest.php:111
Magento\Customer\Test\Fixture\Customer
Definition:
Address.php:7
Magento\Review\Test\TestCase\ManageProductReviewFromCustomerPageTest\TO_MAINTAIN
const TO_MAINTAIN
Definition:
ManageProductReviewFromCustomerPageTest.php:46