Commit 406dfbc6 authored by catch's avatar catch
Browse files

Issue #3227501 by longwave, mondrake: Remove remaining uses of t() in test assertions

parent 86a50988
......@@ -148,19 +148,19 @@ public function postComment(EntityInterface $entity, $comment, $subject = '', $c
switch ($preview_mode) {
case DRUPAL_REQUIRED:
// Preview required so no save button should be found.
$this->assertSession()->buttonNotExists(t('Save'));
$this->assertSession()->buttonNotExists('Save');
$this->submitForm($edit, 'Preview');
// Don't break here so that we can test post-preview field presence and
// function below.
case DRUPAL_OPTIONAL:
$this->assertSession()->buttonExists(t('Preview'));
$this->assertSession()->buttonExists(t('Save'));
$this->assertSession()->buttonExists('Preview');
$this->assertSession()->buttonExists('Save');
$this->submitForm($edit, 'Save');
break;
case DRUPAL_DISABLED:
$this->assertSession()->buttonNotExists(t('Preview'));
$this->assertSession()->buttonExists(t('Save'));
$this->assertSession()->buttonNotExists('Preview');
$this->assertSession()->buttonExists('Save');
$this->submitForm($edit, 'Save');
break;
}
......@@ -502,7 +502,7 @@ public function testsNonIntegerIdEntities() {
// Attempt to add a comment-type referencing this entity-type.
$this->drupalGet('admin/structure/comment/types/add');
$this->assertSession()->optionNotExists('edit-target-entity-type-id', 'entity_test_string_id');
$this->assertSession()->responseNotContains(t('Test entity with string_id'));
$this->assertSession()->responseNotContains('Test entity with string_id');
// Create a bundle for entity_test_no_id.
entity_test_create_bundle('entity_test', 'Entity Test', 'entity_test_no_id');
......
......@@ -148,19 +148,19 @@ public function postComment($entity, $comment, $subject = '', $contact = NULL, $
switch ($preview_mode) {
case DRUPAL_REQUIRED:
// Preview required so no save button should be found.
$this->assertSession()->buttonNotExists(t('Save'));
$this->assertSession()->buttonNotExists('Save');
$this->submitForm($edit, 'Preview');
// Don't break here so that we can test post-preview field presence and
// function below.
case DRUPAL_OPTIONAL:
$this->assertSession()->buttonExists(t('Preview'));
$this->assertSession()->buttonExists(t('Save'));
$this->assertSession()->buttonExists('Preview');
$this->assertSession()->buttonExists('Save');
$this->submitForm($edit, 'Save');
break;
case DRUPAL_DISABLED:
$this->assertSession()->buttonNotExists(t('Preview'));
$this->assertSession()->buttonExists(t('Save'));
$this->assertSession()->buttonNotExists('Preview');
$this->assertSession()->buttonExists('Save');
$this->submitForm($edit, 'Save');
break;
}
......
......@@ -414,15 +414,15 @@ public function testContactConfigEntityTranslation() {
// Test that delete links work and operations perform properly.
foreach ($this->langcodes as $langcode) {
$replacements = ['%label' => t('@label @entity_type', ['@label' => $label, '@entity_type' => mb_strtolower(t('Contact form'))]), '@language' => \Drupal::languageManager()->getLanguage($langcode)->getName()];
$language = \Drupal::languageManager()->getLanguage($langcode)->getName();
$this->drupalGet("$translation_base_url/$langcode/delete");
$this->assertSession()->responseContains(t('Are you sure you want to delete the @language translation of %label?', $replacements));
$this->assertSession()->pageTextContains("Are you sure you want to delete the $language translation of $label contact form?");
// Assert link back to list page to cancel delete is present.
$this->assertSession()->linkByHrefExists($translation_base_url);
$this->submitForm([], 'Delete');
$this->assertSession()->responseContains(t('@language translation of %label was deleted', $replacements));
$this->assertSession()->pageTextContains("$language translation of $label contact form was deleted");
$this->assertSession()->linkByHrefExists("$translation_base_url/$langcode/add");
$this->assertSession()->linkByHrefNotExists("translation_base_url/$langcode/edit");
$this->assertSession()->linkByHrefNotExists("$translation_base_url/$langcode/delete");
......
......@@ -55,7 +55,7 @@ public function testDisableSetting() {
];
$this->submitForm($edit, 'Save configuration');
$assert->pageTextContains(t('Settings successfully updated.'));
$assert->pageTextContains('Settings successfully updated.');
$assert->checkboxChecked($group_checkbox);
......@@ -66,7 +66,7 @@ public function testDisableSetting() {
];
$this->submitForm($edit, 'Save configuration');
$assert->pageTextContains(t('Settings successfully updated.'));
$assert->pageTextContains('Settings successfully updated.');
$assert->checkboxNotChecked($group_checkbox);
}
......
......@@ -3,7 +3,6 @@
namespace Drupal\Tests\dblog\Functional;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Database\Database;
use Drupal\Core\Logger\RfcLogLevel;
......@@ -455,14 +454,14 @@ private function doUser() {
// Add user.
// Default display includes name and email address; if too long, the email
// address is replaced by three periods.
$this->assertLogMessage(t('New user: %name %email.', ['%name' => $name, '%email' => '<' . $user->getEmail() . '>']), 'DBLog event was recorded: [add user]');
$this->assertLogMessage("New user: $name <{$user->getEmail()}>.", 'DBLog event was recorded: [add user]');
// Log in user.
$this->assertLogMessage(t('Session opened for %name.', ['%name' => $name]), 'DBLog event was recorded: [login user]');
$this->assertLogMessage("Session opened for $name.", 'DBLog event was recorded: [login user]');
// Log out user.
$this->assertLogMessage(t('Session closed for %name.', ['%name' => $name]), 'DBLog event was recorded: [logout user]');
$this->assertLogMessage("Session closed for $name.", 'DBLog event was recorded: [logout user]');
// Delete user.
$message = t('Deleted user: %name %email.', ['%name' => $name, '%email' => '<' . $user->getEmail() . '>']);
$message_text = Unicode::truncate(Html::decodeEntities(strip_tags($message)), 56, TRUE, TRUE);
$message = "Deleted user: $name <{$user->getEmail()}>.";
$message_text = Unicode::truncate($message, 56, TRUE, TRUE);
// Verify that the full message displays on the details page.
$link = FALSE;
if ($links = $this->xpath('//a[text()="' . $message_text . '"]')) {
......@@ -474,7 +473,7 @@ private function doUser() {
$link = mb_substr($value, strpos($value, 'admin/reports/dblog/event/'));
$this->drupalGet($link);
// Check for full message text on the details page.
$this->assertSession()->responseContains($message);
$this->assertSession()->pageTextContains($message);
}
$this->assertNotEmpty($link, 'DBLog event was recorded: [delete user]');
// Visit random URL (to generate page not found event).
......@@ -535,11 +534,11 @@ private function doNode($type) {
// Verify that node events were recorded.
// Was node content added?
$this->assertLogMessage(t('@type: added %title.', ['@type' => $type, '%title' => $title]), 'DBLog event was recorded: [content added]');
$this->assertLogMessage("$type: added $title.", 'DBLog event was recorded: [content added]');
// Was node content updated?
$this->assertLogMessage(t('@type: updated %title.', ['@type' => $type, '%title' => $title]), 'DBLog event was recorded: [content updated]');
$this->assertLogMessage("$type: updated $title.", 'DBLog event was recorded: [content updated]');
// Was node content deleted?
$this->assertLogMessage(t('@type: deleted %title.', ['@type' => $type, '%title' => $title]), 'DBLog event was recorded: [content deleted]');
$this->assertLogMessage("$type: deleted $title.", 'DBLog event was recorded: [content deleted]');
// View the database log access-denied report page.
$this->drupalGet('admin/reports/access-denied');
......@@ -805,7 +804,7 @@ protected function getSeverityConstant($class) {
* The message to pass to simpletest.
*/
protected function assertLogMessage($log_message, $message) {
$message_text = Unicode::truncate(Html::decodeEntities(strip_tags($log_message)), 56, TRUE, TRUE);
$message_text = Unicode::truncate($log_message, 56, TRUE, TRUE);
$this->assertSession()->linkExists($message_text, 0, $message);
}
......
......@@ -126,7 +126,7 @@ public function testBooleanFormatterSettings() {
foreach ($options as $string) {
$assert_session->pageTextContains($string);
}
$assert_session->pageTextContains(t('Field settings (@on_label / @off_label)', ['@on_label' => $values[0], '@off_label' => $values[1]]));
$assert_session->pageTextContains("Field settings ({$values[0]} / {$values[1]})");
// Test that the settings summary are present in the correct format.
$this->drupalGet('admin/structure/types/manage/' . $this->bundle . '/display');
......
......@@ -126,7 +126,7 @@ public function testBooleanFormatterSettings() {
foreach ($options as $string) {
$assert_session->pageTextContains($string);
}
$assert_session->pageTextContains(t('Field settings (@on_label / @off_label)', ['@on_label' => $values[0], '@off_label' => $values[1]]));
$assert_session->pageTextContains("Field settings ({$values[0]} / {$values[1]})");
}
}
......
......@@ -33,22 +33,22 @@ public function testFields() {
// Integer field.
$field_storage = FieldStorageConfig::load('node.field_test_two');
$this->assertSame("integer", $field_storage->getType(), t('Field type is @fieldtype. It should be integer.', ['@fieldtype' => $field_storage->getType()]));
$this->assertSame("integer", $field_storage->getType());
// Float field.
$field_storage = FieldStorageConfig::load('node.field_test_three');
$this->assertSame("decimal", $field_storage->getType(), t('Field type is @fieldtype. It should be decimal.', ['@fieldtype' => $field_storage->getType()]));
$this->assertSame("decimal", $field_storage->getType());
// Link field.
$field_storage = FieldStorageConfig::load('node.field_test_link');
$this->assertSame("link", $field_storage->getType(), t('Field type is @fieldtype. It should be link.', ['@fieldtype' => $field_storage->getType()]));
$this->assertSame("link", $field_storage->getType());
// File field.
$field_storage = FieldStorageConfig::load('node.field_test_filefield');
$this->assertSame("file", $field_storage->getType(), t('Field type is @fieldtype. It should be file.', ['@fieldtype' => $field_storage->getType()]));
$this->assertSame("file", $field_storage->getType());
$field_storage = FieldStorageConfig::load('node.field_test_imagefield');
$this->assertSame("image", $field_storage->getType(), t('Field type is @fieldtype. It should be image.', ['@fieldtype' => $field_storage->getType()]));
$this->assertSame("image", $field_storage->getType());
$settings = $field_storage->getSettings();
$this->assertSame('file', $settings['target_type']);
$this->assertSame('public', $settings['uri_scheme']);
......@@ -56,51 +56,45 @@ public function testFields() {
// Phone field.
$field_storage = FieldStorageConfig::load('node.field_test_phone');
$this->assertSame("telephone", $field_storage->getType(), t('Field type is @fieldtype. It should be telephone.', ['@fieldtype' => $field_storage->getType()]));
$this->assertSame("telephone", $field_storage->getType());
// Date field.
$field_storage = FieldStorageConfig::load('node.field_test_datetime');
$this->assertSame("datetime", $field_storage->getType(), t('Field type is @fieldtype. It should be datetime.', ['@fieldtype' => $field_storage->getType()]));
$this->assertSame("datetime", $field_storage->getType());
// Date fields.
$field_storage = FieldStorageConfig::load('node.field_test_datetime');
$this->assertSame("datetime", $field_storage->getType(), t('Field type is @fieldtype. It should be datetime.', ['@fieldtype' => $field_storage->getType()]));
$this->assertSame("datetime", $field_storage->getType());
$field_storage = FieldStorageConfig::load('node.field_test_datestamp');
$this->assertSame("timestamp", $field_storage->getType(), t('Field type is @fieldtype. It should be timestamp.', ['@fieldtype' => $field_storage->getType()]));
$this->assertSame("timestamp", $field_storage->getType());
$field_storage = FieldStorageConfig::load('node.field_test_date');
$this->assertSame("datetime", $field_storage->getType(), t('Field type is @fieldtype. It should be datetime.', ['@fieldtype' => $field_storage->getType()]));
$this->assertSame("datetime", $field_storage->getType());
// Decimal field with radio buttons.
$field_storage = FieldStorageConfig::load('node.field_test_decimal_radio_buttons');
$this->assertSame("list_float", $field_storage->getType(), t('Field type is @fieldtype. It should be list_float.', ['@fieldtype' => $field_storage->getType()]));
$this->assertNotNull($field_storage->getSetting('allowed_values')['1.2'], t('First allowed value key is set to 1.2'));
$this->assertNotNull($field_storage->getSetting('allowed_values')['2.1'], t('Second allowed value key is set to 2.1'));
$this->assertSame('1.2', $field_storage->getSetting('allowed_values')['1.2'], t('First allowed value is set to 1.2'));
$this->assertSame('2.1', $field_storage->getSetting('allowed_values')['2.1'], t('Second allowed value is set to 1.2'));
$this->assertSame("list_float", $field_storage->getType());
$this->assertSame('1.2', $field_storage->getSetting('allowed_values')['1.2']);
$this->assertSame('2.1', $field_storage->getSetting('allowed_values')['2.1']);
// Email field.
$field_storage = FieldStorageConfig::load('node.field_test_email');
$this->assertSame("email", $field_storage->getType(), t('Field type is @fieldtype. It should be email.', ['@fieldtype' => $field_storage->getType()]));
$this->assertSame("email", $field_storage->getType());
// Float field with a single checkbox.
$field_storage = FieldStorageConfig::load('node.field_test_float_single_checkbox');
$this->assertSame("boolean", $field_storage->getType(), t('Field type is @fieldtype. It should be boolean.', ['@fieldtype' => $field_storage->getType()]));
$this->assertSame("boolean", $field_storage->getType());
// Integer field with a select list.
$field_storage = FieldStorageConfig::load('node.field_test_integer_selectlist');
$this->assertSame("list_integer", $field_storage->getType(), t('Field type is @fieldtype. It should be list_integer.', ['@fieldtype' => $field_storage->getType()]));
$this->assertNotNull($field_storage->getSetting('allowed_values')['1234'], t('First allowed value key is set to 1234'));
$this->assertNotNull($field_storage->getSetting('allowed_values')['2341'], t('Second allowed value key is set to 2341'));
$this->assertNotNull($field_storage->getSetting('allowed_values')['3412'], t('Third allowed value key is set to 3412'));
$this->assertNotNull($field_storage->getSetting('allowed_values')['4123'], t('Fourth allowed value key is set to 4123'));
$this->assertSame('1234', $field_storage->getSetting('allowed_values')['1234'], t('First allowed value is set to 1234'));
$this->assertSame('2341', $field_storage->getSetting('allowed_values')['2341'], t('Second allowed value is set to 2341'));
$this->assertSame('3412', $field_storage->getSetting('allowed_values')['3412'], t('Third allowed value is set to 3412'));
$this->assertSame('4123', $field_storage->getSetting('allowed_values')['4123'], t('Fourth allowed value is set to 4123'));
$this->assertSame("list_integer", $field_storage->getType());
$this->assertSame('1234', $field_storage->getSetting('allowed_values')['1234']);
$this->assertSame('2341', $field_storage->getSetting('allowed_values')['2341']);
$this->assertSame('3412', $field_storage->getSetting('allowed_values')['3412']);
$this->assertSame('4123', $field_storage->getSetting('allowed_values')['4123']);
// Text field with a single checkbox.
$field_storage = FieldStorageConfig::load('node.field_test_text_single_checkbox');
$this->assertSame("boolean", $field_storage->getType(), t('Field type is @fieldtype. It should be boolean.', ['@fieldtype' => $field_storage->getType()]));
$this->assertSame("boolean", $field_storage->getType());
// Test a node reference field.
$field_storage = FieldStorageConfig::load('node.field_company');
......
......@@ -456,7 +456,7 @@ public function fieldUIAddNewField($bundle_path, $field_name, $label = NULL, $fi
$page->findButton(t('Save and continue'))->click();
$assert_session->responseContains(t('These settings apply to the %label field everywhere it is used.', ['%label' => $label]));
$assert_session->pageTextContains("These settings apply to the $label field everywhere it is used.");
$breadcrumb_link = $page->findLink($label);
// Test breadcrumb.
......@@ -464,11 +464,11 @@ public function fieldUIAddNewField($bundle_path, $field_name, $label = NULL, $fi
// Second step: 'Storage settings' form.
$page->findButton('Save field settings')->click();
$assert_session->responseContains(t('Updated field %label field settings.', ['%label' => $label]));
$assert_session->pageTextContains("Updated field $label field settings.");
// Third step: 'Field settings' form.
$page->findButton('Save settings')->click();
$assert_session->responseContains(t('Saved %label configuration.', ['%label' => $label]));
$assert_session->pageTextContains("Saved $label configuration.");
// Check that the field appears in the overview form.
$row = $page->find('css', '#field-' . $field_name);
......
......@@ -34,23 +34,22 @@ protected function setUp(): void {
* Tests the basic node submission for an anonymous visitor.
*/
public function testAnonymousNode() {
$bundle_label = 'Article';
$node_title = 'test page';
$type = 'Article';
$title = 'test page';
// Load the node form.
$this->drupalLogout();
$this->drupalGet('node/add/article');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextContains(strip_tags(t('Create @name', ['@name' => $bundle_label])));
$this->assertSession()->pageTextContains("Create $type");
$edit = [
'title[0][value]' => $node_title,
'title[0][value]' => $title,
'body[0][value]' => 'Test article',
];
$this->submitForm($edit, 'Save');
$this->assertSession()->statusCodeEquals(200);
$t_args = ['@type' => $bundle_label, '%title' => $node_title];
$this->assertSession()->pageTextContains(strip_tags(t('@type %title has been created.', $t_args)));
$this->assertSession()->pageTextContains("$type $title has been created.");
$matches = [];
if (preg_match('@node/(\d+)$@', $this->getUrl(), $matches)) {
$nid = end($matches);
......@@ -64,29 +63,28 @@ public function testAnonymousNode() {
* Tests file submission for an anonymous visitor.
*/
public function testAnonymousNodeWithFile() {
$bundle_label = 'Article';
$node_title = 'Test page';
$type = 'Article';
$title = 'Test page';
$this->createFileField('field_image', 'node', 'article', [], ['file_extensions' => 'txt png']);
// Load the node form.
$this->drupalLogout();
$this->drupalGet('node/add/article');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextContains(strip_tags(t('Create @name', ['@name' => $bundle_label])));
$this->assertSession()->pageTextContains("Create $type");
// Generate an image file.
$image = $this->getTestFile('image');
// Submit the form.
$edit = [
'title[0][value]' => $node_title,
'title[0][value]' => $title,
'body[0][value]' => 'Test article',
'files[field_image_0]' => $this->container->get('file_system')->realpath($image->getFileUri()),
];
$this->submitForm($edit, 'Save');
$this->assertSession()->statusCodeEquals(200);
$t_args = ['@type' => $bundle_label, '%title' => $node_title];
$this->assertSession()->pageTextContains(strip_tags(t('@type %title has been created.', $t_args)));
$this->assertSession()->pageTextContains("$type $title has been created.");
$matches = [];
if (preg_match('@node/(\d+)$@', $this->getUrl(), $matches)) {
$nid = end($matches);
......@@ -122,14 +120,14 @@ public function testAuthenticatedNodeWithFileWithoutTitle() {
* Helper method to test file submissions with missing node titles.
*/
protected function doTestNodeWithFileWithoutTitle() {
$bundle_label = 'Article';
$node_title = 'Test page';
$type = 'Article';
$title = 'Test page';
$this->createFileField('field_image', 'node', 'article', [], ['file_extensions' => 'txt png']);
// Load the node form.
$this->drupalGet('node/add/article');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextContains(strip_tags(t('Create @name', ['@name' => $bundle_label])));
$this->assertSession()->pageTextContains("Create $type");
// Generate an image file.
$image = $this->getTestFile('image');
......@@ -147,20 +145,18 @@ protected function doTestNodeWithFileWithoutTitle() {
}
$this->submitForm($edit, $label);
$this->assertSession()->statusCodeEquals(200);
$t_args = ['@type' => $bundle_label, '%title' => $node_title];
$this->assertSession()->pageTextNotContains(strip_tags(t('@type %title has been created.', $t_args)));
$this->assertSession()->pageTextNotContains("$type $title has been created.");
$this->assertSession()->pageTextContains('Title field is required.');
// Submit the form again but this time with the missing title field. This
// should still work.
$edit = [
'title[0][value]' => $node_title,
'title[0][value]' => $title,
];
$this->submitForm($edit, $label);
// Confirm the final submission actually worked.
$t_args = ['@type' => $bundle_label, '%title' => $node_title];
$this->assertSession()->pageTextContains(strip_tags(t('@type %title has been created.', $t_args)));
$this->assertSession()->pageTextContains("$type $title has been created.");
$matches = [];
if (preg_match('@node/(\d+)$@', $this->getUrl(), $matches)) {
$nid = end($matches);
......
......@@ -85,7 +85,7 @@ public function testManagedFile() {
$this->getSession()->getPage()->pressButton($remove_button_title);
$this->assertSession()->assertWaitOnAjaxRequest();
$this->submitForm([], 'Save');
$this->assertSession()->responseContains(t('The file ids are %fids.', ['%fids' => '']));
$this->assertSession()->pageTextContains('The file ids are .');
// Upload, then Remove, then Submit.
$this->drupalGet($path);
......@@ -100,7 +100,7 @@ public function testManagedFile() {
$this->assertSession()->assertWaitOnAjaxRequest();
$this->submitForm([], 'Save');
$this->assertSession()->responseContains(t('The file ids are %fids.', ['%fids' => '']));
$this->assertSession()->pageTextContains('The file ids are .');
}
}
}
......
......@@ -108,13 +108,13 @@ public function assertFileHookCalled($hook, $expected_count = 1, $message = NULL
* File object to compare.
*/
public function assertFileUnchanged(FileInterface $before, FileInterface $after) {
$this->assertEquals($before->id(), $after->id(), t('File id is the same: %file1 == %file2.', ['%file1' => $before->id(), '%file2' => $after->id()]));
$this->assertEquals($before->getOwner()->id(), $after->getOwner()->id(), t('File owner is the same: %file1 == %file2.', ['%file1' => $before->getOwner()->id(), '%file2' => $after->getOwner()->id()]));
$this->assertEquals($before->getFilename(), $after->getFilename(), t('File name is the same: %file1 == %file2.', ['%file1' => $before->getFilename(), '%file2' => $after->getFilename()]));
$this->assertEquals($before->getFileUri(), $after->getFileUri(), t('File path is the same: %file1 == %file2.', ['%file1' => $before->getFileUri(), '%file2' => $after->getFileUri()]));
$this->assertEquals($before->getMimeType(), $after->getMimeType(), t('File MIME type is the same: %file1 == %file2.', ['%file1' => $before->getMimeType(), '%file2' => $after->getMimeType()]));
$this->assertEquals($before->getSize(), $after->getSize(), t('File size is the same: %file1 == %file2.', ['%file1' => $before->getSize(), '%file2' => $after->getSize()]));
$this->assertEquals($before->isPermanent(), $after->isPermanent(), t('File status is the same: %file1 == %file2.', ['%file1' => $before->isPermanent(), '%file2' => $after->isPermanent()]));
$this->assertEquals($before->id(), $after->id(), 'File id is the same');
$this->assertEquals($before->getOwner()->id(), $after->getOwner()->id(), 'File owner is the same');
$this->assertEquals($before->getFilename(), $after->getFilename(), 'File name is the same');
$this->assertEquals($before->getFileUri(), $after->getFileUri(), 'File path is the same');
$this->assertEquals($before->getMimeType(), $after->getMimeType(), 'File MIME type is the same');
$this->assertEquals($before->getSize(), $after->getSize(), 'File size is the same');
$this->assertEquals($before->isPermanent(), $after->isPermanent(), 'File status is the same');
}
/**
......@@ -126,8 +126,8 @@ public function assertFileUnchanged(FileInterface $before, FileInterface $after)
* File object to compare.
*/
public function assertDifferentFile(FileInterface $file1, FileInterface $file2) {
$this->assertNotEquals($file1->id(), $file2->id(), t('Files have different ids: %file1 != %file2.', ['%file1' => $file1->id(), '%file2' => $file2->id()]));
$this->assertNotEquals($file1->getFileUri(), $file2->getFileUri(), t('Files have different paths: %file1 != %file2.', ['%file1' => $file1->getFileUri(), '%file2' => $file2->getFileUri()]));
$this->assertNotEquals($file1->id(), $file2->id(), 'Files have different ids');
$this->assertNotEquals($file1->getFileUri(), $file2->getFileUri(), 'Files have different paths');
}
/**
......@@ -139,8 +139,8 @@ public function assertDifferentFile(FileInterface $file1, FileInterface $file2)
* File object to compare.
*/
public function assertSameFile(FileInterface $file1, FileInterface $file2) {
$this->assertEquals($file1->id(), $file2->id(), t('Files have the same ids: %file1 == %file2.', ['%file1' => $file1->id(), '%file2-fid' => $file2->id()]));
$this->assertEquals($file1->getFileUri(), $file2->getFileUri(), t('Files have the same path: %file1 == %file2.', ['%file1' => $file1->getFileUri(), '%file2' => $file2->getFileUri()]));
$this->assertEquals($file1->id(), $file2->id(), 'Files have the same ids');
$this->assertEquals($file1->getFileUri(), $file2->getFileUri(), 'Files have the same path');
}
/**
......
......@@ -62,7 +62,7 @@ public function testFileFields() {
$this->assertFieldAccess('file', 'uri', $file->getFileUri());
$this->assertFieldAccess('file', 'filemime', $file->filemime->value);
$this->assertFieldAccess('file', 'filesize', '4 bytes');
$this->assertFieldAccess('file', 'status', t('Permanent'));
$this->assertFieldAccess('file', 'status', 'Permanent');
// $this->assertFieldAccess('file', 'created', \Drupal::service('date.formatter')->format(123456));
// $this->assertFieldAccess('file', 'changed', \Drupal::service('date.formatter')->format(REQUEST_TIME));
}
......
......@@ -135,7 +135,8 @@ public function testForum() {
// Check that the basic forum install creates a default forum topic
$this->drupalGet('/forum');
// Look for the "General discussion" default forum
$this->assertSession()->responseContains(Link::createFromRoute(t('General discussion'), 'forum.page', ['taxonomy_term' => 1])->toString());
$this->assertSession()->linkExists('General discussion');
$this->assertSession()->linkByHrefExists('/forum/1');
// Check the presence of expected cache tags.
$this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:forum.settings');
......
......@@ -39,12 +39,12 @@ public function testConfigUsingCurrentLanguage() {
->save();
$this->drupalGet('es/admin/language_test/entity_using_current_language/es');
$this->assertSession()->responseNotContains(t('Loaded %label.', ['%label' => 'Spanish']));
$this->assertSession()->responseContains(t('Loaded %label.', ['%label' => 'Español']));
$this->assertSession()->pageTextNotContains('Loaded Spanish.');
$this->assertSession()->pageTextContains('Loaded Español.');
$this->drupalGet('es/admin/language_test/entity_using_original_language/es');
$this->assertSession()->responseContains(t('Loaded %label.', ['%label' => 'Spanish']));
$this->assertSession()->responseNotContains(t('Loaded %label.', ['%label' => 'Español']));
$this->assertSession()->pageTextContains('Loaded Spanish.');
$this->assertSession()->pageTextNotContains('Loaded Español.');
}
}
......@@ -127,7 +127,7 @@ public function testNotSpecifiedNode() {
$node = $this->drupalCreateNode();
$this->drupalget($node->toUrl('edit-form'));
$this->submitForm([], 'Save');
$this->assertSession()->pageTextNotContains(t('The alias is already in use.'));
$this->assertSession()->pageTextNotContains('The alias is already in use.');
}
}
......@@ -326,7 +326,7 @@ public function assertCommentAccess($assume_access, $message) {
$this->assertSession()->pageTextContains($this->commentSubject);
}
else {
$this->assertSession()->pageTextContains(t('Your search yielded no results.'));
$this->assertSession()->pageTextContains('Your search yielded no results.');
}
}
catch (ResponseTextException $exception) {
......
......@@ -109,7 +109,7 @@ public function testSearchIndexUpdateOnNodeDeletion() {
->condition('word', 'dragons')
->execute()
->fetchField();