diff --git a/core/modules/aggregator/src/Tests/AggregatorTestBase.php b/core/modules/aggregator/src/Tests/AggregatorTestBase.php index 10f95b2..f422489 100644 --- a/core/modules/aggregator/src/Tests/AggregatorTestBase.php +++ b/core/modules/aggregator/src/Tests/AggregatorTestBase.php @@ -187,7 +187,7 @@ public function updateFeedItems(FeedInterface $feed, $expected_count = NULL) { if ($expected_count !== NULL) { $feed->item_count = count($feed->items); - $this->assertEquals($expected_count, $feed->item_count, format_string('Total items in feed equal to the total items in database (@val1 != @val2)', ['@val1' => $expected_count, '@val2' => $feed->item_count])); + $this->assertEqual($expected_count, $feed->item_count, format_string('Total items in feed equal to the total items in database (@val1 != @val2)', ['@val1' => $expected_count, '@val2' => $feed->item_count])); } } diff --git a/core/modules/block_content/src/Tests/Views/BlockContentTestBase.php b/core/modules/block_content/src/Tests/Views/BlockContentTestBase.php index 2680510..3ea2dba 100644 --- a/core/modules/block_content/src/Tests/Views/BlockContentTestBase.php +++ b/core/modules/block_content/src/Tests/Views/BlockContentTestBase.php @@ -73,7 +73,7 @@ protected function createBlockContent(array $settings = []) { if ($block_content = BlockContent::create($settings)) { $status = $block_content->save(); } - $this->assertEquals($status, SAVED_NEW, SafeMarkup::format('Created block content %info.', ['%info' => $block_content->label()])); + $this->assertEqual($status, SAVED_NEW, SafeMarkup::format('Created block content %info.', ['%info' => $block_content->label()])); return $block_content; } @@ -105,7 +105,7 @@ protected function createBlockContentType(array $values = []) { $status = $bundle->save(); block_content_add_body_field($bundle->id()); - $this->assertEquals($status, SAVED_NEW, SafeMarkup::format('Created block content type %bundle.', ['%bundle' => $bundle->id()])); + $this->assertEqual($status, SAVED_NEW, SafeMarkup::format('Created block content type %bundle.', ['%bundle' => $bundle->id()])); return $bundle; } diff --git a/core/modules/block_content/tests/src/Functional/BlockContentTranslationUITest.php b/core/modules/block_content/tests/src/Functional/BlockContentTranslationUITest.php index c1f76a8..2699fcf 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentTranslationUITest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentTranslationUITest.php @@ -172,7 +172,7 @@ public function testDisabledBundle() { // Make sure that only a single row was inserted into the block table. $rows = db_query('SELECT * FROM {block_content_field_data} WHERE id = :id', [':id' => $enabled_block_content->id()])->fetchAll(); - $this->assertEquals(1, count($rows)); + $this->assertEqual(1, count($rows)); } /** diff --git a/core/modules/comment/src/Tests/CommentNewIndicatorTest.php b/core/modules/comment/src/Tests/CommentNewIndicatorTest.php index 9bb3f14..318e17c 100644 --- a/core/modules/comment/src/Tests/CommentNewIndicatorTest.php +++ b/core/modules/comment/src/Tests/CommentNewIndicatorTest.php @@ -109,8 +109,8 @@ public function testCommentNewCommentsIndicator() { // The data will be pre-seeded on this particular page in drupalSettings, to // avoid the need for the client to make a separate request to the server. $settings = $this->getDrupalSettings(); - $this->assertEquals($settings['history'], ['lastReadTimestamps' => [1 => 0]]); - $this->assertEquals($settings['comment'], [ + $this->assertEqual($settings['history'], ['lastReadTimestamps' => [1 => 0]]); + $this->assertEqual($settings['comment'], [ 'newCommentsLinks' => [ 'node' => [ 'comment' => [ diff --git a/core/modules/comment/src/Tests/CommentPagerTest.php b/core/modules/comment/src/Tests/CommentPagerTest.php index 4ab53ce..48326bc 100644 --- a/core/modules/comment/src/Tests/CommentPagerTest.php +++ b/core/modules/comment/src/Tests/CommentPagerTest.php @@ -218,7 +218,7 @@ public function assertCommentOrder(array $comments, array $expected_order) { foreach ($comment_anchors as $anchor) { $result_order[] = substr($anchor['id'], 8); } - return $this->assertEquals($expected_cids, $result_order, format_string('Comment order: expected @expected, returned @returned.', ['@expected' => implode(',', $expected_cids), '@returned' => implode(',', $result_order)])); + return $this->assertEqual($expected_cids, $result_order, format_string('Comment order: expected @expected, returned @returned.', ['@expected' => implode(',', $expected_cids), '@returned' => implode(',', $result_order)])); } /** @@ -309,7 +309,7 @@ public function testCommentNewPageIndicator() { foreach ($expected_pages as $new_replies => $expected_page) { $returned_page = \Drupal::entityManager()->getStorage('comment') ->getNewCommentPageNumber($node->get('comment')->comment_count, $new_replies, $node, 'comment'); - $this->assertEquals($expected_page, $returned_page, format_string('Threaded mode, @new replies: expected page @expected, returned page @returned.', ['@new' => $new_replies, '@expected' => $expected_page, '@returned' => $returned_page])); + $this->assertEqual($expected_page, $returned_page, format_string('Threaded mode, @new replies: expected page @expected, returned page @returned.', ['@new' => $new_replies, '@expected' => $expected_page, '@returned' => $returned_page])); } } diff --git a/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php b/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php index 70bf24d..e7a7dfc 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php @@ -101,7 +101,7 @@ protected function doTestBasicTranslation() { $stored_value = $this->getValue($translation, $property, $default_langcode); $value = is_array($value) ? $value[0]['value'] : $value; $message = format_string('@property correctly stored in the default language.', ['@property' => $property]); - $this->assertEquals($stored_value, $value, $message); + $this->assertEqual($stored_value, $value, $message); } // Add a content translation. @@ -140,7 +140,7 @@ protected function doTestBasicTranslation() { $author_field_name = $entity->hasField('content_translation_uid') ? 'content_translation_uid' : 'uid'; if ($entity->getFieldDefinition($author_field_name)->isTranslatable()) { - $this->assertEquals($metadata_target_translation->getAuthor()->id(), $this->translator->id(), + $this->assertEqual($metadata_target_translation->getAuthor()->id(), $this->translator->id(), SafeMarkup::format('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(), @@ -148,7 +148,7 @@ protected function doTestBasicTranslation() { ['@target' => $langcode, '@source' => $default_langcode])); } else { - $this->assertEquals($metadata_target_translation->getAuthor()->id(), $this->editor->id(), 'Author of the entity remained untouched after translation for non translatable owner field.'); + $this->assertEqual($metadata_target_translation->getAuthor()->id(), $this->editor->id(), 'Author of the entity remained untouched after translation for non translatable owner field.'); } $created_field_name = $entity->hasField('content_translation_created') ? 'content_translation_created' : 'created'; @@ -158,7 +158,7 @@ protected function doTestBasicTranslation() { ['@target' => $langcode, '@source' => $default_langcode])); } else { - $this->assertEquals($metadata_target_translation->getCreatedTime(), $metadata_source_translation->getCreatedTime(), 'Creation timestamp of the entity remained untouched after translation for non translatable created field.'); + $this->assertEqual($metadata_target_translation->getCreatedTime(), $metadata_source_translation->getCreatedTime(), 'Creation timestamp of the entity remained untouched after translation for non translatable created field.'); } if ($this->testLanguageSelector) { @@ -207,7 +207,7 @@ protected function doTestBasicTranslation() { $stored_value = $this->getValue($translation, $property, $langcode); $value = is_array($value) ? $value[0]['value'] : $value; $message = format_string('%property correctly stored with language %language.', ['%property' => $property, '%language' => $langcode]); - $this->assertEquals($stored_value, $value, $message); + $this->assertEqual($stored_value, $value, $message); } } } @@ -229,10 +229,10 @@ protected function doTestTranslationOverview() { $language = new Language(['id' => $langcode]); $view_url = $entity->url('canonical', ['language' => $language]); $elements = $this->xpath('//table//a[@href=:href]', [':href' => $view_url]); - $this->assertEquals((string) $elements[0], $entity->getTranslation($langcode)->label(), format_string('Label correctly shown for %language translation.', ['%language' => $langcode])); + $this->assertEqual((string) $elements[0], $entity->getTranslation($langcode)->label(), format_string('Label correctly shown for %language translation.', ['%language' => $langcode])); $edit_path = $entity->url('edit-form', ['language' => $language]); $elements = $this->xpath('//table//ul[@class="dropbutton"]/li/a[@href=:href]', [':href' => $edit_path]); - $this->assertEquals((string) $elements[0], t('Edit'), format_string('Edit link correct for %language translation.', ['%language' => $langcode])); + $this->assertEqual((string) $elements[0], t('Edit'), format_string('Edit link correct for %language translation.', ['%language' => $langcode])); } } } @@ -339,8 +339,8 @@ protected function doTestAuthoringInfo() { $entity = $storage->load($this->entityId); foreach ($this->langcodes as $langcode) { $metadata = $this->manager->getTranslationMetadata($entity->getTranslation($langcode)); - $this->assertEquals($metadata->getAuthor()->id(), $values[$langcode]['uid'], 'Translation author correctly stored.'); - $this->assertEquals($metadata->getCreatedTime(), $values[$langcode]['created'], 'Translation date correctly stored.'); + $this->assertEqual($metadata->getAuthor()->id(), $values[$langcode]['uid'], 'Translation author correctly stored.'); + $this->assertEqual($metadata->getCreatedTime(), $values[$langcode]['created'], 'Translation date correctly stored.'); } // Try to post non valid values and check that they are rejected. @@ -353,8 +353,8 @@ protected function doTestAuthoringInfo() { $this->drupalPostForm($entity->urlInfo('edit-form'), $edit, $this->getFormSubmitAction($entity, $langcode)); $this->assertTrue($this->xpath('//div[contains(@class, "error")]//ul'), 'Invalid values generate a list of form errors.'); $metadata = $this->manager->getTranslationMetadata($entity->getTranslation($langcode)); - $this->assertEquals($metadata->getAuthor()->id(), $values[$langcode]['uid'], 'Translation author correctly kept.'); - $this->assertEquals($metadata->getCreatedTime(), $values[$langcode]['created'], 'Translation date correctly kept.'); + $this->assertEqual($metadata->getAuthor()->id(), $values[$langcode]['uid'], 'Translation author correctly kept.'); + $this->assertEqual($metadata->getCreatedTime(), $values[$langcode]['created'], 'Translation date correctly kept.'); } /** @@ -565,7 +565,7 @@ protected function doTestTranslationChanged() { ->getStorage($this->entityTypeId); $storage->resetCache([$this->entityId]); $entity = $storage->load($this->entityId); - $this->assertEquals( + $this->assertEqual( $entity->getChangedTimeAcrossTranslations(), $entity->getTranslation($langcode)->getChangedTime(), format_string('Changed time for language %language is the latest change over all languages.', ['%language' => $language->getName()]) ); @@ -580,13 +580,13 @@ protected function doTestTranslationChanged() { } if ($translatable_changed_field) { - $this->assertEquals( + $this->assertEqual( count($timestamps), count($entity->getTranslationLanguages()), 'All timestamps from all languages are different.' ); } else { - $this->assertEquals( + $this->assertEqual( count($timestamps), 1, 'All timestamps from all languages are identical.' ); @@ -611,7 +611,7 @@ public function doTestChangedTimeAfterSaveWithoutChanges() { ->getStorage($this->entityTypeId); $storage->resetCache([$this->entityId]); $entity = $storage->load($this->entityId); - $this->assertEquals($changed_timestamp, $entity->getChangedTime(), 'The entity\'s changed time wasn\'t updated after API save without changes.'); + $this->assertEqual($changed_timestamp, $entity->getChangedTime(), 'The entity\'s changed time wasn\'t updated after API save without changes.'); // Ensure different save timestamps. sleep(1); diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationLanguageChangeTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationLanguageChangeTest.php index 651246e..ae326ef 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationLanguageChangeTest.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationLanguageChangeTest.php @@ -110,7 +110,7 @@ public function testTitleDoesNotChangesOnChangingLanguageWidgetAndTriggeringAjax 'test_field_only_en_fr' => 'node created', ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertEquals('node created', \Drupal::state()->get('test_field_only_en_fr')); + $this->assertEqual('node created', \Drupal::state()->get('test_field_only_en_fr')); // Create a translation in French. $this->clickLink('Translate'); diff --git a/core/modules/editor/src/Tests/EditorUploadImageScaleTest.php b/core/modules/editor/src/Tests/EditorUploadImageScaleTest.php index 3c58471..100fb4f 100644 --- a/core/modules/editor/src/Tests/EditorUploadImageScaleTest.php +++ b/core/modules/editor/src/Tests/EditorUploadImageScaleTest.php @@ -76,8 +76,8 @@ public function testEditorUploadImageScale() { $this->setMaxDimensions($max_width, $max_height); $this->assertSavedMaxDimensions($max_width, $max_height); list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri); - $this->assertEquals($uploaded_image_file_width, $image_file_width); - $this->assertEquals($uploaded_image_file_height, $image_file_height); + $this->assertEqual($uploaded_image_file_width, $image_file_width); + $this->assertEqual($uploaded_image_file_height, $image_file_height); $this->assertNoRaw(t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', ['%dimensions' => $max_width . 'x' . $max_height])); // Case 2: max width smaller than uploaded image: image scaled down. @@ -88,8 +88,8 @@ public function testEditorUploadImageScale() { $this->setMaxDimensions($max_width, $max_height); $this->assertSavedMaxDimensions($max_width, $max_height); list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri); - $this->assertEquals($uploaded_image_file_width, $max_width); - $this->assertEquals($uploaded_image_file_height, $uploaded_image_file_height * ($uploaded_image_file_width / $max_width)); + $this->assertEqual($uploaded_image_file_width, $max_width); + $this->assertEqual($uploaded_image_file_height, $uploaded_image_file_height * ($uploaded_image_file_width / $max_width)); $this->assertRaw(t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', ['%dimensions' => $max_width . 'x' . $max_height])); // Case 3: max height smaller than uploaded image: image scaled down. @@ -100,8 +100,8 @@ public function testEditorUploadImageScale() { $this->setMaxDimensions($max_width, $max_height); $this->assertSavedMaxDimensions($max_width, $max_height); list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri); - $this->assertEquals($uploaded_image_file_width, $uploaded_image_file_width * ($uploaded_image_file_height / $max_height)); - $this->assertEquals($uploaded_image_file_height, $max_height); + $this->assertEqual($uploaded_image_file_width, $uploaded_image_file_width * ($uploaded_image_file_height / $max_height)); + $this->assertEqual($uploaded_image_file_height, $max_height); $this->assertRaw(t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', ['%dimensions' => $max_width . 'x' . $max_height])); // Case 4: max dimensions greater than uploaded image: image not scaled. @@ -112,8 +112,8 @@ public function testEditorUploadImageScale() { $this->setMaxDimensions($max_width, $max_height); $this->assertSavedMaxDimensions($max_width, $max_height); list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri); - $this->assertEquals($uploaded_image_file_width, $image_file_width); - $this->assertEquals($uploaded_image_file_height, $image_file_height); + $this->assertEqual($uploaded_image_file_width, $image_file_width); + $this->assertEqual($uploaded_image_file_height, $image_file_height); $this->assertNoRaw(t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', ['%dimensions' => $max_width . 'x' . $max_height])); // Case 5: only max width dimension was provided and it was smaller than @@ -125,8 +125,8 @@ public function testEditorUploadImageScale() { $this->setMaxDimensions($max_width, $max_height); $this->assertSavedMaxDimensions($max_width, $max_height); list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri); - $this->assertEquals($uploaded_image_file_width, $max_width); - $this->assertEquals($uploaded_image_file_height, $uploaded_image_file_height * ($uploaded_image_file_width / $max_width)); + $this->assertEqual($uploaded_image_file_width, $max_width); + $this->assertEqual($uploaded_image_file_height, $uploaded_image_file_height * ($uploaded_image_file_width / $max_width)); $this->assertRaw(t('The image was resized to fit within the maximum allowed width of %width pixels.', ['%width' => $max_width])); // Case 6: only max height dimension was provided and it was smaller than @@ -138,8 +138,8 @@ public function testEditorUploadImageScale() { $this->setMaxDimensions($max_width, $max_height); $this->assertSavedMaxDimensions($max_width, $max_height); list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri); - $this->assertEquals($uploaded_image_file_width, $uploaded_image_file_width * ($uploaded_image_file_height / $max_height)); - $this->assertEquals($uploaded_image_file_height, $max_height); + $this->assertEqual($uploaded_image_file_width, $uploaded_image_file_width * ($uploaded_image_file_height / $max_height)); + $this->assertEqual($uploaded_image_file_height, $max_height); $this->assertRaw(t('The image was resized to fit within the maximum allowed height of %height pixels.', ['%height' => $max_height])); } @@ -215,8 +215,8 @@ protected function assertSavedMaxDimensions($width, $height) { 'width' => $image_upload_settings['max_dimensions']['width'], 'height' => $image_upload_settings['max_dimensions']['height'], ]; - $same_width = $this->assertEquals($width, $expected['width'], 'Actual width of "' . $width . '" equals the expected width of "' . $expected['width'] . '"'); - $same_height = $this->assertEquals($height, $expected['height'], 'Actual height of "' . $height . '" equals the expected width of "' . $expected['height'] . '"'); + $same_width = $this->assertEqual($width, $expected['width'], 'Actual width of "' . $width . '" equals the expected width of "' . $expected['width'] . '"'); + $same_height = $this->assertEqual($height, $expected['height'], 'Actual height of "' . $height . '" equals the expected width of "' . $expected['height'] . '"'); return $same_width && $same_height; } diff --git a/core/modules/field/src/Tests/Boolean/BooleanFormatterSettingsTest.php b/core/modules/field/src/Tests/Boolean/BooleanFormatterSettingsTest.php index 4bbca3c..92efa98 100644 --- a/core/modules/field/src/Tests/Boolean/BooleanFormatterSettingsTest.php +++ b/core/modules/field/src/Tests/Boolean/BooleanFormatterSettingsTest.php @@ -124,7 +124,7 @@ public function testBooleanFormatterSettings() { foreach ($settings as $values) { $this->drupalGet('admin/structure/types/manage/' . $this->bundle . '/display'); $result = $this->xpath('//div[contains(@class, :class) and contains(text(), :text)]', [':class' => 'field-plugin-summary', ':text' => 'Display: TRUE / FALSE']); - $this->assertEquals(count($result), 1, "Boolean formatter settings summary exist."); + $this->assertEqual(count($result), 1, "Boolean formatter settings summary exist."); } } diff --git a/core/modules/field/src/Tests/EntityReference/EntityReferenceAdminTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceAdminTest.php index eec74d4..9bacb07 100644 --- a/core/modules/field/src/Tests/EntityReference/EntityReferenceAdminTest.php +++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceAdminTest.php @@ -461,7 +461,7 @@ public function testMultipleTargetBundles() { /** @var \Drupal\field\Entity\FieldConfig $field_config */ $field_config = FieldConfig::load($field_id); // Expect that the target bundle has been saved in the backend. - $this->assertEquals($field_config->getSetting('handler_settings')['auto_create_bundle'], $vocabularies[1]->id()); + $this->assertEqual($field_config->getSetting('handler_settings')['auto_create_bundle'], $vocabularies[1]->id()); // Delete the other bundle. Field config should not be affected. $vocabularies[0]->delete(); diff --git a/core/modules/field/src/Tests/FieldImportDeleteUninstallUiTest.php b/core/modules/field/src/Tests/FieldImportDeleteUninstallUiTest.php index 32d8241..e353086 100644 --- a/core/modules/field/src/Tests/FieldImportDeleteUninstallUiTest.php +++ b/core/modules/field/src/Tests/FieldImportDeleteUninstallUiTest.php @@ -74,8 +74,8 @@ public function testImportDeleteUninstall() { // Verify entity has been created properly. $id = $entity->id(); $entity = EntityTest::load($id); - $this->assertEquals($entity->field_tel->value, $value); - $this->assertEquals($entity->field_tel[0]->value, $value); + $this->assertEqual($entity->field_tel->value, $value); + $this->assertEqual($entity->field_tel[0]->value, $value); $active = $this->container->get('config.storage'); $sync = $this->container->get('config.storage.sync'); diff --git a/core/modules/field/src/Tests/FieldTestBase.php b/core/modules/field/src/Tests/FieldTestBase.php index 0b0cf46..a610757 100644 --- a/core/modules/field/src/Tests/FieldTestBase.php +++ b/core/modules/field/src/Tests/FieldTestBase.php @@ -59,9 +59,9 @@ public function assertFieldValues(EntityInterface $entity, $field_name, $expecte // Filter out empty values so that they don't mess with the assertions. $field->filterEmptyItems(); $values = $field->getValue(); - $this->assertEquals(count($values), count($expected_values), 'Expected number of values were saved.'); + $this->assertEqual(count($values), count($expected_values), 'Expected number of values were saved.'); foreach ($expected_values as $key => $value) { - $this->assertEquals($values[$key][$column], $value, format_string('Value @value was saved correctly.', ['@value' => $value])); + $this->assertEqual($values[$key][$column], $value, format_string('Value @value was saved correctly.', ['@value' => $value])); } } diff --git a/core/modules/field/src/Tests/FormTest.php b/core/modules/field/src/Tests/FormTest.php index 245c0f5..786e367 100644 --- a/core/modules/field/src/Tests/FormTest.php +++ b/core/modules/field/src/Tests/FormTest.php @@ -132,7 +132,7 @@ public function testFieldFormSingle() { $id = $match[1]; $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created'); $entity = EntityTest::load($id); - $this->assertEquals($entity->{$field_name}->value, $value, 'Field value was saved'); + $this->assertEqual($entity->{$field_name}->value, $value, 'Field value was saved'); // Display edit form. $this->drupalGet('entity_test/manage/' . $id . '/edit'); @@ -148,7 +148,7 @@ public function testFieldFormSingle() { $this->assertText(t('entity_test @id has been updated.', ['@id' => $id]), 'Entity was updated'); $this->container->get('entity.manager')->getStorage('entity_test')->resetCache([$id]); $entity = EntityTest::load($id); - $this->assertEquals($entity->{$field_name}->value, $value, 'Field value was updated'); + $this->assertEqual($entity->{$field_name}->value, $value, 'Field value was updated'); // Empty the field. $value = ''; @@ -220,7 +220,7 @@ public function testFieldFormSingleRequired() { $id = $match[1]; $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created'); $entity = EntityTest::load($id); - $this->assertEquals($entity->{$field_name}->value, $value, 'Field value was saved'); + $this->assertEqual($entity->{$field_name}->value, $value, 'Field value was saved'); // Edit with missing required value. $value = ''; @@ -502,8 +502,8 @@ public function testFieldFormAccess() { $storage = $this->container->get('entity_type.manager') ->getStorage($entity_type); $entity = $storage->load($id); - $this->assertEquals($entity->$field_name_no_access->value, 99, 'Default value was saved for the field with no edit access.'); - $this->assertEquals($entity->$field_name->value, 1, 'Entered value vas saved for the field with edit access.'); + $this->assertEqual($entity->$field_name_no_access->value, 99, 'Default value was saved for the field with no edit access.'); + $this->assertEqual($entity->$field_name->value, 1, 'Entered value vas saved for the field with edit access.'); // Create a new revision. $edit = [ @@ -515,15 +515,15 @@ public function testFieldFormAccess() { // Check that the new revision has the expected values. $storage->resetCache([$id]); $entity = $storage->load($id); - $this->assertEquals($entity->$field_name_no_access->value, 99, 'New revision has the expected value for the field with no edit access.'); - $this->assertEquals($entity->$field_name->value, 2, 'New revision has the expected value for the field with edit access.'); + $this->assertEqual($entity->$field_name_no_access->value, 99, 'New revision has the expected value for the field with no edit access.'); + $this->assertEqual($entity->$field_name->value, 2, 'New revision has the expected value for the field with edit access.'); // Check that the revision is also saved in the revisions table. $entity = $this->container->get('entity_type.manager') ->getStorage($entity_type) ->loadRevision($entity->getRevisionId()); - $this->assertEquals($entity->$field_name_no_access->value, 99, 'New revision has the expected value for the field with no edit access.'); - $this->assertEquals($entity->$field_name->value, 2, 'New revision has the expected value for the field with edit access.'); + $this->assertEqual($entity->$field_name_no_access->value, 99, 'New revision has the expected value for the field with no edit access.'); + $this->assertEqual($entity->$field_name->value, 2, 'New revision has the expected value for the field with edit access.'); } /** @@ -558,7 +558,7 @@ public function testHiddenField() { ->getStorage($entity_type); $entity = $storage->load($id); - $this->assertEquals($entity->{$field_name}->value, 99, 'Default value was saved'); + $this->assertEqual($entity->{$field_name}->value, 99, 'Default value was saved'); // Update the field to remove the default value, and switch to the default // widget. @@ -581,7 +581,7 @@ public function testHiddenField() { $this->assertText(t('entity_test_rev @id has been updated.', ['@id' => $id]), 'Entity was updated'); $storage->resetCache([$id]); $entity = $storage->load($id); - $this->assertEquals($entity->{$field_name}->value, $value, 'Field value was updated'); + $this->assertEqual($entity->{$field_name}->value, $value, 'Field value was updated'); // Set the field back to hidden. entity_get_form_display($entity_type, $this->field->getTargetBundle(), 'default') @@ -595,7 +595,7 @@ public function testHiddenField() { // Check that the expected value has been carried over to the new revision. $storage->resetCache([$id]); $entity = $storage->load($id); - $this->assertEquals($entity->{$field_name}->value, $value, 'New revision has the expected value for the field with the Hidden widget'); + $this->assertEqual($entity->{$field_name}->value, $value, 'New revision has the expected value for the field with the Hidden widget'); } /** diff --git a/core/modules/field/src/Tests/NestedFormTest.php b/core/modules/field/src/Tests/NestedFormTest.php index 92aedf4..0bbfb0d 100644 --- a/core/modules/field/src/Tests/NestedFormTest.php +++ b/core/modules/field/src/Tests/NestedFormTest.php @@ -189,7 +189,7 @@ public function testNestedEntityFormEntityLevelValidation() { $this->drupalPostForm(NULL, $edit, t('Save')); $elements = $this->cssSelect('.entity-2.error'); - $this->assertEquals(1, count($elements), 'The whole nested entity form has been correctly flagged with an error class.'); + $this->assertEqual(1, count($elements), 'The whole nested entity form has been correctly flagged with an error class.'); } } diff --git a/core/modules/field/src/Tests/Number/NumberFieldTest.php b/core/modules/field/src/Tests/Number/NumberFieldTest.php index 8268c9f..64da6c1 100644 --- a/core/modules/field/src/Tests/Number/NumberFieldTest.php +++ b/core/modules/field/src/Tests/Number/NumberFieldTest.php @@ -177,7 +177,7 @@ public function testNumberIntegerField() { 'indexes' => [], 'foreign keys' => [] ]; - $this->assertEquals($storage->getSchema(), $expected); + $this->assertEqual($storage->getSchema(), $expected); // Display creation form. $this->drupalGet('entity_test/add'); diff --git a/core/modules/field/src/Tests/Views/FieldUITest.php b/core/modules/field/src/Tests/Views/FieldUITest.php index ce86a2b..efe7685 100644 --- a/core/modules/field/src/Tests/Views/FieldUITest.php +++ b/core/modules/field/src/Tests/Views/FieldUITest.php @@ -62,7 +62,7 @@ public function testHandlerUI() { }, $result); // @todo Replace this sort by assertArray once it's in. sort($options, SORT_STRING); - $this->assertEquals($options, ['text_default', 'text_trimmed'], 'The text formatters for a simple text field appear as expected.'); + $this->assertEqual($options, ['text_default', 'text_trimmed'], 'The text formatters for a simple text field appear as expected.'); $this->drupalPostForm(NULL, ['options[type]' => 'text_trimmed'], t('Apply')); @@ -78,8 +78,8 @@ public function testHandlerUI() { $this->drupalPostForm('admin/structure/views/view/test_view_fieldapi', [], t('Save')); $view = Views::getView('test_view_fieldapi'); $view->initHandlers(); - $this->assertEquals($view->field['field_name_0']->options['type'], 'text_trimmed'); - $this->assertEquals($view->field['field_name_0']->options['settings']['trim_length'], $random_number); + $this->assertEqual($view->field['field_name_0']->options['type'], 'text_trimmed'); + $this->assertEqual($view->field['field_name_0']->options['settings']['trim_length'], $random_number); // Now change the formatter back to 'default' which doesn't have any // settings. We want to ensure that the settings are empty then. @@ -88,8 +88,8 @@ public function testHandlerUI() { $this->drupalPostForm('admin/structure/views/view/test_view_fieldapi', [], t('Save')); $view = Views::getView('test_view_fieldapi'); $view->initHandlers(); - $this->assertEquals($view->field['field_name_0']->options['type'], 'text_default'); - $this->assertEquals($view->field['field_name_0']->options['settings'], []); + $this->assertEqual($view->field['field_name_0']->options['type'], 'text_default'); + $this->assertEqual($view->field['field_name_0']->options['settings'], []); // Ensure that the view depends on the field storage. $dependencies = \Drupal::service('config.manager')->findConfigEntityDependents('config', [$this->fieldStorages[0]->getConfigDependencyName()]); @@ -116,7 +116,7 @@ public function testHandlerUIAggregation() { }, $result); sort($options, SORT_STRING); - $this->assertEquals($options, ['format', 'value'], 'The expected sort field options were found.'); + $this->assertEqual($options, ['format', 'value'], 'The expected sort field options were found.'); } /** @@ -143,15 +143,15 @@ public function testBooleanFilterHandler() { // Verify that using a boolean field as a filter also results in using the // boolean plugin. $option = $this->xpath('//label[@for="edit-options-value-1"]'); - $this->assertEquals(t('True'), (string) $option[0]); + $this->assertEqual(t('True'), (string) $option[0]); $option = $this->xpath('//label[@for="edit-options-value-0"]'); - $this->assertEquals(t('False'), (string) $option[0]); + $this->assertEqual(t('False'), (string) $option[0]); // Expose the filter and see if the 'Any' option is added and if we can save // it. $this->drupalPostForm(NULL, [], 'Expose filter'); $option = $this->xpath('//label[@for="edit-options-value-all"]'); - $this->assertEquals(t('- Any -'), (string) $option[0]); + $this->assertEqual(t('- Any -'), (string) $option[0]); $this->drupalPostForm(NULL, ['options[value]' => 'All', 'options[expose][required]' => FALSE], 'Apply'); $this->drupalPostForm(NULL, [], 'Save'); $this->drupalGet('/admin/structure/views/nojs/handler/test_view_fieldapi/default/filter/field_boolean_value'); diff --git a/core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php b/core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php index ab52ca8..da958e9 100644 --- a/core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php +++ b/core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php @@ -141,7 +141,7 @@ public function _testSimpleFieldRender() { $field_name = $this->fieldStorages[$key]->getName(); $rendered_field = $view->style_plugin->getField($i, $field_name); $expected_field = $this->nodes[$i]->$field_name->value; - $this->assertEquals($rendered_field, $expected_field); + $this->assertEqual($rendered_field, $expected_field); } } } @@ -180,7 +180,7 @@ public function _testFormatterSimpleFieldRender() { // @TODO: actually there should be a specific formatter. for ($i = 0; $i < 2; $i++) { $rendered_field = $view->style_plugin->getField($i, $this->fieldStorages[5]->getName()); - $this->assertEquals(strlen(html_entity_decode($rendered_field)), 3); + $this->assertEqual(strlen(html_entity_decode($rendered_field)), 3); } } @@ -202,7 +202,7 @@ public function _testMultipleFieldRender() { foreach ($pure_items as $j => $item) { $items[] = $pure_items[$j]['value']; } - $this->assertEquals($rendered_field, implode(', ', $items), 'The amount of items is limited.'); + $this->assertEqual($rendered_field, implode(', ', $items), 'The amount of items is limited.'); } // Test that an empty field is rendered without error. @@ -224,7 +224,7 @@ public function _testMultipleFieldRender() { foreach ($pure_items as $j => $item) { $items[] = $pure_items[$j]['value']; } - $this->assertEquals($rendered_field, implode(', ', $items), 'The amount of items is limited and the offset is correct.'); + $this->assertEqual($rendered_field, implode(', ', $items), 'The amount of items is limited and the offset is correct.'); } $view->destroy(); @@ -245,7 +245,7 @@ public function _testMultipleFieldRender() { foreach ($pure_items as $j => $item) { $items[] = $pure_items[$j]['value']; } - $this->assertEquals($rendered_field, implode(', ', $items), 'The amount of items is limited and they are reversed.'); + $this->assertEqual($rendered_field, implode(', ', $items), 'The amount of items is limited and they are reversed.'); } $view->destroy(); @@ -263,7 +263,7 @@ public function _testMultipleFieldRender() { $pure_items = $this->nodes[$i]->{$field_name}->getValue(); $items[] = $pure_items[0]['value']; $items[] = $pure_items[4]['value']; - $this->assertEquals($rendered_field, implode(', ', $items), 'Items are limited to first and last.'); + $this->assertEqual($rendered_field, implode(', ', $items), 'Items are limited to first and last.'); } $view->destroy(); @@ -283,7 +283,7 @@ public function _testMultipleFieldRender() { foreach ($pure_items as $j => $item) { $items[] = $pure_items[$j]['value']; } - $this->assertEquals($rendered_field, implode(':', $items), 'The amount of items is limited and the custom separator is correct.'); + $this->assertEqual($rendered_field, implode(':', $items), 'The amount of items is limited and the custom separator is correct.'); } $view->destroy(); @@ -302,7 +302,7 @@ public function _testMultipleFieldRender() { foreach ($pure_items as $j => $item) { $items[] = $pure_items[$j]['value']; } - $this->assertEquals($rendered_field, implode('

test

', $items), 'The custom separator is correctly escaped.'); + $this->assertEqual($rendered_field, implode('

test

', $items), 'The custom separator is correctly escaped.'); } $view->destroy(); } diff --git a/core/modules/field_ui/src/Tests/ManageDisplayTest.php b/core/modules/field_ui/src/Tests/ManageDisplayTest.php index 89521eb..688b9e9 100644 --- a/core/modules/field_ui/src/Tests/ManageDisplayTest.php +++ b/core/modules/field_ui/src/Tests/ManageDisplayTest.php @@ -97,7 +97,7 @@ public function testFormatterUI() { 'field_test_with_prepare_view', 'field_test_applicable', ]; - $this->assertEquals($options, $expected_options, 'The expected formatter ordering is respected.'); + $this->assertEqual($options, $expected_options, 'The expected formatter ordering is respected.'); // Ensure that fields can be hidden directly by changing the region. $this->drupalGet($manage_display); @@ -135,8 +135,8 @@ public function testFormatterUI() { $display_options = $display->getComponent('field_test'); $current_format = $display_options['type']; $current_setting_value = $display_options['settings'][$setting_name]; - $this->assertEquals($current_format, $format, 'The formatter was updated.'); - $this->assertEquals($current_setting_value, $setting_value, 'The setting was updated.'); + $this->assertEqual($current_format, $format, 'The formatter was updated.'); + $this->assertEqual($current_setting_value, $setting_value, 'The setting was updated.'); // Assert that hook_field_formatter_settings_summary_alter() is called. $this->assertText('field_test_field_formatter_settings_summary_alter'); @@ -160,7 +160,7 @@ public function testFormatterUI() { $storage = $this->container->get('entity_type.manager')->getStorage('entity_view_display'); $storage->resetCache([$id]); $display = $storage->load($id); - $this->assertEquals($display->getRenderer('field_test')->getThirdPartySetting('field_third_party_test', 'field_test_field_formatter_third_party_settings_form'), 'foo'); + $this->assertEqual($display->getRenderer('field_test')->getThirdPartySetting('field_third_party_test', 'field_test_field_formatter_third_party_settings_form'), 'foo'); $this->assertTrue(in_array('field_third_party_test', $display->calculateDependencies()->getDependencies()['module']), 'The display has a dependency on field_third_party_test module.'); // Confirm that the third party settings are not updated on the settings form. @@ -254,7 +254,7 @@ public function testWidgetUI() { 'test_field_widget', 'test_field_widget_multiple', ]; - $this->assertEquals($options, $expected_options, 'The expected widget ordering is respected.'); + $this->assertEqual($options, $expected_options, 'The expected widget ordering is respected.'); // Change the widget and check that the summary is updated. $edit = [ @@ -276,8 +276,8 @@ public function testWidgetUI() { $display_options = $display->getComponent('field_test'); $current_widget = $display_options['type']; $current_setting_value = $display_options['settings'][$setting_name]; - $this->assertEquals($current_widget, $widget_type, 'The widget was updated.'); - $this->assertEquals($current_setting_value, $setting_value, 'The setting was updated.'); + $this->assertEqual($current_widget, $widget_type, 'The widget was updated.'); + $this->assertEqual($current_setting_value, $setting_value, 'The setting was updated.'); // Assert that hook_field_widget_settings_summary_alter() is called. $this->assertText('field_test_field_widget_settings_summary_alter'); @@ -298,7 +298,7 @@ public function testWidgetUI() { $storage = $this->container->get('entity_type.manager')->getStorage('entity_form_display'); $storage->resetCache(['node.' . $this->type . '.default']); $display = $storage->load('node.' . $this->type . '.default'); - $this->assertEquals($display->getRenderer('field_test')->getThirdPartySetting('field_third_party_test', 'field_test_widget_third_party_settings_form'), 'foo'); + $this->assertEqual($display->getRenderer('field_test')->getThirdPartySetting('field_third_party_test', 'field_test_widget_third_party_settings_form'), 'foo'); $this->assertTrue(in_array('field_third_party_test', $display->calculateDependencies()->getDependencies()['module']), 'Form display does not have a dependency on field_third_party_test module.'); // Confirm that the third party settings are not updated on the settings form. diff --git a/core/modules/field_ui/src/Tests/ManageFieldsTest.php b/core/modules/field_ui/src/Tests/ManageFieldsTest.php index 95eda85..d08ab03 100644 --- a/core/modules/field_ui/src/Tests/ManageFieldsTest.php +++ b/core/modules/field_ui/src/Tests/ManageFieldsTest.php @@ -169,7 +169,7 @@ public function manageFieldsPage($type = '') { } } - $this->assertEquals($number_of_links, $number_of_links_found); + $this->assertEqual($number_of_links, $number_of_links_found); } /** @@ -438,7 +438,7 @@ public function testDefaultValue() { $this->drupalPostForm($admin_path, $edit, t('Save settings')); $this->assertText("Saved $field_name configuration", 'The form was successfully submitted.'); $field = FieldConfig::loadByName('node', $this->contentType, $field_name); - $this->assertEquals($field->getDefaultValueLiteral(), [['value' => 1]], 'The default value was correctly saved.'); + $this->assertEqual($field->getDefaultValueLiteral(), [['value' => 1]], 'The default value was correctly saved.'); // Check that the default value shows up in the form $this->drupalGet($admin_path); @@ -449,7 +449,7 @@ public function testDefaultValue() { $this->drupalPostForm(NULL, $edit, t('Save settings')); $this->assertText("Saved $field_name configuration", 'The form was successfully submitted.'); $field = FieldConfig::loadByName('node', $this->contentType, $field_name); - $this->assertEquals($field->getDefaultValueLiteral(), NULL, 'The default value was correctly saved.'); + $this->assertEqual($field->getDefaultValueLiteral(), NULL, 'The default value was correctly saved.'); // Check that the default value can be empty when the field is marked as // required and can store unlimited values. @@ -467,7 +467,7 @@ public function testDefaultValue() { $this->drupalPostForm(NULL, [], t('Save settings')); $this->assertText("Saved $field_name configuration", 'The form was successfully submitted.'); $field = FieldConfig::loadByName('node', $this->contentType, $field_name); - $this->assertEquals($field->getDefaultValueLiteral(), NULL, 'The default value was correctly saved.'); + $this->assertEqual($field->getDefaultValueLiteral(), NULL, 'The default value was correctly saved.'); // Check that the default widget is used when the field is hidden. entity_get_form_display($field->getTargetEntityTypeId(), $field->getTargetBundle(), 'default') @@ -739,17 +739,17 @@ public function testPreconfiguredFields() { // Add a field with every possible preconfigured value. $this->fieldUIAddNewField(NULL, 'test_custom_options', 'Test label', 'field_ui:test_field_with_preconfigured_options:custom_options'); $field_storage = FieldStorageConfig::loadByName('node', 'field_test_custom_options'); - $this->assertEquals($field_storage->getCardinality(), FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED); - $this->assertEquals($field_storage->getSetting('test_field_storage_setting'), 'preconfigured_storage_setting'); + $this->assertEqual($field_storage->getCardinality(), FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED); + $this->assertEqual($field_storage->getSetting('test_field_storage_setting'), 'preconfigured_storage_setting'); $field = FieldConfig::loadByName('node', 'article', 'field_test_custom_options'); $this->assertTrue($field->isRequired()); - $this->assertEquals($field->getSetting('test_field_setting'), 'preconfigured_field_setting'); + $this->assertEqual($field->getSetting('test_field_setting'), 'preconfigured_field_setting'); $form_display = entity_get_form_display('node', 'article', 'default'); - $this->assertEquals($form_display->getComponent('field_test_custom_options')['type'], 'test_field_widget_multiple'); + $this->assertEqual($form_display->getComponent('field_test_custom_options')['type'], 'test_field_widget_multiple'); $view_display = entity_get_display('node', 'article', 'default'); - $this->assertEquals($view_display->getComponent('field_test_custom_options')['type'], 'field_test_multiple'); + $this->assertEqual($view_display->getComponent('field_test_custom_options')['type'], 'field_test_multiple'); } /** diff --git a/core/modules/file/src/Tests/DownloadTest.php b/core/modules/file/src/Tests/DownloadTest.php index de88870..8f85f09 100644 --- a/core/modules/file/src/Tests/DownloadTest.php +++ b/core/modules/file/src/Tests/DownloadTest.php @@ -24,7 +24,7 @@ public function testPublicFileTransfer() { // URLs can't contain characters outside the ASCII set so $filename has to be // encoded. $filename = $GLOBALS['base_url'] . '/' . \Drupal::service('stream_wrapper_manager')->getViaScheme('public')->getDirectoryPath() . '/' . rawurlencode($file->getFilename()); - $this->assertEquals($filename, $url, 'Correctly generated a URL for a created file.'); + $this->assertEqual($filename, $url, 'Correctly generated a URL for a created file.'); $this->drupalHead($url); $this->assertResponse(200, 'Confirmed that the generated URL is correct by downloading the created file.'); @@ -32,7 +32,7 @@ public function testPublicFileTransfer() { // Drupal core, a module or a theme, for example a JavaScript file). $filepath = 'core/assets/vendor/jquery/jquery.min.js'; $url = file_create_url($filepath); - $this->assertEquals($GLOBALS['base_url'] . '/' . $filepath, $url, 'Correctly generated a URL for a shipped file.'); + $this->assertEqual($GLOBALS['base_url'] . '/' . $filepath, $url, 'Correctly generated a URL for a shipped file.'); $this->drupalHead($url); $this->assertResponse(200, 'Confirmed that the generated URL is correct by downloading the shipped file.'); } @@ -65,12 +65,12 @@ protected function doPrivateFileTransferTest() { // Set file_test access header to allow the download. file_test_set_return('download', ['x-foo' => 'Bar']); $this->drupalGet($url); - $this->assertEquals($this->drupalGetHeader('x-foo'), 'Bar', 'Found header set by file_test module on private download.'); + $this->assertEqual($this->drupalGetHeader('x-foo'), 'Bar', 'Found header set by file_test module on private download.'); $this->assertFalse($this->drupalGetHeader('x-drupal-cache'), 'Page cache is disabled on private file download.'); $this->assertResponse(200, 'Correctly allowed access to a file when file_test provides headers.'); // Test that the file transferred correctly. - $this->assertEquals($contents, $this->content, 'Contents of the file are correct.'); + $this->assertEqual($contents, $this->content, 'Contents of the file are correct.'); // Deny access to all downloads via a -1 header. file_test_set_return('download', -1); @@ -117,7 +117,7 @@ public function testFileCreateUrl() { $this->checkUrl('public', '', $basename, $base_path . '/' . $public_directory_path . '/' . $basename_encoded); $this->checkUrl('private', '', $basename, $base_path . '/' . $script_path . 'system/files/' . $basename_encoded); } - $this->assertEquals(file_create_url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='), 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==', t('Generated URL matches expected URL.')); + $this->assertEqual(file_create_url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='), 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==', t('Generated URL matches expected URL.')); } /** @@ -146,7 +146,7 @@ private function checkUrl($scheme, $directory, $filename, $expected_url) { $file = $this->createFile($filepath, NULL, $scheme); $url = file_create_url($file->getFileUri()); - $this->assertEquals($url, $expected_url); + $this->assertEqual($url, $expected_url); if ($scheme == 'private') { // Tell the implementation of hook_file_download() in file_test.module diff --git a/core/modules/file/src/Tests/FileFieldRevisionTest.php b/core/modules/file/src/Tests/FileFieldRevisionTest.php index 22d70e3..04fbcb8 100644 --- a/core/modules/file/src/Tests/FileFieldRevisionTest.php +++ b/core/modules/file/src/Tests/FileFieldRevisionTest.php @@ -61,7 +61,7 @@ public function testRevisions() { // Check that the original file is still in place on the first revision. $node = node_revision_load($node_vid_r1); $current_file = File::load($node->{$field_name}->target_id); - $this->assertEquals($node_file_r1->id(), $current_file->id(), 'Original file still in place after replacing file in new revision.'); + $this->assertEqual($node_file_r1->id(), $current_file->id(), 'Original file still in place after replacing file in new revision.'); $this->assertFileExists($node_file_r1, 'Original file still in place after replacing file in new revision.'); $this->assertFileEntryExists($node_file_r1, 'Original file entry still in place after replacing file in new revision'); $this->assertFileIsPermanent($node_file_r1, 'Original file is still permanent.'); @@ -73,7 +73,7 @@ public function testRevisions() { $node = $node_storage->load($nid); $node_file_r3 = File::load($node->{$field_name}->target_id); $node_vid_r3 = $node->getRevisionId(); - $this->assertEquals($node_file_r2->id(), $node_file_r3->id(), 'Previous revision file still in place after creating a new revision without a new file.'); + $this->assertEqual($node_file_r2->id(), $node_file_r3->id(), 'Previous revision file still in place after creating a new revision without a new file.'); $this->assertFileIsPermanent($node_file_r3, 'New revision file is permanent.'); // Revert to the first revision and check that the original file is active. @@ -81,7 +81,7 @@ public function testRevisions() { $node_storage->resetCache([$nid]); $node = $node_storage->load($nid); $node_file_r4 = File::load($node->{$field_name}->target_id); - $this->assertEquals($node_file_r1->id(), $node_file_r4->id(), 'Original revision file still in place after reverting to the original revision.'); + $this->assertEqual($node_file_r1->id(), $node_file_r4->id(), 'Original revision file still in place after reverting to the original revision.'); $this->assertFileIsPermanent($node_file_r4, 'Original revision file still permanent after reverting to the original revision.'); // Delete the second revision and check that the file is kept (since it is diff --git a/core/modules/file/src/Tests/FileFieldTestBase.php b/core/modules/file/src/Tests/FileFieldTestBase.php index f167b3b..ba34c8f 100644 --- a/core/modules/file/src/Tests/FileFieldTestBase.php +++ b/core/modules/file/src/Tests/FileFieldTestBase.php @@ -274,7 +274,7 @@ public function assertFileEntryExists($file, $message = NULL) { $this->container->get('entity.manager')->getStorage('file')->resetCache(); $db_file = File::load($file->id()); $message = isset($message) ? $message : format_string('File %file exists in database at the correct path.', ['%file' => $file->getFileUri()]); - $this->assertEquals($db_file->getFileUri(), $file->getFileUri(), $message); + $this->assertEqual($db_file->getFileUri(), $file->getFileUri(), $message); } /** diff --git a/core/modules/file/src/Tests/FileFieldValidateTest.php b/core/modules/file/src/Tests/FileFieldValidateTest.php index e54c8d1..be96f3c 100644 --- a/core/modules/file/src/Tests/FileFieldValidateTest.php +++ b/core/modules/file/src/Tests/FileFieldValidateTest.php @@ -205,7 +205,7 @@ public function testAJAXValidationMessage() { $elements = $this->xpath('//div[contains(@class, :class)]', [ ':class' => 'messages--error', ]); - $this->assertEquals(count($elements), 1, 'Ajax validation messages are displayed once.'); + $this->assertEqual(count($elements), 1, 'Ajax validation messages are displayed once.'); } } diff --git a/core/modules/file/src/Tests/FileFieldWidgetTest.php b/core/modules/file/src/Tests/FileFieldWidgetTest.php index 59b57a1..8017ebf 100644 --- a/core/modules/file/src/Tests/FileFieldWidgetTest.php +++ b/core/modules/file/src/Tests/FileFieldWidgetTest.php @@ -251,7 +251,7 @@ public function testMultiValuedWidget() { $nid = $this->uploadNodeFiles($upload_files_node_creation, $field_name, $type_name); $node_storage->resetCache([$nid]); $node = $node_storage->load($nid); - $this->assertEquals(count($node->{$field_name}), count($upload_files_node_creation), 'Node was successfully saved with mulitple files.'); + $this->assertEqual(count($node->{$field_name}), count($upload_files_node_creation), 'Node was successfully saved with mulitple files.'); // Try to upload more files than allowed on revision. $upload_files_node_revision = [$test_file, $test_file, $test_file, $test_file]; @@ -265,7 +265,7 @@ public function testMultiValuedWidget() { $this->assertRaw(t('Field %field can only hold @max values but there were @count uploaded. The following files have been omitted as a result: %list.', $args)); $node_storage->resetCache([$nid]); $node = $node_storage->load($nid); - $this->assertEquals(count($node->{$field_name}), $cardinality, 'More files than allowed could not be saved to node.'); + $this->assertEqual(count($node->{$field_name}), $cardinality, 'More files than allowed could not be saved to node.'); // Try to upload exactly the allowed number of files on revision. Create an // empty node first, to fill it in its first revision. @@ -275,14 +275,14 @@ public function testMultiValuedWidget() { $this->uploadNodeFile($test_file, $field_name, $node->id(), 1); $node_storage->resetCache([$nid]); $node = $node_storage->load($nid); - $this->assertEquals(count($node->{$field_name}), $cardinality, 'Node was successfully revised to maximum number of files.'); + $this->assertEqual(count($node->{$field_name}), $cardinality, 'Node was successfully revised to maximum number of files.'); // Try to upload exactly the allowed number of files, new node. $upload_files = array_fill(0, $cardinality, $test_file); $nid = $this->uploadNodeFiles($upload_files, $field_name, $type_name); $node_storage->resetCache([$nid]); $node = $node_storage->load($nid); - $this->assertEquals(count($node->{$field_name}), $cardinality, 'Node was successfully saved with maximum number of files.'); + $this->assertEqual(count($node->{$field_name}), $cardinality, 'Node was successfully saved with maximum number of files.'); // Try to upload more files than allowed, new node. $upload_files[] = $test_file; @@ -557,7 +557,7 @@ protected function doTestTemporaryFileRemovalExploit(UserInterface $victim_user, $victim_tmp_file = File::load($victim_tmp_file->id()); $this->assertTrue($victim_tmp_file->isTemporary(), 'New file saved to disk is temporary.'); $this->assertFalse(empty($victim_tmp_file->id()), 'New file has an fid.'); - $this->assertEquals($victim_user->id(), $victim_tmp_file->getOwnerId(), 'New file belongs to the victim.'); + $this->assertEqual($victim_user->id(), $victim_tmp_file->getOwnerId(), 'New file belongs to the victim.'); // Have attacker create a new node with a different uploaded file and // ensure it got uploaded successfully. @@ -573,7 +573,7 @@ protected function doTestTemporaryFileRemovalExploit(UserInterface $victim_user, /** @var \Drupal\file\FileInterface $node_file */ $node_file = File::load($node->{$field_name}->target_id); $this->assertFileExists($node_file, 'A file was saved to disk on node creation'); - $this->assertEquals($attacker_user->id(), $node_file->getOwnerId(), 'New file belongs to the attacker.'); + $this->assertEqual($attacker_user->id(), $node_file->getOwnerId(), 'New file belongs to the attacker.'); // Ensure the file can be downloaded. $this->drupalGet(file_create_url($node_file->getFileUri())); diff --git a/core/modules/file/src/Tests/FileListingTest.php b/core/modules/file/src/Tests/FileListingTest.php index e8f3d00..5c8b834 100644 --- a/core/modules/file/src/Tests/FileListingTest.php +++ b/core/modules/file/src/Tests/FileListingTest.php @@ -128,7 +128,7 @@ public function testFileListingPages() { $this->assertRaw('admin/content/files/usage/' . $file->id() . '">' . $usage); $result = $this->xpath("//td[contains(@class, 'views-field-status') and contains(text(), :value)]", [':value' => t('Temporary')]); - $this->assertEquals(1, count($result), 'Unused file marked as temporary.'); + $this->assertEqual(1, count($result), 'Unused file marked as temporary.'); // Test file usage page. foreach ($nodes as $node) { diff --git a/core/modules/file/src/Tests/FileManagedFileElementTest.php b/core/modules/file/src/Tests/FileManagedFileElementTest.php index c2d39bf..f48532e 100644 --- a/core/modules/file/src/Tests/FileManagedFileElementTest.php +++ b/core/modules/file/src/Tests/FileManagedFileElementTest.php @@ -42,7 +42,7 @@ public function testManagedFile() { $this->drupalPostForm($path, $edit, t('Save')); $this->assertText('The form has become outdated. Copy any unsaved work in the form below'); $last_fid = $this->getLastFileId(); - $this->assertEquals($last_fid_prior, $last_fid, 'File was not saved when uploaded with an invalid form token.'); + $this->assertEqual($last_fid_prior, $last_fid, 'File was not saved when uploaded with an invalid form token.'); // Submit a new file, without using the Upload button. $last_fid_prior = $this->getLastFileId(); diff --git a/core/modules/file/src/Tests/FileManagedTestBase.php b/core/modules/file/src/Tests/FileManagedTestBase.php index 63286f0..879e1c4 100644 --- a/core/modules/file/src/Tests/FileManagedTestBase.php +++ b/core/modules/file/src/Tests/FileManagedTestBase.php @@ -85,7 +85,7 @@ public function assertFileHookCalled($hook, $expected_count = 1, $message = NULL $message = format_string('hook_file_@name was expected to be called %expected times but was called %actual times.', ['@name' => $hook, '%expected' => $expected_count, '%actual' => $actual_count]); } } - $this->assertEquals($actual_count, $expected_count, $message); + $this->assertEqual($actual_count, $expected_count, $message); } /** @@ -97,13 +97,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()]), 'File unchanged'); - $this->assertEquals($before->getOwner()->id(), $after->getOwner()->id(), t('File owner is the same: %file1 == %file2.', ['%file1' => $before->getOwner()->id(), '%file2' => $after->getOwner()->id()]), 'File unchanged'); - $this->assertEquals($before->getFilename(), $after->getFilename(), t('File name is the same: %file1 == %file2.', ['%file1' => $before->getFilename(), '%file2' => $after->getFilename()]), 'File unchanged'); - $this->assertEquals($before->getFileUri(), $after->getFileUri(), t('File path is the same: %file1 == %file2.', ['%file1' => $before->getFileUri(), '%file2' => $after->getFileUri()]), 'File unchanged'); - $this->assertEquals($before->getMimeType(), $after->getMimeType(), t('File MIME type is the same: %file1 == %file2.', ['%file1' => $before->getMimeType(), '%file2' => $after->getMimeType()]), 'File unchanged'); - $this->assertEquals($before->getSize(), $after->getSize(), t('File size is the same: %file1 == %file2.', ['%file1' => $before->getSize(), '%file2' => $after->getSize()]), 'File unchanged'); - $this->assertEquals($before->isPermanent(), $after->isPermanent(), t('File status is the same: %file1 == %file2.', ['%file1' => $before->isPermanent(), '%file2' => $after->isPermanent()]), 'File unchanged'); + $this->assertEqual($before->id(), $after->id(), t('File id is the same: %file1 == %file2.', ['%file1' => $before->id(), '%file2' => $after->id()]), 'File unchanged'); + $this->assertEqual($before->getOwner()->id(), $after->getOwner()->id(), t('File owner is the same: %file1 == %file2.', ['%file1' => $before->getOwner()->id(), '%file2' => $after->getOwner()->id()]), 'File unchanged'); + $this->assertEqual($before->getFilename(), $after->getFilename(), t('File name is the same: %file1 == %file2.', ['%file1' => $before->getFilename(), '%file2' => $after->getFilename()]), 'File unchanged'); + $this->assertEqual($before->getFileUri(), $after->getFileUri(), t('File path is the same: %file1 == %file2.', ['%file1' => $before->getFileUri(), '%file2' => $after->getFileUri()]), 'File unchanged'); + $this->assertEqual($before->getMimeType(), $after->getMimeType(), t('File MIME type is the same: %file1 == %file2.', ['%file1' => $before->getMimeType(), '%file2' => $after->getMimeType()]), 'File unchanged'); + $this->assertEqual($before->getSize(), $after->getSize(), t('File size is the same: %file1 == %file2.', ['%file1' => $before->getSize(), '%file2' => $after->getSize()]), 'File unchanged'); + $this->assertEqual($before->isPermanent(), $after->isPermanent(), t('File status is the same: %file1 == %file2.', ['%file1' => $before->isPermanent(), '%file2' => $after->isPermanent()]), 'File unchanged'); } /** @@ -128,8 +128,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()]), 'Same file'); - $this->assertEquals($file1->getFileUri(), $file2->getFileUri(), t('Files have the same path: %file1 == %file2.', ['%file1' => $file1->getFileUri(), '%file2' => $file2->getFileUri()]), 'Same file'); + $this->assertEqual($file1->id(), $file2->id(), t('Files have the same ids: %file1 == %file2.', ['%file1' => $file1->id(), '%file2-fid' => $file2->id()]), 'Same file'); + $this->assertEqual($file1->getFileUri(), $file2->getFileUri(), t('Files have the same path: %file1 == %file2.', ['%file1' => $file1->getFileUri(), '%file2' => $file2->getFileUri()]), 'Same file'); } /** diff --git a/core/modules/file/src/Tests/FilePrivateTest.php b/core/modules/file/src/Tests/FilePrivateTest.php index 2942cde..88574cb 100644 --- a/core/modules/file/src/Tests/FilePrivateTest.php +++ b/core/modules/file/src/Tests/FilePrivateTest.php @@ -135,7 +135,7 @@ public function testPrivateFile() { /** @var \Drupal\file\FileStorageInterface $file_storage */ $file_storage = $this->container->get('entity.manager')->getStorage('file'); $files = $file_storage->loadByProperties(['uid' => 0]); - $this->assertEquals(1, count($files), 'Loaded one anonymous file.'); + $this->assertEqual(1, count($files), 'Loaded one anonymous file.'); $file = end($files); $this->assertTrue($file->isTemporary(), 'File is temporary.'); $usage = $this->container->get('file.usage')->listUsage($file); diff --git a/core/modules/file/src/Tests/FileTokenReplaceTest.php b/core/modules/file/src/Tests/FileTokenReplaceTest.php index e48f038..5bfa07b 100644 --- a/core/modules/file/src/Tests/FileTokenReplaceTest.php +++ b/core/modules/file/src/Tests/FileTokenReplaceTest.php @@ -78,8 +78,8 @@ public function testFileTokenReplacement() { foreach ($tests as $input => $expected) { $bubbleable_metadata = new BubbleableMetadata(); $output = $token_service->replace($input, ['file' => $file], ['langcode' => $language_interface->getId()], $bubbleable_metadata); - $this->assertEquals($output, $expected, format_string('Sanitized file token %token replaced.', ['%token' => $input])); - $this->assertEquals($bubbleable_metadata, $metadata_tests[$input]); + $this->assertEqual($output, $expected, format_string('Sanitized file token %token replaced.', ['%token' => $input])); + $this->assertEqual($bubbleable_metadata, $metadata_tests[$input]); } // Generate and test unsanitized tokens. @@ -90,7 +90,7 @@ public function testFileTokenReplacement() { foreach ($tests as $input => $expected) { $output = $token_service->replace($input, ['file' => $file], ['langcode' => $language_interface->getId(), 'sanitize' => FALSE]); - $this->assertEquals($output, $expected, format_string('Unsanitized file token %token replaced.', ['%token' => $input])); + $this->assertEqual($output, $expected, format_string('Unsanitized file token %token replaced.', ['%token' => $input])); } } diff --git a/core/modules/file/src/Tests/SaveUploadFormTest.php b/core/modules/file/src/Tests/SaveUploadFormTest.php index 3d3a7f4..e5680706 100644 --- a/core/modules/file/src/Tests/SaveUploadFormTest.php +++ b/core/modules/file/src/Tests/SaveUploadFormTest.php @@ -89,7 +89,7 @@ public function testNormal() { $file1 = File::load($max_fid_after); $this->assertTrue($file1, 'Loaded the file.'); // MIME type of the uploaded image may be either image/jpeg or image/png. - $this->assertEquals(substr($file1->getMimeType(), 0, 5), 'image', 'A MIME type was set.'); + $this->assertEqual(substr($file1->getMimeType(), 0, 5), 'image', 'A MIME type was set.'); // Reset the hook counters to get rid of the 'load' we just called. file_test_reset(); @@ -110,7 +110,7 @@ public function testNormal() { $file2 = File::load($max_fid_after); $this->assertTrue($file2, 'Loaded the file'); // MIME type of the uploaded image may be either image/jpeg or image/png. - $this->assertEquals(substr($file2->getMimeType(), 0, 5), 'image', 'A MIME type was set.'); + $this->assertEqual(substr($file2->getMimeType(), 0, 5), 'image', 'A MIME type was set.'); // Load both files using File::loadMultiple(). $files = File::loadMultiple([$file1->id(), $file2->id()]); @@ -467,7 +467,7 @@ public function testCombinedErrorMessages() { * Tests highlighting of file upload field when it has an error. */ public function testUploadFieldIsHighlighted() { - $this->assertEquals(0, count($this->cssSelect('input[name="files[file_test_upload][]"].error')), 'Successful file upload has no error.'); + $this->assertEqual(0, count($this->cssSelect('input[name="files[file_test_upload][]"].error')), 'Successful file upload has no error.'); /** @var \Drupal\Core\File\FileSystemInterface $file_system */ $file_system = \Drupal::service('file_system'); @@ -478,7 +478,7 @@ public function testUploadFieldIsHighlighted() { $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); $this->assertResponse(200, 'Received a 200 response for posted test file.'); $this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.'); - $this->assertEquals(1, count($this->cssSelect('input[name="files[file_test_upload][]"].error')), 'File upload field has error.'); + $this->assertEqual(1, count($this->cssSelect('input[name="files[file_test_upload][]"].error')), 'File upload field has error.'); } } diff --git a/core/modules/file/src/Tests/SaveUploadTest.php b/core/modules/file/src/Tests/SaveUploadTest.php index 8ffef84..a6e6f9a 100644 --- a/core/modules/file/src/Tests/SaveUploadTest.php +++ b/core/modules/file/src/Tests/SaveUploadTest.php @@ -81,7 +81,7 @@ public function testNormal() { $file1 = File::load($max_fid_after); $this->assertTrue($file1, 'Loaded the file.'); // MIME type of the uploaded image may be either image/jpeg or image/png. - $this->assertEquals(substr($file1->getMimeType(), 0, 5), 'image', 'A MIME type was set.'); + $this->assertEqual(substr($file1->getMimeType(), 0, 5), 'image', 'A MIME type was set.'); // Reset the hook counters to get rid of the 'load' we just called. file_test_reset(); @@ -100,7 +100,7 @@ public function testNormal() { $file2 = File::load($max_fid_after); $this->assertTrue($file2, 'Loaded the file'); // MIME type of the uploaded image may be either image/jpeg or image/png. - $this->assertEquals(substr($file2->getMimeType(), 0, 5), 'image', 'A MIME type was set.'); + $this->assertEqual(substr($file2->getMimeType(), 0, 5), 'image', 'A MIME type was set.'); // Load both files using File::loadMultiple(). $files = File::loadMultiple([$file1->id(), $file2->id()]); diff --git a/core/modules/file/src/Tests/Update/FileUpdateTest.php b/core/modules/file/src/Tests/Update/FileUpdateTest.php index dbdb531..bd724f4 100644 --- a/core/modules/file/src/Tests/Update/FileUpdateTest.php +++ b/core/modules/file/src/Tests/Update/FileUpdateTest.php @@ -48,12 +48,12 @@ public function testPostUpdate8001() { // Check that field_file_generic formatter has a // use_description_as_link_text setting which value is TRUE. $formatter_settings = $this->config($view)->get('content.field_file_generic_2677990.settings'); - $this->assertEquals($formatter_settings, ['use_description_as_link_text' => TRUE]); + $this->assertEqual($formatter_settings, ['use_description_as_link_text' => TRUE]); // Check that field_file_table formatter has a use_description_as_link_text // setting which value is FALSE. $formatter_settings = $this->config($view)->get('content.field_file_table_2677990.settings'); - $this->assertEquals($formatter_settings, ['use_description_as_link_text' => FALSE]); + $this->assertEqual($formatter_settings, ['use_description_as_link_text' => FALSE]); } } diff --git a/core/modules/file/tests/src/Kernel/FileManagedUnitTestBase.php b/core/modules/file/tests/src/Kernel/FileManagedUnitTestBase.php index 95ea546..5aadd3a 100644 --- a/core/modules/file/tests/src/Kernel/FileManagedUnitTestBase.php +++ b/core/modules/file/tests/src/Kernel/FileManagedUnitTestBase.php @@ -107,13 +107,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()]), 'File unchanged'); - $this->assertEquals($before->getOwner()->id(), $after->getOwner()->id(), t('File owner is the same: %file1 == %file2.', ['%file1' => $before->getOwner()->id(), '%file2' => $after->getOwner()->id()]), 'File unchanged'); - $this->assertEquals($before->getFilename(), $after->getFilename(), t('File name is the same: %file1 == %file2.', ['%file1' => $before->getFilename(), '%file2' => $after->getFilename()]), 'File unchanged'); - $this->assertEquals($before->getFileUri(), $after->getFileUri(), t('File path is the same: %file1 == %file2.', ['%file1' => $before->getFileUri(), '%file2' => $after->getFileUri()]), 'File unchanged'); - $this->assertEquals($before->getMimeType(), $after->getMimeType(), t('File MIME type is the same: %file1 == %file2.', ['%file1' => $before->getMimeType(), '%file2' => $after->getMimeType()]), 'File unchanged'); - $this->assertEquals($before->getSize(), $after->getSize(), t('File size is the same: %file1 == %file2.', ['%file1' => $before->getSize(), '%file2' => $after->getSize()]), 'File unchanged'); - $this->assertEquals($before->isPermanent(), $after->isPermanent(), t('File status is the same: %file1 == %file2.', ['%file1' => $before->isPermanent(), '%file2' => $after->isPermanent()]), 'File unchanged'); + $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()])); } /** @@ -138,8 +138,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()]), 'Same file'); - $this->assertEquals($file1->getFileUri(), $file2->getFileUri(), t('Files have the same path: %file1 == %file2.', ['%file1' => $file1->getFileUri(), '%file2' => $file2->getFileUri()]), 'Same file'); + $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()])); } /** diff --git a/core/modules/file/tests/src/Kernel/LoadTest.php b/core/modules/file/tests/src/Kernel/LoadTest.php index 71312ce..d842def 100644 --- a/core/modules/file/tests/src/Kernel/LoadTest.php +++ b/core/modules/file/tests/src/Kernel/LoadTest.php @@ -45,11 +45,11 @@ public function testSingleValues() { $by_fid_file = File::load($file->id()); $this->assertFileHookCalled('load'); $this->assertTrue(is_object($by_fid_file), '\Drupal\file\Entity\File::load() returned an object.'); - $this->assertEquals($by_fid_file->id(), $file->id(), 'Loading by fid got the same fid.', 'File'); - $this->assertEquals($by_fid_file->getFileUri(), $file->getFileUri(), 'Loading by fid got the correct filepath.', 'File'); - $this->assertEquals($by_fid_file->getFilename(), $file->getFilename(), 'Loading by fid got the correct filename.', 'File'); - $this->assertEquals($by_fid_file->getMimeType(), $file->getMimeType(), 'Loading by fid got the correct MIME type.', 'File'); - $this->assertEquals($by_fid_file->isPermanent(), $file->isPermanent(), 'Loading by fid got the correct status.', 'File'); + $this->assertEquals($by_fid_file->id(), $file->id(), 'Loading by fid got the same fid.'); + $this->assertEquals($by_fid_file->getFileUri(), $file->getFileUri(), 'Loading by fid got the correct filepath.'); + $this->assertEquals($by_fid_file->getFilename(), $file->getFilename(), 'Loading by fid got the correct filename.'); + $this->assertEquals($by_fid_file->getMimeType(), $file->getMimeType(), 'Loading by fid got the correct MIME type.'); + $this->assertEquals($by_fid_file->isPermanent(), $file->isPermanent(), 'Loading by fid got the correct status.'); $this->assertTrue($by_fid_file->file_test['loaded'], 'file_test_file_load() was able to modify the file during load.'); } @@ -67,7 +67,7 @@ public function testMultiple() { $this->assertEquals(1, count($by_path_files), 'entity_load_multiple_by_properties() returned an array of the correct size.'); $by_path_file = reset($by_path_files); $this->assertTrue($by_path_file->file_test['loaded'], 'file_test_file_load() was able to modify the file during load.'); - $this->assertEquals($by_path_file->id(), $file->id(), 'Loading by filepath got the correct fid.', 'File'); + $this->assertEquals($by_path_file->id(), $file->id(), 'Loading by filepath got the correct fid.'); // Load by fid. file_test_reset(); @@ -76,7 +76,7 @@ public function testMultiple() { $this->assertEquals(1, count($by_fid_files), '\Drupal\file\Entity\File::loadMultiple() returned an array of the correct size.'); $by_fid_file = reset($by_fid_files); $this->assertTrue($by_fid_file->file_test['loaded'], 'file_test_file_load() was able to modify the file during load.'); - $this->assertEquals($by_fid_file->getFileUri(), $file->getFileUri(), 'Loading by fid got the correct filepath.', 'File'); + $this->assertEquals($by_fid_file->getFileUri(), $file->getFileUri(), 'Loading by fid got the correct filepath.'); } /** @@ -92,7 +92,7 @@ public function testUuidValues() { $this->assertFileHookCalled('load'); $this->assertTrue(is_object($by_uuid_file), '\Drupal::entityManager()->loadEntityByUuid() returned a file object.'); if (is_object($by_uuid_file)) { - $this->assertEquals($by_uuid_file->id(), $file->id(), 'Loading by UUID got the same fid.', 'File'); + $this->assertEquals($by_uuid_file->id(), $file->id(), 'Loading by UUID got the same fid.'); $this->assertTrue($by_uuid_file->file_test['loaded'], 'file_test_file_load() was able to modify the file during load.'); } } diff --git a/core/modules/file/tests/src/Kernel/SaveTest.php b/core/modules/file/tests/src/Kernel/SaveTest.php index cc34160..a0e5a31 100644 --- a/core/modules/file/tests/src/Kernel/SaveTest.php +++ b/core/modules/file/tests/src/Kernel/SaveTest.php @@ -31,7 +31,7 @@ public function testFileSave() { $loaded_file = File::load($file->id()); $this->assertNotNull($loaded_file, 'Record exists in the database.'); $this->assertEquals($loaded_file->isPermanent(), $file->isPermanent(), 'Status was saved correctly.'); - $this->assertEquals($file->getSize(), filesize($file->getFileUri()), 'File size was set correctly.', 'File'); + $this->assertEquals($file->getSize(), filesize($file->getFileUri()), 'File size was set correctly.'); $this->assertTrue($file->getChangedTime() > 1, 'File size was set correctly.', 'File'); $this->assertEquals($loaded_file->langcode->value, 'en', 'Langcode was defaulted correctly.'); @@ -43,7 +43,7 @@ public function testFileSave() { // Check that the correct hooks were called. $this->assertFileHooksCalled(['load', 'update']); - $this->assertEquals($file->id(), $file->id(), 'The file ID of an existing file is not changed when updating the database.', 'File'); + $this->assertEquals($file->id(), $file->id(), 'The file ID of an existing file is not changed when updating the database.'); $this->assertTrue($file->getChangedTime() >= $file->getChangedTime(), "Timestamp didn't go backwards.", 'File'); $loaded_file = File::load($file->id()); $this->assertNotNull($loaded_file, 'Record still exists in the database.', 'File'); diff --git a/core/modules/file/tests/src/Kernel/ValidatorTest.php b/core/modules/file/tests/src/Kernel/ValidatorTest.php index 0647ac3..7b356e8 100644 --- a/core/modules/file/tests/src/Kernel/ValidatorTest.php +++ b/core/modules/file/tests/src/Kernel/ValidatorTest.php @@ -43,11 +43,11 @@ protected function setUp() { public function testFileValidateExtensions() { $file = File::create(['filename' => 'asdf.txt']); $errors = file_validate_extensions($file, 'asdf txt pork'); - $this->assertEquals(count($errors), 0, 'Valid extension accepted.', 'File'); + $this->assertEquals(count($errors), 0, 'Valid extension accepted.'); $file->setFilename('asdf.txt'); $errors = file_validate_extensions($file, 'exe png'); - $this->assertEquals(count($errors), 1, 'Invalid extension blocked.', 'File'); + $this->assertEquals(count($errors), 1, 'Invalid extension blocked.'); } /** @@ -56,11 +56,11 @@ public function testFileValidateExtensions() { public function testFileValidateIsImage() { $this->assertTrue(file_exists($this->image->getFileUri()), 'The image being tested exists.', 'File'); $errors = file_validate_is_image($this->image); - $this->assertEquals(count($errors), 0, 'No error reported for our image file.', 'File'); + $this->assertEquals(count($errors), 0, 'No error reported for our image file.'); $this->assertTrue(file_exists($this->nonImage->getFileUri()), 'The non-image being tested exists.', 'File'); $errors = file_validate_is_image($this->nonImage); - $this->assertEquals(count($errors), 1, 'An error reported for our non-image file.', 'File'); + $this->assertEquals(count($errors), 1, 'An error reported for our non-image file.'); } /** @@ -71,19 +71,19 @@ public function testFileValidateIsImage() { public function testFileValidateImageResolution() { // Non-images. $errors = file_validate_image_resolution($this->nonImage); - $this->assertEquals(count($errors), 0, 'Should not get any errors for a non-image file.', 'File'); + $this->assertEquals(count($errors), 0, 'Should not get any errors for a non-image file.'); $errors = file_validate_image_resolution($this->nonImage, '50x50', '100x100'); - $this->assertEquals(count($errors), 0, 'Do not check the resolution on non files.', 'File'); + $this->assertEquals(count($errors), 0, 'Do not check the resolution on non files.'); // Minimum size. $errors = file_validate_image_resolution($this->image); - $this->assertEquals(count($errors), 0, 'No errors for an image when there is no minimum or maximum resolution.', 'File'); + $this->assertEquals(count($errors), 0, 'No errors for an image when there is no minimum or maximum resolution.'); $errors = file_validate_image_resolution($this->image, 0, '200x1'); - $this->assertEquals(count($errors), 1, 'Got an error for an image that was not wide enough.', 'File'); + $this->assertEquals(count($errors), 1, 'Got an error for an image that was not wide enough.'); $errors = file_validate_image_resolution($this->image, 0, '1x200'); - $this->assertEquals(count($errors), 1, 'Got an error for an image that was not tall enough.', 'File'); + $this->assertEquals(count($errors), 1, 'Got an error for an image that was not tall enough.'); $errors = file_validate_image_resolution($this->image, 0, '200x200'); - $this->assertEquals(count($errors), 1, 'Small images report an error.', 'File'); + $this->assertEquals(count($errors), 1, 'Small images report an error.'); // Maximum size. if ($this->container->get('image.factory')->getToolkitId()) { @@ -92,24 +92,24 @@ public function testFileValidateImageResolution() { $this->image->setFileUri('temporary://druplicon.png'); $errors = file_validate_image_resolution($this->image, '10x5'); - $this->assertEquals(count($errors), 0, 'No errors should be reported when an oversized image can be scaled down.', 'File'); + $this->assertEquals(count($errors), 0, 'No errors should be reported when an oversized image can be scaled down.'); $image = $this->container->get('image.factory')->get($this->image->getFileUri()); - $this->assertTrue($image->getWidth() <= 10, 'Image scaled to correct width.', 'File'); - $this->assertTrue($image->getHeight() <= 5, 'Image scaled to correct height.', 'File'); + $this->assertTrue($image->getWidth() <= 10, 'Image scaled to correct width.'); + $this->assertTrue($image->getHeight() <= 5, 'Image scaled to correct height.'); // Once again, now with negative width and height to force an error. copy('core/misc/druplicon.png', 'temporary://druplicon.png'); $this->image->setFileUri('temporary://druplicon.png'); $errors = file_validate_image_resolution($this->image, '-10x-5'); - $this->assertEquals(count($errors), 1, 'An error reported for an oversized image that can not be scaled down.', 'File'); + $this->assertEquals(count($errors), 1, 'An error reported for an oversized image that can not be scaled down.'); drupal_unlink('temporary://druplicon.png'); } else { // TODO: should check that the error is returned if no toolkit is available. $errors = file_validate_image_resolution($this->image, '5x10'); - $this->assertEquals(count($errors), 1, 'Oversize images that cannot be scaled get an error.', 'File'); + $this->assertEquals(count($errors), 1, 'Oversize images that cannot be scaled get an error.'); } } @@ -124,17 +124,17 @@ public function testFileValidateNameLength() { $file->setFilename(str_repeat('x', 240)); $this->assertEquals(strlen($file->getFilename()), 240); $errors = file_validate_name_length($file); - $this->assertEquals(count($errors), 0, 'No errors reported for 240 length filename.', 'File'); + $this->assertEquals(count($errors), 0, 'No errors reported for 240 length filename.'); // Add a filename with a length too long and test it. $file->setFilename(str_repeat('x', 241)); $errors = file_validate_name_length($file); - $this->assertEquals(count($errors), 1, 'An error reported for 241 length filename.', 'File'); + $this->assertEquals(count($errors), 1, 'An error reported for 241 length filename.'); // Add a filename with an empty string and test it. $file->setFilename(''); $errors = file_validate_name_length($file); - $this->assertEquals(count($errors), 1, 'An error reported for 0 length filename.', 'File'); + $this->assertEquals(count($errors), 1, 'An error reported for 0 length filename.'); } @@ -145,13 +145,13 @@ public function testFileValidateSize() { // Create a file with a size of 1000 bytes, and quotas of only 1 byte. $file = File::create(['filesize' => 1000]); $errors = file_validate_size($file, 0, 0); - $this->assertEquals(count($errors), 0, 'No limits means no errors.', 'File'); + $this->assertEquals(count($errors), 0, 'No limits means no errors.'); $errors = file_validate_size($file, 1, 0); - $this->assertEquals(count($errors), 1, 'Error for the file being over the limit.', 'File'); + $this->assertEquals(count($errors), 1, 'Error for the file being over the limit.'); $errors = file_validate_size($file, 0, 1); - $this->assertEquals(count($errors), 1, 'Error for the user being over their limit.', 'File'); + $this->assertEquals(count($errors), 1, 'Error for the user being over their limit.'); $errors = file_validate_size($file, 1, 1); - $this->assertEquals(count($errors), 2, 'Errors for both the file and their limit.', 'File'); + $this->assertEquals(count($errors), 2, 'Errors for both the file and their limit.'); } } diff --git a/core/modules/image/src/Tests/ImageAdminStylesTest.php b/core/modules/image/src/Tests/ImageAdminStylesTest.php index 67f66e5..38fd984 100644 --- a/core/modules/image/src/Tests/ImageAdminStylesTest.php +++ b/core/modules/image/src/Tests/ImageAdminStylesTest.php @@ -132,7 +132,7 @@ public function testStyle() { // Ensure that third party settings were added to the config entity. // These are added by a hook_image_style_presave() implemented in // image_module_test module. - $this->assertEquals('bar', $style->getThirdPartySetting('image_module_test', 'foo'), 'Third party settings were added to the image style.'); + $this->assertEqual('bar', $style->getThirdPartySetting('image_module_test', 'foo'), 'Third party settings were added to the image style.'); // Ensure that the image style URI matches our expected path. $style_uri_path = $style->url(); @@ -146,7 +146,7 @@ public function testStyle() { $uuids[$effect->getPluginId()] = $uuid; $effect_configuration = $effect->getConfiguration(); foreach ($effect_edits[$effect->getPluginId()] as $field => $value) { - $this->assertEquals($value, $effect_configuration['data'][$field], SafeMarkup::format('The %field field in the %effect effect has the correct value of %value.', ['%field' => $field, '%effect' => $effect->getPluginId(), '%value' => $value])); + $this->assertEqual($value, $effect_configuration['data'][$field], SafeMarkup::format('The %field field in the %effect effect has the correct value of %value.', ['%field' => $field, '%effect' => $effect->getPluginId(), '%value' => $value])); } } @@ -191,7 +191,7 @@ public function testStyle() { // Create an image to make sure it gets flushed after saving. $image_path = $this->createSampleImage($style); - $this->assertEquals($this->getImageCount($style), 1, format_string('Image style %style image %file successfully generated.', ['%style' => $style->label(), '%file' => $image_path])); + $this->assertEqual($this->getImageCount($style), 1, format_string('Image style %style image %file successfully generated.', ['%style' => $style->label(), '%file' => $image_path])); $this->drupalPostForm($style_path, $edit, t('Update style')); @@ -210,7 +210,7 @@ public function testStyle() { // Check that the image was flushed after updating the style. // This is especially important when renaming the style. Make sure that // the old image directory has been deleted. - $this->assertEquals($this->getImageCount($style), 0, format_string('Image style %style was flushed after renaming the style and updating the order of effects.', ['%style' => $style->label()])); + $this->assertEqual($this->getImageCount($style), 0, format_string('Image style %style was flushed after renaming the style and updating the order of effects.', ['%style' => $style->label()])); // Load the style by the new name with the new weights. $style = ImageStyle::load($style_name); @@ -231,7 +231,7 @@ public function testStyle() { // Create an image to make sure it gets flushed after deleting an effect. $image_path = $this->createSampleImage($style); - $this->assertEquals($this->getImageCount($style), 1, format_string('Image style %style image %file successfully generated.', ['%style' => $style->label(), '%file' => $image_path])); + $this->assertEqual($this->getImageCount($style), 1, format_string('Image style %style image %file successfully generated.', ['%style' => $style->label(), '%file' => $image_path])); // Delete the 'image_crop' effect from the style. $this->drupalPostForm($style_path . '/effects/' . $uuids['image_crop'] . '/delete', [], t('Delete')); @@ -262,7 +262,7 @@ public function testStyle() { $this->drupalPostForm(NULL, $edit, t('Add effect')); $entity_type_manager = $this->container->get('entity_type.manager'); $style = $entity_type_manager->getStorage('image_style')->loadUnchanged($style_name); - $this->assertEquals(count($style->getEffects()), 6, 'Rotate effect with transparent background was added.'); + $this->assertEqual(count($style->getEffects()), 6, 'Rotate effect with transparent background was added.'); // Style deletion form. @@ -451,7 +451,7 @@ public function testFlushUserInterface() { $image_uri = $files[0]->uri; $derivative_uri = $style->buildUri($image_uri); $this->assertTrue($style->createDerivative($image_uri, $derivative_uri)); - $this->assertEquals($this->getImageCount($style), 1); + $this->assertEqual($this->getImageCount($style), 1); // Go to image styles list page and check if the flush operation link // exists. @@ -463,7 +463,7 @@ public function testFlushUserInterface() { $this->drupalPostForm($flush_path, [], t('Flush')); // The derivative image file should have been deleted. - $this->assertEquals($this->getImageCount($style), 0); + $this->assertEqual($this->getImageCount($style), 0); } /** @@ -512,7 +512,7 @@ public function testConfigImport() { $this->configImporter()->import(); $this->assertFalse(ImageStyle::load($style_name), 'Style deleted after config import.'); - $this->assertEquals($this->getImageCount($style), 0, 'Image style was flushed after being deleted by config import.'); + $this->assertEqual($this->getImageCount($style), 0, 'Image style was flushed after being deleted by config import.'); } /** diff --git a/core/modules/image/src/Tests/ImageDimensionsTest.php b/core/modules/image/src/Tests/ImageDimensionsTest.php index f59b063..136b0f1 100644 --- a/core/modules/image/src/Tests/ImageDimensionsTest.php +++ b/core/modules/image/src/Tests/ImageDimensionsTest.php @@ -47,8 +47,8 @@ public function testImageDimensions() { ]; // Verify that the original image matches the hard-coded values. $image_file = $image_factory->get($original_uri); - $this->assertEquals($image_file->getWidth(), $variables['#width']); - $this->assertEquals($image_file->getHeight(), $variables['#height']); + $this->assertEqual($image_file->getWidth(), $variables['#width']); + $this->assertEqual($image_file->getHeight(), $variables['#height']); // Scale an image that is wider than it is high. $effect = [ @@ -63,14 +63,14 @@ public function testImageDimensions() { $style->addImageEffect($effect); $style->save(); - $this->assertEquals($this->getImageTag($variables), ''); + $this->assertEqual($this->getImageTag($variables), ''); $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.'); $this->drupalGet($this->getAbsoluteUrl($url)); $this->assertResponse(200, 'Image was generated at the URL.'); $this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.'); $image_file = $image_factory->get($generated_uri); - $this->assertEquals($image_file->getWidth(), 120); - $this->assertEquals($image_file->getHeight(), 60); + $this->assertEqual($image_file->getWidth(), 120); + $this->assertEqual($image_file->getHeight(), 60); // Rotate 90 degrees anticlockwise. $effect = [ @@ -84,14 +84,14 @@ public function testImageDimensions() { $style->addImageEffect($effect); $style->save(); - $this->assertEquals($this->getImageTag($variables), ''); + $this->assertEqual($this->getImageTag($variables), ''); $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.'); $this->drupalGet($this->getAbsoluteUrl($url)); $this->assertResponse(200, 'Image was generated at the URL.'); $this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.'); $image_file = $image_factory->get($generated_uri); - $this->assertEquals($image_file->getWidth(), 60); - $this->assertEquals($image_file->getHeight(), 120); + $this->assertEqual($image_file->getWidth(), 60); + $this->assertEqual($image_file->getHeight(), 120); // Scale an image that is higher than it is wide (rotated by previous effect). $effect = [ @@ -106,14 +106,14 @@ public function testImageDimensions() { $style->addImageEffect($effect); $style->save(); - $this->assertEquals($this->getImageTag($variables), ''); + $this->assertEqual($this->getImageTag($variables), ''); $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.'); $this->drupalGet($this->getAbsoluteUrl($url)); $this->assertResponse(200, 'Image was generated at the URL.'); $this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.'); $image_file = $image_factory->get($generated_uri); - $this->assertEquals($image_file->getWidth(), 45); - $this->assertEquals($image_file->getHeight(), 90); + $this->assertEqual($image_file->getWidth(), 45); + $this->assertEqual($image_file->getHeight(), 90); // Test upscale disabled. $effect = [ @@ -128,14 +128,14 @@ public function testImageDimensions() { $style->addImageEffect($effect); $style->save(); - $this->assertEquals($this->getImageTag($variables), ''); + $this->assertEqual($this->getImageTag($variables), ''); $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.'); $this->drupalGet($this->getAbsoluteUrl($url)); $this->assertResponse(200, 'Image was generated at the URL.'); $this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.'); $image_file = $image_factory->get($generated_uri); - $this->assertEquals($image_file->getWidth(), 45); - $this->assertEquals($image_file->getHeight(), 90); + $this->assertEqual($image_file->getWidth(), 45); + $this->assertEqual($image_file->getHeight(), 90); // Add a desaturate effect. $effect = [ @@ -146,14 +146,14 @@ public function testImageDimensions() { $style->addImageEffect($effect); $style->save(); - $this->assertEquals($this->getImageTag($variables), ''); + $this->assertEqual($this->getImageTag($variables), ''); $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.'); $this->drupalGet($this->getAbsoluteUrl($url)); $this->assertResponse(200, 'Image was generated at the URL.'); $this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.'); $image_file = $image_factory->get($generated_uri); - $this->assertEquals($image_file->getWidth(), 45); - $this->assertEquals($image_file->getHeight(), 90); + $this->assertEqual($image_file->getWidth(), 45); + $this->assertEqual($image_file->getHeight(), 90); // Add a random rotate effect. $effect = [ @@ -167,7 +167,7 @@ public function testImageDimensions() { $style->addImageEffect($effect); $style->save(); - $this->assertEquals($this->getImageTag($variables), ''); + $this->assertEqual($this->getImageTag($variables), ''); $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.'); $this->drupalGet($this->getAbsoluteUrl($url)); $this->assertResponse(200, 'Image was generated at the URL.'); @@ -186,14 +186,14 @@ public function testImageDimensions() { $style->addImageEffect($effect); $style->save(); - $this->assertEquals($this->getImageTag($variables), ''); + $this->assertEqual($this->getImageTag($variables), ''); $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.'); $this->drupalGet($this->getAbsoluteUrl($url)); $this->assertResponse(200, 'Image was generated at the URL.'); $this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.'); $image_file = $image_factory->get($generated_uri); - $this->assertEquals($image_file->getWidth(), 30); - $this->assertEquals($image_file->getHeight(), 30); + $this->assertEqual($image_file->getWidth(), 30); + $this->assertEqual($image_file->getHeight(), 30); // Rotate to a non-multiple of 90 degrees. $effect = [ @@ -209,7 +209,7 @@ public function testImageDimensions() { $style->save(); // @todo Uncomment this once // https://www.drupal.org/project/drupal/issues/2670966 is resolved. - // $this->assertEquals($this->getImageTag($variables), ''); + // $this->assertEqual($this->getImageTag($variables), ''); $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.'); $this->drupalGet($this->getAbsoluteUrl($url)); $this->assertResponse(200, 'Image was generated at the URL.'); @@ -217,8 +217,8 @@ public function testImageDimensions() { $image_file = $image_factory->get($generated_uri); // @todo Uncomment this once // https://www.drupal.org/project/drupal/issues/2670966 is resolved. - // $this->assertEquals($image_file->getWidth(), 41); - // $this->assertEquals($image_file->getHeight(), 41); + // $this->assertEqual($image_file->getWidth(), 41); + // $this->assertEqual($image_file->getHeight(), 41); $effect_plugin = $style->getEffect($effect_id); $style->deleteImageEffect($effect_plugin); @@ -232,7 +232,7 @@ public function testImageDimensions() { $style->addImageEffect($effect); $style->save(); - $this->assertEquals($this->getImageTag($variables), ''); + $this->assertEqual($this->getImageTag($variables), ''); // Test URI dependent image effect. $style = ImageStyle::create(['name' => 'test_uri', 'label' => 'Test URI']); @@ -253,28 +253,28 @@ public function testImageDimensions() { // PNG original image. Should be resized to 100x100. $generated_uri = 'public://styles/test_uri/public/' . \Drupal::service('file_system')->basename($original_uri); $url = file_url_transform_relative($style->buildUrl($original_uri)); - $this->assertEquals($this->getImageTag($variables), ''); + $this->assertEqual($this->getImageTag($variables), ''); $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.'); $this->drupalGet($this->getAbsoluteUrl($url)); $this->assertResponse(200, 'Image was generated at the URL.'); $this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.'); $image_file = $image_factory->get($generated_uri); - $this->assertEquals($image_file->getWidth(), 100); - $this->assertEquals($image_file->getHeight(), 100); + $this->assertEqual($image_file->getWidth(), 100); + $this->assertEqual($image_file->getHeight(), 100); // GIF original image. Should be resized to 50x50. $file = $files[1]; $original_uri = file_unmanaged_copy($file->uri, 'public://', FILE_EXISTS_RENAME); $generated_uri = 'public://styles/test_uri/public/' . \Drupal::service('file_system')->basename($original_uri); $url = file_url_transform_relative($style->buildUrl($original_uri)); $variables['#uri'] = $original_uri; - $this->assertEquals($this->getImageTag($variables), ''); + $this->assertEqual($this->getImageTag($variables), ''); $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.'); $this->drupalGet($this->getAbsoluteUrl($url)); $this->assertResponse(200, 'Image was generated at the URL.'); $this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.'); $image_file = $image_factory->get($generated_uri); - $this->assertEquals($image_file->getWidth(), 50); - $this->assertEquals($image_file->getHeight(), 50); + $this->assertEqual($image_file->getWidth(), 50); + $this->assertEqual($image_file->getHeight(), 50); } /** diff --git a/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php b/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php index d7da0ae..b82348e 100644 --- a/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php +++ b/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php @@ -67,18 +67,18 @@ public function testDefaultImages() { $field = $this->createImageField($field_name, 'article', $storage_settings, $field_settings, $widget_settings); // The field default image id should be 2. - $this->assertEquals($field->getSetting('default_image')['uuid'], $default_images['field']->uuid()); + $this->assertEqual($field->getSetting('default_image')['uuid'], $default_images['field']->uuid()); // Also test \Drupal\field\Entity\FieldConfig::getSettings(). - $this->assertEquals($field->getSettings()['default_image']['uuid'], $default_images['field']->uuid()); + $this->assertEqual($field->getSettings()['default_image']['uuid'], $default_images['field']->uuid()); $field_storage = $field->getFieldStorageDefinition(); // The field storage default image id should be 1. - $this->assertEquals($field_storage->getSetting('default_image')['uuid'], $default_images['field_storage']->uuid()); + $this->assertEqual($field_storage->getSetting('default_image')['uuid'], $default_images['field_storage']->uuid()); // Also test \Drupal\field\Entity\FieldStorageConfig::getSettings(). - $this->assertEquals($field_storage->getSettings()['default_image']['uuid'], $default_images['field_storage']->uuid()); + $this->assertEqual($field_storage->getSettings()['default_image']['uuid'], $default_images['field_storage']->uuid()); // Add another field with another default image to the page content type. $field2 = FieldConfig::create([ @@ -154,7 +154,7 @@ public function testDefaultImages() { // Confirm that the image default is shown for a new article node. $article = $this->drupalCreateNode(['type' => 'article']); $article_built = $this->drupalBuildEntityView($article); - $this->assertEquals( + $this->assertEqual( $article_built[$field_name][0]['#item']->target_id, $default_images['field']->id(), format_string( @@ -173,7 +173,7 @@ public function testDefaultImages() { // Confirm that the image default is shown for a new page node. $page = $this->drupalCreateNode(['type' => 'page']); $page_built = $this->drupalBuildEntityView($page); - $this->assertEquals( + $this->assertEqual( $page_built[$field_name][0]['#item']->target_id, $default_images['field2']->id(), format_string( @@ -204,7 +204,7 @@ public function testDefaultImages() { $node_storage->resetCache([$article->id(), $page->id()]); $article_built = $this->drupalBuildEntityView($article = $node_storage->load($article->id())); $page_built = $this->drupalBuildEntityView($page = $node_storage->load($page->id())); - $this->assertEquals( + $this->assertEqual( $article_built[$field_name][0]['#item']->target_id, $default_images['field']->id(), format_string( @@ -212,7 +212,7 @@ public function testDefaultImages() { ['@fid' => $default_images['field']->id()] ) ); - $this->assertEquals( + $this->assertEqual( $page_built[$field_name][0]['#item']->target_id, $default_images['field2']->id(), format_string( @@ -244,7 +244,7 @@ public function testDefaultImages() { $page_built = $this->drupalBuildEntityView($page = $node_storage->load($page->id())); // Confirm the article uses the new default. - $this->assertEquals( + $this->assertEqual( $article_built[$field_name][0]['#item']->target_id, $default_images['field_new']->id(), format_string( @@ -253,7 +253,7 @@ public function testDefaultImages() { ) ); // Confirm the page remains unchanged. - $this->assertEquals( + $this->assertEqual( $page_built[$field_name][0]['#item']->target_id, $default_images['field2']->id(), format_string( @@ -286,7 +286,7 @@ public function testDefaultImages() { $article_built = $this->drupalBuildEntityView($article = $node_storage->load($article->id())); $page_built = $this->drupalBuildEntityView($page = $node_storage->load($page->id())); // Confirm the article uses the new field storage (not field) default. - $this->assertEquals( + $this->assertEqual( $article_built[$field_name][0]['#item']->target_id, $default_images['field_storage_new']->id(), format_string( @@ -295,7 +295,7 @@ public function testDefaultImages() { ) ); // Confirm the page remains unchanged. - $this->assertEquals( + $this->assertEqual( $page_built[$field_name][0]['#item']->target_id, $default_images['field2']->id(), format_string( diff --git a/core/modules/image/src/Tests/ImageFieldDisplayTest.php b/core/modules/image/src/Tests/ImageFieldDisplayTest.php index 98e3fe3..05d716c 100644 --- a/core/modules/image/src/Tests/ImageFieldDisplayTest.php +++ b/core/modules/image/src/Tests/ImageFieldDisplayTest.php @@ -128,11 +128,11 @@ public function _testImageFieldFormatters($scheme) { $this->assertTrue(!preg_match('/ image_style\:/', $cache_tags_header), 'No image style cache tag found.'); $this->assertRaw($default_output, 'Image linked to file formatter displaying correctly on full node view.'); // Verify that the image can be downloaded. - $this->assertEquals(file_get_contents($test_image->uri), $this->drupalGet(file_create_url($image_uri)), 'File was downloaded successfully.'); + $this->assertEqual(file_get_contents($test_image->uri), $this->drupalGet(file_create_url($image_uri)), 'File was downloaded successfully.'); if ($scheme == 'private') { // Only verify HTTP headers when using private scheme and the headers are // sent by Drupal. - $this->assertEquals($this->drupalGetHeader('Content-Type'), 'image/png', 'Content-Type header was sent.'); + $this->assertEqual($this->drupalGetHeader('Content-Type'), 'image/png', 'Content-Type header was sent.'); $this->assertTrue(strstr($this->drupalGetHeader('Cache-Control'), 'private') !== FALSE, 'Cache-Control header was sent.'); // Log out and try to access the file. @@ -168,7 +168,7 @@ public function _testImageFieldFormatters($scheme) { ':alt' => $alt, ] ); - $this->assertEquals(count($elements), 1, 'Image linked to content formatter displaying correctly on full node view.'); + $this->assertEqual(count($elements), 1, 'Image linked to content formatter displaying correctly on full node view.'); // Test the image style 'thumbnail' formatter. $display_options['settings']['image_link'] = ''; @@ -206,12 +206,12 @@ public function _testImageFieldFormatters($scheme) { 'settings' => ['image_style' => ''], ]; $expected_url = file_url_transform_relative(file_create_url($image_uri)); - $this->assertEquals($expected_url, $node->{$field_name}->view($display_options)[0]['#markup']); + $this->assertEqual($expected_url, $node->{$field_name}->view($display_options)[0]['#markup']); // Test the image URL formatter with an image style. $display_options['settings']['image_style'] = 'thumbnail'; $expected_url = file_url_transform_relative(ImageStyle::load('thumbnail')->buildUrl($image_uri)); - $this->assertEquals($expected_url, $node->{$field_name}->view($display_options)[0]['#markup']); + $this->assertEqual($expected_url, $node->{$field_name}->view($display_options)[0]['#markup']); } /** @@ -437,7 +437,7 @@ public function testImageFieldDefaultImage() { $private_field_storage = FieldStorageConfig::loadByName('node', $private_field_name); $default_image = $private_field_storage->getSetting('default_image'); $file = \Drupal::entityManager()->loadEntityByUuid('file', $default_image['uuid']); - $this->assertEquals('private', file_uri_scheme($file->getFileUri()), 'Default image uses private:// scheme.'); + $this->assertEqual('private', file_uri_scheme($file->getFileUri()), 'Default image uses private:// scheme.'); $this->assertTrue($file->isPermanent(), 'The default image status is permanent.'); // Create a new node with no image attached and ensure that default private // image is displayed. diff --git a/core/modules/image/src/Tests/ImageFieldValidateTest.php b/core/modules/image/src/Tests/ImageFieldValidateTest.php index 0e2c04f..98210d6 100644 --- a/core/modules/image/src/Tests/ImageFieldValidateTest.php +++ b/core/modules/image/src/Tests/ImageFieldValidateTest.php @@ -180,7 +180,7 @@ public function testAJAXValidationMessage() { $elements = $this->xpath('//div[contains(@class, :class)]', [ ':class' => 'messages--error', ]); - $this->assertEquals(count($elements), 1, 'Ajax validation messages are displayed once.'); + $this->assertEqual(count($elements), 1, 'Ajax validation messages are displayed once.'); } } diff --git a/core/modules/image/src/Tests/ImageStyleFlushTest.php b/core/modules/image/src/Tests/ImageStyleFlushTest.php index 20d5495..4e8cd2c 100644 --- a/core/modules/image/src/Tests/ImageStyleFlushTest.php +++ b/core/modules/image/src/Tests/ImageStyleFlushTest.php @@ -82,11 +82,11 @@ public function testFlush() { $image_path = $this->createSampleImage($style, 'public'); // Expecting to find 2 images, one is the sample.png image shown in // image style preview. - $this->assertEquals($this->getImageCount($style, 'public'), 2, format_string('Image style %style image %file successfully generated.', ['%style' => $style->label(), '%file' => $image_path])); + $this->assertEqual($this->getImageCount($style, 'public'), 2, format_string('Image style %style image %file successfully generated.', ['%style' => $style->label(), '%file' => $image_path])); // Create an image for the 'private' wrapper. $image_path = $this->createSampleImage($style, 'private'); - $this->assertEquals($this->getImageCount($style, 'private'), 1, format_string('Image style %style image %file successfully generated.', ['%style' => $style->label(), '%file' => $image_path])); + $this->assertEqual($this->getImageCount($style, 'private'), 1, format_string('Image style %style image %file successfully generated.', ['%style' => $style->label(), '%file' => $image_path])); // Remove the 'image_scale' effect and updates the style, which in turn // forces an image style flush. @@ -101,10 +101,10 @@ public function testFlush() { $this->assertResponse(200); // Post flush, expected 1 image in the 'public' wrapper (sample.png). - $this->assertEquals($this->getImageCount($style, 'public'), 1, format_string('Image style %style flushed correctly for %wrapper wrapper.', ['%style' => $style->label(), '%wrapper' => 'public'])); + $this->assertEqual($this->getImageCount($style, 'public'), 1, format_string('Image style %style flushed correctly for %wrapper wrapper.', ['%style' => $style->label(), '%wrapper' => 'public'])); // Post flush, expected no image in the 'private' wrapper. - $this->assertEquals($this->getImageCount($style, 'private'), 0, format_string('Image style %style flushed correctly for %wrapper wrapper.', ['%style' => $style->label(), '%wrapper' => 'private'])); + $this->assertEqual($this->getImageCount($style, 'private'), 0, format_string('Image style %style flushed correctly for %wrapper wrapper.', ['%style' => $style->label(), '%wrapper' => 'private'])); } } diff --git a/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php b/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php index 25403dd..baa4e7f 100644 --- a/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php +++ b/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php @@ -38,11 +38,11 @@ public function testImageStylePath() { $scheme = 'public'; $actual = $this->style->buildUri("$scheme://foo/bar.gif"); $expected = "$scheme://styles/" . $this->style->id() . "/$scheme/foo/bar.gif"; - $this->assertEquals($actual, $expected, 'Got the path for a file URI.'); + $this->assertEqual($actual, $expected, 'Got the path for a file URI.'); $actual = $this->style->buildUri('foo/bar.gif'); $expected = "$scheme://styles/" . $this->style->id() . "/$scheme/foo/bar.gif"; - $this->assertEquals($actual, $expected, 'Got the path for a relative file path.'); + $this->assertEqual($actual, $expected, 'Got the path for a relative file path.'); } /** @@ -144,7 +144,7 @@ public function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_s $this->config('system.file')->set('default_scheme', $scheme)->save(); $relative_path = file_uri_target($original_uri); $generate_url_from_relative_path = $this->style->buildUrl($relative_path, $clean_url); - $this->assertEquals($generate_url, $generate_url_from_relative_path); + $this->assertEqual($generate_url, $generate_url_from_relative_path); $this->config('system.file')->set('default_scheme', 'temporary')->save(); // Fetch the URL that generates the file. @@ -153,17 +153,17 @@ public function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_s $this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.'); $this->assertRaw(file_get_contents($generated_uri), 'URL returns expected file.'); $image = $this->container->get('image.factory')->get($generated_uri); - $this->assertEquals($this->drupalGetHeader('Content-Type'), $image->getMimeType(), 'Expected Content-Type was reported.'); - $this->assertEquals($this->drupalGetHeader('Content-Length'), $image->getFileSize(), 'Expected Content-Length was reported.'); + $this->assertEqual($this->drupalGetHeader('Content-Type'), $image->getMimeType(), 'Expected Content-Type was reported.'); + $this->assertEqual($this->drupalGetHeader('Content-Length'), $image->getFileSize(), 'Expected Content-Length was reported.'); // Check that we did not download the original file. $original_image = $this->container->get('image.factory')->get($original_uri); $this->assertNotEqual($this->drupalGetHeader('Content-Length'), $original_image->getFileSize()); if ($scheme == 'private') { - $this->assertEquals($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', 'Expires header was sent.'); + $this->assertEqual($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', 'Expires header was sent.'); $this->assertNotEqual(strpos($this->drupalGetHeader('Cache-Control'), 'no-cache'), FALSE, 'Cache-Control header contains \'no-cache\' to prevent caching.'); - $this->assertEquals($this->drupalGetHeader('X-Image-Owned-By'), 'image_module_test', 'Expected custom header has been added.'); + $this->assertEqual($this->drupalGetHeader('X-Image-Owned-By'), 'image_module_test', 'Expected custom header has been added.'); // Make sure that a second request to the already existing derivative // works too. @@ -171,7 +171,7 @@ public function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_s $this->assertResponse(200, 'Image was generated at the URL.'); // Check that the second request also returned the generated image. - $this->assertEquals($this->drupalGetHeader('Content-Length'), $image->getFileSize()); + $this->assertEqual($this->drupalGetHeader('Content-Length'), $image->getFileSize()); // Check that we did not download the original file. $this->assertNotEqual($this->drupalGetHeader('Content-Length'), $original_image->getFileSize()); @@ -203,8 +203,8 @@ public function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_s } } else { - $this->assertEquals($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', 'Expires header was sent.'); - $this->assertEquals(strpos($this->drupalGetHeader('Cache-Control'), 'no-cache'), FALSE, 'Cache-Control header contains \'no-cache\' to prevent caching.'); + $this->assertEqual($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', 'Expires header was sent.'); + $this->assertEqual(strpos($this->drupalGetHeader('Cache-Control'), 'no-cache'), FALSE, 'Cache-Control header contains \'no-cache\' to prevent caching.'); if ($clean_url) { // Add some extra chars to the token. @@ -239,7 +239,7 @@ public function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_s // Stop supressing the security token in the URL. $this->config('image.settings')->set('suppress_itok_output', FALSE)->save(); // Ensure allow_insecure_derivatives is enabled. - $this->assertEquals($this->config('image.settings')->get('allow_insecure_derivatives'), TRUE); + $this->assertEqual($this->config('image.settings')->get('allow_insecure_derivatives'), TRUE); // Check that a security token is still required when generating a second // image derivative using the first one as a source. $nested_url = $this->style->buildUrl($generated_uri, $clean_url); diff --git a/core/modules/image/src/Tests/ImageThemeFunctionTest.php b/core/modules/image/src/Tests/ImageThemeFunctionTest.php index d6485d8..54c5c64 100644 --- a/core/modules/image/src/Tests/ImageThemeFunctionTest.php +++ b/core/modules/image/src/Tests/ImageThemeFunctionTest.php @@ -97,7 +97,7 @@ public function testImageFormatterTheme() { $element = $base_element; $this->setRawContent($renderer->renderRoot($element)); $elements = $this->xpath('//a[@href=:path]/img[@class="image-style-test" and @src=:url and @width=:width and @height=:height]', [':path' => base_path() . $path, ':url' => $url, ':width' => $image->getWidth(), ':height' => $image->getHeight()]); - $this->assertEquals(count($elements), 1, 'theme_image_formatter() correctly renders with a NULL value for the alt option.'); + $this->assertEqual(count($elements), 1, 'theme_image_formatter() correctly renders with a NULL value for the alt option.'); // Test using theme_image_formatter() without an image title, alt text, or // link options. @@ -105,7 +105,7 @@ public function testImageFormatterTheme() { $element['#item']->alt = ''; $this->setRawContent($renderer->renderRoot($element)); $elements = $this->xpath('//a[@href=:path]/img[@class="image-style-test" and @src=:url and @width=:width and @height=:height and @alt=""]', [':path' => base_path() . $path, ':url' => $url, ':width' => $image->getWidth(), ':height' => $image->getHeight()]); - $this->assertEquals(count($elements), 1, 'theme_image_formatter() correctly renders without title, alt, or path options.'); + $this->assertEqual(count($elements), 1, 'theme_image_formatter() correctly renders without title, alt, or path options.'); // Link the image to a fragment on the page, and not a full URL. $fragment = $this->randomMachineName(); @@ -118,7 +118,7 @@ public function testImageFormatterTheme() { ':width' => $image->getWidth(), ':height' => $image->getHeight() ]); - $this->assertEquals(count($elements), 1, 'theme_image_formatter() correctly renders a link fragment.'); + $this->assertEqual(count($elements), 1, 'theme_image_formatter() correctly renders a link fragment.'); } /** @@ -148,14 +148,14 @@ public function testImageStyleTheme() { $element = $base_element; $this->setRawContent($renderer->renderRoot($element)); $elements = $this->xpath('//img[@class="image-style-image-test" and @src=:url and @alt=""]', [':url' => $url]); - $this->assertEquals(count($elements), 1, 'theme_image_style() renders an image correctly.'); + $this->assertEqual(count($elements), 1, 'theme_image_style() renders an image correctly.'); // Test using theme_image_style() with a NULL value for the alt option. $element = $base_element; $element['#alt'] = NULL; $this->setRawContent($renderer->renderRoot($element)); $elements = $this->xpath('//img[@class="image-style-image-test" and @src=:url]', [':url' => $url]); - $this->assertEquals(count($elements), 1, 'theme_image_style() renders an image correctly with a NULL value for the alt option.'); + $this->assertEqual(count($elements), 1, 'theme_image_style() renders an image correctly with a NULL value for the alt option.'); } /** @@ -178,7 +178,7 @@ public function testImageAltFunctionality() { $this->setRawContent($renderer->renderRoot($image_with_alt_property)); $elements = $this->xpath('//img[contains(@class, class) and contains(@alt, :alt)]', [":class" => "image-with-regular-alt", ":alt" => "Regular alt"]); - $this->assertEquals(count($elements), 1, 'Regular alt displays correctly'); + $this->assertEqual(count($elements), 1, 'Regular alt displays correctly'); // Test using alt attribute inside attributes. $image_with_alt_attribute_alt_attribute = [ @@ -196,7 +196,7 @@ public function testImageAltFunctionality() { $this->setRawContent($renderer->renderRoot($image_with_alt_attribute_alt_attribute)); $elements = $this->xpath('//img[contains(@class, class) and contains(@alt, :alt)]', [":class" => "image-with-attribute-alt", ":alt" => "Attribute alt"]); - $this->assertEquals(count($elements), 1, 'Attribute alt displays correctly'); + $this->assertEqual(count($elements), 1, 'Attribute alt displays correctly'); // Test using alt attribute as property and inside attributes. $image_with_alt_attribute_both = [ @@ -215,7 +215,7 @@ public function testImageAltFunctionality() { $this->setRawContent($renderer->renderRoot($image_with_alt_attribute_both)); $elements = $this->xpath('//img[contains(@class, class) and contains(@alt, :alt)]', [":class" => "image-with-attribute-alt", ":alt" => "Attribute alt"]); - $this->assertEquals(count($elements), 1, 'Attribute alt overrides alt property if both set.'); + $this->assertEqual(count($elements), 1, 'Attribute alt overrides alt property if both set.'); } } diff --git a/core/modules/menu_ui/src/Tests/MenuNodeTest.php b/core/modules/menu_ui/src/Tests/MenuNodeTest.php index abfcca3..9990095 100644 --- a/core/modules/menu_ui/src/Tests/MenuNodeTest.php +++ b/core/modules/menu_ui/src/Tests/MenuNodeTest.php @@ -84,7 +84,7 @@ public function testMenuNodeFormWidget() { ]; $this->drupalPostForm(NULL, $edit, t('Save')); $node = $this->drupalGetNodeByTitle($node_title); - $this->assertEquals($node->getTitle(), $edit['title[0][value]']); + $this->assertEqual($node->getTitle(), $edit['title[0][value]']); // Test that we cannot set a menu item from a menu that is not set as // available. diff --git a/core/modules/menu_ui/src/Tests/MenuTest.php b/core/modules/menu_ui/src/Tests/MenuTest.php index 898ae1c..dde9502 100644 --- a/core/modules/menu_ui/src/Tests/MenuTest.php +++ b/core/modules/menu_ui/src/Tests/MenuTest.php @@ -141,7 +141,7 @@ public function testMenu() { $menu_link_manager->resetDefinitions(); $instance = $menu_link_manager->createInstance($instance->getPluginId()); - $this->assertEquals($edit['weight'], $instance->getWeight(), 'Saving an existing link updates the weight.'); + $this->assertEqual($edit['weight'], $instance->getWeight(), 'Saving an existing link updates the weight.'); $this->resetMenuLink($instance, $old_weight); } @@ -786,7 +786,7 @@ public function resetMenuLink(MenuLinkInterface $menu_link, $old_weight) { // Verify menu link. $instance = \Drupal::service('plugin.manager.menu.link')->createInstance($menu_link->getPluginId()); - $this->assertEquals($old_weight, $instance->getWeight(), 'Resets to the old weight.'); + $this->assertEqual($old_weight, $instance->getWeight(), 'Resets to the old weight.'); } /** @@ -951,8 +951,8 @@ protected function doTestMenuBlock() { ], t('Save block')); $block = Block::load($block_id); $settings = $block->getPlugin()->getConfiguration(); - $this->assertEquals($settings['depth'], 3); - $this->assertEquals($settings['level'], 2); + $this->assertEqual($settings['depth'], 3); + $this->assertEqual($settings['level'], 2); // Reset settings. $block->getPlugin()->setConfigurationValue('depth', 0); $block->getPlugin()->setConfigurationValue('level', 1); diff --git a/core/modules/menu_ui/src/Tests/MenuWebTestBase.php b/core/modules/menu_ui/src/Tests/MenuWebTestBase.php index a9bc4f0..e0ee98f 100644 --- a/core/modules/menu_ui/src/Tests/MenuWebTestBase.php +++ b/core/modules/menu_ui/src/Tests/MenuWebTestBase.php @@ -48,29 +48,29 @@ public function assertMenuLink($menu_plugin_id, array $expected_item) { if ($child_ids) { sort($child_ids); } - $this->assertEquals($expected_item['children'], $child_ids); + $this->assertEqual($expected_item['children'], $child_ids); unset($expected_item['children']); } if (isset($expected_item['parents'])) { $parent_ids = array_values($menu_link_manager->getParentIds($menu_plugin_id)); - $this->assertEquals($expected_item['parents'], $parent_ids); + $this->assertEqual($expected_item['parents'], $parent_ids); unset($expected_item['parents']); } if (isset($expected_item['langcode']) && $entity) { - $this->assertEquals($entity->langcode->value, $expected_item['langcode']); + $this->assertEqual($entity->langcode->value, $expected_item['langcode']); unset($expected_item['langcode']); } if (isset($expected_item['enabled']) && $entity) { - $this->assertEquals($entity->enabled->value, $expected_item['enabled']); + $this->assertEqual($entity->enabled->value, $expected_item['enabled']); unset($expected_item['enabled']); } foreach ($expected_item as $key => $value) { $this->assertTrue(isset($definition[$key])); - $this->assertEquals($definition[$key], $value); + $this->assertEqual($definition[$key], $value); } } diff --git a/core/modules/migrate_drupal_ui/src/Tests/MigrateUpgradeTestBase.php b/core/modules/migrate_drupal_ui/src/Tests/MigrateUpgradeTestBase.php index a9f478b..0e01c23 100644 --- a/core/modules/migrate_drupal_ui/src/Tests/MigrateUpgradeTestBase.php +++ b/core/modules/migrate_drupal_ui/src/Tests/MigrateUpgradeTestBase.php @@ -188,7 +188,7 @@ public function testMigrateUpgrade() { ->getDefinitions()) as $entity_type) { $real_count = \Drupal::entityQuery($entity_type)->count()->execute(); $expected_count = isset($expected_counts[$entity_type]) ? $expected_counts[$entity_type] : 0; - $this->assertEquals($expected_count, $real_count, "Found $real_count $entity_type entities, expected $expected_count."); + $this->assertEqual($expected_count, $real_count, "Found $real_count $entity_type entities, expected $expected_count."); } $version_tag = 'Drupal ' . $this->getLegacyDrupalVersion($this->sourceDatabase); diff --git a/core/modules/node/src/Tests/AssertButtonsTrait.php b/core/modules/node/src/Tests/AssertButtonsTrait.php index 4d84977..97016dc 100644 --- a/core/modules/node/src/Tests/AssertButtonsTrait.php +++ b/core/modules/node/src/Tests/AssertButtonsTrait.php @@ -36,10 +36,10 @@ public function assertButtons($buttons, $dropbutton = TRUE) { // Dropbutton elements. $elements = $this->xpath('//div[@class="dropbutton-wrapper"]//input[@type="submit"]'); - $this->assertEquals($count, count($elements)); + $this->assertEqual($count, count($elements)); foreach ($elements as $element) { $value = isset($element['value']) ? (string) $element['value'] : ''; - $this->assertEquals($buttons[$i], $value); + $this->assertEqual($buttons[$i], $value); $i++; } } diff --git a/core/modules/node/src/Tests/NodeRevisionsTest.php b/core/modules/node/src/Tests/NodeRevisionsTest.php index 2c27079..da5b260 100644 --- a/core/modules/node/src/Tests/NodeRevisionsTest.php +++ b/core/modules/node/src/Tests/NodeRevisionsTest.php @@ -323,7 +323,7 @@ public function testNodeRevisionWithoutLogMessage() { $this->assertText($new_title, 'New node title appears on the page.'); $node_storage->resetCache([$node->id()]); $node_revision = $node_storage->load($node->id()); - $this->assertEquals($node_revision->revision_log->value, $revision_log, 'After an existing node revision is re-saved without a log message, the original log message is preserved.'); + $this->assertEqual($node_revision->revision_log->value, $revision_log, 'After an existing node revision is re-saved without a log message, the original log message is preserved.'); // Create another node with an initial revision log message. $node = $this->drupalCreateNode(['revision_log' => $revision_log]); @@ -408,8 +408,8 @@ public function testRevisionTranslationRevert() { /** @var \Drupal\node\NodeInterface $node */ $node = $node_storage->load($node->id()); $this->assertTrue($node->getRevisionId() > $translation_revision_id); - $this->assertEquals($node->label(), $default_translation_title); - $this->assertEquals($node->getTranslation('it')->label(), $translated_title); + $this->assertEqual($node->label(), $default_translation_title); + $this->assertEqual($node->getTranslation('it')->label(), $translated_title); $this->assertNotEqual($node->untranslatable_string_field->value, $untranslatable_string); $latest_revision_id = $translation->getRevisionId(); @@ -423,9 +423,9 @@ public function testRevisionTranslationRevert() { /** @var \Drupal\node\NodeInterface $node */ $node = $node_storage->load($node->id()); $this->assertTrue($node->getRevisionId() > $latest_revision_id); - $this->assertEquals($node->label(), $default_translation_title); - $this->assertEquals($node->getTranslation('it')->label(), $translated_title); - $this->assertEquals($node->untranslatable_string_field->value, $untranslatable_string); + $this->assertEqual($node->label(), $default_translation_title); + $this->assertEqual($node->getTranslation('it')->label(), $translated_title); + $this->assertEqual($node->untranslatable_string_field->value, $untranslatable_string); $latest_revision_id = $translation->getRevisionId(); @@ -440,7 +440,7 @@ public function testRevisionTranslationRevert() { /** @var \Drupal\node\NodeInterface $node */ $node = $node_storage->load($node->id()); $this->assertTrue($node->getRevisionId() > $latest_revision_id); - $this->assertEquals($node->label(), $initial_title); + $this->assertEqual($node->label(), $initial_title); $this->assertFalse($node->hasTranslation('it')); } diff --git a/core/modules/node/src/Tests/NodeTestBase.php b/core/modules/node/src/Tests/NodeTestBase.php index 2e3c8ff..2dcaba5 100644 --- a/core/modules/node/src/Tests/NodeTestBase.php +++ b/core/modules/node/src/Tests/NodeTestBase.php @@ -61,7 +61,7 @@ protected function setUp() { */ public function assertNodeAccess(array $ops, NodeInterface $node, AccountInterface $account) { foreach ($ops as $op => $result) { - $this->assertEquals($result, $this->accessHandler->access($node, $op, $account), $this->nodeAccessAssertMessage($op, $result, $node->language()->getId())); + $this->assertEqual($result, $this->accessHandler->access($node, $op, $account), $this->nodeAccessAssertMessage($op, $result, $node->language()->getId())); } } @@ -79,7 +79,7 @@ public function assertNodeAccess(array $ops, NodeInterface $node, AccountInterfa * to check. If NULL, the untranslated (fallback) access is checked. */ public function assertNodeCreateAccess($bundle, $result, AccountInterface $account, $langcode = NULL) { - $this->assertEquals($result, $this->accessHandler->createAccess($bundle, $account, [ + $this->assertEqual($result, $this->accessHandler->createAccess($bundle, $account, [ 'langcode' => $langcode, ]), $this->nodeAccessAssertMessage('create', $result, $langcode)); } diff --git a/core/modules/node/src/Tests/NodeTypeTest.php b/core/modules/node/src/Tests/NodeTypeTest.php index e9c1b20..70d3ac4 100644 --- a/core/modules/node/src/Tests/NodeTypeTest.php +++ b/core/modules/node/src/Tests/NodeTypeTest.php @@ -35,11 +35,11 @@ public function testNodeTypeGetFunctions() { $this->assertTrue(isset($node_types['article']), 'Node type article is available.'); $this->assertTrue(isset($node_types['page']), 'Node type basic page is available.'); - $this->assertEquals($node_types['article']->label(), $node_names['article'], 'Correct node type base has been returned.'); + $this->assertEqual($node_types['article']->label(), $node_names['article'], 'Correct node type base has been returned.'); $article = NodeType::load('article'); - $this->assertEquals($node_types['article'], $article, 'Correct node type has been returned.'); - $this->assertEquals($node_types['article']->label(), $article->label(), 'Correct node type name has been returned.'); + $this->assertEqual($node_types['article'], $article, 'Correct node type has been returned.'); + $this->assertEqual($node_types['article']->label(), $article->label(), 'Correct node type name has been returned.'); } /** @@ -67,7 +67,7 @@ public function testNodeTypeCreation() { $this->assertCacheTag('config:node_type_list'); $this->assertCacheContext('user.permissions'); $elements = $this->cssSelect('dl.node-type-list dt'); - $this->assertEquals(3, count($elements)); + $this->assertEqual(3, count($elements)); $edit = [ 'name' => 'foo', @@ -80,7 +80,7 @@ public function testNodeTypeCreation() { $this->drupalGet('node/add'); $elements = $this->cssSelect('dl.node-type-list dt'); - $this->assertEquals(4, count($elements)); + $this->assertEqual(4, count($elements)); } /** @@ -92,7 +92,7 @@ public function testNodeTypeEditing() { $this->drupalLogin($web_user); $field = FieldConfig::loadByName('node', 'page', 'body'); - $this->assertEquals($field->getLabel(), 'Body', 'Body field was found.'); + $this->assertEqual($field->getLabel(), 'Body', 'Body field was found.'); // Verify that title and body fields are displayed. $this->drupalGet('node/add/page'); @@ -132,7 +132,7 @@ public function testNodeTypeEditing() { /** @var \Drupal\Core\Entity\EntityTypeBundleInfoInterface $bundle_info */ $bundle_info = \Drupal::service('entity_type.bundle.info'); $node_bundles = $bundle_info->getBundleInfo('node'); - $this->assertEquals($node_bundles['page']['label'], 'NewBar', 'Node type bundle cache is updated'); + $this->assertEqual($node_bundles['page']['label'], 'NewBar', 'Node type bundle cache is updated'); // Remove the body field. $this->drupalPostForm('admin/structure/types/manage/page/fields/node.page.body/delete', [], t('Delete')); @@ -237,7 +237,7 @@ public function testNodeTypeFieldUiPermissions() { public function testNodeTypeNoContentType() { /** @var \Drupal\Core\Entity\EntityTypeBundleInfoInterface $bundle_info */ $bundle_info = \Drupal::service('entity_type.bundle.info'); - $this->assertEquals(2, count($bundle_info->getBundleInfo('node')), 'The bundle information service has 2 bundles for the Node entity type.'); + $this->assertEqual(2, count($bundle_info->getBundleInfo('node')), 'The bundle information service has 2 bundles for the Node entity type.'); $web_user = $this->drupalCreateUser(['administer content types']); $this->drupalLogin($web_user); @@ -253,7 +253,7 @@ public function testNodeTypeNoContentType() { ]), 'Empty text when there are no content types in the system is correct.'); $bundle_info->clearCachedBundles(); - $this->assertEquals(0, count($bundle_info->getBundleInfo('node')), 'The bundle information service has 0 bundles for the Node entity type.'); + $this->assertEqual(0, count($bundle_info->getBundleInfo('node')), 'The bundle information service has 0 bundles for the Node entity type.'); } } diff --git a/core/modules/node/tests/src/Functional/NodeTitleTest.php b/core/modules/node/tests/src/Functional/NodeTitleTest.php index e690be7..0c37b12 100644 --- a/core/modules/node/tests/src/Functional/NodeTitleTest.php +++ b/core/modules/node/tests/src/Functional/NodeTitleTest.php @@ -56,15 +56,15 @@ public function testNodeTitle() { // Test tag. $this->drupalGet('node/' . $node->id()); $xpath = '//title'; - $this->assertEquals($this->xpath($xpath)[0]->getText(), $node->label() . ' | Drupal', 'Page title is equal to node title.', 'Node'); + $this->assertEquals($this->xpath($xpath)[0]->getText(), $node->label() . ' | Drupal', 'Page title is equal to node title.'); // Test breadcrumb in comment preview. $this->drupalGet('comment/reply/node/' . $node->id() . '/comment'); $xpath = '//nav[@class="breadcrumb"]/ol/li[last()]/a'; - $this->assertEquals($this->xpath($xpath)[0]->getText(), $node->label(), 'Node breadcrumb is equal to node title.', 'Node'); + $this->assertEquals($this->xpath($xpath)[0]->getText(), $node->label(), 'Node breadcrumb is equal to node title.'); // Test node title in comment preview. - $this->assertEquals($this->xpath('//article[contains(concat(" ", normalize-space(@class), " "), :node-class)]/h2/a/span', [':node-class' => ' node--type-' . $node->bundle() . ' '])[0]->getText(), $node->label(), 'Node preview title is equal to node title.', 'Node'); + $this->assertEquals($this->xpath('//article[contains(concat(" ", normalize-space(@class), " "), :node-class)]/h2/a/span', [':node-class' => ' node--type-' . $node->bundle() . ' '])[0]->getText(), $node->label(), 'Node preview title is equal to node title.'); // Test node title is clickable on teaser list (/node). $this->drupalGet('node'); @@ -80,7 +80,7 @@ public function testNodeTitle() { $this->assertTitle(0 . ' | Drupal', 'Page title is equal to 0.', 'Node'); // Test that 0 appears in the template <h1>. $xpath = '//h1'; - $this->assertEquals(current($this->xpath($xpath)), 0, 'Node title is displayed as 0.', 'Node'); + $this->assertEquals(current($this->xpath($xpath)), 0, 'Node title is displayed as 0.'); // Test edge case where node title contains special characters. $edge_case_title = 'article\'s "title".'; diff --git a/core/modules/options/tests/src/Functional/OptionsDynamicValuesApiTest.php b/core/modules/options/tests/src/Functional/OptionsDynamicValuesApiTest.php index 733230d..a96fd7a 100644 --- a/core/modules/options/tests/src/Functional/OptionsDynamicValuesApiTest.php +++ b/core/modules/options/tests/src/Functional/OptionsDynamicValuesApiTest.php @@ -17,7 +17,7 @@ class OptionsDynamicValuesApiTest extends OptionsDynamicValuesTestBase { public function testOptionsAllowedValues() { // Test allowed values without passed $items. $values = options_allowed_values($this->fieldStorage); - $this->assertEquals([], $values); + $this->assertEqual([], $values); $values = options_allowed_values($this->fieldStorage, $this->entity); @@ -28,7 +28,7 @@ public function testOptionsAllowedValues() { $this->entity->bundle(), ]; $expected_values = array_combine($expected_values, $expected_values); - $this->assertEquals($expected_values, $values); + $this->assertEqual($expected_values, $values); } } diff --git a/core/modules/options/tests/src/Functional/OptionsDynamicValuesValidationTest.php b/core/modules/options/tests/src/Functional/OptionsDynamicValuesValidationTest.php index cdc40ce..9205011 100644 --- a/core/modules/options/tests/src/Functional/OptionsDynamicValuesValidationTest.php +++ b/core/modules/options/tests/src/Functional/OptionsDynamicValuesValidationTest.php @@ -16,14 +16,14 @@ public function testDynamicAllowedValues() { foreach ($this->test as $key => $value) { $this->entity->test_options->value = $value; $violations = $this->entity->test_options->validate(); - $this->assertEquals(count($violations), 0, "$key is a valid value"); + $this->assertEqual(count($violations), 0, "$key is a valid value"); } // Now verify that validation does not pass against anything else. foreach ($this->test as $key => $value) { $this->entity->test_options->value = is_numeric($value) ? (100 - $value) : ('X' . $value); $violations = $this->entity->test_options->validate(); - $this->assertEquals(count($violations), 1, "$key is not a valid value"); + $this->assertEqual(count($violations), 1, "$key is not a valid value"); } } diff --git a/core/modules/options/tests/src/Functional/OptionsFieldUITest.php b/core/modules/options/tests/src/Functional/OptionsFieldUITest.php index 6a35624..ec5874b 100644 --- a/core/modules/options/tests/src/Functional/OptionsFieldUITest.php +++ b/core/modules/options/tests/src/Functional/OptionsFieldUITest.php @@ -348,7 +348,7 @@ public function testNodeDisplay() { } $elements = $this->xpath('//div[text()="' . $output . '"]'); - $this->assertEquals(count($elements), 1, 'Correct options found.'); + $this->assertEqual(count($elements), 1, 'Correct options found.'); } } diff --git a/core/modules/options/tests/src/Functional/OptionsSelectDynamicValuesTest.php b/core/modules/options/tests/src/Functional/OptionsSelectDynamicValuesTest.php index b5a7ac0..b661c0d 100644 --- a/core/modules/options/tests/src/Functional/OptionsSelectDynamicValuesTest.php +++ b/core/modules/options/tests/src/Functional/OptionsSelectDynamicValuesTest.php @@ -22,7 +22,7 @@ public function testSelectListDynamic() { // Display form. $this->drupalGet('entity_test_rev/manage/' . $this->entity->id() . '/edit'); $options = $this->xpath('//select[@id="edit-test-options"]/option'); - $this->assertEquals(count($options), count($this->test) + 1); + $this->assertEqual(count($options), count($this->test) + 1); foreach ($options as $option) { $value = (string) $option['value']; if ($value != '_none') { diff --git a/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php b/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php index eeb5668..6945610 100644 --- a/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php +++ b/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php @@ -312,7 +312,7 @@ public function testUserWithPermission() { $ajax_commands = Json::decode($response); $this->assertIdentical(1, count($ajax_commands)); $this->assertIdentical('quickeditEntitySaved', $ajax_commands[0]['command'], 'The first AJAX command is an quickeditEntitySaved command.'); - $this->assertEquals($ajax_commands[0]['data'], ['entity_type' => 'node', 'entity_id' => 1], 'Updated entity type and ID returned'); + $this->assertEqual($ajax_commands[0]['data'], ['entity_type' => 'node', 'entity_id' => 1], 'Updated entity type and ID returned'); // Test that a revision was created with the correct log message. $vids = \Drupal::entityManager()->getStorage('node')->revisionIds(Node::load(1)); diff --git a/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php b/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php index abd2017..b50d71b 100644 --- a/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php +++ b/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php @@ -248,11 +248,11 @@ protected function doTestResponsiveImageFieldFormatters($scheme, $empty_styles = $this->removeWhiteSpace(); $this->assertRaw($default_output, 'Image linked to file formatter displaying correctly on full node view.'); // Verify that the image can be downloaded. - $this->assertEquals(file_get_contents($test_image->uri), $this->drupalGet(file_create_url($image_uri)), 'File was downloaded successfully.'); + $this->assertEqual(file_get_contents($test_image->uri), $this->drupalGet(file_create_url($image_uri)), 'File was downloaded successfully.'); if ($scheme == 'private') { // Only verify HTTP headers when using private scheme and the headers are // sent by Drupal. - $this->assertEquals($this->drupalGetHeader('Content-Type'), 'image/png', 'Content-Type header was sent.'); + $this->assertEqual($this->drupalGetHeader('Content-Type'), 'image/png', 'Content-Type header was sent.'); $this->assertTrue(strstr($this->drupalGetHeader('Cache-Control'), 'private') !== FALSE, 'Cache-Control header was sent.'); // Log out and try to access the file. diff --git a/core/modules/rest/src/Tests/RESTTestBase.php b/core/modules/rest/src/Tests/RESTTestBase.php index cd6f172..3f97e46 100644 --- a/core/modules/rest/src/Tests/RESTTestBase.php +++ b/core/modules/rest/src/Tests/RESTTestBase.php @@ -245,7 +245,7 @@ protected function assertResponse($code, $message = '', $group = 'Browser') { if (!isset($this->response)) { return parent::assertResponse($code, $message, $group); } - return $this->assertEquals($code, $this->response->getStatusCode(), $message ? $message : "HTTP response expected $code, actual {$this->response->getStatusCode()}", $group); + return $this->assertEqual($code, $this->response->getStatusCode(), $message ? $message : "HTTP response expected $code, actual {$this->response->getStatusCode()}", $group); } /** diff --git a/core/modules/search/src/Tests/SearchBlockTest.php b/core/modules/search/src/Tests/SearchBlockTest.php index bd33f09..21afda7 100644 --- a/core/modules/search/src/Tests/SearchBlockTest.php +++ b/core/modules/search/src/Tests/SearchBlockTest.php @@ -70,7 +70,7 @@ public function testSearchFormBlock() { /** @var $search_page_repository \Drupal\search\SearchPageRepositoryInterface */ $search_page_repository = \Drupal::service('search.search_page_repository'); $entity_id = $search_page_repository->getDefaultSearchPage(); - $this->assertEquals( + $this->assertEqual( $this->getUrl(), \Drupal::url('search.view_' . $entity_id, [], ['query' => ['keys' => $terms['keys']], 'absolute' => TRUE]), 'Submitted to correct URL.' @@ -84,7 +84,7 @@ public function testSearchFormBlock() { // Confirm that the user is redirected to the search page, when form is // submitted empty. - $this->assertEquals( + $this->assertEqual( $this->getUrl(), \Drupal::url('search.view_' . $entity_id, [], ['query' => ['keys' => ''], 'absolute' => TRUE]), 'Redirected to correct URL.' diff --git a/core/modules/search/src/Tests/SearchConfigSettingsFormTest.php b/core/modules/search/src/Tests/SearchConfigSettingsFormTest.php index 9a92a9a..b081b85 100644 --- a/core/modules/search/src/Tests/SearchConfigSettingsFormTest.php +++ b/core/modules/search/src/Tests/SearchConfigSettingsFormTest.php @@ -177,7 +177,7 @@ public function testSearchModuleDisabling() { $this->submitGetForm('node', $terms, t('Search')); $current = $this->getURL(); $expected = \Drupal::url('search.view_' . $entity->id(), [], ['query' => ['keys' => $info['keys']], 'absolute' => TRUE]); - $this->assertEquals($current, $expected, 'Block redirected to right search page'); + $this->assertEqual($current, $expected, 'Block redirected to right search page'); // Try an invalid search path, which should 404. $this->drupalGet('search/not_a_plugin_path'); diff --git a/core/modules/search/src/Tests/SearchEmbedFormTest.php b/core/modules/search/src/Tests/SearchEmbedFormTest.php index 73048d8..5f3fbea 100644 --- a/core/modules/search/src/Tests/SearchEmbedFormTest.php +++ b/core/modules/search/src/Tests/SearchEmbedFormTest.php @@ -57,7 +57,7 @@ public function testEmbeddedForm() { t('Send away')); $this->assertText(t('Test form was submitted'), 'Form message appears'); $count = \Drupal::state()->get('search_embedded_form.submit_count'); - $this->assertEquals($this->submitCount + 1, $count, 'Form submission count is correct'); + $this->assertEqual($this->submitCount + 1, $count, 'Form submission count is correct'); $this->submitCount = $count; // Now verify that we can see and submit the form from the search results. @@ -68,7 +68,7 @@ public function testEmbeddedForm() { t('Send away')); $this->assertText(t('Test form was submitted'), 'Form message appears'); $count = \Drupal::state()->get('search_embedded_form.submit_count'); - $this->assertEquals($this->submitCount + 1, $count, 'Form submission count is correct'); + $this->assertEqual($this->submitCount + 1, $count, 'Form submission count is correct'); $this->submitCount = $count; // Now verify that if we submit the search form, it doesn't count as @@ -78,7 +78,7 @@ public function testEmbeddedForm() { t('Search')); $this->assertNoText(t('Test form was submitted'), 'Form message does not appear'); $count = \Drupal::state()->get('search_embedded_form.submit_count'); - $this->assertEquals($this->submitCount, $count, 'Form submission count is correct'); + $this->assertEqual($this->submitCount, $count, 'Form submission count is correct'); $this->submitCount = $count; } diff --git a/core/modules/search/src/Tests/SearchPageTextTest.php b/core/modules/search/src/Tests/SearchPageTextTest.php index 2e76384..95d097d 100644 --- a/core/modules/search/src/Tests/SearchPageTextTest.php +++ b/core/modules/search/src/Tests/SearchPageTextTest.php @@ -91,7 +91,7 @@ public function testSearchText() { $edit['keys'] = $search_terms; $this->drupalPostForm('search/node', $edit, t('Search')); $actual_title = (string) current($this->xpath('//title')); - $this->assertEquals($actual_title, Html::decodeEntities(t($title_source, ['@keywords' => Unicode::truncate($search_terms, 60, TRUE, TRUE)])), 'Search page title is correct'); + $this->assertEqual($actual_title, Html::decodeEntities(t($title_source, ['@keywords' => Unicode::truncate($search_terms, 60, TRUE, TRUE)])), 'Search page title is correct'); $edit['keys'] = $this->searchingUser->getUsername(); $this->drupalPostForm('search/user', $edit, t('Search')); diff --git a/core/modules/search/src/Tests/SearchRankingTest.php b/core/modules/search/src/Tests/SearchRankingTest.php index 2e90e7e..55da9ac 100644 --- a/core/modules/search/src/Tests/SearchRankingTest.php +++ b/core/modules/search/src/Tests/SearchRankingTest.php @@ -131,7 +131,7 @@ public function testRankings() { // Do the search and assert the results. $this->nodeSearch->getPlugin()->setSearch('rocks', [], []); $set = $this->nodeSearch->getPlugin()->execute(); - $this->assertEquals($set[0]['node']->id(), $nodes[$node_rank][1]->id(), 'Search ranking "' . $node_rank . '" order.'); + $this->assertEqual($set[0]['node']->id(), $nodes[$node_rank][1]->id(), 'Search ranking "' . $node_rank . '" order.'); // Clear this ranking for the next test. $edit['rankings[' . $node_rank . '][value]'] = 0; @@ -166,8 +166,8 @@ public function testRankings() { // first, then the promoted node, then all the rest. $this->nodeSearch->getPlugin()->setSearch('rocks', [], []); $set = $this->nodeSearch->getPlugin()->execute(); - $this->assertEquals($set[0]['node']->id(), $nodes['sticky'][1]->id(), 'Search ranking for sticky first worked.'); - $this->assertEquals($set[1]['node']->id(), $nodes['promote'][1]->id(), 'Search ranking for promoted second worked.'); + $this->assertEqual($set[0]['node']->id(), $nodes['sticky'][1]->id(), 'Search ranking for sticky first worked.'); + $this->assertEqual($set[1]['node']->id(), $nodes['promote'][1]->id(), 'Search ranking for promoted second worked.'); // Try with recent, then comments. This is a test for issues // https://www.drupal.org/node/771596 and @@ -191,8 +191,8 @@ public function testRankings() { // first, then the commented node, then all the rest. $this->nodeSearch->getPlugin()->setSearch('rocks', [], []); $set = $this->nodeSearch->getPlugin()->execute(); - $this->assertEquals($set[0]['node']->id(), $nodes['recent'][1]->id(), 'Search ranking for recent first worked.'); - $this->assertEquals($set[1]['node']->id(), $nodes['comments'][1]->id(), 'Search ranking for comments second worked.'); + $this->assertEqual($set[0]['node']->id(), $nodes['recent'][1]->id(), 'Search ranking for recent first worked.'); + $this->assertEqual($set[1]['node']->id(), $nodes['comments'][1]->id(), 'Search ranking for comments second worked.'); } @@ -244,10 +244,10 @@ public function testHTMLRankings() { foreach ($sorted_tags as $tag_rank => $tag) { // Assert the results. if ($tag == 'notag') { - $this->assertEquals($set[$tag_rank]['node']->id(), $nodes[$tag]->id(), 'Search tag ranking for plain text order.'); + $this->assertEqual($set[$tag_rank]['node']->id(), $nodes[$tag]->id(), 'Search tag ranking for plain text order.'); } else { - $this->assertEquals($set[$tag_rank]['node']->id(), $nodes[$tag]->id(), 'Search tag ranking for "<' . $sorted_tags[$tag_rank] . '>" order.'); + $this->assertEqual($set[$tag_rank]['node']->id(), $nodes[$tag]->id(), 'Search tag ranking for "<' . $sorted_tags[$tag_rank] . '>" order.'); } } @@ -269,7 +269,7 @@ public function testHTMLRankings() { $set = array_slice($set, -2, 1); // Assert the results. - $this->assertEquals($set[0]['node']->id(), $node->id(), 'Search tag ranking for "<' . $tag . '>" order.'); + $this->assertEqual($set[0]['node']->id(), $node->id(), 'Search tag ranking for "<' . $tag . '>" order.'); // Delete node so it doesn't show up in subsequent search results. $node->delete(); diff --git a/core/modules/simpletest/src/AssertContentTrait.php b/core/modules/simpletest/src/AssertContentTrait.php index 37ff052..3c33e58 100644 --- a/core/modules/simpletest/src/AssertContentTrait.php +++ b/core/modules/simpletest/src/AssertContentTrait.php @@ -809,7 +809,7 @@ protected function assertTitle($title, $message = '', $group = 'Other') { '@expected' => var_export($title, TRUE), ]); } - return $this->assertEquals($actual, $title, $message, $group); + return $this->assertEqual($actual, $title, $message, $group); } return $this->fail('No title element found on the page.'); } diff --git a/core/modules/simpletest/src/InstallerTestBase.php b/core/modules/simpletest/src/InstallerTestBase.php index 913b6d1..96d98e0 100644 --- a/core/modules/simpletest/src/InstallerTestBase.php +++ b/core/modules/simpletest/src/InstallerTestBase.php @@ -274,7 +274,7 @@ protected function continueOnExpectedWarnings($expected_warnings = []) { foreach ($warning_elements as $warning) { $warnings[] = trim((string) $warning); } - $this->assertEquals($expected_warnings, $warnings); + $this->assertEqual($expected_warnings, $warnings); $this->clickLink('continue anyway'); } diff --git a/core/modules/simpletest/src/Tests/BrowserTest.php b/core/modules/simpletest/src/Tests/BrowserTest.php index 944ffe8..fdfaff8 100644 --- a/core/modules/simpletest/src/Tests/BrowserTest.php +++ b/core/modules/simpletest/src/Tests/BrowserTest.php @@ -42,17 +42,17 @@ public function testGetAbsoluteUrl() { $this->drupalGet($url); $absolute = \Drupal::url('user.login', [], ['absolute' => TRUE]); - $this->assertEquals($absolute, $this->url, 'Passed and requested URL are equal.'); - $this->assertEquals($this->url, $this->getAbsoluteUrl($this->url), 'Requested and returned absolute URL are equal.'); + $this->assertEqual($absolute, $this->url, 'Passed and requested URL are equal.'); + $this->assertEqual($this->url, $this->getAbsoluteUrl($this->url), 'Requested and returned absolute URL are equal.'); $this->drupalPostForm(NULL, [], t('Log in')); - $this->assertEquals($absolute, $this->url, 'Passed and requested URL are equal.'); - $this->assertEquals($this->url, $this->getAbsoluteUrl($this->url), 'Requested and returned absolute URL are equal.'); + $this->assertEqual($absolute, $this->url, 'Passed and requested URL are equal.'); + $this->assertEqual($this->url, $this->getAbsoluteUrl($this->url), 'Requested and returned absolute URL are equal.'); $this->clickLink('Create new account'); $absolute = \Drupal::url('user.register', [], ['absolute' => TRUE]); - $this->assertEquals($absolute, $this->url, 'Passed and requested URL are equal.'); - $this->assertEquals($this->url, $this->getAbsoluteUrl($this->url), 'Requested and returned absolute URL are equal.'); + $this->assertEqual($absolute, $this->url, 'Passed and requested URL are equal.'); + $this->assertEqual($this->url, $this->getAbsoluteUrl($this->url), 'Requested and returned absolute URL are equal.'); } /** @@ -73,16 +73,16 @@ public function testXPathEscaping() { // Matches the first link. $urls = $this->xpath('//a[text()=:text]', [':text' => 'A "weird" link, just to bother the dumb "XPath 1.0"']); - $this->assertEquals($urls[0]['href'], 'link1', 'Match with quotes.'); + $this->assertEqual($urls[0]['href'], 'link1', 'Match with quotes.'); $urls = $this->xpath('//a[text()=:text]', [':text' => 'A second "even more weird" link, in memory of George O\'Malley']); - $this->assertEquals($urls[0]['href'], 'link2', 'Match with mixed single and double quotes.'); + $this->assertEqual($urls[0]['href'], 'link2', 'Match with mixed single and double quotes.'); $urls = $this->xpath('//a[text()=:text]', [':text' => 'A $third$ link, so weird it\'s worth $1 million']); - $this->assertEquals($urls[0]['href'], 'link3', 'Match with a regular expression back reference symbol (dollar sign).'); + $this->assertEqual($urls[0]['href'], 'link3', 'Match with a regular expression back reference symbol (dollar sign).'); $urls = $this->xpath('//a[text()=:text]', [':text' => 'A fourth link, containing alternative \\1 regex backreferences \\2']); - $this->assertEquals($urls[0]['href'], 'link4', 'Match with another regular expression back reference symbol (double backslash).'); + $this->assertEqual($urls[0]['href'], 'link4', 'Match with another regular expression back reference symbol (double backslash).'); } /** @@ -93,7 +93,7 @@ public function testCookies() { $user = $this->drupalCreateUser(); $edit = ['name' => $user->getUsername(), 'pass' => $user->pass_raw]; $this->drupalPostForm('<front>', $edit, t('Log in')); - $this->assertEquals(count($this->cookies), 1, 'A cookie is set when the user logs in.'); + $this->assertEqual(count($this->cookies), 1, 'A cookie is set when the user logs in.'); // Check that the name and value of the cookie match the request data. $cookie_header = $this->drupalGetHeader('set-cookie', TRUE); @@ -105,7 +105,7 @@ public function testCookies() { $value = $matches[2]; $this->assertTrue(array_key_exists($name, $this->cookies), 'The cookie name is correct.'); - $this->assertEquals($value, $this->cookies[$name]['value'], 'The cookie value is correct.'); + $this->assertEqual($value, $this->cookies[$name]['value'], 'The cookie value is correct.'); // Set a flag indicating that a cookie has been set in this test. // @see testCookieDoesNotBleed() @@ -121,7 +121,7 @@ public function testCookieDoesNotBleed() { // In order for this test to be effective it should always run after the // testCookies() test. $this->assertTrue(static::$cookieSet, 'Tests have been executed in the expected order.'); - $this->assertEquals(count($this->cookies), 0, 'No cookies are present at the start of a new test.'); + $this->assertEqual(count($this->cookies), 0, 'No cookies are present at the start of a new test.'); } } diff --git a/core/modules/simpletest/src/Tests/KernelTestBaseTest.php b/core/modules/simpletest/src/Tests/KernelTestBaseTest.php index f114fdc..1e9e75d 100644 --- a/core/modules/simpletest/src/Tests/KernelTestBaseTest.php +++ b/core/modules/simpletest/src/Tests/KernelTestBaseTest.php @@ -71,8 +71,8 @@ public function testSetUp() { // nor SQLite make changes that are testable. $database = $this->container->get('database'); if ($database->driver() == 'pgsql') { - $this->assertEquals('on', $database->query("SHOW standard_conforming_strings")->fetchField()); - $this->assertEquals('escape', $database->query("SHOW bytea_output")->fetchField()); + $this->assertEqual('on', $database->query("SHOW standard_conforming_strings")->fetchField()); + $this->assertEqual('escape', $database->query("SHOW bytea_output")->fetchField()); } } @@ -243,27 +243,27 @@ public function testEnableModulesFixedList() { $entity_manager = \Drupal::entityManager(); // entity_test is loaded via $modules; its entity type should exist. - $this->assertEquals($this->container->get('module_handler')->moduleExists('entity_test'), TRUE); + $this->assertEqual($this->container->get('module_handler')->moduleExists('entity_test'), TRUE); $this->assertTrue(TRUE == $entity_manager->getDefinition('entity_test')); // Load some additional modules; entity_test should still exist. $this->enableModules(['field', 'text', 'entity_test']); - $this->assertEquals($this->container->get('module_handler')->moduleExists('entity_test'), TRUE); + $this->assertEqual($this->container->get('module_handler')->moduleExists('entity_test'), TRUE); $this->assertTrue(TRUE == $entity_manager->getDefinition('entity_test')); // Install some other modules; entity_test should still exist. $this->container->get('module_installer')->install(['user', 'field', 'field_test'], FALSE); - $this->assertEquals($this->container->get('module_handler')->moduleExists('entity_test'), TRUE); + $this->assertEqual($this->container->get('module_handler')->moduleExists('entity_test'), TRUE); $this->assertTrue(TRUE == $entity_manager->getDefinition('entity_test')); // Uninstall one of those modules; entity_test should still exist. $this->container->get('module_installer')->uninstall(['field_test']); - $this->assertEquals($this->container->get('module_handler')->moduleExists('entity_test'), TRUE); + $this->assertEqual($this->container->get('module_handler')->moduleExists('entity_test'), TRUE); $this->assertTrue(TRUE == $entity_manager->getDefinition('entity_test')); // Set the weight of a module; entity_test should still exist. module_set_weight('field', -1); - $this->assertEquals($this->container->get('module_handler')->moduleExists('entity_test'), TRUE); + $this->assertEqual($this->container->get('module_handler')->moduleExists('entity_test'), TRUE); $this->assertTrue(TRUE == $entity_manager->getDefinition('entity_test')); // Reactivate the previously uninstalled module. @@ -313,13 +313,13 @@ public function testEnableModulesTheme() { */ public function testNoThemeByDefault() { $themes = $this->config('core.extension')->get('theme'); - $this->assertEquals($themes, []); + $this->assertEqual($themes, []); $extensions = $this->container->get('config.storage')->read('core.extension'); - $this->assertEquals($extensions['theme'], []); + $this->assertEqual($extensions['theme'], []); $active_theme = $this->container->get('theme.manager')->getActiveTheme(); - $this->assertEquals($active_theme->getName(), 'core'); + $this->assertEqual($active_theme->getName(), 'core'); } /** diff --git a/core/modules/simpletest/src/Tests/SimpleTestBrowserTest.php b/core/modules/simpletest/src/Tests/SimpleTestBrowserTest.php index 864fd4a..bb9da94 100644 --- a/core/modules/simpletest/src/Tests/SimpleTestBrowserTest.php +++ b/core/modules/simpletest/src/Tests/SimpleTestBrowserTest.php @@ -44,16 +44,16 @@ public function testInternalBrowser() { // Check that current user service updated. $this->assertNotEqual($old_user_id, $this->container->get('current_user')->id(), 'Current user service updated.'); $headers = $this->drupalGetHeaders(TRUE); - $this->assertEquals(count($headers), 2, 'There was one intermediate request.'); + $this->assertEqual(count($headers), 2, 'There was one intermediate request.'); $this->assertTrue(strpos($headers[0][':status'], '303') !== FALSE, 'Intermediate response code was 303.'); $this->assertFalse(empty($headers[0]['location']), 'Intermediate request contained a Location header.'); - $this->assertEquals($this->getUrl(), $headers[0]['location'], 'HTTP redirect was followed'); + $this->assertEqual($this->getUrl(), $headers[0]['location'], 'HTTP redirect was followed'); $this->assertFalse($this->drupalGetHeader('Location'), 'Headers from intermediate request were reset.'); $this->assertResponse(200, 'Response code from intermediate request was reset.'); $this->drupalLogout(); // Check that current user service updated to anonymous user. - $this->assertEquals(0, $this->container->get('current_user')->id(), 'Current user service updated.'); + $this->assertEqual(0, $this->container->get('current_user')->id(), 'Current user service updated.'); // Test the maximum redirection option. $this->maximumRedirects = 1; @@ -65,7 +65,7 @@ public function testInternalBrowser() { 'query' => ['destination' => 'user/logout'], ]); $headers = $this->drupalGetHeaders(TRUE); - $this->assertEquals(count($headers), 2, 'Simpletest stopped following redirects after the first one.'); + $this->assertEqual(count($headers), 2, 'Simpletest stopped following redirects after the first one.'); // Remove the Simpletest private key file so we can test the protection // against requests that forge a valid testing user agent to gain access diff --git a/core/modules/simpletest/src/Tests/SimpleTestTest.php b/core/modules/simpletest/src/Tests/SimpleTestTest.php index 31b293a..42759c2 100644 --- a/core/modules/simpletest/src/Tests/SimpleTestTest.php +++ b/core/modules/simpletest/src/Tests/SimpleTestTest.php @@ -176,7 +176,7 @@ public function stubTest() { assert(FALSE, 'Lorem Ipsum'); } catch (\AssertionError $e) { - $this->assertEquals($e->getMessage(), 'Lorem Ipsum', 'Runtime assertions Enabled and running.'); + $this->assertEqual($e->getMessage(), 'Lorem Ipsum', 'Runtime assertions Enabled and running.'); } } // This causes the second of the sixteen passes asserted in @@ -265,7 +265,7 @@ public function confirmStubTestResults() { $this->assertAssertion("Debug: 'Foo'", 'Debug', 'Fail', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()'); - $this->assertEquals('16 passes, 3 fails, 2 exceptions, 3 debug messages', $this->childTestResults['summary']); + $this->assertEqual('16 passes, 3 fails, 2 exceptions, 3 debug messages', $this->childTestResults['summary']); $this->testIds[] = $test_id = $this->getTestIdFromResults(); $this->assertTrue($test_id, 'Found test ID in results.'); diff --git a/core/modules/simpletest/src/Tests/TimeZoneTest.php b/core/modules/simpletest/src/Tests/TimeZoneTest.php index a6240f5..9a98c79 100644 --- a/core/modules/simpletest/src/Tests/TimeZoneTest.php +++ b/core/modules/simpletest/src/Tests/TimeZoneTest.php @@ -30,8 +30,8 @@ protected function setUp() { */ public function testAccountTimeZones() { $expected = 'Australia/Sydney'; - $this->assertEquals($this->rootUser->getTimeZone(), $expected, 'Root user has correct time zone.'); - $this->assertEquals($this->adminUser->getTimeZone(), $expected, 'Admin user has correct time zone.'); + $this->assertEqual($this->rootUser->getTimeZone(), $expected, 'Root user has correct time zone.'); + $this->assertEqual($this->adminUser->getTimeZone(), $expected, 'Admin user has correct time zone.'); } } diff --git a/core/modules/simpletest/src/Tests/UiPhpUnitOutputTest.php b/core/modules/simpletest/src/Tests/UiPhpUnitOutputTest.php index 7a2a475..e032cef 100644 --- a/core/modules/simpletest/src/Tests/UiPhpUnitOutputTest.php +++ b/core/modules/simpletest/src/Tests/UiPhpUnitOutputTest.php @@ -35,7 +35,7 @@ public function testOutput() { // Check that there are <br> tags for the HTML output by // SimpletestUiPrinter. - $this->assertEquals($output[19], 'HTML output was generated<br />'); + $this->assertEqual($output[19], 'HTML output was generated<br />'); // Check that URLs are printed as HTML links. $this->assertIdentical(strpos($output[20], '<a href="http'), 0); } diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php index 57f0068..441b239 100644 --- a/core/modules/simpletest/src/WebTestBase.php +++ b/core/modules/simpletest/src/WebTestBase.php @@ -1940,7 +1940,7 @@ protected function assertUrl($path, array $options = [], $message = '', $group = // difference, decode them for comparison purposes. $actual_url = urldecode($this->getUrl()); $expected_url = urldecode($url); - return $this->assertEquals($actual_url, $expected_url, $message, $group); + return $this->assertEqual($actual_url, $expected_url, $message, $group); } /** diff --git a/core/modules/simpletest/tests/src/Functional/MailCaptureTest.php b/core/modules/simpletest/tests/src/Functional/MailCaptureTest.php index c31811e..71a3947 100644 --- a/core/modules/simpletest/tests/src/Functional/MailCaptureTest.php +++ b/core/modules/simpletest/tests/src/Functional/MailCaptureTest.php @@ -32,14 +32,14 @@ public function testMailSend() { // Before we send the email, drupalGetMails should return an empty array. $captured_emails = $this->drupalGetMails(); - $this->assertEquals(count($captured_emails), 0, 'The captured emails queue is empty.', 'Email'); + $this->assertEquals(count($captured_emails), 0, 'The captured emails queue is empty.'); // Send the email. \Drupal::service('plugin.manager.mail')->getInstance(['module' => 'simpletest', 'key' => 'drupal_mail_test'])->mail($message); // Ensure that there is one email in the captured emails array. $captured_emails = $this->drupalGetMails(); - $this->assertEquals(count($captured_emails), 1, 'One email was captured.', 'Email'); + $this->assertEquals(count($captured_emails), 1, 'One email was captured.'); // Assert that the email was sent by iterating over the message properties // and ensuring that they are captured intact. @@ -61,22 +61,22 @@ public function testMailSend() { // There should now be 6 emails captured. $captured_emails = $this->drupalGetMails(); - $this->assertEquals(count($captured_emails), 6, 'All emails were captured.', 'Email'); + $this->assertEquals(count($captured_emails), 6, 'All emails were captured.'); // Test different ways of getting filtered emails via drupalGetMails(). $captured_emails = $this->drupalGetMails(['id' => 'drupal_mail_test']); - $this->assertEquals(count($captured_emails), 1, 'Only one email is returned when filtering by id.', 'Email'); + $this->assertEquals(count($captured_emails), 1, 'Only one email is returned when filtering by id.'); $captured_emails = $this->drupalGetMails(['id' => 'drupal_mail_test', 'subject' => $subject]); - $this->assertEquals(count($captured_emails), 1, 'Only one email is returned when filtering by id and subject.', 'Email'); + $this->assertEquals(count($captured_emails), 1, 'Only one email is returned when filtering by id and subject.'); $captured_emails = $this->drupalGetMails(['id' => 'drupal_mail_test', 'subject' => $subject, 'from' => 'this_was_not_used@example.com']); - $this->assertEquals(count($captured_emails), 0, 'No emails are returned when querying with an unused from address.', 'Email'); + $this->assertEquals(count($captured_emails), 0, 'No emails are returned when querying with an unused from address.'); // Send the last email again, so we can confirm that the // drupalGetMails-filter correctly returns all emails with a given // property/value. \Drupal::service('plugin.manager.mail')->getInstance(['module' => 'drupal_mail_test', 'key' => $index])->mail($message); $captured_emails = $this->drupalGetMails(['id' => 'drupal_mail_test_4']); - $this->assertEquals(count($captured_emails), 2, 'All emails with the same id are returned when filtering by id.', 'Email'); + $this->assertEquals(count($captured_emails), 2, 'All emails with the same id are returned when filtering by id.'); } } diff --git a/core/modules/system/src/Tests/Ajax/AjaxFormCacheTest.php b/core/modules/system/src/Tests/Ajax/AjaxFormCacheTest.php index 2519717..11a4044 100644 --- a/core/modules/system/src/Tests/Ajax/AjaxFormCacheTest.php +++ b/core/modules/system/src/Tests/Ajax/AjaxFormCacheTest.php @@ -22,7 +22,7 @@ public function testFormCacheUsage() { $this->drupalLogin($this->rootUser); // Ensure that the cache is empty. - $this->assertEquals(0, count($key_value_expirable->getAll())); + $this->assertEqual(0, count($key_value_expirable->getAll())); // Visit an AJAX form that is not cached, 3 times. $uncached_form_url = Url::fromRoute('ajax_forms_test.commands_form'); @@ -31,7 +31,7 @@ public function testFormCacheUsage() { $this->drupalGet($uncached_form_url); // The number of cache entries should not have changed. - $this->assertEquals(0, count($key_value_expirable->getAll())); + $this->assertEqual(0, count($key_value_expirable->getAll())); } /** diff --git a/core/modules/system/src/Tests/Ajax/DialogTest.php b/core/modules/system/src/Tests/Ajax/DialogTest.php index 52259f0..90c548b 100644 --- a/core/modules/system/src/Tests/Ajax/DialogTest.php +++ b/core/modules/system/src/Tests/Ajax/DialogTest.php @@ -96,9 +96,9 @@ public function testDialog() { // Emulate going to the JS version of the page and check the JSON response. $ajax_result = $this->drupalGetAjax('ajax-test/dialog-contents', ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_modal']]); - $this->assertEquals($modal_expected_response, $ajax_result[3], 'Modal dialog JSON response matches.'); + $this->assertEqual($modal_expected_response, $ajax_result[3], 'Modal dialog JSON response matches.'); // Test the HTML escaping of & character. - $this->assertEquals($ajax_result[3]['dialogOptions']['title'], 'AJAX Dialog & contents'); + $this->assertEqual($ajax_result[3]['dialogOptions']['title'], 'AJAX Dialog & contents'); $this->assertNotEqual($ajax_result[3]['dialogOptions']['title'], 'AJAX Dialog & contents'); // Check that requesting a "normal" dialog without JS goes to a page. @@ -116,7 +116,7 @@ public function testDialog() { 'dialogOptions[target]' => 'ajax-test-dialog-wrapper-1', ] ]); - $this->assertEquals($normal_expected_response, $ajax_result[3], 'Normal dialog JSON response matches.'); + $this->assertEqual($normal_expected_response, $ajax_result[3], 'Normal dialog JSON response matches.'); // Emulate going to the JS version of the page and check the JSON response. // This needs to use WebTestBase::drupalPostAjaxForm() so that the correct @@ -132,12 +132,12 @@ public function testDialog() { $this->assert(strpos($ajax_result[3]['selector'], $no_target_expected_response['selector']) === 0, 'Selector starts with right string.'); unset($ajax_result[3]['selector']); unset($no_target_expected_response['selector']); - $this->assertEquals($no_target_expected_response, $ajax_result[3], 'Normal dialog with no target JSON response matches.'); + $this->assertEqual($no_target_expected_response, $ajax_result[3], 'Normal dialog with no target JSON response matches.'); // Emulate closing the dialog via an AJAX request. There is no non-JS // version of this test. $ajax_result = $this->drupalGetAjax('ajax-test/dialog-close'); - $this->assertEquals($close_expected_response, $ajax_result[0], 'Close dialog JSON response matches.'); + $this->assertEqual($close_expected_response, $ajax_result[0], 'Close dialog JSON response matches.'); // Test submitting via a POST request through the button for modals. This // approach more accurately reflects the real responses by Drupal because @@ -154,13 +154,13 @@ public function testDialog() { $this->assertTrue($dialog_js_exists, 'Drupal dialog JS added to the page.'); // Check that the response matches the expected value. - $this->assertEquals($modal_expected_response, $ajax_result[4], 'POST request modal dialog JSON response matches.'); + $this->assertEqual($modal_expected_response, $ajax_result[4], 'POST request modal dialog JSON response matches.'); // Test the HTML escaping of & character. $this->assertNotEqual($ajax_result[4]['dialogOptions']['title'], 'AJAX Dialog & contents'); // Abbreviated test for "normal" dialogs, testing only the difference. $ajax_result = $this->drupalPostAjaxForm('ajax-test/dialog', [], 'button2'); - $this->assertEquals($normal_expected_response, $ajax_result[4], 'POST request normal dialog JSON response matches.'); + $this->assertEqual($normal_expected_response, $ajax_result[4], 'POST request normal dialog JSON response matches.'); // Check that requesting a form dialog without JS goes to a page. $this->drupalGet('ajax-test/dialog-form'); @@ -188,13 +188,13 @@ public function testDialog() { ], ], ]; - $this->assertEquals($expected_ajax_settings, $ajax_result[0]['settings']['ajax']); + $this->assertEqual($expected_ajax_settings, $ajax_result[0]['settings']['ajax']); $this->setRawContent($ajax_result[3]['data']); // Remove the data, the form build id and token will never match. unset($ajax_result[3]['data']); $form = $this->xpath("//form[@id='ajax-test-form']"); $this->assertTrue(!empty($form), 'Modal dialog JSON contains form.'); - $this->assertEquals($form_expected_response, $ajax_result[3]); + $this->assertEqual($form_expected_response, $ajax_result[3]); // Check that requesting an entity form dialog without JS goes to a page. $this->drupalGet('admin/structure/contact/add'); @@ -210,7 +210,7 @@ public function testDialog() { unset($ajax_result[3]['data']); $form = $this->xpath("//form[@id='contact-form-add-form']"); $this->assertTrue(!empty($form), 'Modal dialog JSON contains entity form.'); - $this->assertEquals($entity_form_expected_response, $ajax_result[3]); + $this->assertEqual($entity_form_expected_response, $ajax_result[3]); } } diff --git a/core/modules/system/src/Tests/Ajax/MultiFormTest.php b/core/modules/system/src/Tests/Ajax/MultiFormTest.php index 3b1b698..96844ed 100644 --- a/core/modules/system/src/Tests/Ajax/MultiFormTest.php +++ b/core/modules/system/src/Tests/Ajax/MultiFormTest.php @@ -69,9 +69,9 @@ public function testMultiForm() { $this->drupalGet('form-test/two-instances-of-same-form'); $fields = $this->xpath($form_xpath . $field_xpath); - $this->assertEquals(count($fields), 2); + $this->assertEqual(count($fields), 2); foreach ($fields as $field) { - $this->assertEquals(count($field->xpath('.' . $field_items_xpath_suffix)), 1, 'Found the correct number of field items on the initial page.'); + $this->assertEqual(count($field->xpath('.' . $field_items_xpath_suffix)), 1, 'Found the correct number of field items on the initial page.'); $this->assertFieldsByValue($field->xpath('.' . $button_xpath_suffix), NULL, 'Found the "add more" button on the initial page.'); } @@ -88,7 +88,7 @@ public function testMultiForm() { $form = $this->xpath($form_xpath)[$offset]; $field = $form->xpath('.' . $field_xpath); - $this->assertEquals(count($field[0]->xpath('.' . $field_items_xpath_suffix)), $i + 2, 'Found the correct number of field items after an AJAX submission.'); + $this->assertEqual(count($field[0]->xpath('.' . $field_items_xpath_suffix)), $i + 2, 'Found the correct number of field items after an AJAX submission.'); $this->assertFieldsByValue($field[0]->xpath('.' . $button_xpath_suffix), NULL, 'Found the "add more" button after an AJAX submission.'); $this->assertNoDuplicateIds(t('Updated page contains unique IDs'), 'Other'); } diff --git a/core/modules/system/src/Tests/Cache/AssertPageCacheContextsAndTagsTrait.php b/core/modules/system/src/Tests/Cache/AssertPageCacheContextsAndTagsTrait.php index c58c207..b115a61 100644 --- a/core/modules/system/src/Tests/Cache/AssertPageCacheContextsAndTagsTrait.php +++ b/core/modules/system/src/Tests/Cache/AssertPageCacheContextsAndTagsTrait.php @@ -85,7 +85,7 @@ protected function assertPageCacheContextsAndTags(Url $url, array $expected_cont // Assert cache miss + expected cache contexts + tags. $this->drupalGet($absolute_url); - $this->assertEquals($this->drupalGetHeader('X-Drupal-Cache'), 'MISS'); + $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS'); $this->assertCacheTags($expected_tags); $this->assertCacheContexts($expected_contexts); @@ -99,7 +99,7 @@ protected function assertPageCacheContextsAndTags(Url $url, array $expected_cont $cid = implode(':', $cid_parts); $cache_entry = \Drupal::cache('page')->get($cid); sort($cache_entry->tags); - $this->assertEquals($cache_entry->tags, $expected_tags); + $this->assertEqual($cache_entry->tags, $expected_tags); $this->debugCacheTags($cache_entry->tags, $expected_tags); } diff --git a/core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php b/core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php index 5cbf2d7..c270f51 100644 --- a/core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php +++ b/core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php @@ -142,7 +142,7 @@ public function testSetGet() { $this->assertTrue($cached->valid, 'Item is marked as valid.'); // We need to round because microtime may be rounded up in the backend. $this->assertTrue($cached->created >= REQUEST_TIME && $cached->created <= round(microtime(TRUE), 3), 'Created time is correct.'); - $this->assertEquals($cached->expire, Cache::PERMANENT, 'Expire time is correct.'); + $this->assertEqual($cached->expire, Cache::PERMANENT, 'Expire time is correct.'); $this->assertIdentical(FALSE, $backend->get('test2'), "Backend does not contain data for cache id test2."); $backend->set('test2', ['value' => 3], REQUEST_TIME + 3); @@ -151,7 +151,7 @@ public function testSetGet() { $this->assertIdentical(['value' => 3], $cached->data); $this->assertTrue($cached->valid, 'Item is marked as valid.'); $this->assertTrue($cached->created >= REQUEST_TIME && $cached->created <= round(microtime(TRUE), 3), 'Created time is correct.'); - $this->assertEquals($cached->expire, REQUEST_TIME + 3, 'Expire time is correct.'); + $this->assertEqual($cached->expire, REQUEST_TIME + 3, 'Expire time is correct.'); $backend->set('test3', 'foobar', REQUEST_TIME - 3); $this->assertFalse($backend->get('test3'), 'Invalid item not returned.'); @@ -159,7 +159,7 @@ public function testSetGet() { $this->assert(is_object($cached), 'Backend returned an object for cache id test3.'); $this->assertFalse($cached->valid, 'Item is marked as valid.'); $this->assertTrue($cached->created >= REQUEST_TIME && $cached->created <= round(microtime(TRUE), 3), 'Created time is correct.'); - $this->assertEquals($cached->expire, REQUEST_TIME - 3, 'Expire time is correct.'); + $this->assertEqual($cached->expire, REQUEST_TIME - 3, 'Expire time is correct.'); $this->assertIdentical(FALSE, $backend->get('test4'), "Backend does not contain data for cache id test4."); $with_eof = ['foo' => "\nEOF\ndata"]; @@ -169,7 +169,7 @@ public function testSetGet() { $this->assertIdentical($with_eof, $cached->data); $this->assertTrue($cached->valid, 'Item is marked as valid.'); $this->assertTrue($cached->created >= REQUEST_TIME && $cached->created <= round(microtime(TRUE), 3), 'Created time is correct.'); - $this->assertEquals($cached->expire, Cache::PERMANENT, 'Expire time is correct.'); + $this->assertEqual($cached->expire, Cache::PERMANENT, 'Expire time is correct.'); $this->assertIdentical(FALSE, $backend->get('test5'), "Backend does not contain data for cache id test5."); $with_eof_and_semicolon = ['foo' => "\nEOF;\ndata"]; @@ -179,7 +179,7 @@ public function testSetGet() { $this->assertIdentical($with_eof_and_semicolon, $cached->data); $this->assertTrue($cached->valid, 'Item is marked as valid.'); $this->assertTrue($cached->created >= REQUEST_TIME && $cached->created <= round(microtime(TRUE), 3), 'Created time is correct.'); - $this->assertEquals($cached->expire, Cache::PERMANENT, 'Expire time is correct.'); + $this->assertEqual($cached->expire, Cache::PERMANENT, 'Expire time is correct.'); $with_variable = ['foo' => '$bar']; $backend->set('test6', $with_variable); @@ -198,7 +198,7 @@ public function testSetGet() { $data->this_should_not_be_in_the_cache = TRUE; $cached = $backend->get('test7'); $this->assert(is_object($cached), "Backend returned an object for cache id test7."); - $this->assertEquals($expected_data, $cached->data); + $this->assertEqual($expected_data, $cached->data); $this->assertFalse(isset($cached->data->this_should_not_be_in_the_cache)); // Add a property to the cache data. It should not appear when we fetch // the data from cache again. @@ -209,11 +209,11 @@ public function testSetGet() { // Check with a long key. $cid = str_repeat('a', 300); $backend->set($cid, 'test'); - $this->assertEquals('test', $backend->get($cid)->data); + $this->assertEqual('test', $backend->get($cid)->data); // Check that the cache key is case sensitive. $backend->set('TEST8', 'value'); - $this->assertEquals('value', $backend->get('TEST8')->data); + $this->assertEqual('value', $backend->get('TEST8')->data); $this->assertFalse($backend->get('test8')); // Calling ::set() with invalid cache tags. This should fail an assertion. @@ -321,7 +321,7 @@ public function testGetMultiple() { // Test return - ensure that objects has expected properties. $this->assertTrue($ret['test2']->valid, 'Item is marked as valid.'); $this->assertTrue($ret['test2']->created >= REQUEST_TIME && $ret['test2']->created <= round(microtime(TRUE), 3), 'Created time is correct.'); - $this->assertEquals($ret['test2']->expire, Cache::PERMANENT, 'Expire time is correct.'); + $this->assertEqual($ret['test2']->expire, Cache::PERMANENT, 'Expire time is correct.'); // Test return - ensure it does not contain nonexistent cache ids. $this->assertFalse(isset($ret['test19']), "Nonexistent cache id test19 is not set."); $this->assertFalse(isset($ret['test21']), "Nonexistent cache id test21 is not set."); @@ -371,7 +371,7 @@ public function testGetMultiple() { // Test with a long $cid and non-numeric array key. $cids = ['key:key' => $long_cid]; $return = $backend->getMultiple($cids); - $this->assertEquals(300, $return[$long_cid]->data); + $this->assertEqual(300, $return[$long_cid]->data); $this->assertTrue(empty($cids)); } @@ -396,21 +396,21 @@ public function testSetMultiple() { $cids = array_keys($items); $cached = $backend->getMultiple($cids); - $this->assertEquals($cached['cid_1']->data, $items['cid_1']['data'], 'Over-written cache item set correctly.'); + $this->assertEqual($cached['cid_1']->data, $items['cid_1']['data'], 'Over-written cache item set correctly.'); $this->assertTrue($cached['cid_1']->valid, 'Item is marked as valid.'); $this->assertTrue($cached['cid_1']->created >= REQUEST_TIME && $cached['cid_1']->created <= round(microtime(TRUE), 3), 'Created time is correct.'); - $this->assertEquals($cached['cid_1']->expire, CacheBackendInterface::CACHE_PERMANENT, 'Cache expiration defaults to permanent.'); + $this->assertEqual($cached['cid_1']->expire, CacheBackendInterface::CACHE_PERMANENT, 'Cache expiration defaults to permanent.'); - $this->assertEquals($cached['cid_2']->data, $items['cid_2']['data'], 'New cache item set correctly.'); - $this->assertEquals($cached['cid_2']->expire, CacheBackendInterface::CACHE_PERMANENT, 'Cache expiration defaults to permanent.'); + $this->assertEqual($cached['cid_2']->data, $items['cid_2']['data'], 'New cache item set correctly.'); + $this->assertEqual($cached['cid_2']->expire, CacheBackendInterface::CACHE_PERMANENT, 'Cache expiration defaults to permanent.'); - $this->assertEquals($cached['cid_3']->data, $items['cid_3']['data'], 'New cache item with serialized data set correctly.'); - $this->assertEquals($cached['cid_3']->expire, CacheBackendInterface::CACHE_PERMANENT, 'Cache expiration defaults to permanent.'); + $this->assertEqual($cached['cid_3']->data, $items['cid_3']['data'], 'New cache item with serialized data set correctly.'); + $this->assertEqual($cached['cid_3']->expire, CacheBackendInterface::CACHE_PERMANENT, 'Cache expiration defaults to permanent.'); - $this->assertEquals($cached['cid_4']->data, $items['cid_4']['data'], 'New cache item set correctly.'); - $this->assertEquals($cached['cid_4']->expire, $future_expiration, 'Cache expiration has been correctly set.'); + $this->assertEqual($cached['cid_4']->data, $items['cid_4']['data'], 'New cache item set correctly.'); + $this->assertEqual($cached['cid_4']->expire, $future_expiration, 'Cache expiration has been correctly set.'); - $this->assertEquals($cached['cid_5']->data, $items['cid_5']['data'], 'New cache item set correctly.'); + $this->assertEqual($cached['cid_5']->data, $items['cid_5']['data'], 'New cache item set correctly.'); // Calling ::setMultiple() with invalid cache tags. This should fail an // assertion. @@ -510,18 +510,18 @@ public function testInvalidate() { $cids = $reference; $ret = $backend->getMultiple($cids); - $this->assertEquals(count($ret), 4, 'Four items returned.'); + $this->assertEqual(count($ret), 4, 'Four items returned.'); $backend->invalidate('test1'); $backend->invalidateMultiple(['test2', 'test3']); $cids = $reference; $ret = $backend->getMultiple($cids); - $this->assertEquals(count($ret), 1, 'Only one item element returned.'); + $this->assertEqual(count($ret), 1, 'Only one item element returned.'); $cids = $reference; $ret = $backend->getMultiple($cids, TRUE); - $this->assertEquals(count($ret), 4, 'Four items returned.'); + $this->assertEqual(count($ret), 4, 'Four items returned.'); // Calling invalidateMultiple() with an empty array should not cause an // error. diff --git a/core/modules/system/src/Tests/Cache/PageCacheTagsTestBase.php b/core/modules/system/src/Tests/Cache/PageCacheTagsTestBase.php index 3bdff36..1e29e56 100644 --- a/core/modules/system/src/Tests/Cache/PageCacheTagsTestBase.php +++ b/core/modules/system/src/Tests/Cache/PageCacheTagsTestBase.php @@ -48,7 +48,7 @@ protected function setUp() { protected function verifyPageCache(Url $url, $hit_or_miss, $tags = FALSE) { $this->drupalGet($url); $message = SafeMarkup::format('Page cache @hit_or_miss for %path.', ['@hit_or_miss' => $hit_or_miss, '%path' => $url->toString()]); - $this->assertEquals($this->drupalGetHeader('X-Drupal-Cache'), $hit_or_miss, $message); + $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), $hit_or_miss, $message); if ($hit_or_miss === 'HIT' && is_array($tags)) { $absolute_url = $url->setAbsolute()->toString(); diff --git a/core/modules/system/src/Tests/Common/AddFeedTest.php b/core/modules/system/src/Tests/Common/AddFeedTest.php index 22528a7..40ff215 100644 --- a/core/modules/system/src/Tests/Common/AddFeedTest.php +++ b/core/modules/system/src/Tests/Common/AddFeedTest.php @@ -89,7 +89,7 @@ public function testFeedIconEscaping() { '#title' => '<>&"\'', ]; $text = \Drupal::service('renderer')->renderRoot($variables); - $this->assertEquals(trim(strip_tags($text)), 'Subscribe to <>&"'', 'feed_icon template escapes reserved HTML characters.'); + $this->assertEqual(trim(strip_tags($text)), 'Subscribe to <>&"'', 'feed_icon template escapes reserved HTML characters.'); } } diff --git a/core/modules/system/src/Tests/Common/AlterTest.php b/core/modules/system/src/Tests/Common/AlterTest.php index 3b5130b..863bd54 100644 --- a/core/modules/system/src/Tests/Common/AlterTest.php +++ b/core/modules/system/src/Tests/Common/AlterTest.php @@ -36,14 +36,14 @@ public function testDrupalAlter() { $array_expected = ['foo' => 'Drupal theme']; \Drupal::moduleHandler()->alter('drupal_alter', $array_copy); \Drupal::theme()->alter('drupal_alter', $array_copy); - $this->assertEquals($array_copy, $array_expected, 'Single array was altered.'); + $this->assertEqual($array_copy, $array_expected, 'Single array was altered.'); $entity_copy = clone $entity; $entity_expected = clone $entity; $entity_expected->foo = 'Drupal theme'; \Drupal::moduleHandler()->alter('drupal_alter', $entity_copy); \Drupal::theme()->alter('drupal_alter', $entity_copy); - $this->assertEquals($entity_copy, $entity_expected, 'Single object was altered.'); + $this->assertEqual($entity_copy, $entity_expected, 'Single object was altered.'); // Verify alteration of multiple arguments. $array_copy = $array; @@ -55,9 +55,9 @@ public function testDrupalAlter() { $array2_expected = ['foo' => 'Drupal theme']; \Drupal::moduleHandler()->alter('drupal_alter', $array_copy, $entity_copy, $array2_copy); \Drupal::theme()->alter('drupal_alter', $array_copy, $entity_copy, $array2_copy); - $this->assertEquals($array_copy, $array_expected, 'First argument to \Drupal::moduleHandler->alter() was altered.'); - $this->assertEquals($entity_copy, $entity_expected, 'Second argument to \Drupal::moduleHandler->alter() was altered.'); - $this->assertEquals($array2_copy, $array2_expected, 'Third argument to \Drupal::moduleHandler->alter() was altered.'); + $this->assertEqual($array_copy, $array_expected, 'First argument to \Drupal::moduleHandler->alter() was altered.'); + $this->assertEqual($entity_copy, $entity_expected, 'Second argument to \Drupal::moduleHandler->alter() was altered.'); + $this->assertEqual($array2_copy, $array2_expected, 'Third argument to \Drupal::moduleHandler->alter() was altered.'); // Verify alteration order when passing an array of types to \Drupal::moduleHandler->alter(). // common_test_module_implements_alter() places 'block' implementation after @@ -66,7 +66,7 @@ public function testDrupalAlter() { $array_expected = ['foo' => 'Drupal block theme']; \Drupal::moduleHandler()->alter(['drupal_alter', 'drupal_alter_foo'], $array_copy); \Drupal::theme()->alter(['drupal_alter', 'drupal_alter_foo'], $array_copy); - $this->assertEquals($array_copy, $array_expected, 'hook_TYPE_alter() implementations ran in correct order.'); + $this->assertEqual($array_copy, $array_expected, 'hook_TYPE_alter() implementations ran in correct order.'); } } diff --git a/core/modules/system/src/Tests/Common/RenderWebTest.php b/core/modules/system/src/Tests/Common/RenderWebTest.php index 5b74775..ed0e086 100644 --- a/core/modules/system/src/Tests/Common/RenderWebTest.php +++ b/core/modules/system/src/Tests/Common/RenderWebTest.php @@ -34,7 +34,7 @@ public function testWrapperFormatCacheContext() { $this->drupalGet('common-test/type-link-active-class', ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'json']]); $this->assertIdentical('application/json', $this->drupalGetHeader('Content-Type')); $json = Json::decode($this->getRawContent()); - $this->assertEquals(['content', 'title'], array_keys($json)); + $this->assertEqual(['content', 'title'], array_keys($json)); $this->assertIdentical('Test active link class', $json['title']); $this->assertCacheContext('url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT); } diff --git a/core/modules/system/src/Tests/Common/SimpleTestErrorCollectorTest.php b/core/modules/system/src/Tests/Common/SimpleTestErrorCollectorTest.php index b1a2073..9af773b 100644 --- a/core/modules/system/src/Tests/Common/SimpleTestErrorCollectorTest.php +++ b/core/modules/system/src/Tests/Common/SimpleTestErrorCollectorTest.php @@ -34,7 +34,7 @@ class SimpleTestErrorCollectorTest extends WebTestBase { public function testErrorCollect() { $this->collectedErrors = []; $this->drupalGet('error-test/generate-warnings-with-report'); - $this->assertEquals(count($this->collectedErrors), 3, 'Three errors were collected'); + $this->assertEqual(count($this->collectedErrors), 3, 'Three errors were collected'); if (count($this->collectedErrors) == 3) { $this->assertError($this->collectedErrors[0], 'Notice', 'Drupal\error_test\Controller\ErrorTestController->generateWarnings()', 'ErrorTestController.php', 'Undefined variable: bananas'); @@ -83,11 +83,11 @@ protected function error($message = '', $group = 'Other', array $caller = NULL) * Asserts that a collected error matches what we are expecting. */ public function assertError($error, $group, $function, $file, $message = NULL) { - $this->assertEquals($error['group'], $group, format_string("Group was %group", ['%group' => $group])); - $this->assertEquals($error['caller']['function'], $function, format_string("Function was %function", ['%function' => $function])); - $this->assertEquals(drupal_basename($error['caller']['file']), $file, format_string("File was %file", ['%file' => $file])); + $this->assertEqual($error['group'], $group, format_string("Group was %group", ['%group' => $group])); + $this->assertEqual($error['caller']['function'], $function, format_string("Function was %function", ['%function' => $function])); + $this->assertEqual(drupal_basename($error['caller']['file']), $file, format_string("File was %file", ['%file' => $file])); if (isset($message)) { - $this->assertEquals($error['message'], $message, format_string("Message was %message", ['%message' => $message])); + $this->assertEqual($error['message'], $message, format_string("Message was %message", ['%message' => $message])); } } diff --git a/core/modules/system/src/Tests/Common/UrlTest.php b/core/modules/system/src/Tests/Common/UrlTest.php index c7976e5..1092e1a 100644 --- a/core/modules/system/src/Tests/Common/UrlTest.php +++ b/core/modules/system/src/Tests/Common/UrlTest.php @@ -63,8 +63,8 @@ public function testLinkBubbleableMetadata() { ]; \Drupal::service('renderer')->renderRoot($link); $this->pass($title); - $this->assertEquals($expected_cacheability, $link['#cache']); - $this->assertEquals($expected_attachments, $link['#attached']); + $this->assertEqual($expected_cacheability, $link['#cache']); + $this->assertEqual($expected_attachments, $link['#attached']); } } @@ -171,7 +171,7 @@ public function testLinkRenderArrayText() { $renderer->executeInRenderContext(new RenderContext(), function () use ($renderer, $l) { $renderable_text = ['#markup' => 'foo']; $l_renderable_text = \Drupal::l($renderable_text, Url::fromUri('https://www.drupal.org')); - $this->assertEquals($l_renderable_text, $l); + $this->assertEqual($l_renderable_text, $l); }); // Test a themed link with plain text 'text'. @@ -181,7 +181,7 @@ public function testLinkRenderArrayText() { '#url' => Url::fromUri('https://www.drupal.org'), ]; $type_link_plain = $renderer->renderRoot($type_link_plain_array); - $this->assertEquals($type_link_plain, $l); + $this->assertEqual($type_link_plain, $l); // Build a themed link with renderable 'text'. $type_link_nested_array = [ @@ -190,7 +190,7 @@ public function testLinkRenderArrayText() { '#url' => Url::fromUri('https://www.drupal.org'), ]; $type_link_nested = $renderer->renderRoot($type_link_nested_array); - $this->assertEquals($type_link_nested, $l); + $this->assertEqual($type_link_nested, $l); } /** @@ -226,22 +226,22 @@ public function testDrupalGetQueryParameters() { // First-level exclusion. $result = $original; unset($result['b']); - $this->assertEquals(UrlHelper::filterQueryParameters($original, ['b']), $result, "'b' was removed."); + $this->assertEqual(UrlHelper::filterQueryParameters($original, ['b']), $result, "'b' was removed."); // Second-level exclusion. $result = $original; unset($result['b']['d']); - $this->assertEquals(UrlHelper::filterQueryParameters($original, ['b[d]']), $result, "'b[d]' was removed."); + $this->assertEqual(UrlHelper::filterQueryParameters($original, ['b[d]']), $result, "'b[d]' was removed."); // Third-level exclusion. $result = $original; unset($result['b']['e']['f']); - $this->assertEquals(UrlHelper::filterQueryParameters($original, ['b[e][f]']), $result, "'b[e][f]' was removed."); + $this->assertEqual(UrlHelper::filterQueryParameters($original, ['b[e][f]']), $result, "'b[e][f]' was removed."); // Multiple exclusions. $result = $original; unset($result['a'], $result['b']['e'], $result['c']); - $this->assertEquals(UrlHelper::filterQueryParameters($original, ['a', 'b[e]', 'c']), $result, "'a', 'b[e]', 'c' were removed."); + $this->assertEqual(UrlHelper::filterQueryParameters($original, ['a', 'b[e]', 'c']), $result, "'a', 'b[e]', 'c' were removed."); } /** @@ -259,7 +259,7 @@ public function testDrupalParseUrl() { 'query' => ['foo' => 'bar', 'bar' => 'baz', 'baz' => ''], 'fragment' => 'foo', ]; - $this->assertEquals(UrlHelper::parse($url), $expected, 'URL parsed correctly.'); + $this->assertEqual(UrlHelper::parse($url), $expected, 'URL parsed correctly.'); } } } @@ -271,7 +271,7 @@ public function testDrupalParseUrl() { 'query' => [], 'fragment' => '', ]; - $this->assertEquals(UrlHelper::parse($url), $result, 'Relative URL parsed correctly.'); + $this->assertEqual(UrlHelper::parse($url), $result, 'Relative URL parsed correctly.'); // Test that drupal can recognize an absolute URL. Used to prevent attack vectors. $url = 'https://www.drupal.org/foo/bar?foo=bar&bar=baz&baz#foo'; @@ -291,30 +291,30 @@ public function testExternalUrls() { // Verify external URL can contain a fragment. $url = $test_url . '#drupal'; $result = Url::fromUri($url)->toString(); - $this->assertEquals($url, $result, 'External URL with fragment works without a fragment in $options.'); + $this->assertEqual($url, $result, 'External URL with fragment works without a fragment in $options.'); // Verify fragment can be overridden in an external URL. $url = $test_url . '#drupal'; $fragment = $this->randomMachineName(10); $result = Url::fromUri($url, ['fragment' => $fragment])->toString(); - $this->assertEquals($test_url . '#' . $fragment, $result, 'External URL fragment is overridden with a custom fragment in $options.'); + $this->assertEqual($test_url . '#' . $fragment, $result, 'External URL fragment is overridden with a custom fragment in $options.'); // Verify external URL can contain a query string. $url = $test_url . '?drupal=awesome'; $result = Url::fromUri($url)->toString(); - $this->assertEquals($url, $result); + $this->assertEqual($url, $result); // Verify external URL can be extended with a query string. $url = $test_url; $query = [$this->randomMachineName(5) => $this->randomMachineName(5)]; $result = Url::fromUri($url, ['query' => $query])->toString(); - $this->assertEquals($url . '?' . http_build_query($query, '', '&'), $result, 'External URL can be extended with a query string in $options.'); + $this->assertEqual($url . '?' . http_build_query($query, '', '&'), $result, 'External URL can be extended with a query string in $options.'); // Verify query string can be extended in an external URL. $url = $test_url . '?drupal=awesome'; $query = [$this->randomMachineName(5) => $this->randomMachineName(5)]; $result = Url::fromUri($url, ['query' => $query])->toString(); - $this->assertEquals($url . '&' . http_build_query($query, '', '&'), $result); + $this->assertEqual($url . '&' . http_build_query($query, '', '&'), $result); } } diff --git a/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php b/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php index 0dfb1b3..d215df5 100644 --- a/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php +++ b/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php @@ -431,7 +431,7 @@ public function testReferencedEntity() { $this->verifyPageCache($empty_entity_listing_url, 'HIT', $empty_entity_listing_cache_tags); // Verify the entity type's list cache contexts are present. $contexts_in_header = $this->drupalGetHeader('X-Drupal-Cache-Contexts'); - $this->assertEquals(Cache::mergeContexts($page_cache_contexts, $this->getAdditionalCacheContextsForEntityListing()), empty($contexts_in_header) ? [] : explode(' ', $contexts_in_header)); + $this->assertEqual(Cache::mergeContexts($page_cache_contexts, $this->getAdditionalCacheContextsForEntityListing()), empty($contexts_in_header) ? [] : explode(' ', $contexts_in_header)); $this->pass("Test listing containing referenced entity.", 'Debug'); // Prime the page cache for the listing containing the referenced entity. @@ -440,7 +440,7 @@ public function testReferencedEntity() { $this->verifyPageCache($nonempty_entity_listing_url, 'HIT', $nonempty_entity_listing_cache_tags); // Verify the entity type's list cache contexts are present. $contexts_in_header = $this->drupalGetHeader('X-Drupal-Cache-Contexts'); - $this->assertEquals(Cache::mergeContexts($page_cache_contexts, $this->getAdditionalCacheContextsForEntityListing()), empty($contexts_in_header) ? [] : explode(' ', $contexts_in_header)); + $this->assertEqual(Cache::mergeContexts($page_cache_contexts, $this->getAdditionalCacheContextsForEntityListing()), empty($contexts_in_header) ? [] : explode(' ', $contexts_in_header)); // Verify that after modifying the referenced entity, there is a cache miss // for every route except the one for the non-referencing entity. diff --git a/core/modules/system/src/Tests/Entity/EntityFormTest.php b/core/modules/system/src/Tests/Entity/EntityFormTest.php index 3409629..2ebc350 100644 --- a/core/modules/system/src/Tests/Entity/EntityFormTest.php +++ b/core/modules/system/src/Tests/Entity/EntityFormTest.php @@ -117,13 +117,13 @@ protected function doTestMultilingualFormCRUD($entity_type_id) { // translation module. $entity->addTranslation('ro', ['name' => $name1_ro])->save(); $translated_entity = $this->loadEntityByName($entity_type_id, $name1)->getTranslation('ro'); - $this->assertEquals($translated_entity->name->value, $name1_ro, format_string('%entity_type: The translation has been added.', ['%entity_type' => $entity_type_id])); + $this->assertEqual($translated_entity->name->value, $name1_ro, format_string('%entity_type: The translation has been added.', ['%entity_type' => $entity_type_id])); $edit['name[0][value]'] = $name2_ro; $this->drupalPostForm('ro/' . $entity_type_id . '/manage/' . $entity->id() . '/edit', $edit, t('Save')); $translated_entity = $this->loadEntityByName($entity_type_id, $name1)->getTranslation('ro'); $this->assertTrue($translated_entity, format_string('%entity_type: Modified translation found in the database.', ['%entity_type' => $entity_type_id])); - $this->assertEquals($translated_entity->name->value, $name2_ro, format_string('%entity_type: The name of the translation has been modified.', ['%entity_type' => $entity_type_id])); + $this->assertEqual($translated_entity->name->value, $name2_ro, format_string('%entity_type: The name of the translation has been modified.', ['%entity_type' => $entity_type_id])); $this->drupalGet('ro/' . $entity_type_id . '/manage/' . $entity->id() . '/edit'); $this->clickLink(t('Delete')); @@ -162,7 +162,7 @@ public function testValidationHandlers() { // to be thrown. $state->set('entity_test.form.validate.test', 'button-level'); $this->drupalPostForm('entity_test/add', [], 'Save'); - $this->assertEquals($state->get('entity_test.form.save.exception'), 'Drupal\Core\Entity\EntityStorageException: Entity validation was skipped.', 'Button-level validation handlers behave correctly.'); + $this->assertEqual($state->get('entity_test.form.save.exception'), 'Drupal\Core\Entity\EntityStorageException: Entity validation was skipped.', 'Button-level validation handlers behave correctly.'); } } diff --git a/core/modules/system/src/Tests/Form/ElementsTableSelectTest.php b/core/modules/system/src/Tests/Form/ElementsTableSelectTest.php index 1e9db63..d335518 100644 --- a/core/modules/system/src/Tests/Form/ElementsTableSelectTest.php +++ b/core/modules/system/src/Tests/Form/ElementsTableSelectTest.php @@ -87,18 +87,18 @@ public function testTableselectColSpan() { // There should be three labeled column headers and 1 for the input. $table_head = $this->xpath('//thead'); - $this->assertEquals(count($table_head[0]->tr->th), 4, 'There are four column headers'); + $this->assertEqual(count($table_head[0]->tr->th), 4, 'There are four column headers'); $table_body = $this->xpath('//tbody'); // The first two body rows should each have 5 table cells: One for the // radio, one cell in the first column, one cell in the second column, // and two cells in the third column which has colspan 2. for ($i = 0; $i <= 1; $i++) { - $this->assertEquals(count($table_body[0]->tr[$i]->td), 5, format_string('There are five cells in row @row.', ['@row' => $i])); + $this->assertEqual(count($table_body[0]->tr[$i]->td), 5, format_string('There are five cells in row @row.', ['@row' => $i])); } // The third row should have 3 cells, one for the radio, one spanning the // first and second column, and a third in column 3 (which has colspan 3). - $this->assertEquals(count($table_body[0]->tr[2]->td), 3, 'There are three cells in row 3.'); + $this->assertEqual(count($table_body[0]->tr[2]->td), 3, 'There are three cells in row 3.'); } /** diff --git a/core/modules/system/src/Tests/Form/RebuildTest.php b/core/modules/system/src/Tests/Form/RebuildTest.php index b9e9fa9..2e138bd 100644 --- a/core/modules/system/src/Tests/Form/RebuildTest.php +++ b/core/modules/system/src/Tests/Form/RebuildTest.php @@ -110,10 +110,10 @@ public function testPreserveFormActionAfterAJAX() { // Ensure that the form's action is correct. $forms = $this->xpath('//form[contains(@class, "node-page-form")]'); - $this->assertEquals(1, count($forms)); + $this->assertEqual(1, count($forms)); // Strip query params off the action before asserting. $url = parse_url($forms[0]['action'])['path']; - $this->assertEquals(Url::fromRoute('node.add', ['node_type' => 'page'])->toString(), $url); + $this->assertEqual(Url::fromRoute('node.add', ['node_type' => 'page'])->toString(), $url); } } diff --git a/core/modules/system/src/Tests/Form/StorageTest.php b/core/modules/system/src/Tests/Form/StorageTest.php index 346e7b4..a1f7fee 100644 --- a/core/modules/system/src/Tests/Form/StorageTest.php +++ b/core/modules/system/src/Tests/Form/StorageTest.php @@ -135,7 +135,7 @@ public function testImmutableForm() { // Request the form with 'cache' query parameter to enable form caching. $this->drupalGet('form_test/form-storage', ['query' => ['cache' => 1, 'immutable' => 1]]); $buildIdFields = $this->xpath('//input[@name="form_build_id"]'); - $this->assertEquals(count($buildIdFields), 1, 'One form build id field on the page'); + $this->assertEqual(count($buildIdFields), 1, 'One form build id field on the page'); $buildId = (string) $buildIdFields[0]['value']; // Trigger validation error by submitting an empty title. @@ -147,7 +147,7 @@ public function testImmutableForm() { // Retrieve the new build-id. $buildIdFields = $this->xpath('//input[@name="form_build_id"]'); - $this->assertEquals(count($buildIdFields), 1, 'One form build id field on the page'); + $this->assertEqual(count($buildIdFields), 1, 'One form build id field on the page'); $buildId = (string) $buildIdFields[0]['value']; // Trigger validation error by again submitting an empty title. @@ -164,12 +164,12 @@ public function testImmutableForm() { public function testImmutableFormLegacyProtection() { $this->drupalGet('form_test/form-storage', ['query' => ['cache' => 1, 'immutable' => 1]]); $build_id_fields = $this->xpath('//input[@name="form_build_id"]'); - $this->assertEquals(count($build_id_fields), 1, 'One form build id field on the page'); + $this->assertEqual(count($build_id_fields), 1, 'One form build id field on the page'); $build_id = (string) $build_id_fields[0]['value']; // Try to poison the form cache. $original = $this->drupalGetAjax('form-test/form-storage-legacy/' . $build_id); - $this->assertEquals($original['form']['#build_id_old'], $build_id, 'Original build_id was recorded'); + $this->assertEqual($original['form']['#build_id_old'], $build_id, 'Original build_id was recorded'); $this->assertNotEqual($original['form']['#build_id'], $build_id, 'New build_id was generated'); // Assert that a watchdog message was logged by @@ -179,7 +179,7 @@ public function testImmutableFormLegacyProtection() { // Ensure that the form state was not poisoned by the preceding call. $original = $this->drupalGetAjax('form-test/form-storage-legacy/' . $build_id); - $this->assertEquals($original['form']['#build_id_old'], $build_id, 'Original build_id was recorded'); + $this->assertEqual($original['form']['#build_id_old'], $build_id, 'Original build_id was recorded'); $this->assertNotEqual($original['form']['#build_id'], $build_id, 'New build_id was generated'); $this->assert(empty($original['form']['#poisoned']), 'Original form structure was preserved'); $this->assert(empty($original['form_state']['poisoned']), 'Original form state was preserved'); diff --git a/core/modules/system/src/Tests/Installer/DistributionProfileExistingSettingsTest.php b/core/modules/system/src/Tests/Installer/DistributionProfileExistingSettingsTest.php index 9ddbf5e..48b9fcb 100644 --- a/core/modules/system/src/Tests/Installer/DistributionProfileExistingSettingsTest.php +++ b/core/modules/system/src/Tests/Installer/DistributionProfileExistingSettingsTest.php @@ -119,13 +119,13 @@ public function testInstalled() { $this->assertText($this->rootUser->getUsername()); // Confirm that Drupal recognizes this distribution as the current profile. - $this->assertEquals(\Drupal::installProfile(), 'mydistro'); + $this->assertEqual(\Drupal::installProfile(), 'mydistro'); $this->assertNull(Settings::get('install_profile'), 'The install profile has not been written to settings.php.'); - $this->assertEquals($this->config('core.extension')->get('profile'), 'mydistro', 'The install profile has been written to core.extension configuration.'); + $this->assertEqual($this->config('core.extension')->get('profile'), 'mydistro', 'The install profile has been written to core.extension configuration.'); $this->rebuildContainer(); $this->pass('Container can be rebuilt even though distribution is not written to settings.php.'); - $this->assertEquals(\Drupal::installProfile(), 'mydistro'); + $this->assertEqual(\Drupal::installProfile(), 'mydistro'); } } diff --git a/core/modules/system/src/Tests/Installer/DistributionProfileTest.php b/core/modules/system/src/Tests/Installer/DistributionProfileTest.php index 112fec0..3d2c4c4 100644 --- a/core/modules/system/src/Tests/Installer/DistributionProfileTest.php +++ b/core/modules/system/src/Tests/Installer/DistributionProfileTest.php @@ -73,9 +73,9 @@ public function testInstalled() { $this->assertText($this->rootUser->getUsername()); // Confirm that Drupal recognizes this distribution as the current profile. - $this->assertEquals(\Drupal::installProfile(), 'mydistro'); - $this->assertEquals(Settings::get('install_profile'), 'mydistro', 'The install profile has been written to settings.php.'); - $this->assertEquals($this->config('core.extension')->get('profile'), 'mydistro', 'The install profile has been written to core.extension configuration.'); + $this->assertEqual(\Drupal::installProfile(), 'mydistro'); + $this->assertEqual(Settings::get('install_profile'), 'mydistro', 'The install profile has been written to settings.php.'); + $this->assertEqual($this->config('core.extension')->get('profile'), 'mydistro', 'The install profile has been written to core.extension configuration.'); } } diff --git a/core/modules/system/src/Tests/Installer/DistributionProfileTranslationQueryTest.php b/core/modules/system/src/Tests/Installer/DistributionProfileTranslationQueryTest.php index 7702c4a..85b1e44 100644 --- a/core/modules/system/src/Tests/Installer/DistributionProfileTranslationQueryTest.php +++ b/core/modules/system/src/Tests/Installer/DistributionProfileTranslationQueryTest.php @@ -88,12 +88,12 @@ protected function setUpSettings() { // The language should have been automatically detected, all following // screens should be translated already. $elements = $this->xpath('//input[@type="submit"]/@value'); - $this->assertEquals((string) current($elements), 'Save and continue de'); + $this->assertEqual((string) current($elements), 'Save and continue de'); $this->translations['Save and continue'] = 'Save and continue de'; // Check the language direction. $direction = (string) current($this->xpath('/html/@dir')); - $this->assertEquals($direction, 'ltr'); + $this->assertEqual($direction, 'ltr'); // Verify that the distribution name appears. $this->assertRaw($this->info['distribution']['name']); diff --git a/core/modules/system/src/Tests/Installer/DistributionProfileTranslationTest.php b/core/modules/system/src/Tests/Installer/DistributionProfileTranslationTest.php index 422647e..a4c8091 100644 --- a/core/modules/system/src/Tests/Installer/DistributionProfileTranslationTest.php +++ b/core/modules/system/src/Tests/Installer/DistributionProfileTranslationTest.php @@ -83,12 +83,12 @@ protected function setUpSettings() { // The language should have been automatically detected, all following // screens should be translated already. $elements = $this->xpath('//input[@type="submit"]/@value'); - $this->assertEquals((string) current($elements), 'Save and continue de'); + $this->assertEqual((string) current($elements), 'Save and continue de'); $this->translations['Save and continue'] = 'Save and continue de'; // Check the language direction. $direction = (string) current($this->xpath('/html/@dir')); - $this->assertEquals($direction, 'ltr'); + $this->assertEqual($direction, 'ltr'); // Verify that the distribution name appears. $this->assertRaw($this->info['distribution']['name']); diff --git a/core/modules/system/src/Tests/Installer/InstallerExistingConfigDirectoryTest.php b/core/modules/system/src/Tests/Installer/InstallerExistingConfigDirectoryTest.php index ded5b16..b06b4ca 100644 --- a/core/modules/system/src/Tests/Installer/InstallerExistingConfigDirectoryTest.php +++ b/core/modules/system/src/Tests/Installer/InstallerExistingConfigDirectoryTest.php @@ -37,8 +37,8 @@ protected function setUp() { public function testInstaller() { $this->assertUrl('user/1'); $this->assertResponse(200); - $this->assertEquals($this->expectedFilePerms, fileperms($this->siteDirectory . '/config_read_only')); - $this->assertEquals([], glob($this->siteDirectory . '/config_read_only/*'), 'The sync directory is empty after install because it is read-only.'); + $this->assertEqual($this->expectedFilePerms, fileperms($this->siteDirectory . '/config_read_only')); + $this->assertEqual([], glob($this->siteDirectory . '/config_read_only/*'), 'The sync directory is empty after install because it is read-only.'); } } diff --git a/core/modules/system/src/Tests/Installer/InstallerExistingSettingsMismatchProfileTest.php b/core/modules/system/src/Tests/Installer/InstallerExistingSettingsMismatchProfileTest.php index a3e5668..0349fe5 100644 --- a/core/modules/system/src/Tests/Installer/InstallerExistingSettingsMismatchProfileTest.php +++ b/core/modules/system/src/Tests/Installer/InstallerExistingSettingsMismatchProfileTest.php @@ -94,8 +94,8 @@ protected function setUpSettings() { public function testInstaller() { $this->assertUrl('user/1'); $this->assertResponse(200); - $this->assertEquals('testing', \Drupal::installProfile()); - $this->assertEquals('testing', Settings::get('install_profile'), 'Profile was correctly changed to testing in Settings.php'); + $this->assertEqual('testing', \Drupal::installProfile()); + $this->assertEqual('testing', Settings::get('install_profile'), 'Profile was correctly changed to testing in Settings.php'); } } diff --git a/core/modules/system/src/Tests/Installer/InstallerExistingSettingsNoProfileTest.php b/core/modules/system/src/Tests/Installer/InstallerExistingSettingsNoProfileTest.php index 9738984..3405cb5 100644 --- a/core/modules/system/src/Tests/Installer/InstallerExistingSettingsNoProfileTest.php +++ b/core/modules/system/src/Tests/Installer/InstallerExistingSettingsNoProfileTest.php @@ -64,7 +64,7 @@ protected function setUpSettings() { public function testInstaller() { $this->assertUrl('user/1'); $this->assertResponse(200); - $this->assertEquals('testing', \Drupal::installProfile()); + $this->assertEqual('testing', \Drupal::installProfile()); } } diff --git a/core/modules/system/src/Tests/Installer/InstallerExistingSettingsTest.php b/core/modules/system/src/Tests/Installer/InstallerExistingSettingsTest.php index 087b118..4f09b6b 100644 --- a/core/modules/system/src/Tests/Installer/InstallerExistingSettingsTest.php +++ b/core/modules/system/src/Tests/Installer/InstallerExistingSettingsTest.php @@ -75,8 +75,8 @@ protected function setUpSettings() { public function testInstaller() { $this->assertUrl('user/1'); $this->assertResponse(200); - $this->assertEquals('testing', \Drupal::installProfile(), 'Profile was changed from minimal to testing during interactive install.'); - $this->assertEquals('testing', Settings::get('install_profile'), 'Profile was correctly changed to testing in Settings.php'); + $this->assertEqual('testing', \Drupal::installProfile(), 'Profile was changed from minimal to testing during interactive install.'); + $this->assertEqual('testing', Settings::get('install_profile'), 'Profile was correctly changed to testing in Settings.php'); } } diff --git a/core/modules/system/src/Tests/Installer/InstallerLanguageDirectionTest.php b/core/modules/system/src/Tests/Installer/InstallerLanguageDirectionTest.php index 854a71a..5e2c15a 100644 --- a/core/modules/system/src/Tests/Installer/InstallerLanguageDirectionTest.php +++ b/core/modules/system/src/Tests/Installer/InstallerLanguageDirectionTest.php @@ -30,12 +30,12 @@ protected function setUpLanguage() { // After selecting a different language than English, all following screens // should be translated already. $elements = $this->xpath('//input[@type="submit"]/@value'); - $this->assertEquals((string) current($elements), 'Save and continue Arabic'); + $this->assertEqual((string) current($elements), 'Save and continue Arabic'); $this->translations['Save and continue'] = 'Save and continue Arabic'; // Verify that language direction is right-to-left. $direction = (string) current($this->xpath('/html/@dir')); - $this->assertEquals($direction, 'rtl'); + $this->assertEqual($direction, 'rtl'); } /** diff --git a/core/modules/system/src/Tests/Installer/InstallerTest.php b/core/modules/system/src/Tests/Installer/InstallerTest.php index 18bf140..be51057 100644 --- a/core/modules/system/src/Tests/Installer/InstallerTest.php +++ b/core/modules/system/src/Tests/Installer/InstallerTest.php @@ -28,7 +28,7 @@ public function testInstaller() { // Ensure that the timezone is correct for sites under test after installing // interactively. - $this->assertEquals($this->config('system.date')->get('timezone.default'), 'Australia/Sydney'); + $this->assertEqual($this->config('system.date')->get('timezone.default'), 'Australia/Sydney'); } /** @@ -41,7 +41,7 @@ protected function setUpLanguage() { $this->assertRaw('<meta charset="utf-8" />'); // Assert that the expected title is present. - $this->assertEquals('Choose language', $this->cssSelect('main h2')[0]); + $this->assertEqual('Choose language', $this->cssSelect('main h2')[0]); parent::setUpLanguage(); } @@ -51,9 +51,9 @@ protected function setUpLanguage() { */ protected function setUpProfile() { // Assert that the expected title is present. - $this->assertEquals('Select an installation profile', $this->cssSelect('main h2')[0]); + $this->assertEqual('Select an installation profile', $this->cssSelect('main h2')[0]); $result = $this->xpath('//span[contains(@class, :class) and contains(text(), :text)]', [':class' => 'visually-hidden', ':text' => 'Select an installation profile']); - $this->assertEquals(count($result), 1, "Title/Label not displayed when '#title_display' => 'invisible' attribute is set"); + $this->assertEqual(count($result), 1, "Title/Label not displayed when '#title_display' => 'invisible' attribute is set"); parent::setUpProfile(); } @@ -63,7 +63,7 @@ protected function setUpProfile() { */ protected function setUpSettings() { // Assert that the expected title is present. - $this->assertEquals('Database configuration', $this->cssSelect('main h2')[0]); + $this->assertEqual('Database configuration', $this->cssSelect('main h2')[0]); parent::setUpSettings(); } @@ -73,7 +73,7 @@ protected function setUpSettings() { */ protected function setUpSite() { // Assert that the expected title is present. - $this->assertEquals('Configure site', $this->cssSelect('main h2')[0]); + $this->assertEqual('Configure site', $this->cssSelect('main h2')[0]); parent::setUpSite(); } diff --git a/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php b/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php index 4380303..dcde753 100644 --- a/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php +++ b/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php @@ -72,7 +72,7 @@ protected function installParameters() { */ public function testTranslationsLoaded() { // Ensure the title is correct. - $this->assertEquals('SITE_NAME_' . $this->langcode, \Drupal::config('system.site')->get('name')); + $this->assertEqual('SITE_NAME_' . $this->langcode, \Drupal::config('system.site')->get('name')); // Verify German and Spanish were configured. $this->drupalGet('admin/config/regional/language'); @@ -110,14 +110,14 @@ public function testTranslationsLoaded() { if ($this->langcode == 'de') { // Active configuration should be in German and no German override should // exist. - $this->assertEquals($config->get('anonymous'), 'Anonymous de'); - $this->assertEquals($config->get('langcode'), 'de'); + $this->assertEqual($config->get('anonymous'), 'Anonymous de'); + $this->assertEqual($config->get('langcode'), 'de'); $this->assertTrue($override_de->isNew()); if ($this->profile == 'testing_multilingual_with_english') { // English is already added in this profile. Should make the override // available. - $this->assertEquals($override_en->get('anonymous'), 'Anonymous'); + $this->assertEqual($override_en->get('anonymous'), 'Anonymous'); } else { // English is not yet available. @@ -127,7 +127,7 @@ public function testTranslationsLoaded() { $edit = ['predefined_langcode' => 'en']; $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language')); $override_en = $language_manager->getLanguageConfigOverride('en', 'user.settings'); - $this->assertEquals($override_en->get('anonymous'), 'Anonymous'); + $this->assertEqual($override_en->get('anonymous'), 'Anonymous'); } // Activate a module, to make sure that config is not overridden by module @@ -143,16 +143,16 @@ public function testTranslationsLoaded() { } else { // Active configuration should be English. - $this->assertEquals($config->get('anonymous'), 'Anonymous'); - $this->assertEquals($config->get('langcode'), 'en'); + $this->assertEqual($config->get('anonymous'), 'Anonymous'); + $this->assertEqual($config->get('langcode'), 'en'); // There should not be an English override. $this->assertTrue($override_en->isNew()); // German should be an override. - $this->assertEquals($override_de->get('anonymous'), 'Anonymous de'); + $this->assertEqual($override_de->get('anonymous'), 'Anonymous de'); } // Spanish is always an override (never used as installation language). - $this->assertEquals($override_es->get('anonymous'), 'Anonymous es'); + $this->assertEqual($override_es->get('anonymous'), 'Anonymous es'); } diff --git a/core/modules/system/src/Tests/Installer/InstallerTranslationQueryTest.php b/core/modules/system/src/Tests/Installer/InstallerTranslationQueryTest.php index e6cd95e..86c20f7 100644 --- a/core/modules/system/src/Tests/Installer/InstallerTranslationQueryTest.php +++ b/core/modules/system/src/Tests/Installer/InstallerTranslationQueryTest.php @@ -35,12 +35,12 @@ protected function visitInstaller() { // The language should have been automatically detected, all following // screens should be translated already. $elements = $this->xpath('//input[@type="submit"]/@value'); - $this->assertEquals((string) current($elements), 'Save and continue de'); + $this->assertEqual((string) current($elements), 'Save and continue de'); $this->translations['Save and continue'] = 'Save and continue de'; // Check the language direction. $direction = (string) current($this->xpath('/html/@dir')); - $this->assertEquals($direction, 'ltr'); + $this->assertEqual($direction, 'ltr'); } /** diff --git a/core/modules/system/src/Tests/Installer/InstallerTranslationTest.php b/core/modules/system/src/Tests/Installer/InstallerTranslationTest.php index 73d8654..7a803e7 100644 --- a/core/modules/system/src/Tests/Installer/InstallerTranslationTest.php +++ b/core/modules/system/src/Tests/Installer/InstallerTranslationTest.php @@ -33,12 +33,12 @@ protected function setUpLanguage() { // After selecting a different language than English, all following screens // should be translated already. $elements = $this->xpath('//input[@type="submit"]/@value'); - $this->assertEquals((string) current($elements), 'Save and continue de'); + $this->assertEqual((string) current($elements), 'Save and continue de'); $this->translations['Save and continue'] = 'Save and continue de'; // Check the language direction. $direction = (string) current($this->xpath('/html/@dir')); - $this->assertEquals($direction, 'ltr'); + $this->assertEqual($direction, 'ltr'); } /** @@ -77,11 +77,11 @@ public function testInstaller() { $this->rebuildContainer(); /** @var \Drupal\user\Entity\User $account */ $account = User::load(0); - $this->assertEquals($account->language()->getId(), 'en', 'Anonymous user is English.'); + $this->assertEqual($account->language()->getId(), 'en', 'Anonymous user is English.'); $account = User::load(1); - $this->assertEquals($account->language()->getId(), 'en', 'Administrator user is English.'); + $this->assertEqual($account->language()->getId(), 'en', 'Administrator user is English.'); $account = $this->drupalCreateUser(); - $this->assertEquals($account->language()->getId(), 'de', 'New user is German.'); + $this->assertEqual($account->language()->getId(), 'de', 'New user is German.'); // Ensure that we can enable basic_auth on a non-english site. $this->drupalPostForm('admin/modules', ['modules[basic_auth][enable]' => TRUE], t('Install')); @@ -112,8 +112,8 @@ public function testInstaller() { $config = \Drupal::config('user.settings'); $override_de = $language_manager->getLanguageConfigOverride('de', 'user.settings'); $override_en = $language_manager->getLanguageConfigOverride('en', 'user.settings'); - $this->assertEquals($config->get('anonymous'), 'Anonymous de'); - $this->assertEquals($config->get('langcode'), 'de'); + $this->assertEqual($config->get('anonymous'), 'Anonymous de'); + $this->assertEqual($config->get('langcode'), 'de'); $this->assertTrue($override_de->isNew()); $this->assertTrue($override_en->isNew()); @@ -122,7 +122,7 @@ public function testInstaller() { $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language')); $override_en = $language_manager->getLanguageConfigOverride('en', 'user.settings'); $this->assertFalse($override_en->isNew()); - $this->assertEquals($override_en->get('anonymous'), 'Anonymous'); + $this->assertEqual($override_en->get('anonymous'), 'Anonymous'); } /** diff --git a/core/modules/system/src/Tests/Installer/MultipleDistributionsProfileTest.php b/core/modules/system/src/Tests/Installer/MultipleDistributionsProfileTest.php index 3bdb7be..171a0af 100644 --- a/core/modules/system/src/Tests/Installer/MultipleDistributionsProfileTest.php +++ b/core/modules/system/src/Tests/Installer/MultipleDistributionsProfileTest.php @@ -79,13 +79,13 @@ public function testInstalled() { $this->assertText($this->rootUser->getUsername()); // Confirm that Drupal recognizes this distribution as the current profile. - $this->assertEquals(\Drupal::installProfile(), 'distribution_one'); - $this->assertEquals(Settings::get('install_profile'), 'distribution_one', 'The install profile has been written to settings.php.'); - $this->assertEquals($this->config('core.extension')->get('profile'), 'distribution_one', 'The install profile has been written to core.extension configuration.'); + $this->assertEqual(\Drupal::installProfile(), 'distribution_one'); + $this->assertEqual(Settings::get('install_profile'), 'distribution_one', 'The install profile has been written to settings.php.'); + $this->assertEqual($this->config('core.extension')->get('profile'), 'distribution_one', 'The install profile has been written to core.extension configuration.'); $this->rebuildContainer(); $this->pass('Container can be rebuilt as distribution is written to configuration.'); - $this->assertEquals(\Drupal::installProfile(), 'distribution_one'); + $this->assertEqual(\Drupal::installProfile(), 'distribution_one'); } } diff --git a/core/modules/system/src/Tests/Installer/SingleVisibleProfileTest.php b/core/modules/system/src/Tests/Installer/SingleVisibleProfileTest.php index 040ced9..91af34a 100644 --- a/core/modules/system/src/Tests/Installer/SingleVisibleProfileTest.php +++ b/core/modules/system/src/Tests/Installer/SingleVisibleProfileTest.php @@ -59,7 +59,7 @@ public function testInstalled() { // Confirm that we are logged-in after installation. $this->assertText($this->rootUser->getUsername()); // Confirm that the minimal profile was installed. - $this->assertEquals(drupal_get_profile(), 'minimal'); + $this->assertEqual(drupal_get_profile(), 'minimal'); } } diff --git a/core/modules/system/src/Tests/Module/ModuleTestBase.php b/core/modules/system/src/Tests/Module/ModuleTestBase.php index 08a405c..cc5a7ef 100644 --- a/core/modules/system/src/Tests/Module/ModuleTestBase.php +++ b/core/modules/system/src/Tests/Module/ModuleTestBase.php @@ -159,7 +159,7 @@ public function assertModules(array $modules, $enabled) { else { $message = 'Module "@module" is not enabled.'; } - $this->assertEquals($this->container->get('module_handler')->moduleExists($module), $enabled, format_string($message, ['@module' => $module])); + $this->assertEqual($this->container->get('module_handler')->moduleExists($module), $enabled, format_string($message, ['@module' => $module])); } } diff --git a/core/modules/system/src/Tests/Page/DefaultMetatagsTest.php b/core/modules/system/src/Tests/Page/DefaultMetatagsTest.php index 8c3e05a..e0228ef 100644 --- a/core/modules/system/src/Tests/Page/DefaultMetatagsTest.php +++ b/core/modules/system/src/Tests/Page/DefaultMetatagsTest.php @@ -18,15 +18,15 @@ public function testMetaTag() { $this->drupalGet(''); // Ensures that the charset metatag is on the page. $result = $this->xpath('//meta[@charset="utf-8"]'); - $this->assertEquals(count($result), 1); + $this->assertEqual(count($result), 1); // Ensure that the charset one is the first metatag. $result = $this->xpath('//meta'); - $this->assertEquals((string) $result[0]->attributes()->charset, 'utf-8'); + $this->assertEqual((string) $result[0]->attributes()->charset, 'utf-8'); // Ensure that the shortcut icon is on the page. $result = $this->xpath('//link[@rel = "shortcut icon"]'); - $this->assertEquals(count($result), 1, 'The shortcut icon is present.'); + $this->assertEqual(count($result), 1, 'The shortcut icon is present.'); } } diff --git a/core/modules/system/src/Tests/Pager/PagerTest.php b/core/modules/system/src/Tests/Pager/PagerTest.php index 9da8ab1..71413f2 100644 --- a/core/modules/system/src/Tests/Pager/PagerTest.php +++ b/core/modules/system/src/Tests/Pager/PagerTest.php @@ -168,7 +168,7 @@ public function testMultiplePagers() { foreach ([0, 1, 4] as $pager_element) { $active_page = $this->cssSelect("div.test-pager-{$pager_element} ul.pager__items li.is-active:contains('{$data['expected_page'][$pager_element]}')"); $destination = str_replace('%2C', ',', $active_page[0]->a['href'][0]->__toString()); - $this->assertEquals($destination, $data['expected_query']); + $this->assertEqual($destination, $data['expected_query']); } } } @@ -184,7 +184,7 @@ public function testPagerEllipsis() { } $this->drupalGet('admin/reports/dblog'); $elements = $this->cssSelect(".pager__item--ellipsis:contains('…')"); - $this->assertEquals(count($elements), 0, 'No ellipsis has been set.'); + $this->assertEqual(count($elements), 0, 'No ellipsis has been set.'); // Insert an extra 50 log messages to get 10 pages. $logger = $this->container->get('logger.factory')->get('pager_test'); @@ -193,7 +193,7 @@ public function testPagerEllipsis() { } $this->drupalGet('admin/reports/dblog'); $elements = $this->cssSelect(".pager__item--ellipsis:contains('…')"); - $this->assertEquals(count($elements), 1, 'Found the ellipsis.'); + $this->assertEqual(count($elements), 1, 'Found the ellipsis.'); } /** @@ -235,14 +235,14 @@ protected function assertPagerItems($current_page) { $this->assertTrue($element->a, 'Element for current page has link.'); $destination = $element->a['href'][0]->__toString(); // URL query string param is 0-indexed. - $this->assertEquals($destination, '?page=' . ($page - 1)); + $this->assertEqual($destination, '?page=' . ($page - 1)); } else { $this->assertNoClass($element, 'is-active', "Element for page $page has no .is-active class."); $this->assertClass($element, 'pager__item', "Element for page $page has .pager__item class."); $this->assertTrue($element->a, "Link to page $page found."); $destination = $element->a['href'][0]->__toString(); - $this->assertEquals($destination, '?page=' . ($page - 1)); + $this->assertEqual($destination, '?page=' . ($page - 1)); } unset($elements[--$page]); } @@ -255,7 +255,7 @@ protected function assertPagerItems($current_page) { $this->assertTrue($first->a, 'Link to first page found.'); $this->assertNoClass($first->a, 'is-active', 'Link to first page is not active.'); $destination = $first->a['href'][0]->__toString(); - $this->assertEquals($destination, '?page=0'); + $this->assertEqual($destination, '?page=0'); } if (isset($previous)) { $this->assertClass($previous, 'pager__item--previous', 'Element for first page has .pager__item--previous class.'); @@ -263,7 +263,7 @@ protected function assertPagerItems($current_page) { $this->assertNoClass($previous->a, 'is-active', 'Link to previous page is not active.'); $destination = $previous->a['href'][0]->__toString(); // URL query string param is 0-indexed, $current_page is 1-indexed. - $this->assertEquals($destination, '?page=' . ($current_page - 2)); + $this->assertEqual($destination, '?page=' . ($current_page - 2)); } if (isset($next)) { $this->assertClass($next, 'pager__item--next', 'Element for next page has .pager__item--next class.'); @@ -271,7 +271,7 @@ protected function assertPagerItems($current_page) { $this->assertNoClass($next->a, 'is-active', 'Link to next page is not active.'); $destination = $next->a['href'][0]->__toString(); // URL query string param is 0-indexed, $current_page is 1-indexed. - $this->assertEquals($destination, '?page=' . $current_page); + $this->assertEqual($destination, '?page=' . $current_page); } if (isset($last)) { $this->assertClass($last, 'pager__item--last', 'Element for last page has .pager__item--last class.'); @@ -279,7 +279,7 @@ protected function assertPagerItems($current_page) { $this->assertNoClass($last->a, 'is-active', 'Link to last page is not active.'); $destination = $last->a['href'][0]->__toString(); // URL query string param is 0-indexed. - $this->assertEquals($destination, '?page=' . ($total_pages - 1)); + $this->assertEqual($destination, '?page=' . ($total_pages - 1)); } } diff --git a/core/modules/system/src/Tests/Render/HtmlResponseAttachmentsTest.php b/core/modules/system/src/Tests/Render/HtmlResponseAttachmentsTest.php index 171d6db..6060fcc 100644 --- a/core/modules/system/src/Tests/Render/HtmlResponseAttachmentsTest.php +++ b/core/modules/system/src/Tests/Render/HtmlResponseAttachmentsTest.php @@ -61,7 +61,7 @@ public function testAttachments() { '</foo?bar=<baz>&baz=false>; rel="alternate"', '</foo/bar>; hreflang="nl"; rel="alternate"', ]; - $this->assertEquals($this->drupalGetHeader('link'), implode(',', $expected_link_headers)); + $this->assertEqual($this->drupalGetHeader('link'), implode(',', $expected_link_headers)); } /** @@ -104,7 +104,7 @@ protected function assertTeapotHeaders() { protected function assertFeed() { // Discover the DOM element for the feed link. $test_meta = $this->xpath('//head/link[@href="test://url"]'); - $this->assertEquals(1, count($test_meta), 'Link has URL.'); + $this->assertEqual(1, count($test_meta), 'Link has URL.'); // Reconcile the other attributes. $test_meta_attributes = [ 'href' => 'test://url', @@ -118,7 +118,7 @@ protected function assertFeed() { } else { foreach ($test_meta->attributes() as $attribute => $value) { - $this->assertEquals($value, $test_meta_attributes[$attribute]); + $this->assertEqual($value, $test_meta_attributes[$attribute]); } } } @@ -129,7 +129,7 @@ protected function assertFeed() { protected function assertHead() { // Discover the DOM element for the meta link. $test_meta = $this->xpath('//head/meta[@test-attribute="testvalue"]'); - $this->assertEquals(1, count($test_meta), 'There\'s only one test attribute.'); + $this->assertEqual(1, count($test_meta), 'There\'s only one test attribute.'); // Grab the only DOM element. $test_meta = reset($test_meta); if (empty($test_meta)) { @@ -137,7 +137,7 @@ protected function assertHead() { } else { $test_meta_attributes = $test_meta->attributes(); - $this->assertEquals($test_meta_attributes['test-attribute'], 'testvalue'); + $this->assertEqual($test_meta_attributes['test-attribute'], 'testvalue'); } } diff --git a/core/modules/system/src/Tests/Routing/RouterTest.php b/core/modules/system/src/Tests/Routing/RouterTest.php index df641db..83a9c55 100644 --- a/core/modules/system/src/Tests/Routing/RouterTest.php +++ b/core/modules/system/src/Tests/Routing/RouterTest.php @@ -35,17 +35,17 @@ public function testFinishResponseSubscriber() { $this->assertRaw('test1', 'The correct string was returned because the route was successful.'); // Check expected headers from FinishResponseSubscriber. $headers = $this->drupalGetHeaders(); - $this->assertEquals($headers['x-ua-compatible'], 'IE=edge'); - $this->assertEquals($headers['content-language'], 'en'); - $this->assertEquals($headers['x-content-type-options'], 'nosniff'); - $this->assertEquals($headers['x-frame-options'], 'SAMEORIGIN'); + $this->assertEqual($headers['x-ua-compatible'], 'IE=edge'); + $this->assertEqual($headers['content-language'], 'en'); + $this->assertEqual($headers['x-content-type-options'], 'nosniff'); + $this->assertEqual($headers['x-frame-options'], 'SAMEORIGIN'); $this->drupalGet('router_test/test2'); $this->assertRaw('test2', 'The correct string was returned because the route was successful.'); // Check expected headers from FinishResponseSubscriber. $headers = $this->drupalGetHeaders(); - $this->assertEquals($headers['x-drupal-cache-contexts'], implode(' ', $expected_cache_contexts)); - $this->assertEquals($headers['x-drupal-cache-tags'], 'config:user.role.anonymous http_response rendered'); + $this->assertEqual($headers['x-drupal-cache-contexts'], implode(' ', $expected_cache_contexts)); + $this->assertEqual($headers['x-drupal-cache-tags'], 'config:user.role.anonymous http_response rendered'); // Confirm that the page wrapping is being added, so we're not getting a // raw body returned. $this->assertRaw('</html>', 'Page markup was found.'); @@ -58,13 +58,13 @@ public function testFinishResponseSubscriber() { // 1. controller result: render array, globally cacheable route access. $this->drupalGet('router_test/test18'); $headers = $this->drupalGetHeaders(); - $this->assertEquals($headers['x-drupal-cache-contexts'], implode(' ', Cache::mergeContexts($renderer_required_cache_contexts, ['url']))); - $this->assertEquals($headers['x-drupal-cache-tags'], 'config:user.role.anonymous foo http_response rendered'); + $this->assertEqual($headers['x-drupal-cache-contexts'], implode(' ', Cache::mergeContexts($renderer_required_cache_contexts, ['url']))); + $this->assertEqual($headers['x-drupal-cache-tags'], 'config:user.role.anonymous foo http_response rendered'); // 2. controller result: render array, per-role cacheable route access. $this->drupalGet('router_test/test19'); $headers = $this->drupalGetHeaders(); - $this->assertEquals($headers['x-drupal-cache-contexts'], implode(' ', Cache::mergeContexts($renderer_required_cache_contexts, ['url', 'user.roles']))); - $this->assertEquals($headers['x-drupal-cache-tags'], 'config:user.role.anonymous foo http_response rendered'); + $this->assertEqual($headers['x-drupal-cache-contexts'], implode(' ', Cache::mergeContexts($renderer_required_cache_contexts, ['url', 'user.roles']))); + $this->assertEqual($headers['x-drupal-cache-tags'], 'config:user.role.anonymous foo http_response rendered'); // 3. controller result: Response object, globally cacheable route access. $this->drupalGet('router_test/test1'); $headers = $this->drupalGetHeaders(); @@ -78,13 +78,13 @@ public function testFinishResponseSubscriber() { // 5. controller result: CacheableResponse object, globally cacheable route access. $this->drupalGet('router_test/test21'); $headers = $this->drupalGetHeaders(); - $this->assertEquals($headers['x-drupal-cache-contexts'], ''); - $this->assertEquals($headers['x-drupal-cache-tags'], 'http_response'); + $this->assertEqual($headers['x-drupal-cache-contexts'], ''); + $this->assertEqual($headers['x-drupal-cache-tags'], 'http_response'); // 6. controller result: CacheableResponse object, per-role cacheable route access. $this->drupalGet('router_test/test22'); $headers = $this->drupalGetHeaders(); - $this->assertEquals($headers['x-drupal-cache-contexts'], 'user.roles'); - $this->assertEquals($headers['x-drupal-cache-tags'], 'http_response'); + $this->assertEqual($headers['x-drupal-cache-contexts'], 'user.roles'); + $this->assertEqual($headers['x-drupal-cache-tags'], 'http_response'); // Finally, verify that the X-Drupal-Cache-Contexts and X-Drupal-Cache-Tags // headers are not sent when their container parameter is set to FALSE. @@ -264,11 +264,11 @@ public function testUserAccount() { $this->drupalGet('router_test/test12/' . $second_account->id()); $this->assertText($account->getUsername() . ':' . $second_account->getUsername()); - $this->assertEquals($account->id(), $this->loggedInUser->id(), 'Ensure that the user was not changed.'); + $this->assertEqual($account->id(), $this->loggedInUser->id(), 'Ensure that the user was not changed.'); $this->drupalGet('router_test/test13/' . $second_account->id()); $this->assertText($account->getUsername() . ':' . $second_account->getUsername()); - $this->assertEquals($account->id(), $this->loggedInUser->id(), 'Ensure that the user was not changed.'); + $this->assertEqual($account->id(), $this->loggedInUser->id(), 'Ensure that the user was not changed.'); } /** @@ -279,7 +279,7 @@ public function testControllerResolutionAjax() { // The correct controller. $this->drupalGetAjax('/router_test/test10'); - $this->assertEquals($this->drupalGetHeader('Content-Type'), 'application/json', 'Correct mime content type was returned'); + $this->assertEqual($this->drupalGetHeader('Content-Type'), 'application/json', 'Correct mime content type was returned'); $this->assertRaw('abcde', 'Correct body was found.'); } @@ -311,14 +311,14 @@ public function testLeadingSlashes() { $request = $this->container->get('request_stack')->getCurrentRequest(); $url = $request->getUriForPath('//router_test/test1'); $this->drupalGet($url); - $this->assertEquals(1, $this->redirectCount, $url . " redirected to " . $this->url); + $this->assertEqual(1, $this->redirectCount, $url . " redirected to " . $this->url); $this->assertUrl($request->getUriForPath('/router_test/test1')); // It should not matter how many leading slashes are used and query strings // should be preserved. $url = $request->getUriForPath('/////////////////////////////////////////////////router_test/test1') . '?qs=test'; $this->drupalGet($url); - $this->assertEquals(1, $this->redirectCount, $url . " redirected to " . $this->url); + $this->assertEqual(1, $this->redirectCount, $url . " redirected to " . $this->url); $this->assertUrl($request->getUriForPath('/router_test/test1') . '?qs=test'); } diff --git a/core/modules/system/src/Tests/Session/SessionAuthenticationTest.php b/core/modules/system/src/Tests/Session/SessionAuthenticationTest.php index 9587354..ffdc08d 100644 --- a/core/modules/system/src/Tests/Session/SessionAuthenticationTest.php +++ b/core/modules/system/src/Tests/Session/SessionAuthenticationTest.php @@ -59,7 +59,7 @@ public function testSessionFromBasicAuthenticationDoesNotLeak() { $this->assertResponse(200, 'A route protected with basic authentication can be accessed by an authenticated user.'); // Check that the correct user is logged in. - $this->assertEquals($this->user->id(), json_decode($this->getRawContent())->user, 'The correct user is authenticated on a route with basic authentication.'); + $this->assertEqual($this->user->id(), json_decode($this->getRawContent())->user, 'The correct user is authenticated on a route with basic authentication.'); // If we now try to access a page without basic authentication then we // should no longer be logged in. @@ -99,10 +99,10 @@ public function testBasicAuthSession() { */ protected function assertSessionData($response, $expected) { $response = json_decode($response, TRUE); - $this->assertEquals(['test_value' => $expected], $response['session'], 'The session data matches the expected value.'); + $this->assertEqual(['test_value' => $expected], $response['session'], 'The session data matches the expected value.'); // Check that we are logged in as the correct user. - $this->assertEquals($this->user->id(), $response['user'], 'The correct user is logged in.'); + $this->assertEqual($this->user->id(), $response['user'], 'The correct user is logged in.'); } /** diff --git a/core/modules/system/src/Tests/Session/SessionTest.php b/core/modules/system/src/Tests/Session/SessionTest.php index 515baeb..1be9561 100644 --- a/core/modules/system/src/Tests/Session/SessionTest.php +++ b/core/modules/system/src/Tests/Session/SessionTest.php @@ -169,7 +169,7 @@ public function testEmptyAnonymousSession() { $this->assertSessionCookie(FALSE); // @todo Reinstate when REQUEST and RESPONSE events fire for cached pages. // $this->assertSessionEmpty(TRUE); - $this->assertEquals($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', 'Page was not cached.'); + $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', 'Page was not cached.'); // Start a new session by setting a message. $this->drupalGet('session-test/set-message'); @@ -191,7 +191,7 @@ public function testEmptyAnonymousSession() { // @todo Reinstate when REQUEST and RESPONSE events fire for cached pages. // $this->assertSessionEmpty(TRUE); $this->assertNoText(t('This is a dummy message.'), 'Message was not cached.'); - $this->assertEquals($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.'); + $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.'); $this->assertFalse($this->drupalGetHeader('Set-Cookie'), 'New session was not started.'); // Verify that no session is created if drupal_save_session(FALSE) is called. @@ -224,22 +224,22 @@ public function testSessionWrite() { sleep(1); $this->drupalGet('session-test/set/foo'); $times2 = db_query($sql, [':uid' => $user->id()])->fetchObject(); - $this->assertEquals($times2->access, $times1->access, 'Users table was not updated.'); + $this->assertEqual($times2->access, $times1->access, 'Users table was not updated.'); $this->assertNotEqual($times2->timestamp, $times1->timestamp, 'Sessions table was updated.'); // Write the same value again, i.e. do not modify the session. sleep(1); $this->drupalGet('session-test/set/foo'); $times3 = db_query($sql, [':uid' => $user->id()])->fetchObject(); - $this->assertEquals($times3->access, $times1->access, 'Users table was not updated.'); - $this->assertEquals($times3->timestamp, $times2->timestamp, 'Sessions table was not updated.'); + $this->assertEqual($times3->access, $times1->access, 'Users table was not updated.'); + $this->assertEqual($times3->timestamp, $times2->timestamp, 'Sessions table was not updated.'); // Do not change the session. sleep(1); $this->drupalGet(''); $times4 = db_query($sql, [':uid' => $user->id()])->fetchObject(); - $this->assertEquals($times4->access, $times3->access, 'Users table was not updated.'); - $this->assertEquals($times4->timestamp, $times3->timestamp, 'Sessions table was not updated.'); + $this->assertEqual($times4->access, $times3->access, 'Users table was not updated.'); + $this->assertEqual($times4->timestamp, $times3->timestamp, 'Sessions table was not updated.'); // Force updating of users and sessions table once per second. $this->settingsSet('session_write_interval', 0); diff --git a/core/modules/system/src/Tests/Session/StackSessionHandlerIntegrationTest.php b/core/modules/system/src/Tests/Session/StackSessionHandlerIntegrationTest.php index a609340..ac36868 100644 --- a/core/modules/system/src/Tests/Session/StackSessionHandlerIntegrationTest.php +++ b/core/modules/system/src/Tests/Session/StackSessionHandlerIntegrationTest.php @@ -41,7 +41,7 @@ public function testRequest() { ['END', NULL, 'close'], ['END', 'test_argument', 'close'], ]; - $this->assertEquals($expect_trace, $actual_trace); + $this->assertEqual($expect_trace, $actual_trace); } } diff --git a/core/modules/system/src/Tests/System/AccessDeniedTest.php b/core/modules/system/src/Tests/System/AccessDeniedTest.php index e1be8b8..ba1d599 100644 --- a/core/modules/system/src/Tests/System/AccessDeniedTest.php +++ b/core/modules/system/src/Tests/System/AccessDeniedTest.php @@ -45,9 +45,9 @@ public function testAccessDenied() { // correct path information in drupalSettings. $this->drupalLogin($this->createUser([])); $this->drupalGet('admin', ['query' => ['foo' => 'bar']]); - $this->assertEquals($this->drupalSettings['path']['currentPath'], 'admin'); - $this->assertEquals($this->drupalSettings['path']['currentPathIsAdmin'], TRUE); - $this->assertEquals($this->drupalSettings['path']['currentQuery'], ['foo' => 'bar']); + $this->assertEqual($this->drupalSettings['path']['currentPath'], 'admin'); + $this->assertEqual($this->drupalSettings['path']['currentPathIsAdmin'], TRUE); + $this->assertEqual($this->drupalSettings['path']['currentQuery'], ['foo' => 'bar']); $this->drupalLogin($this->adminUser); diff --git a/core/modules/system/src/Tests/System/AdminTest.php b/core/modules/system/src/Tests/System/AdminTest.php index 56c6b7e..7921e1c 100644 --- a/core/modules/system/src/Tests/System/AdminTest.php +++ b/core/modules/system/src/Tests/System/AdminTest.php @@ -161,9 +161,9 @@ public function testCompactMode() { $this->drupalGet('admin/compact/off'); $this->assertResponse(200, 'A valid page is returned after turning off compact mode.'); $this->assertUrl($frontpage_url, [], 'The user is redirected to the front page after turning off compact mode.'); - $this->assertEquals($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', 'Compact mode turns off.'); + $this->assertEqual($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', 'Compact mode turns off.'); $this->drupalGet('admin/compact/off'); - $this->assertEquals($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', 'Compact mode remains off after a repeat call.'); + $this->assertEqual($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', 'Compact mode remains off after a repeat call.'); $this->drupalGet(''); $this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'Compact mode persists on new requests.'); } diff --git a/core/modules/system/src/Tests/System/CronRunTest.php b/core/modules/system/src/Tests/System/CronRunTest.php index 747f73f..ec4e649 100644 --- a/core/modules/system/src/Tests/System/CronRunTest.php +++ b/core/modules/system/src/Tests/System/CronRunTest.php @@ -90,7 +90,7 @@ public function testCronExceptions() { // The common_test_cron_helper module sets the 'common_test_cron' variable. $this->cronRun(); $result = \Drupal::state()->get('common_test.cron'); - $this->assertEquals($result, 'success', 'Cron correctly handles exceptions thrown during hook_cron() invocations.'); + $this->assertEqual($result, 'success', 'Cron correctly handles exceptions thrown during hook_cron() invocations.'); } /** @@ -113,7 +113,7 @@ public function testCronUI() { $this->assertUrl('admin/config/system/cron'); // Check that cron does not run when saving the configuration form. - $this->assertEquals($cron_last, \Drupal::state()->get('system.cron_last'), 'Cron does not run when saving the configuration form.'); + $this->assertEqual($cron_last, \Drupal::state()->get('system.cron_last'), 'Cron does not run when saving the configuration form.'); // Check that cron runs when triggered manually. $this->drupalPostForm(NULL, [], 'Run cron'); diff --git a/core/modules/system/src/Tests/System/HtaccessTest.php b/core/modules/system/src/Tests/System/HtaccessTest.php index 37505c8..fab7a37 100644 --- a/core/modules/system/src/Tests/System/HtaccessTest.php +++ b/core/modules/system/src/Tests/System/HtaccessTest.php @@ -148,7 +148,7 @@ public function testSvgzContentEncoding() { $this->drupalGet('core/modules/system/tests/logo.svgz'); $this->assertResponse(200); $header = $this->drupalGetHeader('Content-Encoding'); - $this->assertEquals($header, 'gzip'); + $this->assertEqual($header, 'gzip'); } } diff --git a/core/modules/system/src/Tests/System/PageTitleTest.php b/core/modules/system/src/Tests/System/PageTitleTest.php index 918090f..44e33cb 100644 --- a/core/modules/system/src/Tests/System/PageTitleTest.php +++ b/core/modules/system/src/Tests/System/PageTitleTest.php @@ -103,14 +103,14 @@ public function testRoutingTitle() { $this->assertTitle('Foo | Drupal'); $result = $this->xpath('//h1[@class="page-title"]'); - $this->assertEquals('Foo', (string) $result[0]); + $this->assertEqual('Foo', (string) $result[0]); // Test forms $this->drupalGet('form-test/object-builder'); $this->assertTitle('Test dynamic title | Drupal'); $result = $this->xpath('//h1[@class="page-title"]'); - $this->assertEquals('Test dynamic title', (string) $result[0]); + $this->assertEqual('Test dynamic title', (string) $result[0]); // Set some custom translated strings. $this->addCustomTranslations('en', [ @@ -123,14 +123,14 @@ public function testRoutingTitle() { $this->assertTitle('Static title translated | Drupal'); $result = $this->xpath('//h1[@class="page-title"]'); - $this->assertEquals('Static title translated', (string) $result[0]); + $this->assertEqual('Static title translated', (string) $result[0]); // Test the dynamic '_title_callback' route option. $this->drupalGet('test-page-dynamic-title'); $this->assertTitle('Dynamic title | Drupal'); $result = $this->xpath('//h1[@class="page-title"]'); - $this->assertEquals('Dynamic title', (string) $result[0]); + $this->assertEqual('Dynamic title', (string) $result[0]); // Ensure that titles are cacheable and are escaped normally if the // controller does not escape them. diff --git a/core/modules/system/src/Tests/System/ShutdownFunctionsTest.php b/core/modules/system/src/Tests/System/ShutdownFunctionsTest.php index 537cc3e..50fae03 100644 --- a/core/modules/system/src/Tests/System/ShutdownFunctionsTest.php +++ b/core/modules/system/src/Tests/System/ShutdownFunctionsTest.php @@ -42,8 +42,8 @@ public function testShutdownFunctions() { // We need to wait to ensure that the shutdown functions have fired. sleep(1); } - $this->assertEquals(\Drupal::state()->get('_system_test_first_shutdown_function'), [$arg1, $arg2]); - $this->assertEquals(\Drupal::state()->get('_system_test_second_shutdown_function'), [$arg1, $arg2]); + $this->assertEqual(\Drupal::state()->get('_system_test_first_shutdown_function'), [$arg1, $arg2]); + $this->assertEqual(\Drupal::state()->get('_system_test_second_shutdown_function'), [$arg1, $arg2]); if (!$server_using_fastcgi) { // Make sure exceptions displayed through diff --git a/core/modules/system/src/Tests/System/SiteMaintenanceTest.php b/core/modules/system/src/Tests/System/SiteMaintenanceTest.php index c539b0e..e269a6c 100644 --- a/core/modules/system/src/Tests/System/SiteMaintenanceTest.php +++ b/core/modules/system/src/Tests/System/SiteMaintenanceTest.php @@ -71,13 +71,13 @@ public function testSiteMaintenance() { // Logout and verify that offline message is displayed. $this->drupalLogout(); $this->drupalGet(''); - $this->assertEquals('Site under maintenance', $this->cssSelect('main h1')[0]); + $this->assertEqual('Site under maintenance', $this->cssSelect('main h1')[0]); $this->assertText($offline_message); $this->drupalGet('node'); - $this->assertEquals('Site under maintenance', $this->cssSelect('main h1')[0]); + $this->assertEqual('Site under maintenance', $this->cssSelect('main h1')[0]); $this->assertText($offline_message); $this->drupalGet('user/register'); - $this->assertEquals('Site under maintenance', $this->cssSelect('main h1')[0]); + $this->assertEqual('Site under maintenance', $this->cssSelect('main h1')[0]); $this->assertText($offline_message); // Verify that user is able to log in. @@ -110,7 +110,7 @@ public function testSiteMaintenance() { // Logout and verify that custom site offline message is displayed. $this->drupalLogout(); $this->drupalGet(''); - $this->assertEquals('Site under maintenance', $this->cssSelect('main h1')[0]); + $this->assertEqual('Site under maintenance', $this->cssSelect('main h1')[0]); $this->assertRaw($offline_message, 'Found the site offline message.'); // Verify that custom site offline message is not displayed on user/password. @@ -137,7 +137,7 @@ public function testSiteMaintenance() { // Logout and verify that offline message is displayed in Bartik. $this->drupalLogout(); $this->drupalGet(''); - $this->assertEquals('Site under maintenance', $this->cssSelect('main h1')[0]); + $this->assertEqual('Site under maintenance', $this->cssSelect('main h1')[0]); } /** diff --git a/core/modules/system/src/Tests/System/SystemConfigFormTestBase.php b/core/modules/system/src/Tests/System/SystemConfigFormTestBase.php index 39e4f65..a14fd31 100644 --- a/core/modules/system/src/Tests/System/SystemConfigFormTestBase.php +++ b/core/modules/system/src/Tests/System/SystemConfigFormTestBase.php @@ -60,7 +60,7 @@ public function testConfigForm() { $this->assertTrue($valid_form, format_string('Input values: %values<br/>Validation handler errors: %errors', $args)); foreach ($this->values as $data) { - $this->assertEquals($data['#value'], $this->config($data['#config_name'])->get($data['#config_key'])); + $this->assertEqual($data['#value'], $this->config($data['#config_name'])->get($data['#config_key'])); } } diff --git a/core/modules/system/src/Tests/System/ThemeTest.php b/core/modules/system/src/Tests/System/ThemeTest.php index 36299a3..a02680e 100644 --- a/core/modules/system/src/Tests/System/ThemeTest.php +++ b/core/modules/system/src/Tests/System/ThemeTest.php @@ -117,9 +117,9 @@ public function testThemeSettings() { $explicit_file = 'public://' . $input; $local_file = PublicStream::basePath() . '/' . $input; } - $this->assertEquals((string) $elements[0], $implicit_public_file); - $this->assertEquals((string) $elements[1], $explicit_file); - $this->assertEquals((string) $elements[2], $local_file); + $this->assertEqual((string) $elements[0], $implicit_public_file); + $this->assertEqual((string) $elements[1], $explicit_file); + $this->assertEqual((string) $elements[2], $local_file); // Verify the actual 'src' attribute of the logo being output in a site // branding block. @@ -129,7 +129,7 @@ public function testThemeSettings() { ':rel' => 'home', ] ); - $this->assertEquals((string) $elements[0]['src'], $expected['src']); + $this->assertEqual((string) $elements[0]['src'], $expected['src']); } $unsupported_paths = [ // Stream wrapper URI to non-existing file. @@ -181,7 +181,7 @@ public function testThemeSettings() { ':rel' => 'home', ] ); - $this->assertEquals($elements[0]['src'], file_url_transform_relative(file_create_url($uploaded_filename))); + $this->assertEqual($elements[0]['src'], file_url_transform_relative(file_create_url($uploaded_filename))); $this->container->get('theme_handler')->install(['bartik']); @@ -311,7 +311,7 @@ public function testSwitchDefaultTheme() { $theme_handler->install(['bartik']); $this->drupalGet('admin/appearance'); $this->clickLink(t('Set as default')); - $this->assertEquals($this->config('system.theme')->get('default'), 'bartik'); + $this->assertEqual($this->config('system.theme')->get('default'), 'bartik'); // Test the default theme on the secondary links (blocks admin page). $this->drupalGet('admin/structure/block'); @@ -416,7 +416,7 @@ public function testInstallAndSetAsDefault() { // Test the confirmation message. $this->assertText('Bartik is now the default theme.'); // Make sure Bartik is now set as the default theme in config. - $this->assertEquals($this->config('system.theme')->get('default'), 'bartik'); + $this->assertEqual($this->config('system.theme')->get('default'), 'bartik'); // This checks for a regression. See https://www.drupal.org/node/2498691. $this->assertNoText('The bartik theme was not found.'); diff --git a/core/modules/system/src/Tests/Theme/FunctionsTest.php b/core/modules/system/src/Tests/Theme/FunctionsTest.php index 1942e67..8258348 100644 --- a/core/modules/system/src/Tests/Theme/FunctionsTest.php +++ b/core/modules/system/src/Tests/Theme/FunctionsTest.php @@ -468,12 +468,12 @@ public function testDrupalPreRenderLinks() { $html = \Drupal::service('renderer')->renderRoot($render_array); $dom = new \DOMDocument(); $dom->loadHTML($html); - $this->assertEquals($dom->getElementsByTagName('ul')->length, 1, 'One "ul" tag found in the rendered HTML.'); + $this->assertEqual($dom->getElementsByTagName('ul')->length, 1, 'One "ul" tag found in the rendered HTML.'); $list_elements = $dom->getElementsByTagName('li'); - $this->assertEquals($list_elements->length, 3, 'Three "li" tags found in the rendered HTML.'); - $this->assertEquals($list_elements->item(0)->nodeValue, 'Parent link original', 'First expected link found.'); - $this->assertEquals($list_elements->item(1)->nodeValue, 'First child link', 'Second expected link found.'); - $this->assertEquals($list_elements->item(2)->nodeValue, 'Second child link', 'Third expected link found.'); + $this->assertEqual($list_elements->length, 3, 'Three "li" tags found in the rendered HTML.'); + $this->assertEqual($list_elements->item(0)->nodeValue, 'Parent link original', 'First expected link found.'); + $this->assertEqual($list_elements->item(1)->nodeValue, 'First child link', 'Second expected link found.'); + $this->assertEqual($list_elements->item(2)->nodeValue, 'Second child link', 'Third expected link found.'); $this->assertIdentical(strpos($html, 'Parent link copy'), FALSE, '"Parent link copy" link not found.'); $this->assertIdentical(strpos($html, 'Third child link'), FALSE, '"Third child link" link not found.'); @@ -486,19 +486,19 @@ public function testDrupalPreRenderLinks() { // First check the child HTML. $dom = new \DOMDocument(); $dom->loadHTML($child_html); - $this->assertEquals($dom->getElementsByTagName('ul')->length, 1, 'One "ul" tag found in the rendered child HTML.'); + $this->assertEqual($dom->getElementsByTagName('ul')->length, 1, 'One "ul" tag found in the rendered child HTML.'); $list_elements = $dom->getElementsByTagName('li'); - $this->assertEquals($list_elements->length, 2, 'Two "li" tags found in the rendered child HTML.'); - $this->assertEquals($list_elements->item(0)->nodeValue, 'Parent link copy', 'First expected link found.'); - $this->assertEquals($list_elements->item(1)->nodeValue, 'First child link', 'Second expected link found.'); + $this->assertEqual($list_elements->length, 2, 'Two "li" tags found in the rendered child HTML.'); + $this->assertEqual($list_elements->item(0)->nodeValue, 'Parent link copy', 'First expected link found.'); + $this->assertEqual($list_elements->item(1)->nodeValue, 'First child link', 'Second expected link found.'); // Then check the parent HTML. $dom = new \DOMDocument(); $dom->loadHTML($parent_html); - $this->assertEquals($dom->getElementsByTagName('ul')->length, 1, 'One "ul" tag found in the rendered parent HTML.'); + $this->assertEqual($dom->getElementsByTagName('ul')->length, 1, 'One "ul" tag found in the rendered parent HTML.'); $list_elements = $dom->getElementsByTagName('li'); - $this->assertEquals($list_elements->length, 2, 'Two "li" tags found in the rendered parent HTML.'); - $this->assertEquals($list_elements->item(0)->nodeValue, 'Parent link original', 'First expected link found.'); - $this->assertEquals($list_elements->item(1)->nodeValue, 'Second child link', 'Second expected link found.'); + $this->assertEqual($list_elements->length, 2, 'Two "li" tags found in the rendered parent HTML.'); + $this->assertEqual($list_elements->item(0)->nodeValue, 'Parent link original', 'First expected link found.'); + $this->assertEqual($list_elements->item(1)->nodeValue, 'Second child link', 'Second expected link found.'); $this->assertIdentical(strpos($parent_html, 'First child link'), FALSE, '"First child link" link not found.'); $this->assertIdentical(strpos($parent_html, 'Third child link'), FALSE, '"Third child link" link not found.'); } diff --git a/core/modules/system/src/Tests/Theme/ThemeTest.php b/core/modules/system/src/Tests/Theme/ThemeTest.php index f15f370..64f330e 100644 --- a/core/modules/system/src/Tests/Theme/ThemeTest.php +++ b/core/modules/system/src/Tests/Theme/ThemeTest.php @@ -85,22 +85,22 @@ public function testThemeSuggestions() { $this->config('system.site')->set('page.front', '/nobody-home')->save(); $args = ['node', '1', 'edit']; $suggestions = theme_get_suggestions($args, 'page'); - $this->assertEquals($suggestions, ['page__node', 'page__node__%', 'page__node__1', 'page__node__edit'], 'Found expected node edit page suggestions'); + $this->assertEqual($suggestions, ['page__node', 'page__node__%', 'page__node__1', 'page__node__edit'], 'Found expected node edit page suggestions'); // Check attack vectors. $args = ['node', '\\1']; $suggestions = theme_get_suggestions($args, 'page'); - $this->assertEquals($suggestions, ['page__node', 'page__node__%', 'page__node__1'], 'Removed invalid \\ from suggestions'); + $this->assertEqual($suggestions, ['page__node', 'page__node__%', 'page__node__1'], 'Removed invalid \\ from suggestions'); $args = ['node', '1/']; $suggestions = theme_get_suggestions($args, 'page'); - $this->assertEquals($suggestions, ['page__node', 'page__node__%', 'page__node__1'], 'Removed invalid / from suggestions'); + $this->assertEqual($suggestions, ['page__node', 'page__node__%', 'page__node__1'], 'Removed invalid / from suggestions'); $args = ['node', "1\0"]; $suggestions = theme_get_suggestions($args, 'page'); - $this->assertEquals($suggestions, ['page__node', 'page__node__%', 'page__node__1'], 'Removed invalid \\0 from suggestions'); + $this->assertEqual($suggestions, ['page__node', 'page__node__%', 'page__node__1'], 'Removed invalid \\0 from suggestions'); // Define path with hyphens to be used to generate suggestions. $args = ['node', '1', 'hyphen-path']; $result = ['page__node', 'page__node__%', 'page__node__1', 'page__node__hyphen_path']; $suggestions = theme_get_suggestions($args, 'page'); - $this->assertEquals($suggestions, $result, 'Found expected page suggestions for paths containing hyphens.'); + $this->assertEqual($suggestions, $result, 'Found expected page suggestions for paths containing hyphens.'); } /** @@ -261,7 +261,7 @@ public function testClassLoading() { public function testFindThemeTemplates() { $registry = $this->container->get('theme.registry')->get(); $templates = drupal_find_theme_templates($registry, '.html.twig', drupal_get_path('theme', 'test_theme')); - $this->assertEquals($templates['node__1']['template'], 'node--1', 'Template node--1.tpl.twig was found in test_theme.'); + $this->assertEqual($templates['node__1']['template'], 'node--1', 'Template node--1.tpl.twig was found in test_theme.'); } /** @@ -287,7 +287,7 @@ public function testRegionClass() { $this->drupalPlaceBlock('system_main_block'); $this->drupalGet(''); $elements = $this->cssSelect(".region-sidebar-first.new_class"); - $this->assertEquals(count($elements), 1, 'New class found.'); + $this->assertEqual(count($elements), 1, 'New class found.'); } /** @@ -312,7 +312,7 @@ public function testSuggestionPreprocessForDefaults() { 'Flamingo', ]; foreach ($expected_values as $key => $value) { - $this->assertEquals((string) $value, $items[$key]); + $this->assertEqual((string) $value, $items[$key]); } } } diff --git a/core/modules/system/src/Tests/Theme/TwigTransTest.php b/core/modules/system/src/Tests/Theme/TwigTransTest.php index 130ff24..b73cdaf 100644 --- a/core/modules/system/src/Tests/Theme/TwigTransTest.php +++ b/core/modules/system/src/Tests/Theme/TwigTransTest.php @@ -68,7 +68,7 @@ protected function setUp() { $this->rebuildContainer(); // Check that lolspeak is the default language for the site. - $this->assertEquals(\Drupal::languageManager()->getDefaultLanguage()->getId(), 'xx', 'Lolspeak is the default language'); + $this->assertEqual(\Drupal::languageManager()->getDefaultLanguage()->getId(), 'xx', 'Lolspeak is the default language'); } /** diff --git a/core/modules/taxonomy/src/Tests/TaxonomyTermIndentationTest.php b/core/modules/taxonomy/src/Tests/TaxonomyTermIndentationTest.php index 4f30ec6..599b6fb 100644 --- a/core/modules/taxonomy/src/Tests/TaxonomyTermIndentationTest.php +++ b/core/modules/taxonomy/src/Tests/TaxonomyTermIndentationTest.php @@ -55,7 +55,7 @@ public function testTermIndentation() { // Check explicitly that term 2's parent is term 1. $parents = $taxonomy_storage->loadParents($term2->id()); - $this->assertEquals(key($parents), 1, 'Term 1 is the term 2\'s parent'); + $this->assertEqual(key($parents), 1, 'Term 1 is the term 2\'s parent'); // Move the second term back out to the root level. $edit = [ diff --git a/core/modules/taxonomy/src/Tests/TermAutocompleteTest.php b/core/modules/taxonomy/src/Tests/TermAutocompleteTest.php index 2ac816c..7ff519d 100644 --- a/core/modules/taxonomy/src/Tests/TermAutocompleteTest.php +++ b/core/modules/taxonomy/src/Tests/TermAutocompleteTest.php @@ -149,14 +149,14 @@ public function testAutocompleteCountResults() { $this->autocompleteUrl, ['query' => ['q' => 'aaa 10']] ); - $this->assertEquals(1, count($data), 'Autocomplete returned 1 result'); + $this->assertEqual(1, count($data), 'Autocomplete returned 1 result'); // Test the correct number of matches when multiple are partial matches. $data = $this->drupalGetJSON( $this->autocompleteUrl, ['query' => ['q' => 'aaa 1']] ); - $this->assertEquals(3, count($data), 'Autocomplete returned 3 results'); + $this->assertEqual(3, count($data), 'Autocomplete returned 3 results'); // Tests that only 10 results are returned, even if there are more than 10 // matches. @@ -164,7 +164,7 @@ public function testAutocompleteCountResults() { $this->autocompleteUrl, ['query' => ['q' => 'aaa']] ); - $this->assertEquals(10, count($data), 'Autocomplete returned only 10 results (for over 10 matches)'); + $this->assertEqual(10, count($data), 'Autocomplete returned only 10 results (for over 10 matches)'); } /** diff --git a/core/modules/taxonomy/src/Tests/TermTest.php b/core/modules/taxonomy/src/Tests/TermTest.php index ba47854..42f92b1 100644 --- a/core/modules/taxonomy/src/Tests/TermTest.php +++ b/core/modules/taxonomy/src/Tests/TermTest.php @@ -86,7 +86,7 @@ public function testTaxonomyTermHierarchy() { // Check that hierarchy is flat. $vocabulary = Vocabulary::load($this->vocabulary->id()); - $this->assertEquals(0, $vocabulary->getHierarchy(), 'Vocabulary is flat.'); + $this->assertEqual(0, $vocabulary->getHierarchy(), 'Vocabulary is flat.'); // Edit $term2, setting $term1 as parent. $edit = []; @@ -362,7 +362,7 @@ public function testTermInterface() { $value = $this->randomMachineName(); $term->setDescription($value); $term->save(); - $this->assertEquals($term->description->processed, "<p>$value</p>\n"); + $this->assertEqual($term->description->processed, "<p>$value</p>\n"); // Check that the term feed page is working. $this->drupalGet('taxonomy/term/' . $term->id() . '/feed'); @@ -416,9 +416,9 @@ public function testTermReorder() { $taxonomy_storage->resetCache(); $terms = $taxonomy_storage->loadTree($this->vocabulary->id()); - $this->assertEquals($terms[0]->tid, $term2->id(), 'Term 2 was moved above term 1.'); - $this->assertEquals($terms[1]->parents, [$term2->id()], 'Term 3 was made a child of term 2.'); - $this->assertEquals($terms[2]->tid, $term1->id(), 'Term 1 was moved below term 2.'); + $this->assertEqual($terms[0]->tid, $term2->id(), 'Term 2 was moved above term 1.'); + $this->assertEqual($terms[1]->parents, [$term2->id()], 'Term 3 was made a child of term 2.'); + $this->assertEqual($terms[2]->tid, $term1->id(), 'Term 1 was moved below term 2.'); $this->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview', [], t('Reset to alphabetical')); // Submit confirmation form. @@ -428,10 +428,10 @@ public function testTermReorder() { $taxonomy_storage->resetCache(); $terms = $taxonomy_storage->loadTree($this->vocabulary->id(), 0, NULL, TRUE); - $this->assertEquals($terms[0]->id(), $term1->id(), 'Term 1 was moved to back above term 2.'); - $this->assertEquals($terms[1]->id(), $term2->id(), 'Term 2 was moved to back below term 1.'); - $this->assertEquals($terms[2]->id(), $term3->id(), 'Term 3 is still below term 2.'); - $this->assertEquals($terms[2]->parents, [$term2->id()], 'Term 3 is still a child of term 2.'); + $this->assertEqual($terms[0]->id(), $term1->id(), 'Term 1 was moved to back above term 2.'); + $this->assertEqual($terms[1]->id(), $term2->id(), 'Term 2 was moved to back below term 1.'); + $this->assertEqual($terms[2]->id(), $term3->id(), 'Term 3 is still below term 2.'); + $this->assertEqual($terms[2]->parents, [$term2->id()], 'Term 3 is still a child of term 2.'); } /** @@ -454,13 +454,13 @@ public function testTermMultipleParentsInterface() { $terms = taxonomy_term_load_multiple_by_name($edit['name[0][value]']); $term = reset($terms); $this->assertNotNull($term, 'Term found in database.'); - $this->assertEquals($edit['name[0][value]'], $term->getName(), 'Term name was successfully saved.'); - $this->assertEquals($edit['description[0][value]'], $term->getDescription(), 'Term description was successfully saved.'); + $this->assertEqual($edit['name[0][value]'], $term->getName(), 'Term name was successfully saved.'); + $this->assertEqual($edit['description[0][value]'], $term->getDescription(), 'Term description was successfully saved.'); // Check that the parent tid is still there. The other parent (<root>) is // not added by \Drupal\taxonomy\TermStorageInterface::loadParents(). $parents = $this->container->get('entity.manager')->getStorage('taxonomy_term')->loadParents($term->id()); $parent = reset($parents); - $this->assertEquals($edit['parent[]'][1], $parent->id(), 'Term parents were successfully saved.'); + $this->assertEqual($edit['parent[]'][1], $parent->id(), 'Term parents were successfully saved.'); } /** @@ -503,11 +503,11 @@ public function testTaxonomyGetTermByName() { // Load multiple terms with the same name. $terms = taxonomy_term_load_multiple_by_name($term->getName()); - $this->assertEquals(count($terms), 2, 'Two terms loaded with the same name.'); + $this->assertEqual(count($terms), 2, 'Two terms loaded with the same name.'); // Load single term when restricted to one vocabulary. $terms = taxonomy_term_load_multiple_by_name($term->getName(), $this->vocabulary->id()); - $this->assertEquals(count($terms), 1, 'One term loaded when restricted by vocabulary.'); + $this->assertEqual(count($terms), 1, 'One term loaded when restricted by vocabulary.'); $this->assertTrue(isset($terms[$term->id()]), 'Term loaded using exact name and vocabulary machine name.'); // Create a new term with another name. @@ -520,7 +520,7 @@ public function testTaxonomyGetTermByName() { // Try to load terms filtering by a non-existing vocabulary. $terms = taxonomy_term_load_multiple_by_name($term2->getName(), 'non_existing_vocabulary'); - $this->assertEquals(count($terms), 0, 'No terms loaded when restricted by a non-existing vocabulary.'); + $this->assertEqual(count($terms), 0, 'No terms loaded when restricted by a non-existing vocabulary.'); } /** diff --git a/core/modules/text/src/Tests/TextFieldTest.php b/core/modules/text/src/Tests/TextFieldTest.php index a55f7e3..f3fb43f 100644 --- a/core/modules/text/src/Tests/TextFieldTest.php +++ b/core/modules/text/src/Tests/TextFieldTest.php @@ -58,10 +58,10 @@ public function testTextFieldValidation() { $entity->{$field_name}->value = str_repeat('x', $i); $violations = $entity->{$field_name}->validate(); if ($i <= $max_length) { - $this->assertEquals(count($violations), 0, "Length $i does not cause validation error when max_length is $max_length"); + $this->assertEqual(count($violations), 0, "Length $i does not cause validation error when max_length is $max_length"); } else { - $this->assertEquals(count($violations), 1, "Length $i causes validation error when max_length is $max_length"); + $this->assertEqual(count($violations), 1, "Length $i causes validation error when max_length is $max_length"); } } } diff --git a/core/modules/user/src/Tests/RestRegisterUserTest.php b/core/modules/user/src/Tests/RestRegisterUserTest.php index b9c34ce..450c552 100644 --- a/core/modules/user/src/Tests/RestRegisterUserTest.php +++ b/core/modules/user/src/Tests/RestRegisterUserTest.php @@ -60,7 +60,7 @@ public function testRegisterUser() { $this->assertFalse($user->isBlocked()); $this->assertFalse(empty($user->getPassword())); $email_count = count($this->drupalGetMails()); - $this->assertEquals(0, $email_count); + $this->assertEqual(0, $email_count); // Attempt to register without sending a password. $this->registerRequest('Rick.Deckard', FALSE); diff --git a/core/modules/user/src/Tests/UserBlocksTest.php b/core/modules/user/src/Tests/UserBlocksTest.php index cf20d9b..0a4c619 100644 --- a/core/modules/user/src/Tests/UserBlocksTest.php +++ b/core/modules/user/src/Tests/UserBlocksTest.php @@ -79,7 +79,7 @@ public function testUserLoginBlock() { // Now, log out and repeat with a non-403 page. $this->drupalLogout(); $this->drupalGet('filter/tips'); - $this->assertEquals('MISS', $this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER)); + $this->assertEqual('MISS', $this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER)); $this->drupalPostForm(NULL, $edit, t('Log in')); $this->assertNoText(t('User login'), 'Logged in.'); $this->assertPattern('!<title.*?' . t('Compose tips') . '.*?!', 'Still on the same page after login for allowed page'); @@ -87,7 +87,7 @@ public function testUserLoginBlock() { // Log out again and repeat with a non-403 page including query arguments. $this->drupalLogout(); $this->drupalGet('filter/tips', ['query' => ['foo' => 'bar']]); - $this->assertEquals('HIT', $this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER)); + $this->assertEqual('HIT', $this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER)); $this->drupalPostForm(NULL, $edit, t('Log in')); $this->assertNoText(t('User login'), 'Logged in.'); $this->assertPattern('!!', 'Still on the same page after login for allowed page'); @@ -96,7 +96,7 @@ public function testUserLoginBlock() { // Repeat with different query arguments. $this->drupalLogout(); $this->drupalGet('filter/tips', ['query' => ['foo' => 'baz']]); - $this->assertEquals('HIT', $this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER)); + $this->assertEqual('HIT', $this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER)); $this->drupalPostForm(NULL, $edit, t('Log in')); $this->assertNoText(t('User login'), 'Logged in.'); $this->assertPattern('!!', 'Still on the same page after login for allowed page'); diff --git a/core/modules/user/src/Tests/UserCreateTest.php b/core/modules/user/src/Tests/UserCreateTest.php index 391bc51..7b53443 100644 --- a/core/modules/user/src/Tests/UserCreateTest.php +++ b/core/modules/user/src/Tests/UserCreateTest.php @@ -28,8 +28,8 @@ public function testUserAdd() { $user = $this->drupalCreateUser(['administer users']); $this->drupalLogin($user); - $this->assertEquals($user->getCreatedTime(), REQUEST_TIME, 'Creating a user sets default "created" timestamp.'); - $this->assertEquals($user->getChangedTime(), REQUEST_TIME, 'Creating a user sets default "changed" timestamp.'); + $this->assertEqual($user->getCreatedTime(), REQUEST_TIME, 'Creating a user sets default "created" timestamp.'); + $this->assertEqual($user->getChangedTime(), REQUEST_TIME, 'Creating a user sets default "changed" timestamp.'); // Create a field. $field_name = 'test_field'; @@ -99,17 +99,17 @@ public function testUserAdd() { if ($notify) { $this->assertText(t('A welcome message with further instructions has been emailed to the new user @name.', ['@name' => $edit['name']]), 'User created'); - $this->assertEquals(count($this->drupalGetMails()), 1, 'Notification email sent'); + $this->assertEqual(count($this->drupalGetMails()), 1, 'Notification email sent'); } else { $this->assertText(t('Created a new user account for @name. No email has been sent.', ['@name' => $edit['name']]), 'User created'); - $this->assertEquals(count($this->drupalGetMails()), 0, 'Notification email not sent'); + $this->assertEqual(count($this->drupalGetMails()), 0, 'Notification email not sent'); } $this->drupalGet('admin/people'); $this->assertText($edit['name'], 'User found in list of users'); $user = user_load_by_name($name); - $this->assertEquals($user->isActive(), 'User is not blocked'); + $this->assertEqual($user->isActive(), 'User is not blocked'); } // Test that the password '0' is considered a password. diff --git a/core/modules/user/src/Tests/UserPasswordResetTest.php b/core/modules/user/src/Tests/UserPasswordResetTest.php index df7d140..b940878 100644 --- a/core/modules/user/src/Tests/UserPasswordResetTest.php +++ b/core/modules/user/src/Tests/UserPasswordResetTest.php @@ -82,7 +82,7 @@ public function testUserPasswordReset() { $this->drupalPostForm(NULL, $edit, t('Submit')); $this->assertText(t('@name is not recognized as a username or an email address.', ['@name' => $edit['name']]), 'Validation error message shown when trying to request password for invalid account.'); - $this->assertEquals(count($this->drupalGetMails(['id' => 'user_password_reset'])), 0, 'No email was sent when requesting a password for an invalid account.'); + $this->assertEqual(count($this->drupalGetMails(['id' => 'user_password_reset'])), 0, 'No email was sent when requesting a password for an invalid account.'); // Reset the password by username via the password reset page. $edit['name'] = $this->account->getUsername(); @@ -324,7 +324,7 @@ public function testResetImpersonation() { $user1 = User::load($user1->id()); $user2 = User::load($user2->id()); - $this->assertEquals($user1->getPassword(), $user2->getPassword(), 'Both users have the same password hash.'); + $this->assertEqual($user1->getPassword(), $user2->getPassword(), 'Both users have the same password hash.'); // The password reset URL must not be valid for the second user when only // the user ID is changed in the URL. diff --git a/core/modules/user/src/Tests/UserRegistrationTest.php b/core/modules/user/src/Tests/UserRegistrationTest.php index b39ad39..128b71b 100644 --- a/core/modules/user/src/Tests/UserRegistrationTest.php +++ b/core/modules/user/src/Tests/UserRegistrationTest.php @@ -252,14 +252,14 @@ public function testRegistrationDefaultValues() { $accounts = $this->container->get('entity_type.manager')->getStorage('user') ->loadByProperties(['name' => $name, 'mail' => $mail]); $new_user = reset($accounts); - $this->assertEquals($new_user->getUsername(), $name, 'Username matches.'); - $this->assertEquals($new_user->getEmail(), $mail, 'Email address matches.'); + $this->assertEqual($new_user->getUsername(), $name, 'Username matches.'); + $this->assertEqual($new_user->getEmail(), $mail, 'Email address matches.'); $this->assertTrue(($new_user->getCreatedTime() > REQUEST_TIME - 20), 'Correct creation time.'); - $this->assertEquals($new_user->isActive(), $config_user_settings->get('register') == USER_REGISTER_VISITORS ? 1 : 0, 'Correct status field.'); - $this->assertEquals($new_user->getTimezone(), $config_system_date->get('timezone.default'), 'Correct time zone field.'); - $this->assertEquals($new_user->langcode->value, \Drupal::languageManager()->getDefaultLanguage()->getId(), 'Correct language field.'); - $this->assertEquals($new_user->preferred_langcode->value, \Drupal::languageManager()->getDefaultLanguage()->getId(), 'Correct preferred language field.'); - $this->assertEquals($new_user->init->value, $mail, 'Correct init field.'); + $this->assertEqual($new_user->isActive(), $config_user_settings->get('register') == USER_REGISTER_VISITORS ? 1 : 0, 'Correct status field.'); + $this->assertEqual($new_user->getTimezone(), $config_system_date->get('timezone.default'), 'Correct time zone field.'); + $this->assertEqual($new_user->langcode->value, \Drupal::languageManager()->getDefaultLanguage()->getId(), 'Correct language field.'); + $this->assertEqual($new_user->preferred_langcode->value, \Drupal::languageManager()->getDefaultLanguage()->getId(), 'Correct preferred language field.'); + $this->assertEqual($new_user->init->value, $mail, 'Correct init field.'); } /** @@ -343,7 +343,7 @@ public function testRegistrationWithUserFields() { $accounts = $this->container->get('entity_type.manager')->getStorage('user') ->loadByProperties(['name' => $name, 'mail' => $mail]); $new_user = reset($accounts); - $this->assertEquals($new_user->test_user_field->value, $value, 'The field value was correctly saved.'); + $this->assertEqual($new_user->test_user_field->value, $value, 'The field value was correctly saved.'); // Check that the 'add more' button works. $field_storage->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED); @@ -373,9 +373,9 @@ public function testRegistrationWithUserFields() { $accounts = $this->container->get('entity_type.manager')->getStorage('user') ->loadByProperties(['name' => $name, 'mail' => $mail]); $new_user = reset($accounts); - $this->assertEquals($new_user->test_user_field[0]->value, $value, format_string('@js : The field value was correctly saved.', ['@js' => $js])); - $this->assertEquals($new_user->test_user_field[1]->value, $value + 1, format_string('@js : The field value was correctly saved.', ['@js' => $js])); - $this->assertEquals($new_user->test_user_field[2]->value, $value + 2, format_string('@js : The field value was correctly saved.', ['@js' => $js])); + $this->assertEqual($new_user->test_user_field[0]->value, $value, format_string('@js : The field value was correctly saved.', ['@js' => $js])); + $this->assertEqual($new_user->test_user_field[1]->value, $value + 1, format_string('@js : The field value was correctly saved.', ['@js' => $js])); + $this->assertEqual($new_user->test_user_field[2]->value, $value + 2, format_string('@js : The field value was correctly saved.', ['@js' => $js])); } } diff --git a/core/modules/views/src/Tests/AssertViewsCacheTagsTrait.php b/core/modules/views/src/Tests/AssertViewsCacheTagsTrait.php index 93ecc34..b01e985 100644 --- a/core/modules/views/src/Tests/AssertViewsCacheTagsTrait.php +++ b/core/modules/views/src/Tests/AssertViewsCacheTagsTrait.php @@ -53,7 +53,7 @@ protected function assertViewsCacheTags(ViewExecutable $view, $expected_results_ // Render array cache tags. $this->pass('Checking render array cache tags.'); sort($expected_render_array_cache_tags); - $this->assertEquals($build['#cache']['tags'], $expected_render_array_cache_tags); + $this->assertEqual($build['#cache']['tags'], $expected_render_array_cache_tags); $this->debugCacheTags($build['#cache']['tags'], $expected_render_array_cache_tags); if ($views_caching_is_enabled) { @@ -70,7 +70,7 @@ protected function assertViewsCacheTags(ViewExecutable $view, $expected_results_ $this->assertTrue($results_cache_item, 'Results cache item found.'); if ($results_cache_item) { sort($expected_results_cache); - $this->assertEquals($results_cache_item->tags, $expected_results_cache); + $this->assertEqual($results_cache_item->tags, $expected_results_cache); $this->debugCacheTags($results_cache_item->tags, $expected_results_cache); } } @@ -87,7 +87,7 @@ protected function assertViewsCacheTags(ViewExecutable $view, $expected_results_ if ($views_caching_is_enabled === TRUE) { $this->assertTrue(!empty($render_cache_item), 'Render cache item found.'); if ($render_cache_item) { - $this->assertEquals($render_cache_item['#cache']['tags'], $expected_render_array_cache_tags); + $this->assertEqual($render_cache_item['#cache']['tags'], $expected_render_array_cache_tags); $this->debugCacheTags($render_cache_item['#cache']['tags'], $expected_render_array_cache_tags); } } @@ -138,7 +138,7 @@ protected function assertViewsCacheTagsFromStaticRenderArray(ViewExecutable $vie // Render array cache tags. $this->pass('Checking render array cache tags.'); sort($expected_render_array_cache_tags); - $this->assertEquals($build['#cache']['tags'], $expected_render_array_cache_tags); + $this->assertEqual($build['#cache']['tags'], $expected_render_array_cache_tags); $this->debugCacheTags($build['#cache']['tags'], $expected_render_array_cache_tags); $this->pass('Checking Views render cache item cache tags.'); @@ -149,7 +149,7 @@ protected function assertViewsCacheTagsFromStaticRenderArray(ViewExecutable $vie if ($views_caching_is_enabled) { $this->assertTrue(!empty($render_cache_item), 'Render cache item found.'); if ($render_cache_item) { - $this->assertEquals($render_cache_item['#cache']['tags'], $expected_render_array_cache_tags); + $this->assertEqual($render_cache_item['#cache']['tags'], $expected_render_array_cache_tags); $this->debugCacheTags($render_cache_item['#cache']['tags'], $expected_render_array_cache_tags); } } diff --git a/core/modules/views/src/Tests/FieldApiDataTest.php b/core/modules/views/src/Tests/FieldApiDataTest.php index 4b33bd7..d2d035c 100644 --- a/core/modules/views/src/Tests/FieldApiDataTest.php +++ b/core/modules/views/src/Tests/FieldApiDataTest.php @@ -197,7 +197,7 @@ public function testViewsData() { ['left_field' => 'langcode', 'field' => 'langcode'], ], ]; - $this->assertEquals($expected_join, $data[$current_table]['table']['join']['node_field_data']); + $this->assertEqual($expected_join, $data[$current_table]['table']['join']['node_field_data']); $expected_join = [ 'table' => $revision_table, 'left_field' => 'vid', @@ -207,7 +207,7 @@ public function testViewsData() { ['left_field' => 'langcode', 'field' => 'langcode'], ], ]; - $this->assertEquals($expected_join, $data[$revision_table]['table']['join']['node_field_revision']); + $this->assertEqual($expected_join, $data[$revision_table]['table']['join']['node_field_revision']); // Test click sortable. $this->assertTrue($data[$current_table][$field_storage->getName()]['field']['click sortable'], 'String field is click sortable.'); @@ -215,14 +215,14 @@ public function testViewsData() { $this->assertTrue(empty($data[$revision_table][$field_storage->getName()]['field']['click sortable']), 'Non-primary fields are not click sortable'); $this->assertTrue($data[$current_table][$field_storage->getName()]['help'] instanceof MarkupInterface); - $this->assertEquals($data[$current_table][$field_storage->getName()]['help'], 'Appears in: page, article. Also known as: Content: GiraffeB" label'); + $this->assertEqual($data[$current_table][$field_storage->getName()]['help'], 'Appears in: page, article. Also known as: Content: GiraffeB" label'); $this->assertTrue($data[$current_table][$field_storage->getName() . '_value']['help'] instanceof MarkupInterface); - $this->assertEquals($data[$current_table][$field_storage->getName() . '_value']['help'], 'Appears in: page, article. Also known as: Content: GiraffeA" label (field_name_0)'); + $this->assertEqual($data[$current_table][$field_storage->getName() . '_value']['help'], 'Appears in: page, article. Also known as: Content: GiraffeA" label (field_name_0)'); // Since each label is only used once, views_entity_field_label() will // return a label using alphabetical sorting. - $this->assertEquals('GiraffeA" label (field_name_0)', $data[$current_table][$field_storage->getName() . '_value']['title']); + $this->assertEqual('GiraffeA" label (field_name_0)', $data[$current_table][$field_storage->getName() . '_value']['title']); // Attach the same field to a different bundle with a different label. $this->drupalCreateContentType(['type' => 'news']); @@ -237,9 +237,9 @@ public function testViewsData() { // Now the 'GiraffeB" label' is used twice and therefore will be // selected by views_entity_field_label(). - $this->assertEquals('GiraffeB" label (field_name_0)', $data[$current_table][$field_storage->getName() . '_value']['title']); + $this->assertEqual('GiraffeB" label (field_name_0)', $data[$current_table][$field_storage->getName() . '_value']['title']); $this->assertTrue($data[$current_table][$field_storage->getName()]['help'] instanceof MarkupInterface); - $this->assertEquals($data[$current_table][$field_storage->getName()]['help'], 'Appears in: page, article, news. Also known as: Content: GiraffeA" label'); + $this->assertEqual($data[$current_table][$field_storage->getName()]['help'], 'Appears in: page, article, news. Also known as: Content: GiraffeA" label'); } /** diff --git a/core/modules/views/src/Tests/Plugin/DisplayFeedTest.php b/core/modules/views/src/Tests/Plugin/DisplayFeedTest.php index 4d67b99..04ba4ca 100644 --- a/core/modules/views/src/Tests/Plugin/DisplayFeedTest.php +++ b/core/modules/views/src/Tests/Plugin/DisplayFeedTest.php @@ -59,8 +59,8 @@ public function testFeedOutput() { $this->drupalGet('test-feed-display.xml'); $result = $this->xpath('//title'); - $this->assertEquals($result[0], $site_name, 'The site title is used for the feed title.'); - $this->assertEquals($result[1], $node_title, 'Node title with HTML entities displays correctly.'); + $this->assertEqual($result[0], $site_name, 'The site title is used for the feed title.'); + $this->assertEqual($result[1], $node_title, 'Node title with HTML entities displays correctly.'); // Verify HTML is properly escaped in the description field. $this->assertRaw('<p>A paragraph</p>'); @@ -71,7 +71,7 @@ public function testFeedOutput() { $this->drupalGet('test-feed-display.xml'); $result = $this->xpath('//title'); - $this->assertEquals($result[0], 'test_display_feed', 'The display title is used for the feed title.'); + $this->assertEqual($result[0], 'test_display_feed', 'The display title is used for the feed title.'); // Add a block display and attach the feed. $view->getExecutable()->newDisplay('block', NULL, 'test'); @@ -88,11 +88,11 @@ public function testFeedOutput() { $this->drupalGet('test-feed-icon/' . $node->id()); $page_url = $this->getUrl(); $icon_href = $this->cssSelect('a.feed-icon[href *= "test-feed-icon"]')[0]['href']; - $this->assertEquals($icon_href, $page_url . '/feed', 'The feed icon was found.'); + $this->assertEqual($icon_href, $page_url . '/feed', 'The feed icon was found.'); $link_href = $this->cssSelect('link[type = "application/rss+xml"][href *= "test-feed-icon"]')[0]['href']; - $this->assertEquals($link_href, $page_url . '/feed', 'The RSS link was found.'); + $this->assertEqual($link_href, $page_url . '/feed', 'The RSS link was found.'); $feed_link = simplexml_load_string($this->drupalGet($icon_href))->channel->link; - $this->assertEquals($feed_link, $page_url, 'The channel link was found.'); + $this->assertEqual($feed_link, $page_url, 'The channel link was found.'); } /** @@ -115,7 +115,7 @@ public function testFeedFieldOutput() { $this->drupalGet('test-feed-display-fields.xml'); $result = $this->xpath('//title/a'); - $this->assertEquals($result[0], $node_title, 'Node title with HTML entities displays correctly.'); + $this->assertEqual($result[0], $node_title, 'Node title with HTML entities displays correctly.'); // Verify HTML is properly escaped in the description field. $this->assertRaw('<p>A paragraph</p>'); } @@ -136,7 +136,7 @@ public function testDisabledFeed() { // Check that the rss header is output on the page display. $this->drupalGet('/test-attached-disabled'); $feed_header = $this->xpath('//link[@rel="alternate"]'); - $this->assertEquals($feed_header[0]['type'], 'application/rss+xml', 'The feed link has the type application/rss+xml.'); + $this->assertEqual($feed_header[0]['type'], 'application/rss+xml', 'The feed link has the type application/rss+xml.'); $this->assertTrue(strpos($feed_header[0]['href'], 'test-attached-disabled.xml'), 'Page display contains the correct feed URL.'); // Disable the feed display. diff --git a/core/modules/views/src/Tests/Plugin/StyleOpmlTest.php b/core/modules/views/src/Tests/Plugin/StyleOpmlTest.php index 0bcb5f6..66a8bc8 100644 --- a/core/modules/views/src/Tests/Plugin/StyleOpmlTest.php +++ b/core/modules/views/src/Tests/Plugin/StyleOpmlTest.php @@ -53,9 +53,9 @@ public function testOpmlOutput() { $this->drupalGet('test-feed-opml-style'); $outline = $this->xpath('//outline[1]'); - $this->assertEquals($outline[0]['type'], 'rss', 'The correct type attribute is used for rss OPML.'); - $this->assertEquals($outline[0]['text'], $feed->label(), 'The correct text attribute is used for rss OPML.'); - $this->assertEquals($outline[0]['xmlurl'], $feed->getUrl(), 'The correct xmlUrl attribute is used for rss OPML.'); + $this->assertEqual($outline[0]['type'], 'rss', 'The correct type attribute is used for rss OPML.'); + $this->assertEqual($outline[0]['text'], $feed->label(), 'The correct text attribute is used for rss OPML.'); + $this->assertEqual($outline[0]['xmlurl'], $feed->getUrl(), 'The correct xmlUrl attribute is used for rss OPML.'); $view = $this->container->get('entity.manager') ->getStorage('view') @@ -67,9 +67,9 @@ public function testOpmlOutput() { $this->drupalGet('test-feed-opml-style'); $outline = $this->xpath('//outline[1]'); - $this->assertEquals($outline[0]['type'], 'link', 'The correct type attribute is used for link OPML.'); - $this->assertEquals($outline[0]['text'], $feed->label(), 'The correct text attribute is used for link OPML.'); - $this->assertEquals($outline[0]['url'], $feed->getUrl(), 'The correct URL attribute is used for link OPML.'); + $this->assertEqual($outline[0]['type'], 'link', 'The correct type attribute is used for link OPML.'); + $this->assertEqual($outline[0]['text'], $feed->label(), 'The correct text attribute is used for link OPML.'); + $this->assertEqual($outline[0]['url'], $feed->getUrl(), 'The correct URL attribute is used for link OPML.'); // xmlUrl should not be present when type is link. $this->assertNull($outline[0]['xmlUrl'], 'The xmlUrl attribute is not used for link OPML.'); } diff --git a/core/modules/views/src/Tests/Update/EntityViewsMultiValueBaseFieldDataUpdateTest.php b/core/modules/views/src/Tests/Update/EntityViewsMultiValueBaseFieldDataUpdateTest.php index 74ce0c7..206214e 100644 --- a/core/modules/views/src/Tests/Update/EntityViewsMultiValueBaseFieldDataUpdateTest.php +++ b/core/modules/views/src/Tests/Update/EntityViewsMultiValueBaseFieldDataUpdateTest.php @@ -40,14 +40,14 @@ public function testUpdateMultiValueBaseFields() { // The ID should remain unchanged. Otherwise the update handler could // overwrite a separate handler config. - $this->assertEquals('roles', $handler_config['id']); + $this->assertEqual('roles', $handler_config['id']); // The field should be updated from 'roles' to the correct column name. - $this->assertEquals('roles_target_id', $handler_config['field']); + $this->assertEqual('roles_target_id', $handler_config['field']); // Check the table is still correct. - $this->assertEquals('user__roles', $handler_config['table']); + $this->assertEqual('user__roles', $handler_config['table']); // The plugin ID should be updated as well. - $this->assertEquals($type === 'arguments' ? 'user__roles_rid' : 'user_roles', $handler_config['plugin_id']); + $this->assertEqual($type === 'arguments' ? 'user__roles_rid' : 'user_roles', $handler_config['plugin_id']); } } diff --git a/core/modules/views/src/Tests/ViewAjaxTest.php b/core/modules/views/src/Tests/ViewAjaxTest.php index c90fed0..820d9e2 100644 --- a/core/modules/views/src/Tests/ViewAjaxTest.php +++ b/core/modules/views/src/Tests/ViewAjaxTest.php @@ -33,10 +33,10 @@ public function testAjaxView() { $drupal_settings = $this->getDrupalSettings(); $this->assertTrue(isset($drupal_settings['views']['ajax_path']), 'The Ajax callback path is set in drupalSettings.'); - $this->assertEquals(count($drupal_settings['views']['ajaxViews']), 1); + $this->assertEqual(count($drupal_settings['views']['ajaxViews']), 1); $view_entry = array_keys($drupal_settings['views']['ajaxViews'])[0]; - $this->assertEquals($drupal_settings['views']['ajaxViews'][$view_entry]['view_name'], 'test_ajax_view', 'The view\'s ajaxViews array entry has the correct \'view_name\' key.'); - $this->assertEquals($drupal_settings['views']['ajaxViews'][$view_entry]['view_display_id'], 'page_1', 'The view\'s ajaxViews array entry has the correct \'view_display_id\' key.'); + $this->assertEqual($drupal_settings['views']['ajaxViews'][$view_entry]['view_name'], 'test_ajax_view', 'The view\'s ajaxViews array entry has the correct \'view_name\' key.'); + $this->assertEqual($drupal_settings['views']['ajaxViews'][$view_entry]['view_display_id'], 'page_1', 'The view\'s ajaxViews array entry has the correct \'view_display_id\' key.'); $data = []; $data['view_name'] = 'test_ajax_view'; @@ -53,12 +53,12 @@ public function testAjaxView() { $this->assertTrue(isset($data[0]['settings']['views']['ajaxViews'])); // Ensure that the view insert command is part of the result. - $this->assertEquals($data[1]['command'], 'insert'); + $this->assertEqual($data[1]['command'], 'insert'); $this->assertTrue(strpos($data[1]['selector'], '.js-view-dom-id-') === 0); $this->setRawContent($data[1]['data']); $result = $this->xpath('//div[contains(@class, "views-row")]'); - $this->assertEquals(count($result), 2, 'Ensure that two items are rendered in the HTML.'); + $this->assertEqual(count($result), 2, 'Ensure that two items are rendered in the HTML.'); } /** diff --git a/core/modules/views_ui/src/Tests/PreviewTest.php b/core/modules/views_ui/src/Tests/PreviewTest.php index 13825ee..c723cb3 100644 --- a/core/modules/views_ui/src/Tests/PreviewTest.php +++ b/core/modules/views_ui/src/Tests/PreviewTest.php @@ -31,7 +31,7 @@ public function testPreviewContextual() { $this->drupalPostForm(NULL, $edit = [], t('Update preview')); $elements = $this->xpath('//div[@id="views-live-preview"]//ul[contains(@class, :ul-class)]/li[contains(@class, :li-class)]', [':ul-class' => 'contextual-links', ':li-class' => 'filter-add']); - $this->assertEquals(count($elements), 1, 'The contextual link to add a new field is shown.'); + $this->assertEqual(count($elements), 1, 'The contextual link to add a new field is shown.'); $this->drupalPostForm(NULL, $edit = ['view_args' => '100'], t('Update preview')); @@ -52,19 +52,19 @@ public function testPreviewUI() { $this->drupalPostForm(NULL, $edit = [], t('Update preview')); $elements = $this->xpath('//div[@class = "view-content"]/div[contains(@class, views-row)]'); - $this->assertEquals(count($elements), 5); + $this->assertEqual(count($elements), 5); // Filter just the first result. $this->drupalPostForm(NULL, $edit = ['view_args' => '1'], t('Update preview')); $elements = $this->xpath('//div[@class = "view-content"]/div[contains(@class, views-row)]'); - $this->assertEquals(count($elements), 1); + $this->assertEqual(count($elements), 1); // Filter for no results. $this->drupalPostForm(NULL, $edit = ['view_args' => '100'], t('Update preview')); $elements = $this->xpath('//div[@class = "view-content"]/div[contains(@class, views-row)]'); - $this->assertEquals(count($elements), 0); + $this->assertEqual(count($elements), 0); // Test that area text and exposed filters are present and rendered. $this->assertFieldByName('id', NULL, 'ID exposed filter field found.'); @@ -119,7 +119,7 @@ public function testPreviewUI() { $this->drupalPostForm("admin/structure/views/nojs/display/test_preview/default/title", $edit = ['title' => 'Double & escaped'], t('Apply')); $this->drupalPostForm(NULL, [], t('Update preview')); $elements = $this->xpath('//div[@id="views-live-preview"]/div[contains(@class, views-query-info)]//td[text()=:text]', [':text' => t('Double & escaped')]); - $this->assertEquals(1, count($elements)); + $this->assertEqual(1, count($elements)); } /** @@ -254,7 +254,7 @@ public function testPreviewAdditionalInfo() { // Check for implementation of hook_views_preview_info_alter(). // @see views_ui_test.module $elements = $this->xpath('//div[@id="views-live-preview"]/div[contains(@class, views-query-info)]//td[text()=:text]', [':text' => t('Test row count')]); - $this->assertEquals(count($elements), 1, 'Views Query Preview Info area altered.'); + $this->assertEqual(count($elements), 1, 'Views Query Preview Info area altered.'); // Check that additional assets are attached. $this->assertTrue(strpos($this->getDrupalSettings()['ajaxPageState']['libraries'], 'views_ui_test/views_ui_test.test') !== FALSE, 'Attached library found.'); $this->assertRaw('css/views_ui_test.test.css', 'Attached CSS asset found.'); @@ -357,7 +357,7 @@ protected function assertPreviewAJAX($result, $row_count) { // Test if preview contains the expected number of rows. $elements = $this->xpath('//div[@class = "view-content"]/div[contains(@class, views-row)]'); - $this->assertEquals(count($elements), $row_count, 'Expected items found on page.'); + $this->assertEqual(count($elements), $row_count, 'Expected items found on page.'); } /** diff --git a/core/modules/views_ui/src/Tests/RowUITest.php b/core/modules/views_ui/src/Tests/RowUITest.php index a84fe4b..5689009 100644 --- a/core/modules/views_ui/src/Tests/RowUITest.php +++ b/core/modules/views_ui/src/Tests/RowUITest.php @@ -52,8 +52,8 @@ public function testRowUI() { $view = Views::getView($view_name); $view->initDisplay(); $row = $view->display_handler->getOption('row'); - $this->assertEquals($row['type'], 'test_row', 'Make sure that the test_row got saved as used row plugin.'); - $this->assertEquals($row['options']['test_option'], $random_name, 'Make sure that the custom settings field got saved as expected.'); + $this->assertEqual($row['type'], 'test_row', 'Make sure that the test_row got saved as used row plugin.'); + $this->assertEqual($row['options']['test_option'], $random_name, 'Make sure that the custom settings field got saved as expected.'); // Change the row plugin to fields using ajax. // Note: this is the best approximation we can achieve, because we cannot diff --git a/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php b/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php index 6f3cb84..c323ace 100644 --- a/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php @@ -92,7 +92,7 @@ public function testFileCheckDirectoryHandling() { $this->assertTrue(is_file(file_default_scheme() . '://.htaccess'), 'Successfully re-created the .htaccess file in the files directory.', 'File'); // Verify contents of .htaccess file. $file = file_get_contents(file_default_scheme() . '://.htaccess'); - $this->assertEquals($file, FileStorage::htaccessLines(FALSE), 'The .htaccess file contains the proper content.', 'File'); + $this->assertEquals($file, FileStorage::htaccessLines(FALSE), 'The .htaccess file contains the proper content.'); } /** @@ -106,14 +106,14 @@ public function testFileCreateNewFilepath() { $directory = 'core/misc'; $original = $directory . '/' . $basename; $path = file_create_filename($basename, $directory); - $this->assertEquals($path, $original, format_string('New filepath %new equals %original.', ['%new' => $path, '%original' => $original]), 'File'); + $this->assertEquals($path, $original, format_string('New filepath %new equals %original.', ['%new' => $path, '%original' => $original])); // Then we test against a file that already exists within that directory. $basename = 'druplicon.png'; $original = $directory . '/' . $basename; $expected = $directory . '/druplicon_0.png'; $path = file_create_filename($basename, $directory); - $this->assertEquals($path, $expected, format_string('Creating a new filepath from %original equals %new (expected %expected).', ['%new' => $path, '%original' => $original, '%expected' => $expected]), 'File'); + $this->assertEquals($path, $expected, format_string('Creating a new filepath from %original equals %new (expected %expected).', ['%new' => $path, '%original' => $original, '%expected' => $expected])); // @TODO: Finally we copy a file into a directory several times, to ensure a properly iterating filename suffix. } @@ -134,19 +134,19 @@ public function testFileDestination() { // First test for non-existent file. $destination = 'core/misc/xyz.txt'; $path = file_destination($destination, FILE_EXISTS_REPLACE); - $this->assertEquals($path, $destination, 'Non-existing filepath destination is correct with FILE_EXISTS_REPLACE.', 'File'); + $this->assertEquals($path, $destination, 'Non-existing filepath destination is correct with FILE_EXISTS_REPLACE.'); $path = file_destination($destination, FILE_EXISTS_RENAME); - $this->assertEquals($path, $destination, 'Non-existing filepath destination is correct with FILE_EXISTS_RENAME.', 'File'); + $this->assertEquals($path, $destination, 'Non-existing filepath destination is correct with FILE_EXISTS_RENAME.'); $path = file_destination($destination, FILE_EXISTS_ERROR); - $this->assertEquals($path, $destination, 'Non-existing filepath destination is correct with FILE_EXISTS_ERROR.', 'File'); + $this->assertEquals($path, $destination, 'Non-existing filepath destination is correct with FILE_EXISTS_ERROR.'); $destination = 'core/misc/druplicon.png'; $path = file_destination($destination, FILE_EXISTS_REPLACE); - $this->assertEquals($path, $destination, 'Existing filepath destination remains the same with FILE_EXISTS_REPLACE.', 'File'); + $this->assertEquals($path, $destination, 'Existing filepath destination remains the same with FILE_EXISTS_REPLACE.'); $path = file_destination($destination, FILE_EXISTS_RENAME); $this->assertNotEqual($path, $destination, 'A new filepath destination is created when filepath destination already exists with FILE_EXISTS_RENAME.', 'File'); $path = file_destination($destination, FILE_EXISTS_ERROR); - $this->assertEquals($path, FALSE, 'An error is returned when filepath destination already exists with FILE_EXISTS_ERROR.', 'File'); + $this->assertEquals($path, FALSE, 'An error is returned when filepath destination already exists with FILE_EXISTS_ERROR.'); } /**