Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DeleteProductRatingEntityTest.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\Review\Test\Fixture\Rating;
9 use Magento\Review\Test\Page\Adminhtml\RatingEdit;
10 use Magento\Review\Test\Page\Adminhtml\RatingIndex;
11 use Magento\Mtf\Fixture\FixtureFactory;
12 use Magento\Mtf\TestCase\Injectable;
13 
30 class DeleteProductRatingEntityTest extends Injectable
31 {
32  /* tags */
33  const MVP = 'no';
34  /* end tags */
35 
41  protected $ratingIndex;
42 
48  protected $ratingEdit;
49 
56  public function __prepare(FixtureFactory $fixtureFactory)
57  {
58  $product = $fixtureFactory->createByCode('catalogProductSimple', ['dataset' => 'default']);
59  $product->persist();
60 
61  return ['product' => $product];
62  }
63 
71  public function __inject(RatingIndex $ratingIndex, RatingEdit $ratingEdit)
72  {
73  $this->ratingIndex = $ratingIndex;
74  $this->ratingEdit = $ratingEdit;
75  }
76 
83  public function testDeleteProductRatingEntity(Rating $productRating)
84  {
85  // Preconditions
86  $productRating->persist();
87 
88  // Steps
89  $this->ratingIndex->open();
90  $this->ratingIndex->getRatingGrid()->searchAndOpen(['rating_code' => $productRating->getRatingCode()]);
91  $this->ratingEdit->getPageActions()->delete();
92  $this->ratingEdit->getModalBlock()->acceptAlert();
93  }
94 }
__inject(RatingIndex $ratingIndex, RatingEdit $ratingEdit)