function LocaleLookupTest::setUp

Same name in other branches
  1. 9 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 \Drupal\locale\LocaleLookup @group locale

Namespace

Drupal\Tests\locale\Unit

Code

protected function setUp() {
    $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);
}

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