function LocaleLookupTest::testResolveCacheMissNoTranslation
Same name in other branches
- 9 core/modules/locale/tests/src/Unit/LocaleLookupTest.php \Drupal\Tests\locale\Unit\LocaleLookupTest::testResolveCacheMissNoTranslation()
- 10 core/modules/locale/tests/src/Unit/LocaleLookupTest.php \Drupal\Tests\locale\Unit\LocaleLookupTest::testResolveCacheMissNoTranslation()
- 11.x core/modules/locale/tests/src/Unit/LocaleLookupTest.php \Drupal\Tests\locale\Unit\LocaleLookupTest::testResolveCacheMissNoTranslation()
Tests locale lookups without a found translation.
@covers ::resolveCacheMiss
File
-
core/
modules/ locale/ tests/ src/ Unit/ LocaleLookupTest.php, line 245
Class
- LocaleLookupTest
- @coversDefaultClass \Drupal\locale\LocaleLookup @group locale
Namespace
Drupal\Tests\locale\UnitCode
public function testResolveCacheMissNoTranslation() {
$string = $this->createMock('Drupal\\locale\\StringInterface');
$string->expects($this->once())
->method('addLocation')
->will($this->returnSelf());
$this->storage
->expects($this->once())
->method('findTranslation')
->will($this->returnValue(NULL));
$this->storage
->expects($this->once())
->method('createString')
->will($this->returnValue($string));
$request = Request::create('/test');
$this->requestStack
->push($request);
$locale_lookup = $this->getMockBuilder('Drupal\\locale\\LocaleLookup')
->setConstructorArgs([
'en',
'irrelevant',
$this->storage,
$this->cache,
$this->lock,
$this->configFactory,
$this->languageManager,
$this->requestStack,
])
->setMethods([
'persist',
])
->getMock();
$locale_lookup->expects($this->never())
->method('persist');
$this->assertTrue($locale_lookup->get('test'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.