comparison core/modules/locale/tests/src/Unit/LocaleTranslationTest.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\Tests\locale\Unit;
4
5 use Drupal\locale\LocaleTranslation;
6 use Drupal\Tests\UnitTestCase;
7 use Symfony\Component\HttpFoundation\RequestStack;
8
9 /**
10 * @coversDefaultClass \Drupal\locale\LocaleTranslation
11 * @group locale
12 */
13 class LocaleTranslationTest extends UnitTestCase {
14
15 /**
16 * A mocked storage to use when instantiating LocaleTranslation objects.
17 *
18 * @var \PHPUnit_Framework_MockObject_MockObject
19 */
20 protected $storage;
21
22 /**
23 * A mocked language manager built from LanguageManagerInterface.
24 *
25 * @var \Drupal\Core\Language\LanguageManagerInterface|\PHPUnit_Framework_MockObject_MockObject
26 */
27 protected $languageManager;
28
29 /**
30 * The request stack.
31 *
32 * @var \Symfony\Component\HttpFoundation\RequestStack
33 */
34 protected $requestStack;
35
36 /**
37 * {@inheritdoc}
38 */
39 protected function setUp() {
40 $this->storage = $this->getMock('Drupal\locale\StringStorageInterface');
41 $this->cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
42 $this->lock = $this->getMock('Drupal\Core\Lock\LockBackendInterface');
43 $this->languageManager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
44 $this->requestStack = new RequestStack();
45 }
46
47 /**
48 * Tests for \Drupal\locale\LocaleTranslation::destruct().
49 */
50 public function testDestruct() {
51 $translation = new LocaleTranslation($this->storage, $this->cache, $this->lock, $this->getConfigFactoryStub(), $this->languageManager, $this->requestStack);
52 // Prove that destruction works without errors when translations are empty.
53 $this->assertAttributeEmpty('translations', $translation);
54 $translation->destruct();
55 }
56
57 }