/**
  * Clear data after test
  *
  * @return void
  */
 public function tearDown()
 {
     $this->ratingIndex->open();
     if ($this->review instanceof ReviewInjectable) {
         foreach ($this->review->getRatings() as $rating) {
             $this->ratingIndex->getRatingGrid()->searchAndOpen(['rating_code' => $rating['title']]);
             $this->ratingEdit->getPageActions()->delete();
         }
     }
 }
 /**
  * Clear data after test
  *
  * @return void
  */
 public function tearDown()
 {
     $this->ratingIndex->open();
     $ratingGrid = $this->ratingIndex->getRatingGrid();
     $pageActions = $this->ratingEdit->getPageActions();
     foreach ($this->review->getRatings() as $rating) {
         $ratingGrid->searchAndOpen(['rating_code' => $rating['title']]);
         $pageActions->delete();
     }
 }
 /**
  * Assert that product rating is displayed on product review(backend)
  *
  * @param ReviewIndex $reviewIndex
  * @param ReviewEdit $reviewEdit
  * @param ReviewInjectable $review
  * @param ReviewInjectable|null $reviewInitial [optional]
  * @return void
  */
 public function processAssert(ReviewIndex $reviewIndex, ReviewEdit $reviewEdit, ReviewInjectable $review, ReviewInjectable $reviewInitial = null)
 {
     $filter = ['title' => $review->getTitle()];
     $reviewIndex->open();
     $reviewIndex->getReviewGrid()->searchAndOpen($filter);
     $ratingReview = array_replace($reviewInitial && $reviewInitial->hasData('ratings') ? $reviewInitial->getRatings() : [], $review->hasData('ratings') ? $review->getRatings() : []);
     $ratingReview = $this->sortDataByPath($ratingReview, '::title');
     $ratingForm = $reviewEdit->getReviewForm()->getData();
     $ratingForm = $this->sortDataByPath($ratingForm['ratings'], '::title');
     $error = $this->verifyData($ratingReview, $ratingForm);
     \PHPUnit_Framework_Assert::assertTrue(empty($error), $error);
 }
Пример #4
0
 /**
  * Fill ratings on the review form
  *
  * @param ReviewInjectable $review
  * @return void
  */
 protected function fillRatings(ReviewInjectable $review)
 {
     if (!$review->hasData('ratings')) {
         return;
     }
     foreach ($review->getRatings() as $rating) {
         $this->setRating($rating['title'], $rating['rating']);
     }
 }