Mercurial > hg > isophonics-drupal-site
comparison core/modules/language/tests/src/Unit/ConfigurableLanguageUnitTest.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\language\Unit; | |
4 | |
5 use Drupal\language\Entity\ConfigurableLanguage; | |
6 use Drupal\Tests\UnitTestCase; | |
7 | |
8 /** | |
9 * Tests the ConfigurableLanguage entity class. | |
10 * | |
11 * @group language | |
12 * @coversDefaultClass \Drupal\language\Entity\ConfigurableLanguage | |
13 * @see \Drupal\language\Entity\ConfigurableLanguage. | |
14 */ | |
15 class ConfigurableLanguageUnitTest extends UnitTestCase { | |
16 | |
17 /** | |
18 * @covers ::getDirection | |
19 */ | |
20 public function testDirection() { | |
21 // Direction of language writing, an integer. Usually either | |
22 // ConfigurableLanguage::DIRECTION_LTR or | |
23 // ConfigurableLanguage::DIRECTION_RTL. | |
24 $configurableLanguage = new ConfigurableLanguage(['direction' => ConfigurableLanguage::DIRECTION_LTR], 'configurable_language'); | |
25 $this->assertEquals(ConfigurableLanguage::DIRECTION_LTR, $configurableLanguage->getDirection()); | |
26 | |
27 // Test direction again, setting direction to RTL. | |
28 $configurableLanguage = new ConfigurableLanguage(['direction' => ConfigurableLanguage::DIRECTION_RTL], 'configurable_language'); | |
29 $this->assertEquals(ConfigurableLanguage::DIRECTION_RTL, $configurableLanguage->getDirection()); | |
30 } | |
31 | |
32 /** | |
33 * @covers ::getWeight | |
34 * @covers ::setWeight | |
35 */ | |
36 public function testWeight() { | |
37 // The weight, an integer. Used to order languages with larger positive | |
38 // weights sinking items toward the bottom of lists. | |
39 $configurableLanguage = new ConfigurableLanguage(['weight' => -5], 'configurable_language'); | |
40 $this->assertEquals($configurableLanguage->getWeight(), -5); | |
41 $this->assertEquals($configurableLanguage->setWeight(13)->getWeight(), 13); | |
42 } | |
43 | |
44 } |