From 7e1043ea1df476c38f15f2c62547ef242fdd09ee Mon Sep 17 00:00:00 2001 From: catch Date: Mon, 22 Mar 2021 10:00:18 +0000 Subject: [PATCH] Issue #3204764 by longwave, mondrake: PHPUnit assertions do not return a value --- core/lib/Drupal/Core/Test/AssertMailTrait.php | 10 ++------ .../tests/src/Kernel/FilterKernelTest.php | 10 ++------ .../src/Functional/UrlAlterFunctionalTest.php | 10 ++------ .../src/Functional/Form/ConfirmFormTest.php | 5 +--- .../src/Functional/Module/ModuleTestBase.php | 20 +++++---------- .../Functional/Session/SessionHttpsTest.php | 6 +---- .../Functional/System/ErrorHandlerTest.php | 5 +--- .../src/Functional/Handler/FieldWebTest.php | 10 ++------ .../src/Functional/Plugin/ExposedFormTest.php | 5 +--- .../Kernel/Entity/RowEntityRenderersTest.php | 5 +--- .../src/Kernel/Handler/FieldKernelTest.php | 10 ++------ .../Drupal/KernelTests/AssertContentTrait.php | 25 ++++--------------- .../Core/Database/ConnectionUnitTest.php | 4 +-- .../Core/Database/TransactionTest.php | 4 +-- .../Core/Entity/EntityQueryAggregateTest.php | 2 +- .../Entity/FieldTranslationSqlStorageTest.php | 2 +- .../Plugin/Discovery/DiscoveryTestBase.php | 5 +--- 17 files changed, 33 insertions(+), 105 deletions(-) diff --git a/core/lib/Drupal/Core/Test/AssertMailTrait.php b/core/lib/Drupal/Core/Test/AssertMailTrait.php index 5adc24efa2a..0d138020efd 100644 --- a/core/lib/Drupal/Core/Test/AssertMailTrait.php +++ b/core/lib/Drupal/Core/Test/AssertMailTrait.php @@ -87,9 +87,6 @@ trait AssertMailTrait { * 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 assertMailString($field_name, $string, $email_depth, $message = '', $group = 'Other') { $mails = $this->getMails(); @@ -110,7 +107,7 @@ trait AssertMailTrait { if (!$message) { $message = new FormattableMarkup('Expected text found in @field of email message: "@expected".', ['@field' => $field_name, '@expected' => $string]); } - return $this->assertTrue($string_found, $message, $group); + $this->assertTrue($string_found, $message, $group); } /** @@ -130,9 +127,6 @@ trait AssertMailTrait { * 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 assertMailPattern($field_name, $regex, $message = '', $group = 'Other') { $mails = $this->getMails(); @@ -141,7 +135,7 @@ trait AssertMailTrait { if (!$message) { $message = new FormattableMarkup('Expected text found in @field of email message: "@expected".', ['@field' => $field_name, '@expected' => $regex]); } - return $this->assertTrue((bool) $regex_found, $message, $group); + $this->assertTrue((bool) $regex_found, $message, $group); } /** diff --git a/core/modules/filter/tests/src/Kernel/FilterKernelTest.php b/core/modules/filter/tests/src/Kernel/FilterKernelTest.php index effcb7b78e4..e2c8ddff9d1 100644 --- a/core/modules/filter/tests/src/Kernel/FilterKernelTest.php +++ b/core/modules/filter/tests/src/Kernel/FilterKernelTest.php @@ -1139,12 +1139,9 @@ body {color:red} * (optional) Message to display if failed. Defaults to an empty string. * @param string $group * (optional) The group this message belongs to. Defaults to 'Other'. - * - * @return bool - * TRUE on pass, FALSE on fail. */ public function assertNormalized($haystack, $needle, $message = '', $group = 'Other') { - return $this->assertStringContainsString($needle, strtolower(Html::decodeEntities($haystack)), $message); + $this->assertStringContainsString($needle, strtolower(Html::decodeEntities($haystack)), $message); } /** @@ -1164,12 +1161,9 @@ body {color:red} * (optional) Message to display if failed. Defaults to an empty string. * @param string $group * (optional) The group this message belongs to. Defaults to 'Other'. - * - * @return bool - * TRUE on pass, FALSE on fail. */ public function assertNoNormalized($haystack, $needle, $message = '', $group = 'Other') { - return $this->assertStringNotContainsString($needle, strtolower(Html::decodeEntities($haystack)), $message); + $this->assertStringNotContainsString($needle, strtolower(Html::decodeEntities($haystack)), $message); } } diff --git a/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php b/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php index 9780902a309..6acdfee062b 100644 --- a/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php +++ b/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php @@ -96,14 +96,11 @@ class UrlAlterFunctionalTest extends BrowserTestBase { * A string with the original path that is run through generateFrommPath(). * @param $final * A string with the expected result after generateFrommPath(). - * - * @return - * TRUE if $original was correctly altered to $final, FALSE otherwise. */ protected function assertUrlOutboundAlter($original, $final) { // Test outbound altering. $result = $this->container->get('path_processor_manager')->processOutbound($original); - return $this->assertSame($final, $result, new FormattableMarkup('Altered outbound URL %original, expected %final, and got %result.', ['%original' => $original, '%final' => $final, '%result' => $result])); + $this->assertSame($final, $result, new FormattableMarkup('Altered outbound URL %original, expected %final, and got %result.', ['%original' => $original, '%final' => $final, '%result' => $result])); } /** @@ -113,14 +110,11 @@ class UrlAlterFunctionalTest extends BrowserTestBase { * The original path before it has been altered by inbound URL processing. * @param $final * A string with the expected result. - * - * @return - * TRUE if $original was correctly altered to $final, FALSE otherwise. */ protected function assertUrlInboundAlter($original, $final) { // Test inbound altering. $result = $this->container->get('path_alias.manager')->getPathByAlias($original); - return $this->assertSame($final, $result, new FormattableMarkup('Altered inbound URL %original, expected %final, and got %result.', ['%original' => $original, '%final' => $final, '%result' => $result])); + $this->assertSame($final, $result, new FormattableMarkup('Altered inbound URL %original, expected %final, and got %result.', ['%original' => $original, '%final' => $final, '%result' => $result])); } } diff --git a/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php b/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php index eb938dbab5b..617d681fbef 100644 --- a/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php +++ b/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php @@ -79,14 +79,11 @@ class ConfirmFormTest extends BrowserTestBase { * The assert message. * @param string $group * The assertion group. - * - * @return bool - * Result of the assertion. */ public function assertCancelLinkUrl(Url $url, $message = '', $group = 'Other') { $links = $this->xpath('//a[@href=:url]', [':url' => $url->toString()]); $message = ($message ? $message : new FormattableMarkup('Cancel link with URL %url found.', ['%url' => $url->toString()])); - return $this->assertTrue(isset($links[0]), $message, $group); + $this->assertTrue(isset($links[0]), $message, $group); } } diff --git a/core/modules/system/tests/src/Functional/Module/ModuleTestBase.php b/core/modules/system/tests/src/Functional/Module/ModuleTestBase.php index 63e4388cdc0..a2fefcf1531 100644 --- a/core/modules/system/tests/src/Functional/Module/ModuleTestBase.php +++ b/core/modules/system/tests/src/Functional/Module/ModuleTestBase.php @@ -47,9 +47,9 @@ abstract class ModuleTestBase extends BrowserTestBase { $tables = $connection->schema()->findTables($connection->prefixTables('{' . $base_table . '}') . '%'); if ($count) { - return $this->assertNotEmpty($tables, new FormattableMarkup('Tables matching "@base_table" found.', ['@base_table' => $base_table])); + $this->assertNotEmpty($tables, new FormattableMarkup('Tables matching "@base_table" found.', ['@base_table' => $base_table])); } - return $this->assertEmpty($tables, new FormattableMarkup('Tables matching "@base_table" not found.', ['@base_table' => $base_table])); + $this->assertEmpty($tables, new FormattableMarkup('Tables matching "@base_table" not found.', ['@base_table' => $base_table])); } /** @@ -67,7 +67,7 @@ abstract class ModuleTestBase extends BrowserTestBase { $tables_exist = FALSE; } } - return $this->assertTrue($tables_exist, new FormattableMarkup('All database tables defined by the @module module exist.', ['@module' => $module])); + $this->assertTrue($tables_exist, new FormattableMarkup('All database tables defined by the @module module exist.', ['@module' => $module])); } /** @@ -85,7 +85,7 @@ abstract class ModuleTestBase extends BrowserTestBase { $tables_exist = TRUE; } } - return $this->assertFalse($tables_exist, new FormattableMarkup('None of the database tables defined by the @module module exist.', ['@module' => $module])); + $this->assertFalse($tables_exist, new FormattableMarkup('None of the database tables defined by the @module module exist.', ['@module' => $module])); } /** @@ -93,11 +93,6 @@ abstract class ModuleTestBase extends BrowserTestBase { * * @param string $module * The name of the module. - * - * @return bool|null - * TRUE if configuration has been installed, FALSE otherwise. Returns NULL - * if the module configuration directory does not exist or does not contain - * any configuration files. */ public function assertModuleConfig($module) { $module_config_dir = drupal_get_path('module', $module) . '/' . InstallStorage::CONFIG_INSTALL_DIRECTORY; @@ -131,7 +126,7 @@ abstract class ModuleTestBase extends BrowserTestBase { } // Verify that all configuration has been installed (which means that $names // is empty). - return $this->assertEmpty($names, new FormattableMarkup('All default configuration of @module module found.', ['@module' => $module])); + $this->assertEmpty($names, new FormattableMarkup('All default configuration of @module module found.', ['@module' => $module])); } /** @@ -139,13 +134,10 @@ abstract class ModuleTestBase extends BrowserTestBase { * * @param string $module * The name of the module. - * - * @return bool - * TRUE if no configuration was found, FALSE otherwise. */ public function assertNoModuleConfig($module) { $names = \Drupal::configFactory()->listAll($module . '.'); - return $this->assertEmpty($names, new FormattableMarkup('No configuration found for @module module.', ['@module' => $module])); + $this->assertEmpty($names, new FormattableMarkup('No configuration found for @module module.', ['@module' => $module])); } /** diff --git a/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php b/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php index cdfebd96be1..510864318d7 100644 --- a/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php +++ b/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php @@ -248,13 +248,9 @@ class SessionHttpsTest extends BrowserTestBase { * The insecure session ID to search for. * @param $assertion_text * The text to display when we perform the assertion. - * - * @return - * The result of assertTrue() that there's a session in the system that - * has the given insecure and secure session IDs. */ protected function assertSessionIds($sid, $assertion_text) { - return $this->assertNotEmpty(\Drupal::database()->select('sessions', 's')->fields('s', ['timestamp'])->condition('sid', Crypt::hashBase64($sid))->execute()->fetchField(), $assertion_text); + $this->assertNotEmpty(\Drupal::database()->select('sessions', 's')->fields('s', ['timestamp'])->condition('sid', Crypt::hashBase64($sid))->execute()->fetchField(), $assertion_text); } /** diff --git a/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php b/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php index ab8b55b0403..6b02e5fe36d 100644 --- a/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php +++ b/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php @@ -166,12 +166,9 @@ class ErrorHandlerTest extends BrowserTestBase { /** * Asserts that no messages are printed onto the page. - * - * @return bool - * TRUE, if there are no messages. */ protected function assertNoMessages() { - return $this->assertEmpty($this->xpath('//div[contains(@class, "messages")]'), 'Ensures that also no messages div exists, which proves that no messages were generated by the error handler, not even an empty one.'); + $this->assertEmpty($this->xpath('//div[contains(@class, "messages")]'), 'Ensures that also no messages div exists, which proves that no messages were generated by the error handler, not even an empty one.'); } } diff --git a/core/modules/views/tests/src/Functional/Handler/FieldWebTest.php b/core/modules/views/tests/src/Functional/Handler/FieldWebTest.php index 6aa22663b70..d73b27b97d3 100644 --- a/core/modules/views/tests/src/Functional/Handler/FieldWebTest.php +++ b/core/modules/views/tests/src/Functional/Handler/FieldWebTest.php @@ -125,12 +125,9 @@ class FieldWebTest extends ViewTestBase { * The message to display along with the assertion. * @param string $group * The type of assertion - examples are "Browser", "PHP". - * - * @return bool - * TRUE if the assertion succeeded, FALSE otherwise. */ protected function assertSubString($haystack, $needle, $message = '', $group = 'Other') { - return $this->assertStringContainsString($needle, $haystack, $message); + $this->assertStringContainsString($needle, $haystack, $message); } /** @@ -144,12 +141,9 @@ class FieldWebTest extends ViewTestBase { * The message to display along with the assertion. * @param string $group * The type of assertion - examples are "Browser", "PHP". - * - * @return bool - * TRUE if the assertion succeeded, FALSE otherwise. */ protected function assertNotSubString($haystack, $needle, $message = '', $group = 'Other') { - return $this->assertStringNotContainsString($needle, $haystack, $message); + $this->assertStringNotContainsString($needle, $haystack, $message); } /** diff --git a/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php b/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php index c5f70ae8130..3b6f9fc24bd 100644 --- a/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php @@ -363,9 +363,6 @@ class ExposedFormTest extends ViewTestBase { * * @param int[] $ids * The ids to check. - * - * @return bool - * TRUE if ids match, FALSE otherwise. */ protected function assertIds(array $ids) { $elements = $this->cssSelect('div.view-test-exposed-form-sort-items-per-page div.views-row span.field-content'); @@ -374,7 +371,7 @@ class ExposedFormTest extends ViewTestBase { $actual_ids[] = (int) $element->getText(); } - return $this->assertSame($ids, $actual_ids); + $this->assertSame($ids, $actual_ids); } /** diff --git a/core/modules/views/tests/src/Kernel/Entity/RowEntityRenderersTest.php b/core/modules/views/tests/src/Kernel/Entity/RowEntityRenderersTest.php index f73910e0ae4..d373072d09e 100644 --- a/core/modules/views/tests/src/Kernel/Entity/RowEntityRenderersTest.php +++ b/core/modules/views/tests/src/Kernel/Entity/RowEntityRenderersTest.php @@ -243,9 +243,6 @@ class RowEntityRenderersTest extends ViewsKernelTestBase { * (optional) A message to display with the assertion. * @param string $group * (optional) The group this message is in. - * - * @return bool - * TRUE if the assertion succeeded, FALSE otherwise. */ protected function assertTranslations($display, $renderer_id, array $expected, $message = '', $group = 'Other') { $view = Views::getView('test_entity_row_renderers'); @@ -270,7 +267,7 @@ class RowEntityRenderersTest extends ViewsKernelTestBase { } } - return $this->assertTrue($result, $message, $group); + $this->assertTrue($result, $message, $group); } } diff --git a/core/modules/views/tests/src/Kernel/Handler/FieldKernelTest.php b/core/modules/views/tests/src/Kernel/Handler/FieldKernelTest.php index de3d6c6cf49..aa8803bd9cf 100644 --- a/core/modules/views/tests/src/Kernel/Handler/FieldKernelTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/FieldKernelTest.php @@ -109,12 +109,9 @@ class FieldKernelTest extends ViewsKernelTestBase { * 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 if the assertion succeeded, FALSE otherwise. */ protected function assertSubString($haystack, $needle, $message = '', $group = 'Other') { - return $this->assertStringContainsString($needle, $haystack, $message); + $this->assertStringContainsString($needle, $haystack, $message); } /** @@ -134,12 +131,9 @@ class FieldKernelTest extends ViewsKernelTestBase { * 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 if the assertion succeeded, FALSE otherwise. */ protected function assertNotSubString($haystack, $needle, $message = '', $group = 'Other') { - return $this->assertStringNotContainsString($needle, $haystack, $message); + $this->assertStringNotContainsString($needle, $haystack, $message); } /** diff --git a/core/tests/Drupal/KernelTests/AssertContentTrait.php b/core/tests/Drupal/KernelTests/AssertContentTrait.php index b6a03a11b2d..e1032632bbc 100644 --- a/core/tests/Drupal/KernelTests/AssertContentTrait.php +++ b/core/tests/Drupal/KernelTests/AssertContentTrait.php @@ -837,9 +837,6 @@ trait AssertContentTrait { * 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 assertNoTitle($title, $message = '', $group = 'Other') { $actual = (string) current($this->xpath('//title')); @@ -849,7 +846,7 @@ trait AssertContentTrait { '@unexpected' => var_export($title, TRUE), ]); } - return $this->assertNotEquals($title, $actual, $message, $group); + $this->assertNotEquals($title, $actual, $message, $group); } /** @@ -871,9 +868,6 @@ trait AssertContentTrait { * 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 assertThemeOutput($callback, array $variables = [], $expected = '', $message = '', $group = 'Other') { /** @var \Drupal\Core\Render\RendererInterface $renderer */ @@ -889,7 +883,7 @@ trait AssertContentTrait { $message = '%callback rendered correctly.'; } $message = new FormattableMarkup($message, ['%callback' => 'theme_' . $callback . '()']); - return $this->assertSame($expected, $output, $message, $group); + $this->assertSame($expected, $output, $message, $group); } /** @@ -1245,13 +1239,10 @@ trait AssertContentTrait { * in test output. Use 'Debug' to indicate this is debugging output. Do not * translate this string. Defaults to 'Browser'; most tests do not override * this default. - * - * @return bool - * TRUE on pass, FALSE on fail. */ protected function assertOption($id, $option, $message = '', $group = 'Browser') { $options = $this->xpath('//select[@id=:id]//option[@value=:option]', [':id' => $id, ':option' => $option]); - return $this->assertTrue(isset($options[0]), $message ? $message : new FormattableMarkup('Option @option for field @id exists.', ['@option' => $option, '@id' => $id]), $group); + $this->assertTrue(isset($options[0]), $message ? $message : new FormattableMarkup('Option @option for field @id exists.', ['@option' => $option, '@id' => $id]), $group); } /** @@ -1263,13 +1254,10 @@ trait AssertContentTrait { * The text for the option tag to assert. * @param string $message * (optional) A message to display with the assertion. - * - * @return bool - * TRUE on pass, FALSE on fail. */ protected function assertOptionByText($id, $text, $message = '') { $options = $this->xpath('//select[@id=:id]//option[normalize-space(text())=:text]', [':id' => $id, ':text' => $text]); - return $this->assertTrue(isset($options[0]), $message ?: 'Option with text label ' . $text . ' for select field ' . $id . ' exits.'); + $this->assertTrue(isset($options[0]), $message ?: 'Option with text label ' . $text . ' for select field ' . $id . ' exits.'); } /** @@ -1289,13 +1277,10 @@ trait AssertContentTrait { * in test output. Use 'Debug' to indicate this is debugging output. Do not * translate this string. Defaults to 'Browser'; most tests do not override * this default. - * - * @return bool - * TRUE on pass, FALSE on fail. */ protected function assertOptionWithDrupalSelector($drupal_selector, $option, $message = '', $group = 'Browser') { $options = $this->xpath('//select[@data-drupal-selector=:data_drupal_selector]//option[@value=:option]', [':data_drupal_selector' => $drupal_selector, ':option' => $option]); - return $this->assertTrue(isset($options[0]), $message ? $message : new FormattableMarkup('Option @option for field @data_drupal_selector exists.', ['@option' => $option, '@data_drupal_selector' => $drupal_selector]), $group); + $this->assertTrue(isset($options[0]), $message ? $message : new FormattableMarkup('Option @option for field @data_drupal_selector exists.', ['@option' => $option, '@data_drupal_selector' => $drupal_selector]), $group); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php b/core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php index 2005550da85..58193c6db13 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php @@ -98,7 +98,7 @@ class ConnectionUnitTest extends KernelTestBase { */ protected function assertConnection($id) { $list = $this->monitor->query($this->getQuery()['processlist'])->fetchAllKeyed(0, 0); - return $this->assertTrue(isset($list[$id]), new FormattableMarkup('Connection ID @id found.', ['@id' => $id])); + $this->assertTrue(isset($list[$id]), new FormattableMarkup('Connection ID @id found.', ['@id' => $id])); } /** @@ -109,7 +109,7 @@ class ConnectionUnitTest extends KernelTestBase { */ protected function assertNoConnection($id) { $list = $this->monitor->query($this->getQuery()['processlist'])->fetchAllKeyed(0, 0); - return $this->assertFalse(isset($list[$id]), new FormattableMarkup('Connection ID @id not found.', ['@id' => $id])); + $this->assertFalse(isset($list[$id]), new FormattableMarkup('Connection ID @id not found.', ['@id' => $id])); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php b/core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php index 95421a138da..34f36b9230b 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php @@ -326,7 +326,7 @@ class TransactionTest extends DatabaseTestBase { $message = new FormattableMarkup('Row %name is present.', ['%name' => $name]); } $present = (boolean) $this->connection->query('SELECT 1 FROM {test} WHERE [name] = :name', [':name' => $name])->fetchField(); - return $this->assertTrue($present, $message); + $this->assertTrue($present, $message); } /** @@ -342,7 +342,7 @@ class TransactionTest extends DatabaseTestBase { $message = new FormattableMarkup('Row %name is absent.', ['%name' => $name]); } $present = (boolean) $this->connection->query('SELECT 1 FROM {test} WHERE [name] = :name', [':name' => $name])->fetchField(); - return $this->assertFalse($present, $message); + $this->assertFalse($present, $message); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php index f9af54342d7..e408aeca959 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php @@ -597,7 +597,7 @@ class EntityQueryAggregateTest extends EntityKernelTestBase { $found = FALSE; break; } - return $this->assertTrue($found, strtr('!expected expected, !found found', ['!expected' => print_r($expected, TRUE), '!found' => print_r($this->queryResult, TRUE)])); + $this->assertTrue($found, strtr('!expected expected, !found found', ['!expected' => print_r($expected, TRUE), '!found' => print_r($this->queryResult, TRUE)])); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php index eedf53a3255..2148290fe62 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php @@ -98,7 +98,7 @@ class FieldTranslationSqlStorageTest extends EntityLanguageTestBase { } } - return $this->assertTrue($status, $message); + $this->assertTrue($status, $message); } } diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php index bcfef8369c7..160ef2f2b59 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php @@ -66,9 +66,6 @@ abstract class DiscoveryTestBase extends KernelTestBase { * The definition to test. * @param array $expected_definition * The expected definition to test against. - * - * @return bool - * TRUE if the assertion succeeded, FALSE otherwise. */ protected function assertDefinitionIdentical(array $definition, array $expected_definition) { $func = function (&$item) { @@ -78,7 +75,7 @@ abstract class DiscoveryTestBase extends KernelTestBase { }; array_walk_recursive($definition, $func); array_walk_recursive($expected_definition, $func); - return $this->assertSame($expected_definition, $definition); + $this->assertSame($expected_definition, $definition); } }