You are here

private function AccessStorageTest::mockFormState in Permissions by Term 8

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/AccessStorageTest.php \Drupal\Tests\permissions_by_term\Kernel\AccessStorageTest::mockFormState()
1 call to AccessStorageTest::mockFormState()
AccessStorageTest::testSaveMultipleLanguageCodes in tests/src/Kernel/AccessStorageTest.php

File

tests/src/Kernel/AccessStorageTest.php, line 87

Class

AccessStorageTest
@group permissions_by_term

Namespace

Drupal\Tests\permissions_by_term\Kernel

Code

private function mockFormState($langcode, $accessOutput) {
  $formStateStub = $this
    ->getMockBuilder(FormStateInterface::class)
    ->getMock();
  $map = [
    [
      'langcode',
      NULL,
      [
        [
          'value' => $langcode,
        ],
      ],
    ],
    [
      'access',
      NULL,
      $accessOutput,
    ],
  ];
  $formStateStub
    ->expects($this
    ->any())
    ->method('getValue')
    ->will($this
    ->returnValueMap($map));
  return $formStateStub;
}