Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertSetApprovedProductReview.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Constraint\AbstractConstraint;
11 use Magento\Review\Test\Page\Adminhtml\ReviewIndex;
12 use Magento\PageCache\Test\Page\Adminhtml\AdminCache;
13 use Magento\Review\Test\Page\Adminhtml\ReviewEdit;
14 
18 class AssertSetApprovedProductReview extends AbstractConstraint
19 {
25  protected $severeness = 'middle';
26 
32  protected $cachePage;
33 
44  public function processAssert(
45  ReviewIndex $reviewIndex,
46  Review $review,
47  ReviewEdit $reviewEdit,
48  AssertReviewSuccessSaveMessage $assertReviewSuccessSaveMessage,
49  AdminCache $cachePage
50  ) {
51  $this->cachePage = $cachePage;
52  $reviewIndex->open();
53  $reviewGrid = $reviewIndex->getReviewGrid();
54  $reviewGrid->searchAndOpen(['title' => $review->getTitle()]);
55 
56  $reviewEdit->getReviewForm()->setApproveReview();
57  $reviewEdit->getPageActions()->save();
58 
59  $assertReviewSuccessSaveMessage->processAssert($reviewIndex);
61  }
62 
68  protected function flushCacheStorageWithAssert()
69  {
70  $this->cachePage->open();
71  $this->cachePage->getActionsBlock()->flushCacheStorage();
72  $this->cachePage->getModalBlock()->acceptAlert();
73  \PHPUnit\Framework\Assert::assertTrue(
74  $this->cachePage->getActionsBlock()->isStorageCacheFlushed(),
75  'Cache is not flushed.'
76  );
77  }
78 
84  public function toString()
85  {
86  return 'Review status is change to approve.';
87  }
88 }
processAssert(ReviewIndex $reviewIndex, Review $review, ReviewEdit $reviewEdit, AssertReviewSuccessSaveMessage $assertReviewSuccessSaveMessage, AdminCache $cachePage)