Commit b864a3a5 authored by alexpott's avatar alexpott

Issue #2710201 by alexpott, andypost: Fix...

Issue #2710201 by alexpott, andypost: Fix Drupal.Semantics.FunctionT.WhiteSpace and Drupal.Semantics.FunctionT.Concat
parent b13374f2
......@@ -37,7 +37,7 @@ function file_help($route_name, RouteMatchInterface $route_match) {
$output .= '<dd>' . t('The <em>settings</em> and the <em>display</em> of the file field can be configured separately. See the <a href=":field_ui">Field UI help</a> for more information on how to manage fields and their display.', array(':field_ui' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ? \Drupal::url('help.page', array('name' => 'field_ui')) : '#')) . '</dd>';
$output .= '<dt>' . t('Allowing file extensions') . '</dt>';
$output .= '<dd>' . t('In the field settings, you can define the allowed file extensions (for example <em>pdf docx psd</em>) for the files that will be uploaded with the file field.') . '</dd>';
$output .= '<dt>' . t('Storing files ') . '</dt>';
$output .= '<dt>' . t('Storing files') . '</dt>';
$output .= '<dd>' . t('Uploaded files can either be stored as <em>public</em> or <em>private</em>, depending on the <a href=":file-system">File system settings</a>. For more information, see the <a href=":system-help">System module help page</a>.', array(':file-system' => \Drupal::url('system.file_system_settings'), ':system-help' => \Drupal::url('help.page', array('name' => 'system')))) . '</dd>';
$output .= '<dt>' . t('Restricting the maximum file size') . '</dt>';
$output .= '<dd>' . t('The maximum file size that users can upload is limited by PHP settings of the server, but you can restrict by entering the desired value as the <em>Maximum upload size</em> setting. The maximum file size is automatically displayed to users in the help text of the file field.') . '</dd>';
......
......@@ -121,8 +121,7 @@ function testForum() {
//Check that the basic forum install creates a default forum topic
$this->drupalGet('/forum');
// Look for the "General discussion" default forum
$this->assertRaw(t('<a href="'. Url::fromRoute('forum.page', ['taxonomy_term' => 1])->toString() .'">General discussion</a>'), "Found the default forum at the /forum listing");
$this->assertRaw(Link::createFromRoute(t('General discussion'), 'forum.page', ['taxonomy_term' => 1])->toString(), "Found the default forum at the /forum listing");
// Check the presence of expected cache tags.
$this->assertCacheTag('config:forum.settings');
......
......@@ -2,6 +2,7 @@
namespace Drupal\system\Tests\Module;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Logger\RfcLogLevel;
/**
......@@ -203,7 +204,10 @@ public function testInstallUninstall() {
$this->assertText('Are you sure you wish to enable experimental modules?');
$this->drupalPostForm(NULL, array(), t('Continue'));
}
$this->assertText(t('@count modules have been enabled: ', array('@count' => count($all_modules))), 'Modules status has been updated.');
// The string tested here is translatable but we are only using a part of it
// so using a translated string is wrong. Doing so would create a new string
// to translate.
$this->assertText(new FormattableMarkup('@count modules have been enabled: ', array('@count' => count($all_modules))), 'Modules status has been updated.');
}
/**
......
......@@ -2,6 +2,7 @@
namespace Drupal\system\Tests\System;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\simpletest\WebTestBase;
/**
......@@ -183,7 +184,7 @@ function testExceptionHandler() {
* Helper function: assert that the error message is found.
*/
function assertErrorMessage(array $error) {
$message = t('%type: @message in %function (line ', $error);
$message = new FormattableMarkup('%type: @message in %function (line ', $error);
$this->assertRaw($message, format_string('Found error message: @message.', array('@message' => $message)));
}
......@@ -191,7 +192,7 @@ function assertErrorMessage(array $error) {
* Helper function: assert that the error message is not found.
*/
function assertNoErrorMessage(array $error) {
$message = t('%type: @message in %function (line ', $error);
$message = new FormattableMarkup('%type: @message in %function (line ', $error);
$this->assertNoRaw($message, format_string('Did not find error message: @message.', array('@message' => $message)));
}
......
......@@ -293,7 +293,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'#title' => $this->t('Show as expanded'),
'#type' => 'checkbox',
'#default_value' => !empty($menu['expanded']),
'#description' => $this->t('If selected and this menu link has children, the menu will always appear expanded. '),
'#description' => $this->t('If selected and this menu link has children, the menu will always appear expanded.'),
];
// Only display the parent selector if Menu UI module is enabled.
......
......@@ -301,7 +301,7 @@ public function getElements() {
if (!isset($elements)) {
// @todo Add possible html5 elements.
$elements = array(
'' => $this->t(' - Use default -'),
'' => $this->t('- Use default -'),
'0' => $this->t('- None -')
);
$elements += \Drupal::config('views.settings')->get('field_rewrite_elements');
......
......@@ -62,6 +62,11 @@
<rule ref="Drupal.InfoFiles.DuplicateEntry"/>
<rule ref="Drupal.InfoFiles.Required"/>
<rule ref="Drupal.Semantics.EmptyInstall"/>
<rule ref="Drupal.Semantics.FunctionT">
<exclude name="Drupal.Semantics.FunctionT.BackslashSingleQuote"/>
<exclude name="Drupal.Semantics.FunctionT.NotLiteralString"/>
<exclude name="Drupal.Semantics.FunctionT.ConcatString"/>
</rule>
<rule ref="Drupal.Semantics.FunctionWatchdog"/>
<rule ref="Drupal.Semantics.InstallHooks"/>
<rule ref="Drupal.Semantics.LStringTranslatable"/>
......
......@@ -45,7 +45,11 @@ public function testMarkupInterfaceEmpty($expected, $variable) {
*/
public function providerTestMarkupInterfaceEmpty() {
return [
// @codingStandardsIgnoreStart
// The first argument to \Drupal\Core\StringTranslation\TranslatableMarkup
// is not supposed to be an empty string.
'empty TranslatableMarkup' => ['', new TranslatableMarkup('')],
// @codingStandardsIgnoreEnd
'non-empty TranslatableMarkup' => ['<span>test</span>', new TranslatableMarkup('test')],
'empty FormattableMarkup' => ['', new FormattableMarkup('', ['@foo' => 'bar'])],
'non-empty FormattableMarkup' => ['<span>bar</span>', new FormattableMarkup('@foo', ['@foo' => 'bar'])],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment