Browse Source

Add test case for aliased vendor namespaced plugin.

ADmad 11 years ago
parent
commit
907656f759

+ 11 - 3
tests/TestCase/I18n/I18nTest.php

@@ -1,7 +1,5 @@
 <?php
 /**
- * I18nTest file
- *
  * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
  * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  *
@@ -137,12 +135,22 @@ class I18nTest extends TestCase {
  * @return void
  */
 	public function testPluginMesagesLoad() {
-		Plugin::load('TestPlugin');
+		Plugin::load([
+			'TestPlugin',
+			'TestPluginThree' => ['namespace' => 'Company\TestPluginThree']
+		]);
+
 		$translator = I18n::translator('test_plugin');
 		$this->assertEquals(
 			'Plural Rule 1 (from plugin)',
 			$translator->translate('Plural Rule 1')
 		);
+
+		$translator = I18n::translator('test_plugin_three');
+		$this->assertEquals(
+			'String 1 (from plugin three)',
+			$translator->translate('String 1')
+		);
 	}
 
 /**

+ 16 - 0
tests/test_app/Plugin/Company/TestPluginThree/src/Locale/en/test_plugin_three.po

@@ -0,0 +1,16 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: CakePHP Testsuite\n"
+"POT-Creation-Date: 2008-05-15 02:51-0700\n"
+"PO-Revision-Date: \n"
+"Last-Translator: CakePHP I18N & I10N Team <i10n.cakephp@gmail.com>\n"
+"Language-Team: CakePHP I18N & I10N Team <i10n.cakephp@gmail.com>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+"X-Poedit-Language: Two Forms of Plurals\n"
+"X-Poedit-SourceCharset: utf-8\n"
+
+msgid "String 1"
+msgstr "String 1 (from plugin three)"