public function LocaleLookupTest::testResolveCacheMissWithoutFallback in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/locale/tests/src/Unit/LocaleLookupTest.php \Drupal\Tests\locale\Unit\LocaleLookupTest::testResolveCacheMissWithoutFallback()
Tests locale lookups without fallback.
@covers ::resolveCacheMiss
File
- core/
modules/ locale/ tests/ src/ Unit/ LocaleLookupTest.php, line 101 - Contains \Drupal\Tests\locale\Unit\LocaleLookupTest.
Class
- LocaleLookupTest
- @coversDefaultClass \Drupal\locale\LocaleLookup @group locale
Namespace
Drupal\Tests\locale\UnitCode
public function testResolveCacheMissWithoutFallback() {
$args = array(
'language' => 'en',
'source' => 'test',
'context' => 'irrelevant',
);
$result = (object) array(
'translation' => 'test',
);
$this->cache
->expects($this
->once())
->method('get')
->with('locale:en:irrelevant:anonymous', FALSE);
$this->storage
->expects($this
->once())
->method('findTranslation')
->with($this
->equalTo($args))
->will($this
->returnValue($result));
$locale_lookup = $this
->getMockBuilder('Drupal\\locale\\LocaleLookup')
->setConstructorArgs(array(
'en',
'irrelevant',
$this->storage,
$this->cache,
$this->lock,
$this->configFactory,
$this->languageManager,
$this->requestStack,
))
->setMethods(array(
'persist',
))
->getMock();
$locale_lookup
->expects($this
->never())
->method('persist');
$this
->assertSame('test', $locale_lookup
->get('test'));
}