/** * Clear data after test * * @return void */ public function tearDown() { $this->ratingIndex->open(); if ($this->review instanceof Review) { foreach ($this->review->getRatings() as $rating) { $this->ratingIndex->getRatingGrid()->searchAndOpen(['rating_code' => $rating['title']]); $this->ratingEdit->getPageActions()->delete(); } } }
/** * Assert that product rating is displayed on product review(backend) * * @param ReviewIndex $reviewIndex * @param ReviewEdit $reviewEdit * @param Review $review * @param Review|null $reviewInitial [optional] * @return void */ public function processAssert(ReviewIndex $reviewIndex, ReviewEdit $reviewEdit, Review $review, Review $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); }
/** * Clear data after test. * * @return void */ public function tearDown() { if (!$this->reviewInitial instanceof Review) { return; } $this->ratingIndex->open(); foreach ($this->reviewInitial->getRatings() as $rating) { $this->ratingIndex->getRatingGrid()->searchAndOpen(['rating_code' => $rating['title']]); $this->ratingEdit->getPageActions()->delete(); $this->ratingEdit->getModalBlock()->acceptAlert(); } }