function LocaleLookupTest::testGetCid
Same name in other branches
- 9 core/modules/locale/tests/src/Unit/LocaleLookupTest.php \Drupal\Tests\locale\Unit\LocaleLookupTest::testGetCid()
- 10 core/modules/locale/tests/src/Unit/LocaleLookupTest.php \Drupal\Tests\locale\Unit\LocaleLookupTest::testGetCid()
@covers ::getCid
@dataProvider getCidProvider
File
-
core/
modules/ locale/ tests/ src/ Unit/ LocaleLookupTest.php, line 352
Class
- LocaleLookupTest
- @coversDefaultClass \Drupal\locale\LocaleLookup @group locale
Namespace
Drupal\Tests\locale\UnitCode
public function testGetCid(array $roles, $expected) : void {
$this->user = $this->createMock('Drupal\\Core\\Session\\AccountInterface');
$this->user
->expects($this->any())
->method('getRoles')
->willReturn($roles);
$container = new ContainerBuilder();
$container->set('current_user', $this->user);
\Drupal::setContainer($container);
$locale_lookup = $this->getMockBuilder('Drupal\\locale\\LocaleLookup')
->setConstructorArgs([
'en',
'irrelevant',
$this->storage,
$this->cache,
$this->lock,
$this->configFactory,
$this->languageManager,
$this->requestStack,
])
->getMock();
$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.