use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\NestedArray;
use Drupal\Component\Utility\UrlHelper;
-use Drupal\Component\Utility\SafeMarkup;
+use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\EventSubscriber\AjaxResponseSubscriber;
use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
use Drupal\Core\Session\AccountInterface;
use Drupal\Tests\EntityViewTrait;
use Drupal\Tests\block\Traits\BlockCreationTrait as BaseBlockCreationTrait;
use Drupal\Tests\Listeners\DeprecationListenerTrait;
-use Drupal\Tests\node\Traits\ContentTypeCreationTrait;
-use Drupal\Tests\node\Traits\NodeCreationTrait;
+use Drupal\Tests\node\Traits\ContentTypeCreationTrait as BaseContentTypeCreationTrait;
+use Drupal\Tests\node\Traits\NodeCreationTrait as BaseNodeCreationTrait;
use Drupal\Tests\Traits\Core\CronRunTrait;
use Drupal\Tests\TestFileCreationTrait;
-use Drupal\Tests\user\Traits\UserCreationTrait;
+use Drupal\Tests\user\Traits\UserCreationTrait as BaseUserCreationTrait;
use Drupal\Tests\XdebugRequestTrait;
use Zend\Diactoros\Uri;
use BaseBlockCreationTrait {
placeBlock as drupalPlaceBlock;
}
- use ContentTypeCreationTrait {
+ use BaseContentTypeCreationTrait {
createContentType as drupalCreateContentType;
}
use CronRunTrait;
use AssertMailTrait {
getMails as drupalGetMails;
}
- use NodeCreationTrait {
+ use BaseNodeCreationTrait {
getNodeByTitle as drupalGetNodeByTitle;
createNode as drupalCreateNode;
}
- use UserCreationTrait {
+ use BaseUserCreationTrait {
createUser as drupalCreateUser;
createRole as drupalCreateRole;
createAdminRole as drupalCreateAdminRole;
$edit = [
'name' => $account->getUsername(),
- 'pass' => $account->pass_raw
+ 'pass' => $account->pass_raw,
];
$this->drupalPostForm('user/login', $edit, t('Log in'));
'@method' => !empty($curl_options[CURLOPT_NOBODY]) ? 'HEAD' : (empty($curl_options[CURLOPT_POSTFIELDS]) ? 'GET' : 'POST'),
'@url' => isset($original_url) ? $original_url : $url,
'@status' => $status,
- '@length' => format_size(strlen($this->getRawContent()))
+ '@length' => format_size(strlen($this->getRawContent())),
];
- $message = SafeMarkup::format('@method @url returned @status (@length).', $message_vars);
+ $message = new FormattableMarkup('@method @url returned @status (@length).', $message_vars);
$this->assertTrue($this->getRawContent() !== FALSE, $message, 'Browser');
return $this->getRawContent();
}
if ($parameters[1] === 'User deprecated function') {
if (getenv('SYMFONY_DEPRECATIONS_HELPER') !== 'disabled') {
$message = (string) $parameters[0];
- if (!in_array($message, DeprecationListenerTrait::getSkippedDeprecations())) {
+ $test_info = TestDiscovery::getTestInfo(get_called_class());
+ if ($test_info['group'] !== 'legacy' && !in_array($message, DeprecationListenerTrait::getSkippedDeprecations())) {
call_user_func_array([&$this, 'error'], $parameters);
}
}
}
// We have not found a form which contained all fields of $edit.
foreach ($edit as $name => $value) {
- $this->fail(SafeMarkup::format('Failed to set field @name to @value', ['@name' => $name, '@value' => $value]));
+ $this->fail(new FormattableMarkup('Failed to set field @name to @value', ['@name' => $name, '@value' => $value]));
}
if (!$ajax && isset($submit)) {
$this->assertTrue($submit_matches, format_string('Found the @submit button', ['@submit' => $submit]));
$urls = $this->xpath($pattern, [':label' => $label]);
if (isset($urls[$index])) {
$url_target = $this->getAbsoluteUrl($urls[$index]['href']);
- $this->pass(SafeMarkup::format('Clicked link %label (@url_target) from @url_before', ['%label' => $label, '@url_target' => $url_target, '@url_before' => $url_before]), 'Browser');
+ $this->pass(new FormattableMarkup('Clicked link %label (@url_target) from @url_before', ['%label' => $label, '@url_target' => $url_target, '@url_before' => $url_before]), 'Browser');
return $this->drupalGet($url_target);
}
- $this->fail(SafeMarkup::format('Link %label does not exist on @url_before', ['%label' => $label, '@url_before' => $url_before]), 'Browser');
+ $this->fail(new FormattableMarkup('Link %label does not exist on @url_before', ['%label' => $label, '@url_before' => $url_before]), 'Browser');
return FALSE;
}
* (optional) Any additional options to pass for $path to the url generator.
* @param $message
* (optional) A message to display with the assertion. Do not translate
- * messages: use \Drupal\Component\Utility\SafeMarkup::format() to embed
+ * 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 $group
}
$url = $url_obj->setAbsolute()->toString();
if (!$message) {
- $message = SafeMarkup::format('Expected @url matches current URL (@current_url).', [
+ $message = new FormattableMarkup('Expected @url matches current URL (@current_url).', [
'@url' => var_export($url, TRUE),
'@current_url' => $this->getUrl(),
]);
* of all codes see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html.
* @param $message
* (optional) A message to display with the assertion. Do not translate
- * messages: use \Drupal\Component\Utility\SafeMarkup::format() to embed
+ * 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 $group
protected function assertResponse($code, $message = '', $group = 'Browser') {
$curl_code = curl_getinfo($this->curlHandle, CURLINFO_HTTP_CODE);
$match = is_array($code) ? in_array($curl_code, $code) : $curl_code == $code;
- return $this->assertTrue($match, $message ? $message : SafeMarkup::format('HTTP response expected @code, actual @curl_code', ['@code' => $code, '@curl_code' => $curl_code]), $group);
+ return $this->assertTrue($match, $message ? $message : new FormattableMarkup('HTTP response expected @code, actual @curl_code', ['@code' => $code, '@curl_code' => $curl_code]), $group);
}
/**
* of all codes see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html.
* @param $message
* (optional) A message to display with the assertion. Do not translate
- * messages: use \Drupal\Component\Utility\SafeMarkup::format() to embed
+ * 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 $group
protected function assertNoResponse($code, $message = '', $group = 'Browser') {
$curl_code = curl_getinfo($this->curlHandle, CURLINFO_HTTP_CODE);
$match = is_array($code) ? in_array($curl_code, $code) : $curl_code == $code;
- return $this->assertFalse($match, $message ? $message : SafeMarkup::format('HTTP response not expected @code, actual @curl_code', ['@code' => $code, '@curl_code' => $curl_code]), $group);
+ return $this->assertFalse($match, $message ? $message : new FormattableMarkup('HTTP response not expected @code, actual @curl_code', ['@code' => $code, '@curl_code' => $curl_code]), $group);
}
/**