Commit d247620e authored by Dries's avatar Dries

Issue #2286403 by martin107: Inconsistent use of magic number when constants...

Issue #2286403 by martin107: Inconsistent use of magic number when constants DIRECTION_LTR and DIRECTION_RTL already defined.
parent 14ea687e
...@@ -22,7 +22,7 @@ class Language implements LanguageInterface { ...@@ -22,7 +22,7 @@ class Language implements LanguageInterface {
public static $defaultValues = array( public static $defaultValues = array(
'id' => 'en', 'id' => 'en',
'name' => 'English', 'name' => 'English',
'direction' => 0, 'direction' => self::DIRECTION_LTR,
'weight' => 0, 'weight' => 0,
'locked' => 0, 'locked' => 0,
'default' => TRUE, 'default' => TRUE,
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\config\Tests; namespace Drupal\config\Tests;
use Drupal\Core\Language\LanguageInterface;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
/** /**
...@@ -42,7 +43,7 @@ function testSiteNameTranslation() { ...@@ -42,7 +43,7 @@ function testSiteNameTranslation() {
'predefined_langcode' => 'custom', 'predefined_langcode' => 'custom',
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'direction' => '0', 'direction' => LanguageInterface::DIRECTION_LTR,
); );
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
\Drupal::languageManager() \Drupal::languageManager()
......
...@@ -577,7 +577,7 @@ public function testLocaleDBStorage() { ...@@ -577,7 +577,7 @@ public function testLocaleDBStorage() {
'predefined_langcode' => 'custom', 'predefined_langcode' => 'custom',
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'direction' => '0', 'direction' => Language::DIRECTION_LTR,
); );
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
......
...@@ -57,7 +57,7 @@ protected function setUp() { ...@@ -57,7 +57,7 @@ protected function setUp() {
$language = new Language(array( $language = new Language(array(
'id' => 'it', 'id' => 'it',
'name' => 'Italian', 'name' => 'Italian',
'direction' => '0', 'direction' => Language::DIRECTION_LTR,
)); ));
language_save($language); language_save($language);
......
...@@ -52,7 +52,7 @@ function testDependencyInjectedNewDefaultLanguage() { ...@@ -52,7 +52,7 @@ function testDependencyInjectedNewDefaultLanguage() {
$new_language_default = new Language(array( $new_language_default = new Language(array(
'id' => 'fr', 'id' => 'fr',
'name' => 'French', 'name' => 'French',
'direction' => 0, 'direction' => Language::DIRECTION_LTR,
'weight' => 0, 'weight' => 0,
'method_id' => 'language-default', 'method_id' => 'language-default',
'default' => TRUE, 'default' => TRUE,
......
...@@ -55,7 +55,7 @@ function testLanguageList() { ...@@ -55,7 +55,7 @@ function testLanguageList() {
'predefined_langcode' => 'custom', 'predefined_langcode' => 'custom',
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'direction' => '0', 'direction' => Language::DIRECTION_LTR,
); );
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
$this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.'); $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.');
...@@ -139,7 +139,7 @@ function testLanguageList() { ...@@ -139,7 +139,7 @@ function testLanguageList() {
'predefined_langcode' => 'custom', 'predefined_langcode' => 'custom',
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'direction' => '0', 'direction' => Language::DIRECTION_LTR,
); );
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
$this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.'); $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.');
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
use Drupal\locale\LocaleTypedConfig; use Drupal\locale\LocaleTypedConfig;
use Drupal\core\language\languageInterface;
/** /**
* Tests Metadata for configuration objects. * Tests Metadata for configuration objects.
...@@ -55,7 +56,7 @@ function testConfigTranslation() { ...@@ -55,7 +56,7 @@ function testConfigTranslation() {
'predefined_langcode' => 'custom', 'predefined_langcode' => 'custom',
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'direction' => '0', 'direction' => LanguageInterface::DIRECTION_LTR,
); );
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
// Set path prefix. // Set path prefix.
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\locale\Tests; namespace Drupal\locale\Tests;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
use Drupal\Core\Language\LanguageInterface;
/** /**
* Functional tests for multilingual support on nodes. * Functional tests for multilingual support on nodes.
...@@ -80,7 +81,7 @@ function testContentTypeLanguageConfiguration() { ...@@ -80,7 +81,7 @@ function testContentTypeLanguageConfiguration() {
'predefined_langcode' => 'custom', 'predefined_langcode' => 'custom',
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'direction' => '0', 'direction' => LanguageInterface::DIRECTION_LTR,
); );
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\locale\Tests; namespace Drupal\locale\Tests;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
use Drupal\Core\Language\LanguageInterface;
/** /**
* Functional tests for the import of translation files. * Functional tests for the import of translation files.
...@@ -268,7 +269,7 @@ function testConfigPoFile() { ...@@ -268,7 +269,7 @@ function testConfigPoFile() {
'predefined_langcode' => 'custom', 'predefined_langcode' => 'custom',
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $this->randomName(16), 'name' => $this->randomName(16),
'direction' => '0', 'direction' => LanguageInterface::DIRECTION_LTR,
); );
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
......
...@@ -41,7 +41,7 @@ public function testCircularDependency() { ...@@ -41,7 +41,7 @@ public function testCircularDependency() {
$new_language_default = new Language(array( $new_language_default = new Language(array(
'id' => 'fr', 'id' => 'fr',
'name' => 'French', 'name' => 'French',
'direction' => 0, 'direction' => LANGUAGE::DIRECTION_LTR,
'weight' => 0, 'weight' => 0,
'method_id' => 'language-default', 'method_id' => 'language-default',
'default' => TRUE, 'default' => TRUE,
......
...@@ -56,7 +56,7 @@ function testPathLanguageConfiguration() { ...@@ -56,7 +56,7 @@ function testPathLanguageConfiguration() {
'predefined_langcode' => 'custom', 'predefined_langcode' => 'custom',
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'direction' => '0', 'direction' => LanguageInterface::DIRECTION_LTR,
); );
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
......
...@@ -65,7 +65,7 @@ function testStringTranslation() { ...@@ -65,7 +65,7 @@ function testStringTranslation() {
'predefined_langcode' => 'custom', 'predefined_langcode' => 'custom',
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'direction' => '0', 'direction' => LanguageInterface::DIRECTION_LTR,
); );
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
// Add string. // Add string.
...@@ -222,7 +222,7 @@ function testJavaScriptTranslation() { ...@@ -222,7 +222,7 @@ function testJavaScriptTranslation() {
'predefined_langcode' => 'custom', 'predefined_langcode' => 'custom',
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'direction' => '0', 'direction' => LanguageInterface::DIRECTION_LTR,
); );
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
$this->container->get('language_manager')->reset(); $this->container->get('language_manager')->reset();
...@@ -292,7 +292,7 @@ function testStringValidation() { ...@@ -292,7 +292,7 @@ function testStringValidation() {
'predefined_langcode' => 'custom', 'predefined_langcode' => 'custom',
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'direction' => '0', 'direction' => LanguageInterface::DIRECTION_LTR,
); );
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
// Add string. // Add string.
...@@ -342,7 +342,7 @@ function testStringSearch() { ...@@ -342,7 +342,7 @@ function testStringSearch() {
'predefined_langcode' => 'custom', 'predefined_langcode' => 'custom',
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'direction' => '0', 'direction' => LanguageInterface::DIRECTION_LTR,
); );
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
...@@ -350,7 +350,7 @@ function testStringSearch() { ...@@ -350,7 +350,7 @@ function testStringSearch() {
'predefined_langcode' => 'custom', 'predefined_langcode' => 'custom',
'langcode' => 'yy', 'langcode' => 'yy',
'name' => $this->randomName(16), 'name' => $this->randomName(16),
'direction' => '0', 'direction' => LanguageInterface::DIRECTION_LTR,
); );
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\locale\Tests; namespace Drupal\locale\Tests;
use Drupal\Core\Language\LanguageInterface;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
/** /**
...@@ -410,7 +411,7 @@ function testEnableCustomLanguage() { ...@@ -410,7 +411,7 @@ function testEnableCustomLanguage() {
'predefined_langcode' => 'custom', 'predefined_langcode' => 'custom',
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'direction' => '0', 'direction' => LanguageInterface::DIRECTION_LTR,
); );
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\system\Tests\Theme; namespace Drupal\system\Tests\Theme;
use Drupal\Core\Language\LanguageInterface;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
/** /**
...@@ -231,7 +232,7 @@ protected function installLanguages() { ...@@ -231,7 +232,7 @@ protected function installLanguages() {
'predefined_langcode' => 'custom', 'predefined_langcode' => 'custom',
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'direction' => '0', 'direction' => LanguageInterface::DIRECTION_LTR,
); );
// Install the language in Drupal. // Install the language in Drupal.
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\toolbar\Tests; namespace Drupal\toolbar\Tests;
use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\Cache;
use Drupal\Core\Language\LanguageInterface;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
/** /**
...@@ -377,7 +378,7 @@ function testLocaleTranslationSubtreesHashCacheClear() { ...@@ -377,7 +378,7 @@ function testLocaleTranslationSubtreesHashCacheClear() {
'predefined_langcode' => 'custom', 'predefined_langcode' => 'custom',
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'direction' => '0', 'direction' => LanguageInterface::DIRECTION_LTR,
); );
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
t($name, array(), array('langcode' => $langcode)); t($name, array(), array('langcode' => $langcode));
...@@ -463,7 +464,7 @@ function testSubtreesJsonRequest() { ...@@ -463,7 +464,7 @@ function testSubtreesJsonRequest() {
'predefined_langcode' => 'custom', 'predefined_langcode' => 'custom',
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'direction' => '0', 'direction' => LanguageInterface::DIRECTION_LTR,
); );
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
...@@ -488,7 +489,7 @@ function testLanguageSwitching() { ...@@ -488,7 +489,7 @@ function testLanguageSwitching() {
'predefined_langcode' => 'custom', 'predefined_langcode' => 'custom',
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'direction' => '0', 'direction' => LanguageInterface::DIRECTION_LTR,
); );
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\user\Tests; namespace Drupal\user\Tests;
use Drupal\Core\Language\LanguageInterface;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
/** /**
...@@ -137,7 +138,7 @@ function addCustomLanguage() { ...@@ -137,7 +138,7 @@ function addCustomLanguage() {
'predefined_langcode' => 'custom', 'predefined_langcode' => 'custom',
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'direction' => '0', 'direction' => LanguageInterface::DIRECTION_LTR,
); );
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
} }
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\user\Tests; namespace Drupal\user\Tests;
use Drupal\Core\Language\LanguageInterface;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
/** /**
...@@ -48,7 +49,7 @@ function testUserLanguageConfiguration() { ...@@ -48,7 +49,7 @@ function testUserLanguageConfiguration() {
'predefined_langcode' => 'custom', 'predefined_langcode' => 'custom',
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'direction' => '0', 'direction' => LanguageInterface::DIRECTION_LTR,
); );
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
$this->drupalLogout(); $this->drupalLogout();
......
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