|
|
@@ -39,11 +39,31 @@ require_once 'Zend/Loader/Autoloader.php';
|
|
|
*/
|
|
|
class Zend_Application_Resource_TranslateTest extends PHPUnit_Framework_TestCase
|
|
|
{
|
|
|
- private $_translationOptions = array('data' => array(
|
|
|
- 'message1' => 'message1',
|
|
|
- 'message2' => 'message2',
|
|
|
- 'message3' => 'message3'
|
|
|
- ));
|
|
|
+ /**
|
|
|
+ * @var array
|
|
|
+ */
|
|
|
+ protected $_translationOptions = array(
|
|
|
+ 'data' => array(
|
|
|
+ 'message1' => 'message1',
|
|
|
+ 'message2' => 'message2',
|
|
|
+ 'message3' => 'message3'
|
|
|
+ )
|
|
|
+ );
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @var Zend_Loader_Autoloader
|
|
|
+ */
|
|
|
+ protected $autoloader;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @var Zend_Application
|
|
|
+ */
|
|
|
+ protected $application;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @var Zend_Application_Bootstrap_Bootstrap
|
|
|
+ */
|
|
|
+ protected $bootstrap;
|
|
|
|
|
|
public static function main()
|
|
|
{
|
|
|
@@ -218,6 +238,30 @@ class Zend_Application_Resource_TranslateTest extends PHPUnit_Framework_TestCase
|
|
|
$resource = new Zend_Application_Resource_Translate($options);
|
|
|
$translator = $resource->init();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @group GH-103
|
|
|
+ */
|
|
|
+ public function testLogFactory()
|
|
|
+ {
|
|
|
+ $options = $this->_translationOptions;
|
|
|
+ $options['log'][0] = new Zend_Log_Writer_Mock();
|
|
|
+ $options['logUntranslated'] = true;
|
|
|
+ $options['locale'] = 'en';
|
|
|
+
|
|
|
+ $resource = new Zend_Application_Resource_Translate($options);
|
|
|
+ $resource->setBootstrap($this->bootstrap);
|
|
|
+
|
|
|
+ $resource->init()->translate('untranslated');
|
|
|
+ $event = current($options['log'][0]->events);
|
|
|
+
|
|
|
+ $this->assertTrue(is_array($event));
|
|
|
+ $this->assertTrue(array_key_exists('message', $event));
|
|
|
+ $this->assertEquals(
|
|
|
+ "Untranslated message within 'en': untranslated",
|
|
|
+ $event['message']
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (PHPUnit_MAIN_METHOD == 'Zend_Application_Resource_TranslateTest::main') {
|