Commit 2c01cd0b authored by jhodgdon's avatar jhodgdon

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

parent 359aabe0
......@@ -65,7 +65,7 @@ function testTranslationUI() {
$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) {
......
......@@ -50,7 +50,7 @@ protected function assertBasicTranslation() {
$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) {
......
......@@ -104,6 +104,6 @@ public function testFieldAdminHandler() {
), 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.');
}
}
......@@ -523,8 +523,8 @@ function testFieldSqlStorageForeignKeys() {
// 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);
......
......@@ -330,7 +330,7 @@ function testDefaultValue() {
->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.');
}
/**
......
......@@ -98,12 +98,12 @@ function testRevisions() {
// 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 @@ function testRevisions() {
)),
'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);
......
......@@ -9,6 +9,7 @@
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 @@ protected function drupalCreateUser(array $permissions = array(), $name = NULL)
$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 @@ protected function drupalLogout() {
// 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 @@ protected function curlExec($curl_options, $redirect = FALSE) {
'@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 @@ protected function clickLink($label, $index = 0) {
$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);
......
......@@ -118,7 +118,7 @@ function testExpressionUpdate() {
$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 @@ function testPrimaryKeyUpdate() {
->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.');
}
}
......@@ -39,7 +39,7 @@ function testGetAvailableToolkits() {
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'));
}
......
......@@ -28,6 +28,6 @@ public function testMetaTag() {
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');
}
}
......@@ -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 @@ function setUp() {
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 @@ public function testRemovingDefaultMetaTags() {
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');
}
}
}
......@@ -42,7 +42,7 @@ function testTemplateOverride() {
->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.');
}
}
......@@ -118,7 +118,7 @@ public function testEntityFormDisplayUpgrade() {
* 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();
......
......@@ -67,7 +67,7 @@ function testTermLanguage() {
// 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 @@ function testTermLanguage() {
// 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() {
......
......@@ -150,6 +150,6 @@ function testTaxonomyAdminDeletingVocabulary() {
$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.');
}
}
......@@ -89,7 +89,7 @@ function testToolbarClasses() {
// 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.
......
......@@ -60,14 +60,14 @@ function testUserPasswordReset() {
$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.');
......
......@@ -41,7 +41,7 @@ function testAccessPerm() {
$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));
}
......
......@@ -45,7 +45,7 @@ function testAccessRole() {
$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));
}
......
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