Commit 90c2c230 authored by alexpott's avatar alexpott

Issue #2018409 by ParisLiakos: LocaleTranslation should have its translation...

Issue #2018409 by ParisLiakos: LocaleTranslation should have its translation property initialized as array.
parent 69f2cef0
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\Core\Language\LocaleTranslation.
* Contains \Drupal\locale\LocaleTranslation.
*/
namespace Drupal\locale;
......@@ -35,7 +35,7 @@ class LocaleTranslation implements TranslatorInterface, DestructableInterface {
* Array of \Drupal\locale\LocaleLookup objects indexed by language code
* and context.
*/
protected $translations;
protected $translations = array();
/**
* Constructs a translator using a string storage.
......
......@@ -13,7 +13,7 @@
/**
* Functional test for string translation and validation.
*/
class LocaleTranslationTest extends WebTestBase {
class LocaleTranslationUiTest extends WebTestBase {
/**
* Modules to enable.
......
<?php
/**
* @file
* Contains \Drupal\locale\Tests\LocaleTranslationTest.
*/
namespace Drupal\locale\Tests;
use Drupal\locale\LocaleTranslation;
use Drupal\Tests\UnitTestCase;
/**
* Tests for locale translation class.
*
* @see \Drupal\locale\LocaleTranslation
* @group locale
*/
class LocaleTranslationTest extends UnitTestCase {
/**
* A mocked storage to use when instantiating LocaleTranslation objects.
*
* @var \PHPUnit_Framework_MockObject_MockObject
*/
protected $storage;
public static function getInfo() {
return array(
'name' => 'Locale translation tests',
'description' => 'Test locale module translation implementation.',
'group' => 'locale',
);
}
/**
* {@inheritdoc}
*/
protected function setUp() {
$this->storage = $this->getMock('Drupal\locale\StringStorageInterface');
}
/**
* Tests for \Drupal\locale\LocaleTranslation::destruct()
*/
public function testDestruct() {
$translation = new LocaleTranslation($this->storage);
// Prove that destruction works without errors when translations are empty.
$this->assertAttributeEmpty('translations', $translation);
$translation->destruct();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment