Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ApplyRulesAfterReindexTest.php
Go to the documentation of this file.
1 <?php
7 
12 
13 class ApplyRulesAfterReindexTest extends \PHPUnit\Framework\TestCase
14 {
18  private $plugin;
19 
23  private $objectManagerHelper;
24 
28  private $productRuleProcessorMock;
29 
33  private $subjectMock;
34 
35  protected function setUp()
36  {
37  $this->productRuleProcessorMock = $this->getMockBuilder(ProductRuleProcessor::class)
38  ->disableOriginalConstructor()
39  ->getMock();
40  $this->subjectMock = $this->getMockBuilder(Product::class)
41  ->disableOriginalConstructor()
42  ->getMock();
43 
44  $this->objectManagerHelper = new ObjectManagerHelper($this);
45  $this->plugin = $this->objectManagerHelper->getObject(
46  ApplyRulesAfterReindex::class,
47  ['productRuleProcessor' => $this->productRuleProcessorMock]
48  );
49  }
50 
51  public function testAfterReindex()
52  {
53  $id = 'test_id';
54 
55  $this->subjectMock->expects(static::any())
56  ->method('getId')
57  ->willReturn($id);
58  $this->productRuleProcessorMock->expects(static::once())
59  ->method('reindexRow')
60  ->with($id, false);
61 
62  $this->plugin->afterReindex($this->subjectMock);
63  }
64 }
$id
Definition: fieldset.phtml:14