Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertProductReviewIsAvailableForProduct.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Fixture\FixtureInterface;
10 use Magento\Reports\Test\Page\Adminhtml\ProductReportReview;
13 use Magento\Review\Test\Page\Adminhtml\ReviewIndex;
14 use Magento\Mtf\Constraint\AbstractConstraint;
15 
19 class AssertProductReviewIsAvailableForProduct extends AbstractConstraint
20 {
31  public function processAssert(
32  ReviewIndex $reviewIndex,
33  Review $review,
34  ProductReportReview $productReportReview,
35  AssertProductReviewInGrid $assertProductReviewInGrid,
36  FixtureInterface $product
37  ) {
38  $productReportReview->open();
39  $productReportReview->getGridBlock()->openReview($product->getName());
40  unset($assertProductReviewInGrid->filter['visible_in']);
41  $filter = $assertProductReviewInGrid->prepareFilter($product, $review->getData(), '');
42  $reviewIndex->getReviewGrid()->resetFilter();
43  \PHPUnit\Framework\Assert::assertTrue(
44  $reviewIndex->getReviewGrid()->isRowVisible($filter, false),
45  'Review for ' . $product->getName() . ' product is not visible in reports grid.'
46  );
47  }
48 
54  public function toString()
55  {
56  return 'Review is visible in review grid for select product.';
57  }
58 }
prepareFilter(FixtureInterface $product, array $review, $gridStatus='')
processAssert(ReviewIndex $reviewIndex, Review $review, ProductReportReview $productReportReview, AssertProductReviewInGrid $assertProductReviewInGrid, FixtureInterface $product)