Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ModerateProductReviewEntityTest.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Review\Test\Page\Adminhtml\ReviewEdit;
11 use Magento\Review\Test\Page\Adminhtml\ReviewIndex;
12 use Magento\Mtf\TestCase\Injectable;
13 
30 class ModerateProductReviewEntityTest extends Injectable
31 {
32  /* tags */
33  const MVP = 'no';
34  /* end tags */
35 
41  protected $reviewIndex;
42 
48  protected $reviewEdit;
49 
57  public function __inject(ReviewIndex $reviewIndex, ReviewEdit $reviewEdit)
58  {
59  $this->reviewIndex = $reviewIndex;
60  $this->reviewEdit = $reviewEdit;
61  }
62 
70  public function test(Review $reviewInitial, Review $review)
71  {
72  // Precondition
73  $reviewInitial->persist();
74 
75  // Steps
76  $this->reviewIndex->open();
77  $this->reviewIndex->getReviewGrid()->searchAndOpen(['review_id' => $reviewInitial->getReviewId()]);
78  $this->reviewEdit->getReviewForm()->fill($review);
79  $this->reviewEdit->getPageActions()->save();
80 
81  // Prepare data for asserts
82  $product = $reviewInitial->getDataFieldConfig('entity_id')['source']->getEntity();
83 
84  return ['product' => $product];
85  }
86 }