2014-09-03 16:52:33 +00:00
|
|
|
<?php
|
2019-05-01 13:56:41 +00:00
|
|
|
|
|
|
|
|
use MediaWiki\Config\ServiceOptions;
|
2023-01-30 03:53:09 +00:00
|
|
|
use MediaWiki\Tests\Unit\DummyServicesTrait;
|
2019-05-01 13:56:41 +00:00
|
|
|
use Psr\Log\NullLogger;
|
LocalisationCache: Load only core data if possible
Extract loadCoreData(), which loads only the core, non-mergeable keys
from the core messages files, not the extension messages files or the
JSON files. Have loadItem() call this method, skipping the full
initLanguage() + recache(), if possible.
Because compiling the plural rules takes up a significant amount of
loading the core-only data (see discussion on Gerrit), extract
readPluralFilesAndRegisterDeps() from readSourceFilesAndRegisterDeps(),
and only call the latter in loadCoreData() (while recache() calls both).
Also remove a comment about readSourceFilesAndRegisterDeps() returning
false if the localisation doesn’t exist, which AFAICT hasn’t been true
since change I35bbb3a7a1 (commit 8e0c0a9fc9) in 2014.
Note that the new “core-only data” path in loadItem() bypasses the
underlying LCStore even if the core data (or indeed all data) happens to
be present in it. Some investigation and benchmarks (see the discussion
on this change on Gerrit) indicate that this is usually a performance
win; in particular, unless manualRecache is set, just checking whether
the LCStore is expired is relatively expensive.
[For further discussion, see also changes I00f2018400 and I64822e050e on
Gerrit, which were later squashed into this change.]
Bug: T342418
Change-Id: I7ec2d87c0f864c7dbfd629f0b47f22dc8a6fa552
2023-07-21 11:19:29 +00:00
|
|
|
use Wikimedia\TestingAccessWrapper;
|
2019-05-01 13:56:41 +00:00
|
|
|
|
2014-09-03 16:52:33 +00:00
|
|
|
/**
|
|
|
|
|
* @group Database
|
|
|
|
|
* @group Cache
|
|
|
|
|
* @covers LocalisationCache
|
|
|
|
|
* @author Niklas Laxström
|
|
|
|
|
*/
|
2020-06-30 15:09:24 +00:00
|
|
|
class LocalisationCacheTest extends MediaWikiIntegrationTestCase {
|
2023-01-30 03:53:09 +00:00
|
|
|
use DummyServicesTrait;
|
2014-09-03 16:52:33 +00:00
|
|
|
|
2014-12-03 22:12:52 +00:00
|
|
|
/**
|
Hooks::run() call site migration
Migrate all callers of Hooks::run() to use the new
HookContainer/HookRunner system.
General principles:
* Use DI if it is already used. We're not changing the way state is
managed in this patch.
* HookContainer is always injected, not HookRunner. HookContainer
is a service, it's a more generic interface, it is the only
thing that provides isRegistered() which is needed in some cases,
and a HookRunner can be efficiently constructed from it
(confirmed by benchmark). Because HookContainer is needed
for object construction, it is also needed by all factories.
* "Ask your friendly local base class". Big hierarchies like
SpecialPage and ApiBase have getHookContainer() and getHookRunner()
methods in the base class, and classes that extend that base class
are not expected to know or care where the base class gets its
HookContainer from.
* ProtectedHookAccessorTrait provides protected getHookContainer() and
getHookRunner() methods, getting them from the global service
container. The point of this is to ease migration to DI by ensuring
that call sites ask their local friendly base class rather than
getting a HookRunner from the service container directly.
* Private $this->hookRunner. In some smaller classes where accessor
methods did not seem warranted, there is a private HookRunner property
which is accessed directly. Very rarely (two cases), there is a
protected property, for consistency with code that conventionally
assumes protected=private, but in cases where the class might actually
be overridden, a protected accessor is preferred over a protected
property.
* The last resort: Hooks::runner(). Mostly for static, file-scope and
global code. In a few cases it was used for objects with broken
construction schemes, out of horror or laziness.
Constructors with new required arguments:
* AuthManager
* BadFileLookup
* BlockManager
* ClassicInterwikiLookup
* ContentHandlerFactory
* ContentSecurityPolicy
* DefaultOptionsManager
* DerivedPageDataUpdater
* FullSearchResultWidget
* HtmlCacheUpdater
* LanguageFactory
* LanguageNameUtils
* LinkRenderer
* LinkRendererFactory
* LocalisationCache
* MagicWordFactory
* MessageCache
* NamespaceInfo
* PageEditStash
* PageHandlerFactory
* PageUpdater
* ParserFactory
* PermissionManager
* RevisionStore
* RevisionStoreFactory
* SearchEngineConfig
* SearchEngineFactory
* SearchFormWidget
* SearchNearMatcher
* SessionBackend
* SpecialPageFactory
* UserNameUtils
* UserOptionsManager
* WatchedItemQueryService
* WatchedItemStore
Constructors with new optional arguments:
* DefaultPreferencesFactory
* Language
* LinkHolderArray
* MovePage
* Parser
* ParserCache
* PasswordReset
* Router
setHookContainer() now required after construction:
* AuthenticationProvider
* ResourceLoaderModule
* SearchEngine
Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
2020-03-19 02:42:09 +00:00
|
|
|
* @param array $hooks Hook overrides
|
2023-07-28 14:30:52 +00:00
|
|
|
* @param array $options Service options (see {@link LocalisationCache::CONSTRUCTOR_OPTIONS})
|
2016-03-07 10:41:03 +00:00
|
|
|
* @return LocalisationCache
|
2014-12-03 22:12:52 +00:00
|
|
|
*/
|
2023-07-28 14:30:52 +00:00
|
|
|
protected function getMockLocalisationCache( $hooks = [], $options = [] ) {
|
2014-12-03 22:12:52 +00:00
|
|
|
global $IP;
|
2019-05-01 13:56:41 +00:00
|
|
|
|
Hooks::run() call site migration
Migrate all callers of Hooks::run() to use the new
HookContainer/HookRunner system.
General principles:
* Use DI if it is already used. We're not changing the way state is
managed in this patch.
* HookContainer is always injected, not HookRunner. HookContainer
is a service, it's a more generic interface, it is the only
thing that provides isRegistered() which is needed in some cases,
and a HookRunner can be efficiently constructed from it
(confirmed by benchmark). Because HookContainer is needed
for object construction, it is also needed by all factories.
* "Ask your friendly local base class". Big hierarchies like
SpecialPage and ApiBase have getHookContainer() and getHookRunner()
methods in the base class, and classes that extend that base class
are not expected to know or care where the base class gets its
HookContainer from.
* ProtectedHookAccessorTrait provides protected getHookContainer() and
getHookRunner() methods, getting them from the global service
container. The point of this is to ease migration to DI by ensuring
that call sites ask their local friendly base class rather than
getting a HookRunner from the service container directly.
* Private $this->hookRunner. In some smaller classes where accessor
methods did not seem warranted, there is a private HookRunner property
which is accessed directly. Very rarely (two cases), there is a
protected property, for consistency with code that conventionally
assumes protected=private, but in cases where the class might actually
be overridden, a protected accessor is preferred over a protected
property.
* The last resort: Hooks::runner(). Mostly for static, file-scope and
global code. In a few cases it was used for objects with broken
construction schemes, out of horror or laziness.
Constructors with new required arguments:
* AuthManager
* BadFileLookup
* BlockManager
* ClassicInterwikiLookup
* ContentHandlerFactory
* ContentSecurityPolicy
* DefaultOptionsManager
* DerivedPageDataUpdater
* FullSearchResultWidget
* HtmlCacheUpdater
* LanguageFactory
* LanguageNameUtils
* LinkRenderer
* LinkRendererFactory
* LocalisationCache
* MagicWordFactory
* MessageCache
* NamespaceInfo
* PageEditStash
* PageHandlerFactory
* PageUpdater
* ParserFactory
* PermissionManager
* RevisionStore
* RevisionStoreFactory
* SearchEngineConfig
* SearchEngineFactory
* SearchFormWidget
* SearchNearMatcher
* SessionBackend
* SpecialPageFactory
* UserNameUtils
* UserOptionsManager
* WatchedItemQueryService
* WatchedItemStore
Constructors with new optional arguments:
* DefaultPreferencesFactory
* Language
* LinkHolderArray
* MovePage
* Parser
* ParserCache
* PasswordReset
* Router
setHookContainer() now required after construction:
* AuthenticationProvider
* ResourceLoaderModule
* SearchEngine
Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
2020-03-19 02:42:09 +00:00
|
|
|
$hookContainer = $this->createHookContainer( $hooks );
|
|
|
|
|
|
2023-01-30 03:53:09 +00:00
|
|
|
// in case any of the LanguageNameUtils hooks are being used
|
|
|
|
|
$langNameUtils = $this->getDummyLanguageNameUtils(
|
|
|
|
|
[ 'hookContainer' => $hookContainer ]
|
|
|
|
|
);
|
|
|
|
|
|
2023-07-28 14:30:52 +00:00
|
|
|
$options += [
|
|
|
|
|
'forceRecache' => false,
|
|
|
|
|
'manualRecache' => false,
|
|
|
|
|
'ExtensionMessagesFiles' => [],
|
|
|
|
|
'MessagesDirs' => [],
|
|
|
|
|
];
|
|
|
|
|
|
2019-05-01 13:56:41 +00:00
|
|
|
$lc = $this->getMockBuilder( LocalisationCache::class )
|
|
|
|
|
->setConstructorArgs( [
|
2023-07-28 14:30:52 +00:00
|
|
|
new ServiceOptions( LocalisationCache::CONSTRUCTOR_OPTIONS, $options ),
|
2019-05-01 13:56:41 +00:00
|
|
|
new LCStoreDB( [] ),
|
2019-05-02 14:23:42 +00:00
|
|
|
new NullLogger,
|
|
|
|
|
[],
|
2023-01-30 03:53:09 +00:00
|
|
|
$langNameUtils,
|
Hooks::run() call site migration
Migrate all callers of Hooks::run() to use the new
HookContainer/HookRunner system.
General principles:
* Use DI if it is already used. We're not changing the way state is
managed in this patch.
* HookContainer is always injected, not HookRunner. HookContainer
is a service, it's a more generic interface, it is the only
thing that provides isRegistered() which is needed in some cases,
and a HookRunner can be efficiently constructed from it
(confirmed by benchmark). Because HookContainer is needed
for object construction, it is also needed by all factories.
* "Ask your friendly local base class". Big hierarchies like
SpecialPage and ApiBase have getHookContainer() and getHookRunner()
methods in the base class, and classes that extend that base class
are not expected to know or care where the base class gets its
HookContainer from.
* ProtectedHookAccessorTrait provides protected getHookContainer() and
getHookRunner() methods, getting them from the global service
container. The point of this is to ease migration to DI by ensuring
that call sites ask their local friendly base class rather than
getting a HookRunner from the service container directly.
* Private $this->hookRunner. In some smaller classes where accessor
methods did not seem warranted, there is a private HookRunner property
which is accessed directly. Very rarely (two cases), there is a
protected property, for consistency with code that conventionally
assumes protected=private, but in cases where the class might actually
be overridden, a protected accessor is preferred over a protected
property.
* The last resort: Hooks::runner(). Mostly for static, file-scope and
global code. In a few cases it was used for objects with broken
construction schemes, out of horror or laziness.
Constructors with new required arguments:
* AuthManager
* BadFileLookup
* BlockManager
* ClassicInterwikiLookup
* ContentHandlerFactory
* ContentSecurityPolicy
* DefaultOptionsManager
* DerivedPageDataUpdater
* FullSearchResultWidget
* HtmlCacheUpdater
* LanguageFactory
* LanguageNameUtils
* LinkRenderer
* LinkRendererFactory
* LocalisationCache
* MagicWordFactory
* MessageCache
* NamespaceInfo
* PageEditStash
* PageHandlerFactory
* PageUpdater
* ParserFactory
* PermissionManager
* RevisionStore
* RevisionStoreFactory
* SearchEngineConfig
* SearchEngineFactory
* SearchFormWidget
* SearchNearMatcher
* SessionBackend
* SpecialPageFactory
* UserNameUtils
* UserOptionsManager
* WatchedItemQueryService
* WatchedItemStore
Constructors with new optional arguments:
* DefaultPreferencesFactory
* Language
* LinkHolderArray
* MovePage
* Parser
* ParserCache
* PasswordReset
* Router
setHookContainer() now required after construction:
* AuthenticationProvider
* ResourceLoaderModule
* SearchEngine
Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
2020-03-19 02:42:09 +00:00
|
|
|
$hookContainer
|
2019-05-01 13:56:41 +00:00
|
|
|
] )
|
2021-03-20 15:18:58 +00:00
|
|
|
->onlyMethods( [ 'getMessagesDirs' ] )
|
2014-12-03 22:12:52 +00:00
|
|
|
->getMock();
|
2021-04-22 08:28:11 +00:00
|
|
|
$lc->method( 'getMessagesDirs' )
|
|
|
|
|
->willReturn( [ "$IP/tests/phpunit/data/localisationcache" ] );
|
2014-12-03 22:12:52 +00:00
|
|
|
|
|
|
|
|
return $lc;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-01 13:56:41 +00:00
|
|
|
public function testPluralRulesFallback() {
|
2014-12-03 22:12:52 +00:00
|
|
|
$cache = $this->getMockLocalisationCache();
|
2014-09-03 16:52:33 +00:00
|
|
|
|
|
|
|
|
$this->assertEquals(
|
|
|
|
|
$cache->getItem( 'ar', 'pluralRules' ),
|
|
|
|
|
$cache->getItem( 'arz', 'pluralRules' ),
|
|
|
|
|
'arz plural rules (undefined) fallback to ar (defined)'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$this->assertEquals(
|
|
|
|
|
$cache->getItem( 'ar', 'compiledPluralRules' ),
|
|
|
|
|
$cache->getItem( 'arz', 'compiledPluralRules' ),
|
|
|
|
|
'arz compiled plural rules (undefined) fallback to ar (defined)'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$this->assertNotEquals(
|
|
|
|
|
$cache->getItem( 'ksh', 'pluralRules' ),
|
|
|
|
|
$cache->getItem( 'de', 'pluralRules' ),
|
|
|
|
|
'ksh plural rules (defined) dont fallback to de (defined)'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$this->assertNotEquals(
|
|
|
|
|
$cache->getItem( 'ksh', 'compiledPluralRules' ),
|
|
|
|
|
$cache->getItem( 'de', 'compiledPluralRules' ),
|
|
|
|
|
'ksh compiled plural rules (defined) dont fallback to de (defined)'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testRecacheFallbacks() {
|
2014-12-03 22:12:52 +00:00
|
|
|
$lc = $this->getMockLocalisationCache();
|
2016-05-23 22:17:49 +00:00
|
|
|
$lc->recache( 'ba' );
|
2014-09-03 16:52:33 +00:00
|
|
|
$this->assertEquals(
|
2016-02-17 09:09:32 +00:00
|
|
|
[
|
2016-05-23 22:17:49 +00:00
|
|
|
'present-ba' => 'ba',
|
2014-09-03 16:52:33 +00:00
|
|
|
'present-ru' => 'ru',
|
|
|
|
|
'present-en' => 'en',
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
2016-05-23 22:17:49 +00:00
|
|
|
$lc->getItem( 'ba', 'messages' ),
|
2014-09-03 16:52:33 +00:00
|
|
|
'Fallbacks are only used to fill missing data'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testRecacheFallbacksWithHooks() {
|
|
|
|
|
// Use hook to provide updates for messages. This is what the
|
2017-02-20 23:45:58 +00:00
|
|
|
// LocalisationUpdate extension does. See T70781.
|
Hooks::run() call site migration
Migrate all callers of Hooks::run() to use the new
HookContainer/HookRunner system.
General principles:
* Use DI if it is already used. We're not changing the way state is
managed in this patch.
* HookContainer is always injected, not HookRunner. HookContainer
is a service, it's a more generic interface, it is the only
thing that provides isRegistered() which is needed in some cases,
and a HookRunner can be efficiently constructed from it
(confirmed by benchmark). Because HookContainer is needed
for object construction, it is also needed by all factories.
* "Ask your friendly local base class". Big hierarchies like
SpecialPage and ApiBase have getHookContainer() and getHookRunner()
methods in the base class, and classes that extend that base class
are not expected to know or care where the base class gets its
HookContainer from.
* ProtectedHookAccessorTrait provides protected getHookContainer() and
getHookRunner() methods, getting them from the global service
container. The point of this is to ease migration to DI by ensuring
that call sites ask their local friendly base class rather than
getting a HookRunner from the service container directly.
* Private $this->hookRunner. In some smaller classes where accessor
methods did not seem warranted, there is a private HookRunner property
which is accessed directly. Very rarely (two cases), there is a
protected property, for consistency with code that conventionally
assumes protected=private, but in cases where the class might actually
be overridden, a protected accessor is preferred over a protected
property.
* The last resort: Hooks::runner(). Mostly for static, file-scope and
global code. In a few cases it was used for objects with broken
construction schemes, out of horror or laziness.
Constructors with new required arguments:
* AuthManager
* BadFileLookup
* BlockManager
* ClassicInterwikiLookup
* ContentHandlerFactory
* ContentSecurityPolicy
* DefaultOptionsManager
* DerivedPageDataUpdater
* FullSearchResultWidget
* HtmlCacheUpdater
* LanguageFactory
* LanguageNameUtils
* LinkRenderer
* LinkRendererFactory
* LocalisationCache
* MagicWordFactory
* MessageCache
* NamespaceInfo
* PageEditStash
* PageHandlerFactory
* PageUpdater
* ParserFactory
* PermissionManager
* RevisionStore
* RevisionStoreFactory
* SearchEngineConfig
* SearchEngineFactory
* SearchFormWidget
* SearchNearMatcher
* SessionBackend
* SpecialPageFactory
* UserNameUtils
* UserOptionsManager
* WatchedItemQueryService
* WatchedItemStore
Constructors with new optional arguments:
* DefaultPreferencesFactory
* Language
* LinkHolderArray
* MovePage
* Parser
* ParserCache
* PasswordReset
* Router
setHookContainer() now required after construction:
* AuthenticationProvider
* ResourceLoaderModule
* SearchEngine
Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
2020-03-19 02:42:09 +00:00
|
|
|
|
|
|
|
|
$lc = $this->getMockLocalisationCache( [
|
2023-03-28 19:56:37 +00:00
|
|
|
'LocalisationCacheRecacheFallback' =>
|
2021-02-07 13:10:36 +00:00
|
|
|
static function (
|
2014-10-15 15:39:27 +00:00
|
|
|
LocalisationCache $lc,
|
|
|
|
|
$code,
|
|
|
|
|
array &$cache
|
|
|
|
|
) {
|
|
|
|
|
if ( $code === 'ru' ) {
|
2016-05-23 22:17:49 +00:00
|
|
|
$cache['messages']['present-ba'] = 'ru-override';
|
2014-10-15 15:39:27 +00:00
|
|
|
$cache['messages']['present-ru'] = 'ru-override';
|
|
|
|
|
$cache['messages']['present-en'] = 'ru-override';
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-02-17 09:09:32 +00:00
|
|
|
] );
|
2016-05-23 22:17:49 +00:00
|
|
|
$lc->recache( 'ba' );
|
2014-09-03 16:52:33 +00:00
|
|
|
$this->assertEquals(
|
2016-02-17 09:09:32 +00:00
|
|
|
[
|
2016-05-23 22:17:49 +00:00
|
|
|
'present-ba' => 'ba',
|
2014-09-03 16:52:33 +00:00
|
|
|
'present-ru' => 'ru-override',
|
|
|
|
|
'present-en' => 'ru-override',
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
2016-05-23 22:17:49 +00:00
|
|
|
$lc->getItem( 'ba', 'messages' ),
|
2014-09-03 16:52:33 +00:00
|
|
|
'Updates provided by hooks follow the normal fallback order.'
|
|
|
|
|
);
|
|
|
|
|
}
|
2023-07-28 14:30:52 +00:00
|
|
|
|
|
|
|
|
public function testRecacheExtensionMessagesFiles(): void {
|
|
|
|
|
global $IP;
|
|
|
|
|
|
|
|
|
|
$lc = $this->getMockLocalisationCache( [], [
|
|
|
|
|
'ExtensionMessagesFiles' => [
|
|
|
|
|
__METHOD__ => "$IP/tests/phpunit/data/localisationcache/ExtensionMessagesFiles.php",
|
|
|
|
|
]
|
|
|
|
|
] );
|
|
|
|
|
$lc->recache( 'de' );
|
|
|
|
|
$specialPageAliases = $lc->getItem( 'de', 'specialPageAliases' );
|
|
|
|
|
$this->assertSame(
|
|
|
|
|
[ 'LokalisierungsPufferTest' ],
|
|
|
|
|
$specialPageAliases['LocalisationCacheTest'],
|
|
|
|
|
'specialPageAliases can be set in ExtensionMessagesFiles'
|
|
|
|
|
);
|
|
|
|
|
$this->assertSame(
|
|
|
|
|
[ 'Aktive_Benutzer*innen', 'Aktive_Benutzer', 'ActiveFolx', 'ActiveUsers' ],
|
|
|
|
|
$specialPageAliases['Activeusers'],
|
|
|
|
|
'specialPageAliases from extension/core files and fallback languages are merged'
|
|
|
|
|
);
|
2023-07-21 09:31:43 +00:00
|
|
|
$this->assertFalse(
|
|
|
|
|
$lc->getItem( 'de', 'rtl' ),
|
|
|
|
|
'rtl cannot be set in ExtensionMessagesFiles'
|
|
|
|
|
);
|
2023-07-28 14:30:52 +00:00
|
|
|
}
|
|
|
|
|
|
LocalisationCache: Load only core data if possible
Extract loadCoreData(), which loads only the core, non-mergeable keys
from the core messages files, not the extension messages files or the
JSON files. Have loadItem() call this method, skipping the full
initLanguage() + recache(), if possible.
Because compiling the plural rules takes up a significant amount of
loading the core-only data (see discussion on Gerrit), extract
readPluralFilesAndRegisterDeps() from readSourceFilesAndRegisterDeps(),
and only call the latter in loadCoreData() (while recache() calls both).
Also remove a comment about readSourceFilesAndRegisterDeps() returning
false if the localisation doesn’t exist, which AFAICT hasn’t been true
since change I35bbb3a7a1 (commit 8e0c0a9fc9) in 2014.
Note that the new “core-only data” path in loadItem() bypasses the
underlying LCStore even if the core data (or indeed all data) happens to
be present in it. Some investigation and benchmarks (see the discussion
on this change on Gerrit) indicate that this is usually a performance
win; in particular, unless manualRecache is set, just checking whether
the LCStore is expired is relatively expensive.
[For further discussion, see also changes I00f2018400 and I64822e050e on
Gerrit, which were later squashed into this change.]
Bug: T342418
Change-Id: I7ec2d87c0f864c7dbfd629f0b47f22dc8a6fa552
2023-07-21 11:19:29 +00:00
|
|
|
public function testLoadCoreDataAvoidsInitLanguage(): void {
|
|
|
|
|
$lc = $this->getMockLocalisationCache();
|
|
|
|
|
|
|
|
|
|
$lc->getItem( 'de', 'fallback' );
|
|
|
|
|
$lc->getItem( 'de', 'rtl' );
|
|
|
|
|
$lc->getItem( 'de', 'fallbackSequence' );
|
|
|
|
|
$lc->getItem( 'de', 'originalFallbackSequence' );
|
|
|
|
|
|
|
|
|
|
$this->assertArrayNotHasKey( 'de',
|
|
|
|
|
TestingAccessWrapper::newFromObject( $lc )->initialisedLangs );
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-28 14:30:52 +00:00
|
|
|
public function testShallowFallbackForInvalidCode(): void {
|
|
|
|
|
$lc = $this->getMockLocalisationCache();
|
|
|
|
|
$invalidCode = '!invalid!';
|
|
|
|
|
|
|
|
|
|
$this->assertSame( false, $lc->getItem( $invalidCode, 'rtl' ) );
|
|
|
|
|
$this->assertSame( 'windows-1252', $lc->getItem( $invalidCode, 'fallback8bitEncoding' ) );
|
|
|
|
|
}
|
2014-09-03 16:52:33 +00:00
|
|
|
}
|