You are here

protected function LocaleLookupTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/locale/tests/src/Unit/LocaleLookupTest.php \Drupal\Tests\locale\Unit\LocaleLookupTest::setUp()
  2. 10 core/modules/locale/tests/src/Unit/LocaleLookupTest.php \Drupal\Tests\locale\Unit\LocaleLookupTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/locale/tests/src/Unit/LocaleLookupTest.php, line 70

Class

LocaleLookupTest
@coversDefaultClass \Drupal\locale\LocaleLookup @group locale

Namespace

Drupal\Tests\locale\Unit

Code

protected function setUp() : void {
  $this->storage = $this
    ->createMock('Drupal\\locale\\StringStorageInterface');
  $this->cache = $this
    ->createMock('Drupal\\Core\\Cache\\CacheBackendInterface');
  $this->lock = $this
    ->createMock('Drupal\\Core\\Lock\\LockBackendInterface');
  $this->lock
    ->expects($this
    ->never())
    ->method($this
    ->anything());
  $this->user = $this
    ->createMock('Drupal\\Core\\Session\\AccountInterface');
  $this->user
    ->expects($this
    ->any())
    ->method('getRoles')
    ->will($this
    ->returnValue([
    'anonymous',
  ]));
  $this->configFactory = $this
    ->getConfigFactoryStub([
    'locale.settings' => [
      'cache_strings' => FALSE,
    ],
  ]);
  $this->languageManager = $this
    ->createMock('Drupal\\Core\\Language\\LanguageManagerInterface');
  $this->requestStack = new RequestStack();
  $container = new ContainerBuilder();
  $container
    ->set('current_user', $this->user);
  \Drupal::setContainer($container);
}