Skip to content
This repository
Browse code

MINOR Testing languages without fallbacks (related to #7386)

  • Loading branch information...
commit c3d8d82d52006a20c628c5dd8ae27d3f73df5d86 1 parent ad6b7a4
Ingo Schommer authored May 29, 2012
3  tests/i18n/_fakewebroot/i18ntestmodule/lang/mi_NZ.yml
... ...
@@ -0,0 +1,3 @@
  1
+mi_NZ:
  2
+  i18nTestModule:
  3
+    ENTITY: Translation (mi_NZ)
24  tests/i18n/i18nTest.php
@@ -431,6 +431,30 @@ function testIncludeByLocale() {
431 431
 		
432 432
 		SS_ClassLoader::instance()->popManifest();
433 433
 	}
  434
+
  435
+	function testIncludeByLocaleWithoutFallbackLanguage() {
  436
+		$classManifest = new SS_ClassManifest($this->alternateBasePath, true, true, false);
  437
+		SS_ClassLoader::instance()->pushManifest($classManifest);
  438
+		
  439
+		$adapter = i18n::get_translator('core')->getAdapter();
  440
+		$this->assertTrue($adapter->isAvailable('en'));
  441
+		$this->assertFalse($adapter->isAvailable('mi')); // not defined at all
  442
+		$this->assertFalse($adapter->isAvailable('mi_NZ')); // defined, but not loaded yet
  443
+		$this->assertFalse($adapter->isTranslated('i18nTestModule.ENTITY', 'mi'), 
  444
+			'Existing unloaded entity not available before call'
  445
+		);
  446
+		$this->assertFalse($adapter->isTranslated('i18nTestModule.ENTITY', 'mi_NZ'), 
  447
+			'Non-existing unloaded entity not available before call'
  448
+		);
  449
+
  450
+		i18n::include_by_locale('mi_NZ');
  451
+		
  452
+		$this->assertFalse($adapter->isAvailable('mi'));
  453
+		$this->assertTrue($adapter->isAvailable('mi_NZ'));
  454
+		$this->assertTrue($adapter->isTranslated('i18nTestModule.ENTITY', null, 'mi_NZ'), 'Includes module files');
  455
+		
  456
+		SS_ClassLoader::instance()->popManifest();
  457
+	}
434 458
 	
435 459
 	function testRegisterTranslator() {
436 460
 		$translator = new Zend_Translate(array(

0 notes on commit c3d8d82

Please sign in to comment.
Something went wrong with that request. Please try again.