You are here

public function ConfigEntityRevisionsRevertFormBaseTest::getMockInstance in Config Entity Revisions 1.x

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/ConfigEntityRevisionsRevertFormBaseTest.php \Drupal\Tests\config_entity_revisions\Unit\ConfigEntityRevisionsRevertFormBaseTest::getMockInstance()
  2. 8 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

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?

... See full list

File

tests/src/Unit/ConfigEntityRevisionsRevertFormBaseTest.php, line 188

Class

ConfigEntityRevisionsRevertFormBaseTest

Namespace

Drupal\Tests\config_entity_revisions\Unit

Code

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);
}