|
17 | 17 | use Magento\Indexer\Model\Indexer\CollectionFactory;
|
18 | 18 | use Magento\Indexer\Model\Indexer\State;
|
19 | 19 | use Magento\Indexer\Model\Indexer\StateFactory;
|
| 20 | +use Magento\Indexer\Model\WorkingStateProvider; |
20 | 21 | use PHPUnit\Framework\MockObject\MockObject;
|
21 | 22 | use PHPUnit\Framework\TestCase;
|
22 | 23 |
|
@@ -55,8 +56,16 @@ class IndexerTest extends TestCase
|
55 | 56 | */
|
56 | 57 | protected $indexFactoryMock;
|
57 | 58 |
|
| 59 | + /** |
| 60 | + * @var WorkingStateProvider|MockObject |
| 61 | + */ |
| 62 | + private $workingStateProvider; |
| 63 | + |
58 | 64 | protected function setUp(): void
|
59 | 65 | {
|
| 66 | + $this->workingStateProvider = $this->getMockBuilder(WorkingStateProvider::class) |
| 67 | + ->disableOriginalConstructor() |
| 68 | + ->getMock(); |
60 | 69 | $this->configMock = $this->getMockForAbstractClass(
|
61 | 70 | ConfigInterface::class,
|
62 | 71 | [],
|
@@ -99,7 +108,8 @@ protected function setUp(): void
|
99 | 108 | $structureFactory,
|
100 | 109 | $this->viewMock,
|
101 | 110 | $this->stateFactoryMock,
|
102 |
| - $this->indexFactoryMock |
| 111 | + $this->indexFactoryMock, |
| 112 | + $this->workingStateProvider |
103 | 113 | );
|
104 | 114 | }
|
105 | 115 |
|
@@ -211,7 +221,7 @@ public function testReindexAll()
|
211 | 221 | $stateMock->expects($this->never())->method('setIndexerId');
|
212 | 222 | $stateMock->expects($this->once())->method('getId')->willReturn(1);
|
213 | 223 | $stateMock->expects($this->exactly(2))->method('setStatus')->willReturnSelf();
|
214 |
| - $stateMock->expects($this->once())->method('getStatus')->willReturn('idle'); |
| 224 | + $stateMock->expects($this->any())->method('getStatus')->willReturn('idle'); |
215 | 225 | $stateMock->expects($this->exactly(2))->method('save')->willReturnSelf();
|
216 | 226 | $this->stateFactoryMock->expects($this->once())->method('create')->willReturn($stateMock);
|
217 | 227 |
|
@@ -251,7 +261,7 @@ public function testReindexAllWithException()
|
251 | 261 | $stateMock->expects($this->never())->method('setIndexerId');
|
252 | 262 | $stateMock->expects($this->once())->method('getId')->willReturn(1);
|
253 | 263 | $stateMock->expects($this->exactly(2))->method('setStatus')->willReturnSelf();
|
254 |
| - $stateMock->expects($this->once())->method('getStatus')->willReturn('idle'); |
| 264 | + $stateMock->expects($this->any())->method('getStatus')->willReturn('idle'); |
255 | 265 | $stateMock->expects($this->exactly(2))->method('save')->willReturnSelf();
|
256 | 266 | $this->stateFactoryMock->expects($this->once())->method('create')->willReturn($stateMock);
|
257 | 267 |
|
@@ -296,7 +306,7 @@ public function testReindexAllWithError()
|
296 | 306 | $stateMock->expects($this->never())->method('setIndexerId');
|
297 | 307 | $stateMock->expects($this->once())->method('getId')->willReturn(1);
|
298 | 308 | $stateMock->expects($this->exactly(2))->method('setStatus')->willReturnSelf();
|
299 |
| - $stateMock->expects($this->once())->method('getStatus')->willReturn('idle'); |
| 309 | + $stateMock->expects($this->any())->method('getStatus')->willReturn('idle'); |
300 | 310 | $stateMock->expects($this->exactly(2))->method('save')->willReturnSelf();
|
301 | 311 | $this->stateFactoryMock->expects($this->once())->method('create')->willReturn($stateMock);
|
302 | 312 |
|
|
0 commit comments