/**
  * Assert that product rating is displayed on product review page(frontend).
  *
  * @param CatalogProductView $catalogProductView
  * @param ReviewProductList $reviewProductList
  * @param BrowserInterface $browser
  * @param CatalogProductSimple $product
  * @param Review $review
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, ReviewProductList $reviewProductList, BrowserInterface $browser, CatalogProductSimple $product, Review $review)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->openCustomInformationTab('Reviews');
     $catalogProductView->getReviewsBlock()->clickAddReviewLink();
     $reviewForm = $reviewProductList->getReviewFormBlock();
     $ratings = $review->getDataFieldConfig('ratings')['source']->getRatings();
     foreach ($ratings as $rating) {
         \PHPUnit_Framework_Assert::assertTrue($reviewForm->isVisibleRating($rating), 'Product rating "' . $rating->getRatingCode() . '" is not displayed on review product page.');
     }
 }
 /**
  * Add review to product via frontend.
  *
  * @return array
  */
 public function run()
 {
     $product = $this->review->getDataFieldConfig('entity_id')['source']->getEntity();
     $this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     if ($this->isFirstReview) {
         $this->assertProductReviewIsAbsentOnProductPage->processAssert();
     }
     $this->catalogProductView->getViewBlock()->openCustomInformationTab('Reviews');
     $this->catalogProductView->getReviewsBlock()->clickAddReviewLink();
     $reviewForm = $this->reviewProductList->getReviewFormBlock();
     $reviewForm->fill($this->review);
     $reviewForm->submit();
     return ['product' => $product, 'review' => $this->review];
 }
 /**
  * Assert that create success message is displayed after review created on review product page.
  *
  * @param ReviewProductList $reviewProductList
  * @return void
  */
 public function processAssert(ReviewProductList $reviewProductList)
 {
     \PHPUnit_Framework_Assert::assertEquals(self::SUCCESS_MESSAGE, $reviewProductList->getMessagesBlock()->getSuccessMessages());
 }