diff --git a/core/modules/comment/tests/src/Functional/CommentPagerTest.php b/core/modules/comment/tests/src/Functional/CommentPagerTest.php index 51e6ab1d81332ff690bdfc58ebf01e071eedf34b..9c11fef7a3eb4e573bfae406180a256ed60874bb 100644 --- a/core/modules/comment/tests/src/Functional/CommentPagerTest.php +++ b/core/modules/comment/tests/src/Functional/CommentPagerTest.php @@ -224,7 +224,7 @@ public function assertCommentOrder(array $comments, array $expected_order) { foreach ($comment_anchors as $anchor) { $result_order[] = substr($anchor->getAttribute('id'), 8); } - return $this->assertEquals($expected_cids, $result_order, new FormattableMarkup('Comment order: expected @expected, returned @returned.', ['@expected' => implode(',', $expected_cids), '@returned' => implode(',', $result_order)])); + $this->assertEquals($expected_cids, $result_order, new FormattableMarkup('Comment order: expected @expected, returned @returned.', ['@expected' => implode(',', $expected_cids), '@returned' => implode(',', $result_order)])); } /** diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php index 23bed79b24c9214130daf3be7cd2484913714819..91ec56987aa6659c132182e4edb7590d9476721f 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php @@ -259,16 +259,13 @@ public function testAccountLanguageSettingsUI() { * TRUE if translatability should be enabled, FALSE otherwise. * @param array $edit * An array of values to submit to the content translation settings page. - * - * @return bool - * TRUE if the assertion succeeded, FALSE otherwise. */ protected function assertSettings($entity_type, $bundle, $enabled, $edit) { $this->drupalGet('admin/config/regional/content-language'); $this->submitForm($edit, 'Save configuration'); $args = ['@entity_type' => $entity_type, '@bundle' => $bundle, '@enabled' => $enabled ? 'enabled' : 'disabled']; $message = new FormattableMarkup('Translation for entity @entity_type (@bundle) is @enabled.', $args); - return $this->assertEquals($enabled, \Drupal::service('content_translation.manager')->isEnabled($entity_type, $bundle), $message); + $this->assertEquals($enabled, \Drupal::service('content_translation.manager')->isEnabled($entity_type, $bundle), $message); } /** diff --git a/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php b/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php index 63b08fa1c06482f9e34d7f5f5d953fdebcc359b9..fd347167b8ec9de013369f599b611dd533dd9bf3 100644 --- a/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php +++ b/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php @@ -219,8 +219,6 @@ protected function uploadImage($uri) { * The expected width of the uploaded image. * @param string $height * The expected height of the uploaded image. - * - * @return bool */ protected function assertSavedMaxDimensions($width, $height) { $image_upload_settings = Editor::load('basic_html')->getImageUploadSettings(); @@ -228,9 +226,8 @@ protected function assertSavedMaxDimensions($width, $height) { 'width' => $image_upload_settings['max_dimensions']['width'], 'height' => $image_upload_settings['max_dimensions']['height'], ]; - $same_width = $this->assertEquals($expected['width'], $width, 'Actual width of "' . $width . '" equals the expected width of "' . $expected['width'] . '"'); - $same_height = $this->assertEquals($expected['height'], $height, 'Actual height of "' . $height . '" equals the expected width of "' . $expected['height'] . '"'); - return $same_width && $same_height; + $this->assertEquals($expected['width'], $width, 'Actual width of "' . $width . '" equals the expected width of "' . $expected['width'] . '"'); + $this->assertEquals($expected['height'], $height, 'Actual height of "' . $height . '" equals the expected width of "' . $expected['height'] . '"'); } } diff --git a/core/tests/Drupal/KernelTests/AssertContentTrait.php b/core/tests/Drupal/KernelTests/AssertContentTrait.php index 997d8a959a9449822b536cfcc555608b09b671fc..58eabfc3889016d5488b5adb601279c57ba25de3 100644 --- a/core/tests/Drupal/KernelTests/AssertContentTrait.php +++ b/core/tests/Drupal/KernelTests/AssertContentTrait.php @@ -802,9 +802,6 @@ protected function assertTextPattern($pattern, $message = NULL, $group = 'Other' * in test output. Use 'Debug' to indicate this is debugging output. Do not * translate this string. Defaults to 'Other'; most tests do not override * this default. - * - * @return bool - * TRUE on pass, FALSE on fail. */ protected function assertTitle($title, $message = '', $group = 'Other') { // Don't use xpath as it messes with HTML escaping. @@ -817,9 +814,11 @@ protected function assertTitle($title, $message = '', $group = 'Other') { '@expected' => var_export($title, TRUE), ]); } - return $this->assertEquals($title, $actual, $message); + $this->assertEquals($title, $actual, $message); + } + else { + $this->fail('No title element found on the page.'); } - return $this->fail('No title element found on the page.'); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php index 9c459aa432eb404a07f07cab634421826dd13da1..9258c4acf70ec12402b87b2b933fa897bc56aa5d 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php @@ -333,9 +333,6 @@ public function testAutocreateApi() { * The referencing entity. * @param $setter_callback * A callback setting the target entity on the referencing entity. - * - * @return bool - * TRUE if the user was autocreated, FALSE otherwise. */ protected function assertUserAutocreate(EntityInterface $entity, $setter_callback) { $storage = $this->entityTypeManager->getStorage('user'); @@ -345,7 +342,7 @@ protected function assertUserAutocreate(EntityInterface $entity, $setter_callbac $entity->save(); $storage->resetCache(); $user = User::load($user_id); - return $this->assertEquals($entity->user_id->target_id, $user->id()); + $this->assertEquals($entity->user_id->target_id, $user->id()); } /** @@ -355,9 +352,6 @@ protected function assertUserAutocreate(EntityInterface $entity, $setter_callbac * The referencing entity. * @param $setter_callback * A callback setting the target entity on the referencing entity. - * - * @return bool - * TRUE if the user was autocreated, FALSE otherwise. */ protected function assertUserRoleAutocreate(EntityInterface $entity, $setter_callback) { $storage = $this->entityTypeManager->getStorage('user_role'); @@ -367,7 +361,7 @@ protected function assertUserRoleAutocreate(EntityInterface $entity, $setter_cal $entity->save(); $storage->resetCache(); $role = Role::load($role_id); - return $this->assertEquals($entity->user_role->target_id, $role->id()); + $this->assertEquals($entity->user_role->target_id, $role->id()); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Field/FieldItemTest.php b/core/tests/Drupal/KernelTests/Core/Field/FieldItemTest.php index 7c011ecff4f1c6ed7a6ebeba08c24b5192c9ab13..15ab322db081234aadec781be8390e7636bc6f26 100644 --- a/core/tests/Drupal/KernelTests/Core/Field/FieldItemTest.php +++ b/core/tests/Drupal/KernelTests/Core/Field/FieldItemTest.php @@ -85,20 +85,16 @@ public function testSaveWorkflow() { * The test entity. * @param $expected_value * The expected field item value. - * - * @return bool - * TRUE if the item value matches expectations, FALSE otherwise. */ protected function assertSavedFieldItemValue(EntityTest $entity, $expected_value) { $entity->setNewRevision(TRUE); $entity->save(); $base_field_expected_value = str_replace($this->fieldName, 'field_test_item', $expected_value); - $result = $this->assertEquals($base_field_expected_value, $entity->field_test_item->value); - $result = $result && $this->assertEquals($expected_value, $entity->{$this->fieldName}->value); + $this->assertEquals($base_field_expected_value, $entity->field_test_item->value); + $this->assertEquals($expected_value, $entity->{$this->fieldName}->value); $entity = $this->reloadEntity($entity); - $result = $result && $this->assertEquals($base_field_expected_value, $entity->field_test_item->value); - $result = $result && $this->assertEquals($expected_value, $entity->{$this->fieldName}->value); - return $result; + $this->assertEquals($base_field_expected_value, $entity->field_test_item->value); + $this->assertEquals($expected_value, $entity->{$this->fieldName}->value); } }