Skip to content
Snippets Groups Projects

Issue #3130107: Extend unit test coverage for LanguageNegotiationContentEntity

Open Stefanos Petrakis requested to merge issue/drupal-3130107:3130107-add-unit-test into 10.1.x
3 files
+ 69
1284
Compare changes
  • Side-by-side
  • Inline
Files
3
  • 8600163e
    Issue #3319683 by alexpott, mallezie, mondrake: Fix PHPStan errors from... · 8600163e
    catch authored
    Issue #3319683 by alexpott, mallezie, mondrake: Fix PHPStan errors from UserCreationTrait and AssertMailTrait
@@ -82,13 +82,8 @@ protected function assertMail($name, $value = '', $message = '', $group = 'Email
* messages: use \Drupal\Component\Render\FormattableMarkup to embed
* variables in the message text, not t(). If left blank, a default message
* will be displayed.
* @param string $group
* (optional) The group this message is in, which is displayed in a column
* 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.
*/
protected function assertMailString($field_name, $string, $email_depth, $message = '', $group = 'Other') {
protected function assertMailString($field_name, $string, $email_depth, $message = '') {
$mails = $this->getMails();
$string_found = FALSE;
// Cast MarkupInterface objects to string.
@@ -107,7 +102,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]);
}
$this->assertTrue($string_found, $message, $group);
$this->assertTrue($string_found, $message);
}
/**
@@ -122,20 +117,15 @@ protected function assertMailString($field_name, $string, $email_depth, $message
* messages: use \Drupal\Component\Render\FormattableMarkup to embed
* variables in the message text, not t(). If left blank, a default message
* will be displayed.
* @param string $group
* (optional) The group this message is in, which is displayed in a column
* 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.
*/
protected function assertMailPattern($field_name, $regex, $message = '', $group = 'Other') {
protected function assertMailPattern($field_name, $regex, $message = '') {
$mails = $this->getMails();
$mail = end($mails);
$regex_found = preg_match("/$regex/", $mail[$field_name]);
if (!$message) {
$message = new FormattableMarkup('Expected text found in @field of email message: "@expected".', ['@field' => $field_name, '@expected' => $regex]);
}
$this->assertTrue((bool) $regex_found, $message, $group);
$this->assertTrue((bool) $regex_found, $message);
}
}
Loading