function LocaleLookupTest::testGetCid
Same name and namespace in other branches
- 10 core/modules/locale/tests/src/Unit/LocaleLookupTest.php \Drupal\Tests\locale\Unit\LocaleLookupTest::testGetCid()
- 11.x core/modules/locale/tests/src/Unit/LocaleLookupTest.php \Drupal\Tests\locale\Unit\LocaleLookupTest::testGetCid()
- 9 core/modules/locale/tests/src/Unit/LocaleLookupTest.php \Drupal\Tests\locale\Unit\LocaleLookupTest::testGetCid()
Tests get cid.
Attributes
#[DataProvider('getCidProvider')]
File
-
core/
modules/ locale/ tests/ src/ Unit/ LocaleLookupTest.php, line 371
Class
Namespace
Drupal\Tests\locale\UnitCode
public function testGetCid(array $roles, $expected) : void {
$this->storage
->expects($this->never())
->method('findTranslation');
$this->user = $this->createStub(AccountInterface::class);
$this->user
->method('getRoles')
->willReturn($roles);
$container = new ContainerBuilder();
$container->set('current_user', $this->user);
\Drupal::setContainer($container);
$locale_lookup = new LocaleLookup('en', 'irrelevant', $this->storage, $this->createStub(CacheBackendInterface::class), $this->lock, $this->configFactory, $this->languageManager, $this->requestStack);
$o = new \ReflectionObject($locale_lookup);
$method = $o->getMethod('getCid');
$cid = $method->invoke($locale_lookup, 'getCid');
$this->assertEquals($expected, $cid);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.