|
22 | 22 | use PHPUnit\Framework\MockObject\MockObject; |
23 | 23 | use PHPUnit\Framework\TestCase; |
24 | 24 |
|
25 | | -/** test Mview functionality |
| 25 | +/** |
| 26 | + * Test Mview functionality |
| 27 | + * |
| 28 | + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) |
26 | 29 | */ |
27 | 30 | class ViewTest extends TestCase |
28 | 31 | { |
@@ -517,6 +520,41 @@ function () { |
517 | 520 | $this->model->update(); |
518 | 521 | } |
519 | 522 |
|
| 523 | + /** |
| 524 | + * Test update with no changes in the changelog |
| 525 | + */ |
| 526 | + public function testUpdateWithNoChanges() |
| 527 | + { |
| 528 | + $currentVersionId = 3; |
| 529 | + $lastVersionId = 3; |
| 530 | + |
| 531 | + $this->stateMock->method('getViewId') |
| 532 | + ->willReturn(1); |
| 533 | + $this->stateMock->method('getMode') |
| 534 | + ->willReturn(StateInterface::MODE_ENABLED); |
| 535 | + $this->stateMock->method('getStatus') |
| 536 | + ->willReturn(StateInterface::STATUS_IDLE); |
| 537 | + $this->stateMock->expects(self::once()) |
| 538 | + ->method('getVersionId') |
| 539 | + ->willReturn($lastVersionId); |
| 540 | + $this->changelogMock->expects(self::once()) |
| 541 | + ->method('getVersion') |
| 542 | + ->willReturn($currentVersionId); |
| 543 | + |
| 544 | + $this->stateMock->expects(self::never()) |
| 545 | + ->method('setVersionId'); |
| 546 | + $this->stateMock->expects(self::never()) |
| 547 | + ->method('setStatus'); |
| 548 | + $this->stateMock->expects(self::never()) |
| 549 | + ->method('save'); |
| 550 | + $this->actionFactoryMock->expects(self::never()) |
| 551 | + ->method('get'); |
| 552 | + $this->iteratorMock->expects(self::never()) |
| 553 | + ->method('walk'); |
| 554 | + |
| 555 | + $this->model->update(); |
| 556 | + } |
| 557 | + |
520 | 558 | /** |
521 | 559 | * Test to Suspend view updates and set version ID to changelog's end |
522 | 560 | */ |
|
0 commit comments