Issue #3192427 by mondrake, daffie: Replace usages of deprecated AssertLegacyTrait::assertNotEqual

merge-requests/259/head
catch 2021-01-18 16:16:33 +00:00
parent 3302b4e0fb
commit 39bacf4426
57 changed files with 103 additions and 94 deletions

View File

@ -100,7 +100,7 @@ class ConfigEntityTest extends BrowserTestBase {
'label' => $this->randomString(),
'style' => $this->randomMachineName(),
]);
$this->assertNotEqual($config_test->uuid(), $empty->uuid());
$this->assertNotEquals($empty->uuid(), $config_test->uuid());
$this->assertIdentical($config_test->label, $expected['label']);
$this->assertIdentical($config_test->style, $expected['style']);
$this->assertIdentical($config_test->language()->getId(), $default_langcode);

View File

@ -96,7 +96,7 @@ class ConfigExportImportUITest extends BrowserTestBase {
$this->originalSlogan = $this->config('system.site')->get('slogan');
$this->newSlogan = $this->randomString(16);
$this->assertNotEqual($this->newSlogan, $this->originalSlogan);
$this->assertNotEquals($this->originalSlogan, $this->newSlogan);
$this->config('system.site')
->set('slogan', $this->newSlogan)
->save();

View File

@ -251,7 +251,7 @@ class ConfigImportUITest extends BrowserTestBase {
$this->container->get('lock.persistent')->release($config_importer::LOCK_NAME);
// Verify site name has not changed.
$this->assertNotEqual($new_site_name, $this->config('system.site')->get('name'));
$this->assertNotEquals($this->config('system.site')->get('name'), $new_site_name);
}
/**
@ -370,7 +370,7 @@ class ConfigImportUITest extends BrowserTestBase {
$this->assertText('Config import validate error 2.');
// Verify site name has not changed.
$this->assertNotEqual($new_site_name, $this->config('system.site')->get('name'));
$this->assertNotEquals($this->config('system.site')->get('name'), $new_site_name);
}
public function testConfigUninstallConfigException() {

View File

@ -61,7 +61,7 @@ class TransformedConfigExportImportUITest extends BrowserTestBase {
$originalSlogan = $this->config('system.site')->get('slogan');
$this->assertEmpty($originalSlogan);
$newSlogan = $this->randomMachineName(16);
$this->assertNotEqual($newSlogan, $originalSlogan);
$this->assertNotEquals($originalSlogan, $newSlogan);
$this->config('system.site')
->set('slogan', $newSlogan)
->save();

View File

@ -199,7 +199,7 @@ class ContactSitewideTest extends BrowserTestBase {
$this->assertEqual($config['label'], $label);
$this->assertEqual($config['recipients'], [$recipients[0], $recipients[1]]);
$this->assertEqual($config['reply'], $reply);
$this->assertNotEqual($id, $this->config('contact.settings')->get('default_form'));
$this->assertNotEquals($this->config('contact.settings')->get('default_form'), $id);
$this->assertText('Contact form ' . $label . ' has been updated.');
// Ensure the label is displayed on the contact page for this form.
$this->drupalGet('contact/' . $id);

View File

@ -133,10 +133,10 @@ class ContentTranslationMetadataFieldsTest extends ContentTranslationTestBase {
$metadata_target_translation->setPublished(TRUE);
$metadata_target_translation->setAuthor($this->editor);
$this->assertNotEqual($metadata_source_translation->getCreatedTime(), $metadata_target_translation->getCreatedTime(), 'Metadata created field correctly different on both translations.');
$this->assertNotEqual($metadata_source_translation->getChangedTime(), $metadata_target_translation->getChangedTime(), 'Metadata changed field correctly different on both translations.');
$this->assertNotEqual($metadata_source_translation->isPublished(), $metadata_target_translation->isPublished(), 'Metadata published field correctly different on both translations.');
$this->assertNotEqual($metadata_source_translation->getAuthor()->id(), $metadata_target_translation->getAuthor()->id(), 'Metadata author field correctly different on both translations.');
$this->assertNotEquals($metadata_source_translation->getCreatedTime(), $metadata_target_translation->getCreatedTime(), 'Metadata created field correctly different on both translations.');
$this->assertNotEquals($metadata_source_translation->getChangedTime(), $metadata_target_translation->getChangedTime(), 'Metadata changed field correctly different on both translations.');
$this->assertNotEquals($metadata_source_translation->isPublished(), $metadata_target_translation->isPublished(), 'Metadata published field correctly different on both translations.');
$this->assertNotEquals($metadata_source_translation->getAuthor()->id(), $metadata_target_translation->getAuthor()->id(), 'Metadata author field correctly different on both translations.');
}
}

View File

@ -138,7 +138,7 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
$this->assertEqual($metadata_target_translation->getAuthor()->id(), $this->translator->id(),
new FormattableMarkup('Author of the target translation @langcode correctly stored for translatable owner field.', ['@langcode' => $langcode]));
$this->assertNotEqual($metadata_target_translation->getAuthor()->id(), $metadata_source_translation->getAuthor()->id(),
$this->assertNotEquals($metadata_target_translation->getAuthor()->id(), $metadata_source_translation->getAuthor()->id(),
new FormattableMarkup('Author of the target translation @target different from the author of the source translation @source for translatable owner field.',
['@target' => $langcode, '@source' => $default_langcode]));
}
@ -624,7 +624,7 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
$storage->resetCache([$this->entityId]);
$entity = $storage->load($this->entityId);
$this->assertNotEqual($changed_timestamp, $entity->getChangedTime(), 'The entity\'s changed time was updated after form save without changes.');
$this->assertNotEquals($changed_timestamp, $entity->getChangedTime(), 'The entity\'s changed time was updated after form save without changes.');
}
}

View File

@ -71,7 +71,7 @@ class ViewsIntegrationTest extends ViewsKernelTestBase {
if ($index == 2) {
// Make sure that unsafe link differs from the rendered link, so we know
// that some filtering actually happened.
$this->assertNotEqual($link_field, $entry['variables']['link']);
$this->assertNotEquals($entry['variables']['link'], $link_field);
}
$this->assertEqual($link_field, Xss::filterAdmin($entry['variables']['link']));
}

View File

@ -40,7 +40,7 @@ class FormatterPluginManagerTest extends FieldKernelTestBase {
$instance = $formatter_plugin_manager->getInstance($formatter_options);
// Instance should be default widget.
$this->assertNotEqual($instance->getPluginId(), 'field_test_applicable');
$this->assertNotSame('field_test_applicable', $instance->getPluginId());
$this->assertEqual($instance->getPluginId(), 'field_test_default');
}

View File

@ -51,7 +51,7 @@ class WidgetPluginManagerTest extends FieldKernelTestBase {
$instance = $widget_plugin_manager->getInstance($widget_options);
// Instance should be default widget.
$this->assertNotEqual($instance->getPluginId(), 'test_field_widget_multiple');
$this->assertNotSame('test_field_widget_multiple', $instance->getPluginId());
$this->assertEqual($instance->getPluginId(), 'test_field_widget');
}

View File

@ -54,9 +54,9 @@ class FileFieldAnonymousSubmissionTest extends FileFieldTestBase {
$matches = [];
if (preg_match('@node/(\d+)$@', $this->getUrl(), $matches)) {
$nid = end($matches);
$this->assertNotEqual($nid, 0, 'The node ID was extracted from the URL.');
$this->assertNotEquals(0, $nid, 'The node ID was extracted from the URL.');
$node = Node::load($nid);
$this->assertNotEqual($node, NULL, 'The node was loaded successfully.');
$this->assertNotNull($node, 'The node was loaded successfully.');
}
}
@ -90,9 +90,9 @@ class FileFieldAnonymousSubmissionTest extends FileFieldTestBase {
$matches = [];
if (preg_match('@node/(\d+)$@', $this->getUrl(), $matches)) {
$nid = end($matches);
$this->assertNotEqual($nid, 0, 'The node ID was extracted from the URL.');
$this->assertNotEquals(0, $nid, 'The node ID was extracted from the URL.');
$node = Node::load($nid);
$this->assertNotEqual($node, NULL, 'The node was loaded successfully.');
$this->assertNotNull($node, 'The node was loaded successfully.');
$this->assertFileExists(File::load($node->field_image->target_id)->getFileUri());
}
}
@ -164,9 +164,9 @@ class FileFieldAnonymousSubmissionTest extends FileFieldTestBase {
$matches = [];
if (preg_match('@node/(\d+)$@', $this->getUrl(), $matches)) {
$nid = end($matches);
$this->assertNotEqual($nid, 0, 'The node ID was extracted from the URL.');
$this->assertNotEquals(0, $nid, 'The node ID was extracted from the URL.');
$node = Node::load($nid);
$this->assertNotEqual($node, NULL, 'The node was loaded successfully.');
$this->assertNotNull($node, 'The node was loaded successfully.');
$this->assertFileExists(File::load($node->field_image->target_id)->getFileUri());
}
}

View File

@ -154,7 +154,7 @@ abstract class FileFieldTestBase extends BrowserTestBase {
$node->save();
$node_storage->resetCache([$nid]);
$node = $node_storage->load($nid);
$this->assertNotEqual($nid, $node->getRevisionId(), 'Node revision exists.');
$this->assertNotEquals($nid, $node->getRevisionId(), 'Node revision exists.');
}
$this->drupalGet("node/$nid/edit");
$page = $this->getSession()->getPage();

View File

@ -333,7 +333,7 @@ class FileFieldWidgetTest extends FileFieldTestBase {
$this->assertFileExists($comment_file->getFileUri());
// Test authenticated file download.
$url = $comment_file->createFileUrl();
$this->assertNotEqual($url, NULL, 'Confirmed that the URL is valid');
$this->assertNotNull($url, 'Confirmed that the URL is valid');
$this->drupalGet($comment_file->createFileUrl());
$this->assertSession()->statusCodeEquals(200);

View File

@ -113,8 +113,8 @@ abstract class FileManagedTestBase extends BrowserTestBase {
* File object to compare.
*/
public function assertDifferentFile(FileInterface $file1, FileInterface $file2) {
$this->assertNotEqual($file1->id(), $file2->id(), t('Files have different ids: %file1 != %file2.', ['%file1' => $file1->id(), '%file2' => $file2->id()]), 'Different file');
$this->assertNotEqual($file1->getFileUri(), $file2->getFileUri(), t('Files have different paths: %file1 != %file2.', ['%file1' => $file1->getFileUri(), '%file2' => $file2->getFileUri()]), 'Different file');
$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()]));
}
/**

View File

@ -58,7 +58,7 @@ class CopyTest extends FileManagedUnitTestBase {
// Check the return status and that the contents changed.
$this->assertNotFalse($result, 'File copied successfully.');
$this->assertEqual($contents, file_get_contents($result->getFileUri()), 'Contents of file were copied correctly.');
$this->assertNotEqual($result->getFileUri(), $source->getFileUri(), 'Returned file path has changed from the original.');
$this->assertNotEquals($source->getFileUri(), $result->getFileUri(), 'Returned file path has changed from the original.');
// Check that the correct hooks were called.
$this->assertFileHooksCalled(['copy', 'insert']);

View File

@ -126,8 +126,8 @@ abstract class FileManagedUnitTestBase extends KernelTestBase {
* File object to compare.
*/
public function assertDifferentFile(FileInterface $file1, FileInterface $file2) {
$this->assertNotEqual($file1->id(), $file2->id(), t('Files have different ids: %file1 != %file2.', ['%file1' => $file1->id(), '%file2' => $file2->id()]), 'Different file');
$this->assertNotEqual($file1->getFileUri(), $file2->getFileUri(), t('Files have different paths: %file1 != %file2.', ['%file1' => $file1->getFileUri(), '%file2' => $file2->getFileUri()]), 'Different file');
$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()]));
}
/**

View File

@ -75,7 +75,7 @@ class MoveTest extends FileManagedUnitTestBase {
// Compare the source and results.
$loaded_source = File::load($source->id());
$this->assertEqual($loaded_source->id(), $result->id(), "Returned file's id matches the source.");
$this->assertNotEqual($loaded_source->getFileUri(), $source->getFileUri(), 'Returned file path has changed from the original.');
$this->assertNotEquals($source->getFileUri(), $loaded_source->getFileUri(), 'Returned file path has changed from the original.');
}
/**

View File

@ -177,7 +177,7 @@ class ImageStylesPathAndUrlTest extends BrowserTestBase {
// in it.
if ($extra_slash) {
$modified_uri = str_replace('://', ':///', $original_uri);
$this->assertNotEqual($original_uri, $modified_uri, 'An extra slash was added to the generated file URI.');
$this->assertNotEquals($original_uri, $modified_uri, 'An extra slash was added to the generated file URI.');
$generate_url = $this->style->buildUrl($modified_uri, $clean_url);
}
if (!$clean_url) {

View File

@ -96,7 +96,7 @@ class LanguageUrlRewritingTest extends BrowserTestBase {
// we can always check the prefixed URL.
$prefixes = $this->config('language.negotiation')->get('url.prefixes');
$stored_prefix = isset($prefixes[$language->getId()]) ? $prefixes[$language->getId()] : $this->randomMachineName();
$this->assertNotEqual($stored_prefix, $prefix, $message);
$this->assertNotEquals($prefix, $stored_prefix, $message);
$prefix = $stored_prefix;
$this->drupalGet("$prefix/$path");

View File

@ -390,7 +390,7 @@ class LocaleConfigSubscriberTest extends KernelTestBase {
protected function assertNoConfigOverride($config_name, $langcode) {
$config_langcode = $this->configFactory->getEditable($config_name)->get('langcode');
$override = $this->languageManager->getLanguageConfigOverride($langcode, $config_name);
$this->assertNotEqual($config_langcode, $langcode);
$this->assertNotEquals($langcode, $config_langcode);
$this->assertEqual($override->isNew(), TRUE);
}
@ -409,7 +409,7 @@ class LocaleConfigSubscriberTest extends KernelTestBase {
protected function assertConfigOverride($config_name, $key, $value, $langcode) {
$config_langcode = $this->configFactory->getEditable($config_name)->get('langcode');
$override = $this->languageManager->getLanguageConfigOverride($langcode, $config_name);
$this->assertNotEqual($config_langcode, $langcode);
$this->assertNotEquals($langcode, $config_langcode);
$this->assertEqual($override->get($key), $value);
}

View File

@ -67,9 +67,9 @@ class LocaleStringIsSafeTest extends KernelTestBase {
$rendered_original_string = \Drupal::theme()->render('locale_test_tokenized', ['content' => $original_string]);
// Twig assumes that strings are unsafe so it escapes them, and so the
// original and the rendered version should be different.
$this->assertNotEqual(
$rendered_original_string,
$this->assertNotEquals(
$original_string . "\n",
$rendered_original_string,
'Security test ' . $i . ' before translation'
);

View File

@ -78,7 +78,7 @@ class NodeFormSaveChangedTimeTest extends BrowserTestBase {
$storage->resetCache([1]);
$node = $storage->load(1);
$this->assertNotEqual($changed_timestamp, $node->getChangedTime(), "The entity's changed time was updated after form save without changes.");
$this->assertNotEquals($node->getChangedTime(), $changed_timestamp, "The entity's changed time was updated after form save without changes.");
}
}

View File

@ -430,7 +430,7 @@ class NodeRevisionsTest extends NodeTestBase {
$this->assertGreaterThan($translation_revision_id, $node->getRevisionId());
$this->assertEqual($node->label(), $default_translation_title);
$this->assertEqual($node->getTranslation('it')->label(), $translated_title);
$this->assertNotEqual($node->untranslatable_string_field->value, $untranslatable_string);
$this->assertNotEquals($untranslatable_string, $node->untranslatable_string_field->value);
$latest_revision_id = $translation->getRevisionId();

View File

@ -79,7 +79,7 @@ class NodeRevisionsUiTest extends NodeTestBase {
// Load the node again and check the revision is different from before.
$node_storage->resetCache([$node->id()]);
$node_revision = $node_storage->load($node->id());
$this->assertNotEqual($node_revision->getRevisionId(), $node->getRevisionId(), "After an existing node is saved with 'Create new revision' checked, a new revision is created.");
$this->assertNotEquals($node->getRevisionId(), $node_revision->getRevisionId(), "After an existing node is saved with 'Create new revision' checked, a new revision is created.");
}
/**

View File

@ -90,7 +90,7 @@ class NodeAccessRecordsTest extends NodeAccessTestBase {
$grants = node_test_node_grants($web_user, $op);
$altered_grants = $grants;
\Drupal::moduleHandler()->alter('node_grants', $altered_grants, $web_user, $op);
$this->assertNotEqual($grants, $altered_grants, new FormattableMarkup('Altered the %op grant for a user.', ['%op' => $op]));
$this->assertNotEquals($grants, $altered_grants, new FormattableMarkup('Altered the %op grant for a user.', ['%op' => $op]));
}
// Check that core does not grant access to an unpublished node when an

View File

@ -352,7 +352,7 @@ class StyleSerializerTest extends ViewTestBase {
$this->assertNotEmpty($render_cache->get($original));
// Ensure that the XML output is different from the JSON one.
$this->assertNotEqual($result1, $result_xml);
$this->assertNotEquals($result1, $result_xml);
// Ensure that the cached page works.
$result2 = Json::decode($this->drupalGet('test/serialize/entity', ['query' => ['_format' => 'json']]));
@ -368,7 +368,7 @@ class StyleSerializerTest extends ViewTestBase {
$result3 = Json::decode($this->drupalGet('test/serialize/entity', ['query' => ['_format' => 'json']]));
$this->addRequestWithFormat('json');
$this->assertSession()->responseHeaderEquals('content-type', 'application/json');
$this->assertNotEqual($result3, $result2);
$this->assertNotEquals($result2, $result3);
// Add the new entity cache tag and remove the first one, because we just
// show 10 items in total.

View File

@ -57,7 +57,7 @@ class SearchAdvancedSearchFormTest extends BrowserTestBase {
// Verify some properties of the node that was created.
$this->assertSame('page', $this->node->getType(), 'Node type is Basic page.');
$dummy_title = 'Lorem ipsum';
$this->assertNotEqual($dummy_title, $this->node->label(), "Dummy title doesn't equal node title.");
$this->assertNotEquals($dummy_title, $this->node->label(), "Dummy title doesn't equal node title.");
// Search for the dummy title with a GET query.
$this->drupalGet('search/node', ['query' => ['keys' => $dummy_title]]);

View File

@ -106,7 +106,7 @@ class SearchNodeUpdateAndDeletionTest extends BrowserTestBase {
->condition('word', 'dragons')
->execute()
->fetchField();
$this->assertNotEqual($search_index_dataset, FALSE, t('Node info found on the search_index'));
$this->assertNotFalse($search_index_dataset, t('Node info found on the search_index'));
// Delete the node.
$node->delete();

View File

@ -140,7 +140,7 @@ class ShortcutSetsTest extends ShortcutTestBase {
];
$this->drupalPostForm('user/' . $this->adminUser->id() . '/shortcuts', $edit, 'Change set');
$current_set = shortcut_current_displayed_set($this->adminUser);
$this->assertNotEqual($current_set->id(), $this->set->id(), 'A shortcut set can be switched to at the same time as it is created.');
$this->assertNotEquals($this->set->id(), $current_set->id(), 'A shortcut set can be switched to at the same time as it is created.');
$this->assertEqual($current_set->label(), $edit['label'], 'The new set is correctly assigned to the user.');
}

View File

@ -93,7 +93,7 @@ class EntityFormTest extends BrowserTestBase {
$this->assertNull($entity, new FormattableMarkup('%entity_type: The entity has been modified.', ['%entity_type' => $entity_type]));
$entity = $this->loadEntityByName($entity_type, $name2);
$this->assertNotNull($entity, new FormattableMarkup('%entity_type: Modified entity found in the database.', ['%entity_type' => $entity_type]));
$this->assertNotEqual($entity->name->value, $name1, new FormattableMarkup('%entity_type: The entity name has been modified.', ['%entity_type' => $entity_type]));
$this->assertNotEquals($name1, $entity->name->value, new FormattableMarkup('%entity_type: The entity name has been modified.', ['%entity_type' => $entity_type]));
$this->drupalGet($entity_type . '/manage/' . $entity->id() . '/edit');
$this->clickLink(t('Delete'));

View File

@ -147,8 +147,8 @@ class EntityRevisionsTest extends BrowserTestBase {
// Check that the fields and properties contain new content.
// Verify that the revision ID changed.
$this->assertGreaterThan($legacy_revision_id, $entity->revision_id->value);
$this->assertNotEqual($entity->name->value, $legacy_name, new FormattableMarkup('%entity_type: Name changed.', ['%entity_type' => $entity_type]));
$this->assertNotEqual($entity->translatable_test_field->value, $legacy_text, new FormattableMarkup('%entity_type: Text changed.', ['%entity_type' => $entity_type]));
$this->assertNotEquals($legacy_name, $entity->name->value, new FormattableMarkup('%entity_type: Name changed.', ['%entity_type' => $entity_type]));
$this->assertNotEquals($legacy_text, $entity->translatable_test_field->value, new FormattableMarkup('%entity_type: Text changed.', ['%entity_type' => $entity_type]));
}
$revisions = $storage->loadMultipleRevisions($revision_ids);

View File

@ -55,7 +55,7 @@ class FormStoragePageCacheTest extends BrowserTestBase {
$this->submitForm($edit, 'Save');
$this->assertText('No old build id');
$build_id_first_validation = $this->getFormBuildId();
$this->assertNotEqual($build_id_initial, $build_id_first_validation, 'Build id changes when form validation fails');
$this->assertNotEquals($build_id_initial, $build_id_first_validation, 'Build id changes when form validation fails');
// Trigger validation error by again submitting an empty title.
$edit = ['title' => ''];
@ -76,8 +76,8 @@ class FormStoragePageCacheTest extends BrowserTestBase {
$this->submitForm($edit, 'Save');
$this->assertText('No old build id');
$build_id_from_cache_first_validation = $this->getFormBuildId();
$this->assertNotEqual($build_id_initial, $build_id_from_cache_first_validation, 'Build id changes when form validation fails');
$this->assertNotEqual($build_id_first_validation, $build_id_from_cache_first_validation, 'Build id from first user is not reused');
$this->assertNotEquals($build_id_initial, $build_id_from_cache_first_validation, 'Build id changes when form validation fails');
$this->assertNotEquals($build_id_first_validation, $build_id_from_cache_first_validation, 'Build id from first user is not reused');
// Trigger validation error by again submitting an empty title.
$edit = ['title' => ''];
@ -106,14 +106,14 @@ class FormStoragePageCacheTest extends BrowserTestBase {
$this->assertNoText('No old build id');
$this->assertNoText($build_id_initial);
$build_id_first_rebuild = $this->getFormBuildId();
$this->assertNotEqual($build_id_initial, $build_id_first_rebuild, 'Build id changes on first rebuild.');
$this->assertNotEquals($build_id_initial, $build_id_first_rebuild, 'Build id changes on first rebuild.');
// Trigger subsequent rebuild, should regenerate the build id again.
$edit = ['title' => 'something'];
$this->submitForm($edit, 'Rebuild');
$this->assertText($build_id_first_rebuild);
$build_id_second_rebuild = $this->getFormBuildId();
$this->assertNotEqual($build_id_first_rebuild, $build_id_second_rebuild, 'Build id changes on second rebuild.');
$this->assertNotEquals($build_id_first_rebuild, $build_id_second_rebuild, 'Build id changes on second rebuild.');
}
}

View File

@ -371,7 +371,7 @@ EOT;
public function testRemoveTrailingWhitespace() {
$text = "Hi there! \nHerp Derp";
$mail_lines = explode("\n", MailFormatHelper::wrapMail($text));
$this->assertNotEqual(" ", substr($mail_lines[0], -1), 'Trailing whitespace removed.');
$this->assertNotEquals(" ", substr($mail_lines[0], -1), 'Trailing whitespace removed.');
}
/**

View File

@ -265,7 +265,7 @@ class SessionTest extends BrowserTestBase {
$this->drupalGet('session-test/set/foo');
$times2 = $query->execute()->fetchObject();
$this->assertEqual($times2->access, $times1->access, 'Users table was not updated.');
$this->assertNotEqual($times2->timestamp, $times1->timestamp, 'Sessions table was updated.');
$this->assertNotEquals($times1->timestamp, $times2->timestamp, 'Sessions table was updated.');
// Write the same value again, i.e. do not modify the session.
sleep(1);
@ -289,8 +289,8 @@ class SessionTest extends BrowserTestBase {
$this->writeSettings($settings);
$this->drupalGet('');
$times5 = $query->execute()->fetchObject();
$this->assertNotEqual($times5->access, $times4->access, 'Users table was updated.');
$this->assertNotEqual($times5->timestamp, $times4->timestamp, 'Sessions table was updated.');
$this->assertNotEquals($times4->access, $times5->access, 'Users table was updated.');
$this->assertNotEquals($times4->timestamp, $times5->timestamp, 'Sessions table was updated.');
}
/**

View File

@ -113,7 +113,7 @@ class ProgrammaticTest extends KernelTestBase {
$form_state->setProgrammedBypassAccessCheck(FALSE);
\Drupal::formBuilder()->submitForm('\Drupal\form_test\Form\FormTestProgrammaticForm', $form_state);
$values = $form_state->get('programmatic_form_submit');
$this->assertNotEqual($values['field_restricted'], 'dummy value', 'The value for the restricted field is not stored.');
$this->assertNotSame('dummy value', $values['field_restricted'], 'The value for the restricted field is not stored.');
}

View File

@ -340,7 +340,7 @@ class ToolbarAdminMenuTest extends BrowserTestBase {
// Assert that the old admin menu subtrees hash and the new admin menu
// subtrees hash are different.
$this->assertNotEmpty($new_subtree_hash, 'A valid hash value for the admin menu subtrees was created.');
$this->assertNotEqual($original_subtree_hash, $new_subtree_hash, 'The user-specific subtree menu hash has been updated.');
$this->assertNotEquals($original_subtree_hash, $new_subtree_hash, 'The user-specific subtree menu hash has been updated.');
}
/**
@ -379,7 +379,7 @@ class ToolbarAdminMenuTest extends BrowserTestBase {
// Assert that the old admin menu subtree hash and the new admin menu
// subtree hash are different.
$this->assertNotEmpty($new_subtree_hash, 'A valid hash value for the admin menu subtrees was created.');
$this->assertNotEqual($this->hash, $new_subtree_hash, 'The user-specific subtree menu hash has been updated.');
$this->assertNotEquals($this->hash, $new_subtree_hash, 'The user-specific subtree menu hash has been updated.');
}
/**
@ -442,7 +442,7 @@ class ToolbarAdminMenuTest extends BrowserTestBase {
// Assert that the old admin menu subtree hash and the new admin menu
// subtree hash are different.
$this->assertNotEmpty($new_subtree_hash, 'A valid hash value for the admin menu subtrees was created.');
$this->assertNotEqual($this->hash, $new_subtree_hash, 'The user-specific subtree menu hash has been updated.');
$this->assertNotEquals($this->hash, $new_subtree_hash, 'The user-specific subtree menu hash has been updated.');
// Save the new subtree hash as the original.
$this->hash = $new_subtree_hash;

View File

@ -78,7 +78,7 @@ class UserPermissionsTest extends BrowserTestBase {
$this->assertTrue($account->hasPermission('administer users'), 'User now has "administer users" permission.');
$current_permissions_hash = $permissions_hash_generator->generate($account);
$this->assertIdentical($current_permissions_hash, $permissions_hash_generator->generate($this->loggedInUser));
$this->assertNotEqual($previous_permissions_hash, $current_permissions_hash, 'Permissions hash has changed.');
$this->assertNotEquals($previous_permissions_hash, $current_permissions_hash, 'Permissions hash has changed.');
$previous_permissions_hash = $current_permissions_hash;
// Remove a permission.
@ -91,7 +91,7 @@ class UserPermissionsTest extends BrowserTestBase {
$this->assertFalse($account->hasPermission('access user profiles'), 'User no longer has "access user profiles" permission.');
$current_permissions_hash = $permissions_hash_generator->generate($account);
$this->assertIdentical($current_permissions_hash, $permissions_hash_generator->generate($this->loggedInUser));
$this->assertNotEqual($previous_permissions_hash, $current_permissions_hash, 'Permissions hash has changed.');
$this->assertNotEquals($previous_permissions_hash, $current_permissions_hash, 'Permissions hash has changed.');
// Ensure that the admin role doesn't have any checkboxes.
$this->drupalGet('admin/people/permissions');
@ -173,7 +173,7 @@ class UserPermissionsTest extends BrowserTestBase {
// Verify the permissions hash has changed.
$current_permissions_hash = $permissions_hash_generator->generate($account);
$this->assertNotEqual($previous_permissions_hash, $current_permissions_hash, 'Permissions hash has changed.');
$this->assertNotEquals($previous_permissions_hash, $current_permissions_hash, 'Permissions hash has changed.');
}
/**

View File

@ -127,7 +127,7 @@ class AccessRoleTest extends AccessTestBase {
$this->assertContains('user.roles', $build['#cache']['contexts']);
$this->assertEqual(['config:views.view.test_access_role'], $build['#cache']['tags']);
$this->assertEqual(Cache::PERMANENT, $build['#cache']['max-age']);
$this->assertNotEqual($result, '');
$this->assertNotSame('', $result);
// Then without access.
$build = DisplayPluginBase::buildBasicRenderable('test_access_role', 'default');

View File

@ -133,7 +133,7 @@ class SortRandomTest extends ViewsKernelTestBase {
$result2 = $renderer->renderPlain($build);
// Ensure that the random ordering works and don't produce the same result.
$this->assertNotEqual($result, $result2);
$this->assertNotEquals($result, $result2);
}
}

View File

@ -166,7 +166,7 @@ class CacheTest extends ViewsKernelTestBase {
// Get the cache item.
$cid2 = $view->display_handler->getPlugin('cache')->generateResultsKey();
$this->assertNotEqual($cid1, $cid2, "Results keys are different.");
$this->assertNotEquals($cid1, $cid2, "Results keys are different.");
// Build the expected result.
$dataset = [['name' => 'Ringo']];

View File

@ -849,7 +849,7 @@ trait AssertContentTrait {
'@unexpected' => var_export($title, TRUE),
]);
}
return $this->assertNotEqual($actual, $title, $message, $group);
return $this->assertNotEquals($title, $actual, $message, $group);
}
/**

View File

@ -116,7 +116,7 @@ class ConnectionTest extends DatabaseTestBase {
// Get a fresh copy of the default connection options.
$connectionOptions = $db->getConnectionOptions();
$this->assertNotEqual($connection_info['default']['database'], $connectionOptions['database'], 'The test connection info database does not match the current connection options database.');
$this->assertNotEquals($connection_info['default']['database'], $connectionOptions['database'], 'The test connection info database does not match the current connection options database.');
}
/**

View File

@ -40,7 +40,7 @@ class SelectComplexTest extends DatabaseTestBase {
foreach ($result as $record) {
$num_records++;
$this->assertGreaterThanOrEqual($last_priority, $record->$priority_field);
$this->assertNotEqual($record->$name_field, 'Ringo', 'Taskless person not selected.');
$this->assertNotSame('Ringo', $record->$name_field, 'Taskless person not selected.');
$last_priority = $record->$priority_field;
}
@ -333,7 +333,7 @@ class SelectComplexTest extends DatabaseTestBase {
$query->where("[$alias].[name] <> [test].[name]");
$crowded_job = $query->execute()->fetch();
$this->assertEqual($crowded_job->job, $crowded_job->other_job, 'Correctly joined same table twice.');
$this->assertNotEqual($crowded_job->name, $crowded_job->other_name, 'Correctly joined same table twice.');
$this->assertNotEquals($crowded_job->other_name, $crowded_job->name, 'Correctly joined same table twice.');
}
/**
@ -414,7 +414,7 @@ class SelectComplexTest extends DatabaseTestBase {
$num_records++;
// Verify that the results are returned in the correct order.
$this->assertGreaterThanOrEqual($last_priority, $record->$priority_field);
$this->assertNotEqual($record->$name_field, 'Ringo', 'Taskless person not selected.');
$this->assertNotSame('Ringo', $record->$name_field, 'Taskless person not selected.');
$last_priority = $record->$priority_field;
}

View File

@ -468,7 +468,7 @@ class SelectTest extends DatabaseTestBase {
->orderRandom()
->execute()
->fetchCol();
$this->assertNotEqual($randomized_ids, $ordered_ids, 'A query with random ordering returns an unordered set of IDs.');
$this->assertNotEquals($ordered_ids, $randomized_ids, 'A query with random ordering returns an unordered set of IDs.');
$sorted_ids = $randomized_ids;
sort($sorted_ids);
$this->assertEqual($sorted_ids, $ordered_ids, 'After sorting the random list, the result matches the original query.');
@ -481,7 +481,7 @@ class SelectTest extends DatabaseTestBase {
->orderRandom()
->execute()
->fetchCol();
$this->assertNotEqual($randomized_ids_second_set, $randomized_ids, 'Performing the query with random ordering a second time returns IDs in a different order.');
$this->assertNotEquals($randomized_ids, $randomized_ids_second_set, 'Performing the query with random ordering a second time returns IDs in a different order.');
$sorted_ids_second_set = $randomized_ids_second_set;
sort($sorted_ids_second_set);
$this->assertEqual($sorted_ids_second_set, $sorted_ids, 'After sorting the second random list, the result matches the sorted version of the first random list.');

View File

@ -218,7 +218,7 @@ class EntityApiTest extends EntityKernelTestBase {
$entity->save();
}
catch (EntityStorageException $e) {
$this->assertNotEqual($e->getCode(), 1, 'Entity presave EntityStorageException caught.');
$this->assertNotEquals(1, $e->getCode(), 'Entity presave EntityStorageException caught.');
}
$entity = EntityTest::create(['name' => 'test3']);
@ -239,7 +239,7 @@ class EntityApiTest extends EntityKernelTestBase {
$entity->delete();
}
catch (EntityStorageException $e) {
$this->assertNotEqual($e->getCode(), 2, 'Entity predelete EntityStorageException thrown.');
$this->assertNotEquals(2, $e->getCode(), 'Entity predelete EntityStorageException thrown.');
}
}

View File

@ -347,7 +347,7 @@ class EntitySchemaTest extends EntityKernelTestBase {
}
// Ensure that there are storage definitions from the entity_test module.
$this->assertNotEqual($entity_type_id_count, 0, 'There are storage definitions provided by the entity_test module in the schema.');
$this->assertNotEquals(0, $entity_type_id_count, 'There are storage definitions provided by the entity_test module in the schema.');
// Uninstall the entity_test module.
$this->container->get('module_installer')->uninstall(['entity_test']);

View File

@ -522,7 +522,7 @@ class EntityTranslationTest extends EntityLanguageTestBase {
$this->assertEqual($entity->name->value, $name, 'No stale reference for the translation object corresponding to the original language.');
$translation2 = $entity->getTranslation($langcode);
$translation2->name->value .= $this->randomMachineName();
$this->assertNotEqual($translation->name->value, $translation2->name->value, 'No stale reference for the actual translation object.');
$this->assertNotEquals($translation->name->value, $translation2->name->value, 'No stale reference for the actual translation object.');
$this->assertEqual($entity, $translation2->getUntranslated(), 'No stale reference in the actual translation object.');
// Verify that deep-cloning is still available when we are not instantiating

View File

@ -58,7 +58,7 @@ class EntityUUIDTest extends EntityKernelTestBase {
$this->assertNotEmpty($uuid);
// Verify that the new UUID is different.
$this->assertNotEqual($custom_entity->uuid(), $uuid);
$this->assertNotEquals($custom_entity->uuid(), $uuid);
// Verify that the UUID is retained upon saving.
$entity->save();
@ -84,20 +84,20 @@ class EntityUUIDTest extends EntityKernelTestBase {
case 'uuid':
$this->assertNotNull($entity_duplicate->uuid());
$this->assertNotNull($entity->uuid());
$this->assertNotEqual($entity_duplicate->uuid(), $entity->uuid());
$this->assertNotEquals($entity->uuid(), $entity_duplicate->uuid());
break;
case 'id':
$this->assertNull($entity_duplicate->id());
$this->assertNotNull($entity->id());
$this->assertNotEqual($entity_duplicate->id(), $entity->id());
$this->assertNotEquals($entity->id(), $entity_duplicate->id());
break;
case 'revision_id':
$this->assertNull($entity_duplicate->getRevisionId());
$this->assertNotNull($entity->getRevisionId());
$this->assertNotEqual($entity_duplicate->getRevisionId(), $entity->getRevisionId());
$this->assertNotEqual($entity_duplicate->{$property}->getValue(), $entity->{$property}->getValue());
$this->assertNotEquals($entity->getRevisionId(), $entity_duplicate->getRevisionId());
$this->assertNotEquals($entity->{$property}->getValue(), $entity_duplicate->{$property}->getValue());
break;
default:
@ -105,7 +105,7 @@ class EntityUUIDTest extends EntityKernelTestBase {
}
}
$entity_duplicate->save();
$this->assertNotEqual($entity->id(), $entity_duplicate->id());
$this->assertNotEquals($entity_duplicate->id(), $entity->id());
}
}

View File

@ -539,8 +539,8 @@ class FieldSqlStorageTest extends EntityKernelTestBase {
'field_name' => $field_name . '2',
'type' => 'test_field',
]);
$this->assertNotEqual($this->tableMapping->getDedicatedDataTableName($field_storage), $this->tableMapping->getDedicatedDataTableName($field_storage2));
$this->assertNotEqual($this->tableMapping->getDedicatedRevisionTableName($field_storage), $this->tableMapping->getDedicatedRevisionTableName($field_storage2));
$this->assertNotEquals($this->tableMapping->getDedicatedDataTableName($field_storage), $this->tableMapping->getDedicatedDataTableName($field_storage2));
$this->assertNotEquals($this->tableMapping->getDedicatedRevisionTableName($field_storage), $this->tableMapping->getDedicatedRevisionTableName($field_storage2));
// Deleted field.
$field_storage = FieldStorageConfig::create([

View File

@ -164,7 +164,7 @@ class DirectoryTest extends FileTestBase {
$path = $file_system->getDestinationFilename($destination, FileSystemInterface::EXISTS_REPLACE);
$this->assertEqual($path, $destination, 'Existing filepath destination remains the same with FileSystemInterface::EXISTS_REPLACE.', 'File');
$path = $file_system->getDestinationFilename($destination, FileSystemInterface::EXISTS_RENAME);
$this->assertNotEqual($path, $destination, 'A new filepath destination is created when filepath destination already exists with FileSystemInterface::EXISTS_RENAME.', 'File');
$this->assertNotEquals($destination, $path, 'A new filepath destination is created when filepath destination already exists with FileSystemInterface::EXISTS_RENAME.');
$path = $file_system->getDestinationFilename($destination, FileSystemInterface::EXISTS_ERROR);
$this->assertEqual($path, FALSE, 'An error is returned when filepath destination already exists with FileSystemInterface::EXISTS_ERROR.', 'File');

View File

@ -36,7 +36,7 @@ class FileCopyTest extends FileTestBase {
$this->assertNotFalse(file_put_contents($desired_filepath, ' '), 'Created a file so a rename will have to happen.');
$newer_filepath = \Drupal::service('file_system')->copy($uri, $desired_filepath, FileSystemInterface::EXISTS_RENAME);
$this->assertNotFalse($newer_filepath, 'Copy was successful.');
$this->assertNotEqual($newer_filepath, $desired_filepath, 'Returned expected filepath.');
$this->assertNotEquals($desired_filepath, $newer_filepath, 'Returned expected filepath.');
$this->assertFileExists($uri);
$this->assertFileExists($newer_filepath);
$this->assertFilePermissions($newer_filepath, Settings::get('file_chmod_file', FileSystem::CHMOD_FILE));
@ -69,7 +69,7 @@ class FileCopyTest extends FileTestBase {
$file_system = \Drupal::service('file_system');
$new_filepath = $file_system->copy($uri, $uri, FileSystemInterface::EXISTS_RENAME);
$this->assertNotFalse($new_filepath, 'Copying onto itself with renaming works.');
$this->assertNotEqual($new_filepath, $uri, 'Copied file has a new name.');
$this->assertNotEquals($uri, $new_filepath, 'Copied file has a new name.');
$this->assertFileExists($uri);
$this->assertFileExists($new_filepath);
$this->assertFilePermissions($new_filepath, Settings::get('file_chmod_file', FileSystem::CHMOD_FILE));
@ -88,7 +88,7 @@ class FileCopyTest extends FileTestBase {
// Copy the file into same directory with renaming works.
$new_filepath = $file_system->copy($uri, $file_system->dirname($uri), FileSystemInterface::EXISTS_RENAME);
$this->assertNotFalse($new_filepath, 'Copying into same directory works.');
$this->assertNotEqual($new_filepath, $uri, 'Copied file has a new name.');
$this->assertNotEquals($uri, $new_filepath, 'Copied file has a new name.');
$this->assertFileExists($uri);
$this->assertFileExists($new_filepath);
$this->assertFilePermissions($new_filepath, Settings::get('file_chmod_file', FileSystem::CHMOD_FILE));

View File

@ -39,7 +39,7 @@ class FileMoveTest extends FileTestBase {
$this->assertNotFalse(file_put_contents($desired_filepath, ' '), 'Created a file so a rename will have to happen.');
$newer_filepath = $file_system->move($new_filepath, $desired_filepath, FileSystemInterface::EXISTS_RENAME);
$this->assertNotFalse($newer_filepath, 'Move was successful.');
$this->assertNotEqual($newer_filepath, $desired_filepath, 'Returned expected filepath.');
$this->assertNotEquals($desired_filepath, $newer_filepath, 'Returned expected filepath.');
$this->assertFileExists($newer_filepath);
$this->assertFileNotExists($new_filepath);
$this->assertFilePermissions($newer_filepath, Settings::get('file_chmod_file', FileSystem::CHMOD_FILE));

View File

@ -66,7 +66,7 @@ class NameMungingTest extends FileTestBase {
$messages = \Drupal::messenger()->all();
\Drupal::messenger()->deleteAll();
$this->assertContainsEquals(strtr('For security reasons, your upload has been renamed to <em class="placeholder">%filename</em>.', ['%filename' => $munged_name]), $messages['status'], 'Alert properly set when a file is renamed.');
$this->assertNotEqual($munged_name, $this->name, new FormattableMarkup('The new filename (%munged) has been modified from the original (%original)', ['%munged' => $munged_name, '%original' => $this->name]));
$this->assertNotEquals($this->name, $munged_name, new FormattableMarkup('The new filename (%munged) has been modified from the original (%original)', ['%munged' => $munged_name, '%original' => $this->name]));
}
/**

View File

@ -94,7 +94,7 @@ class KeyValueContentEntityStorageTest extends KernelTestBase {
]);
$this->assertIdentical($entity_test->id->value, $expected['id']);
$this->assertNotEmpty($entity_test->uuid->value);
$this->assertNotEqual($entity_test->uuid->value, $empty->uuid->value);
$this->assertNotEquals($empty->uuid->value, $entity_test->uuid->value);
$this->assertIdentical($entity_test->name->value, $expected['name']);
$this->assertIdentical($entity_test->langcode->value, $default_langcode);

View File

@ -177,7 +177,7 @@ class TwigEnvironmentTest extends KernelTestBase {
$new_extension_filename = $cache->generateKey($template_path, $class);
\Drupal::getContainer()->set('twig', NULL);
$this->assertNotEqual($new_extension_filename, $original_filename);
$this->assertNotEquals($original_filename, $new_extension_filename);
}
/**

View File

@ -338,6 +338,16 @@ class KernelTestBaseTest extends KernelTestBase {
$this->assertIdenticalObject((object) ['foo' => 'bar'], (object) ['foo' => 'bar']);
}
/**
* Tests the deprecation of AssertLegacyTrait::assertNotEqual.
*
* @group legacy
*/
public function testAssertNotEqual() {
$this->expectDeprecation('AssertLegacyTrait::assertNotEqual() is deprecated in drupal:8.0.0 and is removed from drupal:10.0.0. Use $this->assertNotEquals() instead. See https://www.drupal.org/node/3129738');
$this->assertNotEqual('foo', 'bar');
}
/**
* Tests the deprecation of AssertLegacyTrait::assertNotIdentical.
*

View File

@ -122,7 +122,6 @@ trait DeprecationListenerTrait {
// Simpletest's legacy assertion methods.
'UiHelperTrait::drupalPostForm() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Use $this->submitForm() instead. See https://www.drupal.org/node/3168858',
'AssertLegacyTrait::assertEqual() is deprecated in drupal:8.0.0 and is removed from drupal:10.0.0. Use $this->assertEquals() instead. See https://www.drupal.org/node/3129738',
'AssertLegacyTrait::assertNotEqual() is deprecated in drupal:8.0.0 and is removed from drupal:10.0.0. Use $this->assertNotEquals() instead. See https://www.drupal.org/node/3129738',
'AssertLegacyTrait::assertIdentical() is deprecated in drupal:8.0.0 and is removed from drupal:10.0.0. Use $this->assertSame() instead. See https://www.drupal.org/node/3129738',
'AssertLegacyTrait::assertText() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseContains() or $this->assertSession()->pageTextContains() instead. See https://www.drupal.org/node/3129738',
'AssertLegacyTrait::assertNoText() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseNotContains() or $this->assertSession()->pageTextNotContains() instead. See https://www.drupal.org/node/3129738',