public function ConfigEntityRevisionsRevertFormBaseTest::getMockInstance in Config Entity Revisions 8.2
Same name and namespace in other branches
- 8 tests/src/Unit/ConfigEntityRevisionsRevertFormBaseTest.php \Drupal\Tests\config_entity_revisions\Unit\ConfigEntityRevisionsRevertFormBaseTest::getMockInstance()
- 1.x tests/src/Unit/ConfigEntityRevisionsRevertFormBaseTest.php \Drupal\Tests\config_entity_revisions\Unit\ConfigEntityRevisionsRevertFormBaseTest::getMockInstance()
Generate a mock request.
Parameters
int $revisionId: The revision ID being 'reverted'.
string $classname: The class to be instantiated.
Return value
\Drupal\Tests\config_entity_revisions\Unit\ConfigEntityRevisionsRevertFormTest The resulting test class instance.
13 calls to ConfigEntityRevisionsRevertFormBaseTest::getMockInstance()
- ConfigEntityRevisionsRevertFormBaseTest::actionDependsOnWhetherTheRevisionIsPublished in tests/
src/ Unit/ ConfigEntityRevisionsRevertFormBaseTest.php - Check that action is calculated as expected.
- ConfigEntityRevisionsRevertFormBaseTest::applyRevisionChangeCallsRightFunctionAndSaves in tests/
src/ Unit/ ConfigEntityRevisionsRevertFormBaseTest.php - Check that applyRevisionChange invokes the right fn and seeks to save.
- ConfigEntityRevisionsRevertFormBaseTest::buildFormProducesExpectedRenderArray in tests/
src/ Unit/ ConfigEntityRevisionsRevertFormBaseTest.php - Validate the built render array. Should be just what the parent provides.
- ConfigEntityRevisionsRevertFormBaseTest::cancelUrlIsAsExpected in tests/
src/ Unit/ ConfigEntityRevisionsRevertFormBaseTest.php - Check that the cancel URL is as expected.
- ConfigEntityRevisionsRevertFormBaseTest::displayUpdate in tests/
src/ Unit/ ConfigEntityRevisionsRevertFormBaseTest.php - Does displayUpdate display the expected message?
File
- tests/
src/ Unit/ ConfigEntityRevisionsRevertFormBaseTest.php, line 209
Class
- ConfigEntityRevisionsRevertFormBaseTest
- Class ConfigEntityRevisionsRevertFormBaseTest.
Namespace
Drupal\Tests\config_entity_revisions\UnitCode
public function getMockInstance(int $revisionId, $classname = 'ConfigEntityRevisionsRevertFormTest') {
$configEntity = $this->configEntity;
$mock_request = new Request();
$request_stack = $this
->prophesize(RequestStack::CLASS);
$request_stack
->getCurrentRequest()
->willReturn($mock_request);
$router = $this
->prophesize(AccessAwareRouter::CLASS);
$router
->matchRequest($mock_request)
->will(function () use ($configEntity, $revisionId) {
return [
'config_entity' => $configEntity,
'revision_id' => $revisionId,
];
});
$this->container
->set('router', $router
->reveal());
\Drupal::setContainer($this->container);
$classname = 'Drupal\\Tests\\config_entity_revisions\\Unit\\' . $classname;
return $classname::create($this->container);
}