summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2016-01-18 15:21:29 (GMT)
committerAlex Pott2016-01-18 15:21:29 (GMT)
commitb88c90a6c01f2aed22df97186afd4b71fb2f7eb1 (patch)
tree5c3c569d72528edd29755c6bcbb8b812801b2f7c
parent580b4cf09ab4448d71ac35dffb803d5550ef4786 (diff)
Issue #2645662 by dawehner: Don't pollute the global namespace with t() in tests
-rw-r--r--core/modules/views/tests/src/Unit/EntityViewsDataTest.php23
-rw-r--r--core/tests/Drupal/Tests/Core/Render/Element/MachineNameTest.php2
2 files changed, 13 insertions, 12 deletions
diff --git a/core/modules/views/tests/src/Unit/EntityViewsDataTest.php b/core/modules/views/tests/src/Unit/EntityViewsDataTest.php
index feefe0a..14b7a07 100644
--- a/core/modules/views/tests/src/Unit/EntityViewsDataTest.php
+++ b/core/modules/views/tests/src/Unit/EntityViewsDataTest.php
@@ -138,8 +138,8 @@ class EntityViewsDataTest extends UnitTestCase {
// Add a description field to the fields supplied by the EntityTest
// classes. This example comes from the taxonomy Term entity.
$base_fields['description'] = BaseFieldDefinition::create('text_long')
- ->setLabel(t('Description'))
- ->setDescription(t('A description of the term.'))
+ ->setLabel('Description')
+ ->setDescription('A description of the term.')
->setTranslatable(TRUE)
->setDisplayOptions('view', array(
'label' => 'hidden',
@@ -155,8 +155,8 @@ class EntityViewsDataTest extends UnitTestCase {
// Add a URL field; this example is from the Comment entity.
$base_fields['homepage'] = BaseFieldDefinition::create('uri')
- ->setLabel(t('Homepage'))
- ->setDescription(t("The comment author's home page address."))
+ ->setLabel('Homepage')
+ ->setDescription("The comment author's home page address.")
->setTranslatable(TRUE)
->setSetting('max_length', 255);
@@ -409,8 +409,8 @@ class EntityViewsDataTest extends UnitTestCase {
$base_field_definitions = $this->setupBaseFields(EntityTest::baseFieldDefinitions($this->baseEntityType));
$user_base_field_definitions = [
'uid' => BaseFieldDefinition::create('integer')
- ->setLabel(t('ID'))
- ->setDescription(t('The ID of the user entity.'))
+ ->setLabel('ID')
+ ->setDescription('The ID of the user entity.')
->setReadOnly(TRUE)
->setSetting('unsigned', TRUE)
];
@@ -498,8 +498,8 @@ class EntityViewsDataTest extends UnitTestCase {
$base_field_definitions = $this->setupBaseFields($base_field_definitions);
$user_base_field_definitions = [
'uid' => BaseFieldDefinition::create('integer')
- ->setLabel(t('ID'))
- ->setDescription(t('The ID of the user entity.'))
+ ->setLabel('ID')
+ ->setDescription('The ID of the user entity.')
->setReadOnly(TRUE)
->setSetting('unsigned', TRUE)
];
@@ -621,8 +621,8 @@ class EntityViewsDataTest extends UnitTestCase {
$base_field_definitions = $this->setupBaseFields(EntityTestMulRev::baseFieldDefinitions($this->baseEntityType));
$user_base_field_definitions = [
'uid' => BaseFieldDefinition::create('integer')
- ->setLabel(t('ID'))
- ->setDescription(t('The ID of the user entity.'))
+ ->setLabel('ID')
+ ->setDescription('The ID of the user entity.')
->setReadOnly(TRUE)
->setSetting('unsigned', TRUE)
];
@@ -970,10 +970,11 @@ class TestEntityType extends EntityType {
}
-namespace {
+namespace Drupal\entity_test\Entity {
if (!function_exists('t')) {
function t($string, array $args = []) {
return strtr($string, $args);
}
}
}
+
diff --git a/core/tests/Drupal/Tests/Core/Render/Element/MachineNameTest.php b/core/tests/Drupal/Tests/Core/Render/Element/MachineNameTest.php
index f8948c7..51b9f9f 100644
--- a/core/tests/Drupal/Tests/Core/Render/Element/MachineNameTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/Element/MachineNameTest.php
@@ -110,7 +110,7 @@ class MachineNameTest extends UnitTestCase {
}
-namespace {
+namespace Drupal\Core\Render\Element {
if (!function_exists('t')) {
function t($string, array $args = []) {
return strtr($string, $args);