Issue #2035077 by lazysoundsystem, Crell, Cottser: Remove a few remaining t() from test asserts

8.0.x
Jennifer Hodgdon 2013-07-08 10:49:45 -07:00
parent 359aabe08b
commit 2c01cd0ba9
19 changed files with 35 additions and 33 deletions

View File

@ -65,7 +65,7 @@ class ConfigTestTranslationUITest extends ContentTranslationUITest {
$values[$default_langcode] = $this->getNewEntityValues($default_langcode);
$id = $this->createEntity($values[$default_langcode], $default_langcode);
$entity = entity_load($this->entityType, $id, TRUE);
$this->assertTrue($entity, t('Entity found in the database.'));
$this->assertTrue($entity, 'Entity found in the database.');
$translation = $this->getTranslation($entity, $default_langcode);
foreach ($values[$default_langcode] as $property => $value) {

View File

@ -50,7 +50,7 @@ abstract class ContentTranslationUITest extends ContentTranslationTestBase {
$values[$default_langcode] = $this->getNewEntityValues($default_langcode);
$this->entityId = $this->createEntity($values[$default_langcode], $default_langcode);
$entity = entity_load($this->entityType, $this->entityId, TRUE);
$this->assertTrue($entity, t('Entity found in the database.'));
$this->assertTrue($entity, 'Entity found in the database.');
$translation = $this->getTranslation($entity, $default_langcode);
foreach ($values[$default_langcode] as $property => $value) {

View File

@ -104,6 +104,6 @@ class EntityReferenceAdminTest extends WebTestBase {
), t('Save settings'));
// Check that the field appears in the overview form.
$this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', 'Test label', t('Field was created and appears in the overview page.'));
$this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', 'Test label', 'Field was created and appears in the overview page.');
}
}

View File

@ -523,8 +523,8 @@ class FieldSqlStorageTest extends EntityUnitTestBase {
// Retrieve the field definition and check that the foreign key is in place.
$field = field_info_field($field_name);
$this->assertEqual($schema['foreign keys'][$foreign_key_name]['table'], $foreign_key_name, t('Foreign key table name modified after update'));
$this->assertEqual($schema['foreign keys'][$foreign_key_name]['columns'][$foreign_key_name], 'id', t('Foreign key column name modified after update'));
$this->assertEqual($schema['foreign keys'][$foreign_key_name]['table'], $foreign_key_name, 'Foreign key table name modified after update');
$this->assertEqual($schema['foreign keys'][$foreign_key_name]['columns'][$foreign_key_name], 'id', 'Foreign key column name modified after update');
// Verify the SQL schema.
$schemas = _field_sql_storage_schema($field);

View File

@ -330,7 +330,7 @@ class ManageFieldsTest extends FieldUiTestBase {
->save();
$this->drupalGet($admin_path);
$this->assertNoFieldById($element_id, '', t('No default value was possible for widget that disables default value.'));
$this->assertNoFieldById($element_id, '', 'No default value was possible for widget that disables default value.');
}
/**

View File

@ -98,12 +98,12 @@ class NodeRevisionsAllTestCase extends NodeTestBase {
// Confirm the correct revision text appears on "view revisions" page.
$this->drupalGet("node/$node->nid/revisions/$node->vid/view");
$this->assertText($node->body[Language::LANGCODE_NOT_SPECIFIED][0]['value'], t('Correct text displays for version.'));
$this->assertText($node->body[Language::LANGCODE_NOT_SPECIFIED][0]['value'], 'Correct text displays for version.');
// Confirm the correct log message appears on "revisions overview" page.
$this->drupalGet("node/$node->nid/revisions");
foreach ($logs as $log) {
$this->assertText($log, t('Log message found.'));
$this->assertText($log, 'Log message found.');
}
// Confirm that this is the current revision.
@ -119,7 +119,7 @@ class NodeRevisionsAllTestCase extends NodeTestBase {
)),
'Revision reverted.');
$reverted_node = node_load($node->nid, TRUE);
$this->assertTrue(($nodes[1]->body[Language::LANGCODE_NOT_SPECIFIED][0]['value'] == $reverted_node->body[Language::LANGCODE_NOT_SPECIFIED][0]['value']), t('Node reverted correctly.'));
$this->assertTrue(($nodes[1]->body[Language::LANGCODE_NOT_SPECIFIED][0]['value'] == $reverted_node->body[Language::LANGCODE_NOT_SPECIFIED][0]['value']), 'Node reverted correctly.');
// Confirm that this is not the current version.
$node = node_revision_load($node->vid);

View File

@ -9,6 +9,7 @@ namespace Drupal\simpletest;
use Drupal\Component\Utility\Crypt;
use Drupal\Component\Utility\NestedArray;
use Drupal\Component\Utility\String;
use Drupal\Core\DrupalKernel;
use Drupal\Core\Database\Database;
use Drupal\Core\Database\ConnectionNotDefinedException;
@ -482,7 +483,7 @@ abstract class WebTestBase extends TestBase {
$account = entity_create('user', $edit);
$account->save();
$this->assertTrue(!empty($account->uid), t('User created with name %name and pass %pass', array('%name' => $edit['name'], '%pass' => $edit['pass'])), t('User login'));
$this->assertTrue(!empty($account->uid), String::format('User created with name %name and pass %pass', array('%name' => $edit['name'], '%pass' => $edit['pass'])), 'User login');
if (empty($account->uid)) {
return FALSE;
}
@ -665,9 +666,9 @@ abstract class WebTestBase extends TestBase {
// idea being if you were properly logged out you should be seeing a login
// screen.
$this->drupalGet('user/logout', array('query' => array('destination' => 'user')));
$this->assertResponse(200, t('User was logged out.'));
$pass = $this->assertField('name', t('Username field found.'), t('Logout'));
$pass = $pass && $this->assertField('pass', t('Password field found.'), t('Logout'));
$this->assertResponse(200, 'User was logged out.');
$pass = $this->assertField('name', 'Username field found.', 'Logout');
$pass = $pass && $this->assertField('pass', 'Password field found.', 'Logout');
if ($pass) {
// @see WebTestBase::drupalUserIsLoggedIn()
@ -1102,8 +1103,8 @@ abstract class WebTestBase extends TestBase {
'@status' => $status,
'!length' => format_size(strlen($this->drupalGetContent()))
);
$message = t('!method @url returned @status (!length).', $message_vars);
$this->assertTrue($this->drupalGetContent() !== FALSE, $message, t('Browser'));
$message = String::format('!method @url returned @status (!length).', $message_vars);
$this->assertTrue($this->drupalGetContent() !== FALSE, $message, 'Browser');
return $this->drupalGetContent();
}
@ -2056,7 +2057,7 @@ abstract class WebTestBase extends TestBase {
$url_target = $this->getAbsoluteUrl($urls[$index]['href']);
}
$this->assertTrue(isset($urls[$index]), t('Clicked link %label (@url_target) from @url_before', array('%label' => $label, '@url_target' => $url_target, '@url_before' => $url_before)), t('Browser'));
$this->assertTrue(isset($urls[$index]), String::format('Clicked link %label (@url_target) from @url_before', array('%label' => $label, '@url_target' => $url_target, '@url_before' => $url_before)), 'Browser');
if (isset($url_target)) {
return $this->drupalGet($url_target);

View File

@ -118,7 +118,7 @@ class UpdateTest extends DatabaseTestBase {
$this->assertIdentical($num_rows, 4, 'Updated 4 records.');
$saved_name = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => pow(26, 2)))->fetchField();
$this->assertIdentical($saved_name, 'Paul', t('Successfully updated values using an algebraic expression.'));
$this->assertIdentical($saved_name, 'Paul', 'Successfully updated values using an algebraic expression.');
}
/**
@ -146,9 +146,9 @@ class UpdateTest extends DatabaseTestBase {
->fields(array('id' => 42, 'name' => 'John'))
->condition('id', 1)
->execute();
$this->assertIdentical($num_updated, 1, t('Updated 1 record.'));
$this->assertIdentical($num_updated, 1, 'Updated 1 record.');
$saved_name= db_query('SELECT name FROM {test} WHERE id = :id', array(':id' => 42))->fetchField();
$this->assertIdentical($saved_name, 'John', t('Updated primary key successfully.'));
$this->assertIdentical($saved_name, 'John', 'Updated primary key successfully.');
}
}

View File

@ -39,7 +39,7 @@ class ToolkitTest extends ToolkitTestBase {
function testLoad() {
$image = image_load($this->file, $this->toolkit);
$this->assertTrue(is_object($image), 'Returned an object.');
$this->assertEqual($this->toolkit, $image->toolkit, t('Image had toolkit set.'));
$this->assertEqual($this->toolkit, $image->toolkit, 'Image had toolkit set.');
$this->assertToolkitOperationsCalled(array('load', 'get_info'));
}

View File

@ -28,6 +28,6 @@ class AdminMetaTagTest extends WebTestBase {
list($version, ) = explode('.', VERSION);
$string = '<meta name="Generator" content="Drupal ' . $version . ' (http://drupal.org)" />';
$this->drupalGet('node');
$this->assertRaw($string, 'Fingerprinting meta tag generated correctly.', t('System'));
$this->assertRaw($string, 'Fingerprinting meta tag generated correctly.', 'System');
}
}

View File

@ -7,6 +7,7 @@
namespace Drupal\system\Tests\System;
use Drupal\Component\Utility\String;
use Drupal\simpletest\WebTestBase;
class DefaultMobileMetaTagsTest extends WebTestBase {
@ -34,7 +35,7 @@ class DefaultMobileMetaTagsTest extends WebTestBase {
public function testDefaultMetaTagsExist() {
$this->drupalGet('');
foreach ($this->default_metatags as $name => $metatag) {
$this->assertRaw($metatag, format_string('Default Mobile meta tag "@name" displayed properly.', array('@name' => $name)), t('System'));
$this->assertRaw($metatag, String::format('Default Mobile meta tag "@name" displayed properly.', array('@name' => $name)), 'System');
}
}
@ -45,7 +46,7 @@ class DefaultMobileMetaTagsTest extends WebTestBase {
module_enable(array('system_module_test'));
$this->drupalGet('');
foreach ($this->default_metatags as $name => $metatag) {
$this->assertNoRaw($metatag, format_string('Default Mobile meta tag "@name" removed properly.', array('@name' => $name)), t('System'));
$this->assertNoRaw($metatag, String::format('Default Mobile meta tag "@name" removed properly.', array('@name' => $name)), 'System');
}
}
}

View File

@ -42,7 +42,7 @@ class ThemeTestPhpTemplate extends WebTestBase {
->set('default', 'test_theme_phptemplate')
->save();
$this->drupalGet('theme-test/template-test');
$this->assertText('Success: Template overridden with PHPTemplate theme.', t('Template overridden by PHPTemplate file.'));
$this->assertText('Success: Template overridden with PHPTemplate theme.', 'Template overridden by PHPTemplate file.');
}
}

View File

@ -118,7 +118,7 @@ class FieldUpgradePathTest extends UpgradePathTestBase {
* Tests migration of field and instance definitions to config.
*/
function testFieldUpgradeToConfig() {
$this->assertTrue($this->performUpgrade(), t('The upgrade was completed successfully.'));
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
// Check that the configuration for the 'body' field is correct.
$config = \Drupal::config('field.field.body')->get();

View File

@ -67,7 +67,7 @@ class TermLanguageTest extends TaxonomyTestBase {
// Check if on the edit page the language is correct.
$this->drupalGet('taxonomy/term/' . $term->id() . '/edit');
$this->assertOptionSelected('edit-langcode', $edit['langcode'], t('The term language was correctly selected.'));
$this->assertOptionSelected('edit-langcode', $edit['langcode'], 'The term language was correctly selected.');
// Change the language of the term.
$edit['langcode'] = 'bb';
@ -75,7 +75,7 @@ class TermLanguageTest extends TaxonomyTestBase {
// Check again that on the edit page the language is correct.
$this->drupalGet('taxonomy/term/' . $term->id() . '/edit');
$this->assertOptionSelected('edit-langcode', $edit['langcode'], t('The term language was correctly selected.'));
$this->assertOptionSelected('edit-langcode', $edit['langcode'], 'The term language was correctly selected.');
}
function testDefaultTermLanguage() {

View File

@ -150,6 +150,6 @@ class VocabularyTest extends TaxonomyTestBase {
$this->drupalPost(NULL, NULL, t('Delete'));
$this->assertRaw(t('Deleted vocabulary %name.', array('%name' => $vocabulary->name)), 'Vocabulary deleted.');
$this->container->get('plugin.manager.entity')->getStorageController('taxonomy_vocabulary')->resetCache();
$this->assertFalse(taxonomy_vocabulary_load($vid), t('Vocabulary not found.'));
$this->assertFalse(taxonomy_vocabulary_load($vid), 'Vocabulary not found.');
}
}

View File

@ -89,7 +89,7 @@ class ToolbarMenuTranslationTest extends WebTestBase {
// Go to another page in the custom language and make sure the menu item
// was translated.
$this->drupalGet($langcode . '/admin/structure');
$this->assertText($menu_item_translated, t('Found the menu translated.'));
$this->assertText($menu_item_translated, 'Found the menu translated.');
// Toolbar icons are included based on the presence of a specific class on
// the menu item. Ensure that class also exists for a translated menu item.

View File

@ -60,14 +60,14 @@ class UserPasswordResetTest extends WebTestBase {
$this->drupalPost(NULL, $edit, t('E-mail new password'));
$this->assertText(t('Sorry, @name is not recognized as a username or an e-mail address.', array('@name' => $edit['name'])), 'Validation error message shown when trying to request password for invalid account.');
$this->assertEqual(count($this->drupalGetMails(array('id' => 'user_password_reset'))), 0, t('No e-mail was sent when requesting a password for an invalid account.'));
$this->assertEqual(count($this->drupalGetMails(array('id' => 'user_password_reset'))), 0, 'No e-mail was sent when requesting a password for an invalid account.');
// Reset the password by username via the password reset page.
$edit['name'] = $this->account->name;
$this->drupalPost(NULL, $edit, t('E-mail new password'));
// Verify that the user was sent an e-mail.
$this->assertMail('to', $this->account->mail, t('Password e-mail sent to user.'));
$this->assertMail('to', $this->account->mail, 'Password e-mail sent to user.');
$subject = t('Replacement login information for @username at @site', array('@username' => $this->account->name, '@site' => config('system.site')->get('name')));
$this->assertMail('subject', $subject, 'Password reset e-mail subject is correct.');

View File

@ -41,7 +41,7 @@ class AccessPermissionTest extends AccessTestBase {
$access_plugin = $view->display_handler->getPlugin('access');
$this->assertTrue($access_plugin instanceof Permission, 'Make sure the right class got instantiated.');
$this->assertTrue($view->display_handler->access($this->adminUser), t('Admin-Account should be able to access the view everytime'));
$this->assertTrue($view->display_handler->access($this->adminUser), 'Admin-Account should be able to access the view everytime');
$this->assertFalse($view->display_handler->access($this->webUser));
$this->assertTrue($view->display_handler->access($this->normalUser));
}

View File

@ -45,7 +45,7 @@ class AccessRoleTest extends AccessTestBase {
$access_plugin = $view->display_handler->getPlugin('access');
$this->assertTrue($access_plugin instanceof Role, 'Make sure the right class got instantiated.');
$this->assertTrue($view->display_handler->access($this->adminUser), t('Admin-Account should be able to access the view everytime'));
$this->assertTrue($view->display_handler->access($this->adminUser), 'Admin-Account should be able to access the view everytime');
$this->assertFalse($view->display_handler->access($this->webUser));
$this->assertTrue($view->display_handler->access($this->normalUser));
}