diff --git a/core/modules/language/lib/Drupal/language/Plugin/views/field/LanguageField.php b/core/modules/language/lib/Drupal/language/Plugin/views/field/LanguageField.php index 3909fcd..152104d 100644 --- a/core/modules/language/lib/Drupal/language/Plugin/views/field/LanguageField.php +++ b/core/modules/language/lib/Drupal/language/Plugin/views/field/LanguageField.php @@ -44,7 +44,7 @@ class LanguageField extends FieldPluginBase { // ready, see http://drupal.org/node/1616594. $value = $this->getValue($values); $language = language_load($value); - return $language ? $language->name : ''; + return $language ? $language->getName() : ''; } } diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php index 2091878..e90b48b 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php @@ -8,6 +8,7 @@ namespace Drupal\node\Tests; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Verifies node access functionality for multiple languages. diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php index 1f37118..dc959c1 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php @@ -82,8 +82,8 @@ function testNodeTokenReplacement() { $tests['[node:author]'] = String::checkPlain($account->getUsername()); $tests['[node:author:uid]'] = $node->getOwnerId(); $tests['[node:author:name]'] = String::checkPlain($account->getUsername()); - $tests['[node:created:since]'] = \Drupal::service('date')->formatInterval(REQUEST_TIME - $node->getCreatedTime(), 2, $this->languageInterface->id); - $tests['[node:changed:since]'] = \Drupal::service('date')->formatInterval(REQUEST_TIME - $node->getChangedTime(), 2, $this->languageInterface->id); + $tests['[node:created:since]'] = \Drupal::service('date')->formatInterval(REQUEST_TIME - $node->getCreatedTime(), 2, $this->languageInterface->getId()); + $tests['[node:changed:since]'] = \Drupal::service('date')->formatInterval(REQUEST_TIME - $node->getChangedTime(), 2, $this->languageInterface-getId()); // Test to make sure that we generated something for each token. $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.'); diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php index 37ce3f2..1e5a08a 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php @@ -476,7 +476,7 @@ function testLanguageFallback() { // Check that language fallback respects language weight by default. $languages = $this->languageManager->getLanguages(); - $languages[$langcode]->weight = -1; + $languages[$langcode]->setWeight(-1); language_save($languages[$langcode]); $translation = $this->entityManager->getTranslationFromContext($entity, $langcode2); $this->assertEqual($translation->language()->getId(), $langcode, 'The current translation language matches the expected one.'); diff --git a/core/modules/system/lib/Drupal/system/Tests/System/TokenReplaceUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/System/TokenReplaceUnitTest.php index 623d995..fefc8d7 100644 --- a/core/modules/system/lib/Drupal/system/Tests/System/TokenReplaceUnitTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/TokenReplaceUnitTest.php @@ -45,7 +45,7 @@ class TokenReplaceUnitTest extends TokenReplaceUnitTestBase { foreach ($tests as $test) { $input = $test['prefix'] . '[site:name]' . $test['suffix']; $expected = $test['prefix'] . 'Drupal' . $test['suffix']; - $output = $this->tokenService->replace($input, array(), array('langcode' => $this->languageInterface->id)); + $output = $this->tokenService->replace($input, array(), array('langcode' => $this->languageInterface->getId())); $this->assertTrue($output == $expected, format_string('Token recognized in string %string', array('%string' => $input))); } @@ -66,12 +66,12 @@ class TokenReplaceUnitTest extends TokenReplaceUnitTestBase { // Replace with with the clear parameter, only the valid token should remain. $target = String::checkPlain(\Drupal::config('system.site')->get('name')); - $result = $this->tokenService->replace($source, array(), array('langcode' => $this->languageInterface->id, 'clear' => TRUE)); + $result = $this->tokenService->replace($source, array(), array('langcode' => $this->languageInterface->getId(), 'clear' => TRUE)); $this->assertEqual($target, $result, 'Valid tokens replaced while invalid tokens ignored.'); $target .= '[user:name]'; $target .= '[bogus:token]'; - $result = $this->tokenService->replace($source, array(), array('langcode' => $this->languageInterface->id)); + $result = $this->tokenService->replace($source, array(), array('langcode' => $this->languageInterface->getId())); $this->assertEqual($target, $result, 'Valid tokens replaced while invalid tokens ignored.'); } @@ -111,7 +111,7 @@ class TokenReplaceUnitTest extends TokenReplaceUnitTestBase { $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.'); foreach ($tests as $input => $expected) { - $output = $this->tokenService->replace($input, array(), array('langcode' => $this->languageInterface->id)); + $output = $this->tokenService->replace($input, array(), array('langcode' => $this->languageInterface->getId())); $this->assertEqual($output, $expected, format_string('Sanitized system site information token %token replaced.', array('%token' => $input))); } @@ -120,7 +120,7 @@ class TokenReplaceUnitTest extends TokenReplaceUnitTestBase { $tests['[site:slogan]'] = $config->get('slogan'); foreach ($tests as $input => $expected) { - $output = $this->tokenService->replace($input, array(), array('langcode' => $this->languageInterface->id, 'sanitize' => FALSE)); + $output = $this->tokenService->replace($input, array(), array('langcode' => $this->languageInterface->getId(), 'sanitize' => FALSE)); $this->assertEqual($output, $expected, format_string('Unsanitized system site information token %token replaced.', array('%token' => $input))); } @@ -146,18 +146,18 @@ class TokenReplaceUnitTest extends TokenReplaceUnitTestBase { // Generate and test tokens. $tests = array(); $date_service = \Drupal::service('date'); - $tests['[date:short]'] = $date_service->format($date, 'short', '', NULL, $this->languageInterface->id); - $tests['[date:medium]'] = $date_service->format($date, 'medium', '', NULL, $this->languageInterface->id); - $tests['[date:long]'] = $date_service->format($date, 'long', '', NULL, $this->languageInterface->id); - $tests['[date:custom:m/j/Y]'] = $date_service->format($date, 'custom', 'm/j/Y', NULL, $this->languageInterface->id); - $tests['[date:since]'] = $date_service->formatInterval(REQUEST_TIME - $date, 2, $this->languageInterface->id); + $tests['[date:short]'] = $date_service->format($date, 'short', '', NULL, $this->languageInterface->getId()); + $tests['[date:medium]'] = $date_service->format($date, 'medium', '', NULL, $this->languageInterface->getId()); + $tests['[date:long]'] = $date_service->format($date, 'long', '', NULL, $this->languageInterface->getId()); + $tests['[date:custom:m/j/Y]'] = $date_service->format($date, 'custom', 'm/j/Y', NULL, $this->languageInterface->getId()); + $tests['[date:since]'] = $date_service->formatInterval(REQUEST_TIME - $date, 2, $this->languageInterface->getId()); $tests['[date:raw]'] = Xss::filter($date); // Test to make sure that we generated something for each token. $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.'); foreach ($tests as $input => $expected) { - $output = $this->tokenService->replace($input, array('date' => $date), array('langcode' => $this->languageInterface->id)); + $output = $this->tokenService->replace($input, array('date' => $date), array('langcode' => $this->languageInterface->getId())); $this->assertEqual($output, $expected, format_string('Date token %token replaced.', array('%token' => $input))); } } diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermLanguageTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermLanguageTest.php index 0e44497..3da8b1b 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermLanguageTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermLanguageTest.php @@ -103,10 +103,10 @@ function testDefaultTermLanguage() { // Change the default language of the site and check if the default terms // language is still correctly selected. $old_default = \Drupal::languageManager()->getDefaultLanguage(); - $old_default->default = FALSE; + $old_default->setDefault(FALSE); language_save($old_default); $new_default = \Drupal::languageManager()->getLanguage('cc'); - $new_default->default = TRUE; + $new_default->setDefault(TRUE); language_save($new_default); $edit = array( 'default_language[langcode]' => 'site_default', diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php index 4ed08e4..c31217f 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php @@ -634,7 +634,7 @@ 'label' => $form_state['values']['label'], 'description' => $form_state['values']['description'], 'base_table' => $this->base_table, - 'langcode' => language_default()->id, + 'langcode' => language_default()->getId(), ); $view = entity_create('view', $values); diff --git a/core/tests/Drupal/Tests/Core/Utility/TokenTest.php b/core/tests/Drupal/Tests/Core/Utility/TokenTest.php index f92502e..be79860 100644 --- a/core/tests/Drupal/Tests/Core/Utility/TokenTest.php +++ b/core/tests/Drupal/Tests/Core/Utility/TokenTest.php @@ -83,7 +83,7 @@ class TokenTest extends UnitTestCase { ); $language = $this->getMock('\Drupal\Core\Language\Language'); - $language->id = $this->randomName(); + $language->setId($this->randomName()); $this->languageManager->expects($this->once()) ->method('getCurrentLanguage')