function LocaleLookupTest::setUp

Same name and namespace in other branches
  1. 8.9.x 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()
  3. 11.x 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 <a href="/api/drupal/core%21modules%21locale%21src%21LocaleLookup.php/class/LocaleLookup/9" title="A cache collector to allow for dynamic building of the locale cache." class="local">\Drupal\locale\LocaleLookup</a> @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')
        ->willReturn([
        '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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.