public function ConfigEntityRevisionsRevertFormBaseTest::applyRevisionChangeCallsRightFunctionAndSaves in Config Entity Revisions 1.x
Same name and namespace in other branches
- 8.2 tests/src/Unit/ConfigEntityRevisionsRevertFormBaseTest.php \Drupal\Tests\config_entity_revisions\Unit\ConfigEntityRevisionsRevertFormBaseTest::applyRevisionChangeCallsRightFunctionAndSaves()
- 8 tests/src/Unit/ConfigEntityRevisionsRevertFormBaseTest.php \Drupal\Tests\config_entity_revisions\Unit\ConfigEntityRevisionsRevertFormBaseTest::applyRevisionChangeCallsRightFunctionAndSaves()
Check that applyRevisionChange invokes the right fn and seeks to save.
@test
File
- tests/
src/ Unit/ ConfigEntityRevisionsRevertFormBaseTest.php, line 430
Class
Namespace
Drupal\Tests\config_entity_revisions\UnitCode
public function applyRevisionChangeCallsRightFunctionAndSaves() {
// Older revision -> revert called.
$this->instance = $this
->getMockInstance(300, 'ConfigEntityRevisionsRevertFormTest2');
$revision = $this->mockOldRevision;
$revision
->save()
->shouldBeCalled();
$this->instance
->applyRevisionChange();
$this
->assertTrue($this->instance
->get('prepareRevertedRevisionCalled'));
$this
->assertFalse($this->instance
->get('prepareToPublishCurrentRevisionCalled'));
// Newer revision -> publish called.
$this->instance = $this
->getMockInstance(324, 'ConfigEntityRevisionsRevertFormTest2');
$revision = $this->mockNewRevision;
$revision
->save()
->shouldBeCalled();
$this->instance
->applyRevisionChange();
$this
->assertFalse($this->instance
->get('prepareRevertedRevisionCalled'));
$this
->assertTrue($this->instance
->get('prepareToPublishCurrentRevisionCalled'));
}