Loading core/lib/Drupal/Core/Test/AssertMailTrait.php +2 −8 Original line number Diff line number Diff line Loading @@ -87,9 +87,6 @@ protected function assertMail($name, $value = '', $message = '', $group = 'Email * 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(); Loading @@ -110,7 +107,7 @@ protected function assertMailString($field_name, $string, $email_depth, $message 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); } /** Loading @@ -130,9 +127,6 @@ protected function assertMailString($field_name, $string, $email_depth, $message * 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(); Loading @@ -141,7 +135,7 @@ protected function assertMailPattern($field_name, $regex, $message = '', $group 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); } /** Loading core/modules/filter/tests/src/Kernel/FilterKernelTest.php +2 −8 Original line number Diff line number Diff line Loading @@ -1139,12 +1139,9 @@ public function testHtmlCorrectorFilter() { * (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); } /** Loading @@ -1164,12 +1161,9 @@ public function assertNormalized($haystack, $needle, $message = '', $group = 'Ot * (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); } } core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php +2 −8 Original line number Diff line number Diff line Loading @@ -96,14 +96,11 @@ public function testUrlAlter() { * 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])); } /** Loading @@ -113,14 +110,11 @@ protected function assertUrlOutboundAlter($original, $final) { * 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])); } } core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php +1 −4 Original line number Diff line number Diff line Loading @@ -79,14 +79,11 @@ public function testConfirmFormWithExternalDestination() { * 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); } } core/modules/system/tests/src/Functional/Module/ModuleTestBase.php +6 −14 Original line number Diff line number Diff line Loading @@ -47,9 +47,9 @@ public function assertTableCount($base_table, $count = TRUE) { $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])); } /** Loading @@ -67,7 +67,7 @@ public function assertModuleTablesExist($module) { $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])); } /** Loading @@ -85,7 +85,7 @@ public function assertModuleTablesDoNotExist($module) { $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])); } /** Loading @@ -93,11 +93,6 @@ public function assertModuleTablesDoNotExist($module) { * * @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; Loading Loading @@ -131,7 +126,7 @@ public function assertModuleConfig($module) { } // 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])); } /** Loading @@ -139,13 +134,10 @@ public function assertModuleConfig($module) { * * @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])); } /** Loading Loading
core/lib/Drupal/Core/Test/AssertMailTrait.php +2 −8 Original line number Diff line number Diff line Loading @@ -87,9 +87,6 @@ protected function assertMail($name, $value = '', $message = '', $group = 'Email * 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(); Loading @@ -110,7 +107,7 @@ protected function assertMailString($field_name, $string, $email_depth, $message 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); } /** Loading @@ -130,9 +127,6 @@ protected function assertMailString($field_name, $string, $email_depth, $message * 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(); Loading @@ -141,7 +135,7 @@ protected function assertMailPattern($field_name, $regex, $message = '', $group 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); } /** Loading
core/modules/filter/tests/src/Kernel/FilterKernelTest.php +2 −8 Original line number Diff line number Diff line Loading @@ -1139,12 +1139,9 @@ public function testHtmlCorrectorFilter() { * (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); } /** Loading @@ -1164,12 +1161,9 @@ public function assertNormalized($haystack, $needle, $message = '', $group = 'Ot * (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); } }
core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php +2 −8 Original line number Diff line number Diff line Loading @@ -96,14 +96,11 @@ public function testUrlAlter() { * 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])); } /** Loading @@ -113,14 +110,11 @@ protected function assertUrlOutboundAlter($original, $final) { * 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])); } }
core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php +1 −4 Original line number Diff line number Diff line Loading @@ -79,14 +79,11 @@ public function testConfirmFormWithExternalDestination() { * 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); } }
core/modules/system/tests/src/Functional/Module/ModuleTestBase.php +6 −14 Original line number Diff line number Diff line Loading @@ -47,9 +47,9 @@ public function assertTableCount($base_table, $count = TRUE) { $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])); } /** Loading @@ -67,7 +67,7 @@ public function assertModuleTablesExist($module) { $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])); } /** Loading @@ -85,7 +85,7 @@ public function assertModuleTablesDoNotExist($module) { $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])); } /** Loading @@ -93,11 +93,6 @@ public function assertModuleTablesDoNotExist($module) { * * @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; Loading Loading @@ -131,7 +126,7 @@ public function assertModuleConfig($module) { } // 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])); } /** Loading @@ -139,13 +134,10 @@ public function assertModuleConfig($module) { * * @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])); } /** Loading