Issue #3159230 by mondrake, sandeep_jangra, ravi.shankar, naresh_bavaskar, larowlan, longwave: AssertLegacyTrait::assert(No)Raw() in functional tests still have a message passed in
parent
97cff664d5
commit
a44a9b1cd0
|
@ -83,7 +83,7 @@ class ConfigurationTest extends BrowserTestBase {
|
|||
$this->assertSession()->statusCodeEquals(200);
|
||||
|
||||
// Make sure that the action was actually deleted.
|
||||
$this->assertRaw(t('The action %action has been deleted.', ['%action' => $new_action_label]), 'Make sure that we get a delete confirmation message.');
|
||||
$this->assertRaw(t('The action %action has been deleted.', ['%action' => $new_action_label]));
|
||||
$this->drupalGet('admin/config/system/actions');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertNoText($new_action_label, "Make sure the action label does not appear on the overview page after we've deleted the action.");
|
||||
|
|
|
@ -93,7 +93,7 @@ abstract class AggregatorTestBase extends BrowserTestBase {
|
|||
*/
|
||||
public function deleteFeed(FeedInterface $feed) {
|
||||
$this->drupalPostForm('aggregator/sources/' . $feed->id() . '/delete', [], t('Delete'));
|
||||
$this->assertRaw(t('The feed %title has been deleted.', ['%title' => $feed->label()]), 'Feed deleted successfully.');
|
||||
$this->assertRaw(t('The feed %title has been deleted.', ['%title' => $feed->label()]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -213,7 +213,7 @@ abstract class AggregatorTestBase extends BrowserTestBase {
|
|||
*/
|
||||
public function deleteFeedItems(FeedInterface $feed) {
|
||||
$this->drupalPostForm('admin/config/services/aggregator/delete/' . $feed->id(), [], t('Delete items'));
|
||||
$this->assertRaw(t('The news items from %title have been deleted.', ['%title' => $feed->label()]), 'Feed items deleted.');
|
||||
$this->assertRaw(t('The news items from %title have been deleted.', ['%title' => $feed->label()]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -62,7 +62,7 @@ class ImportOpmlTest extends AggregatorTestBase {
|
|||
|
||||
$edit = [];
|
||||
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import'));
|
||||
$this->assertRaw(t('<em>Either</em> upload a file or enter a URL.'), 'Error if no fields are filled.');
|
||||
$this->assertRaw(t('<em>Either</em> upload a file or enter a URL.'));
|
||||
|
||||
$path = $this->getEmptyOpml();
|
||||
$edit = [
|
||||
|
@ -70,7 +70,7 @@ class ImportOpmlTest extends AggregatorTestBase {
|
|||
'remote' => file_create_url($path),
|
||||
];
|
||||
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import'));
|
||||
$this->assertRaw(t('<em>Either</em> upload a file or enter a URL.'), 'Error if both fields are filled.');
|
||||
$this->assertRaw(t('<em>Either</em> upload a file or enter a URL.'));
|
||||
|
||||
$edit = ['remote' => 'invalidUrl://empty'];
|
||||
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import'));
|
||||
|
@ -110,8 +110,10 @@ class ImportOpmlTest extends AggregatorTestBase {
|
|||
'refresh' => '900',
|
||||
];
|
||||
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import'));
|
||||
$this->assertRaw(t('A feed with the URL %url already exists.', ['%url' => $feeds[0]['url[0][value]']]), 'Verifying that a duplicate URL was identified');
|
||||
$this->assertRaw(t('A feed named %title already exists.', ['%title' => $feeds[1]['title[0][value]']]), 'Verifying that a duplicate title was identified');
|
||||
// Verify that a duplicate URL was identified.
|
||||
$this->assertRaw(t('A feed with the URL %url already exists.', ['%url' => $feeds[0]['url[0][value]']]));
|
||||
// Verify that a duplicate title was identified.
|
||||
$this->assertRaw(t('A feed named %title already exists.', ['%title' => $feeds[1]['title[0][value]']]));
|
||||
|
||||
$after = $count_query->execute();
|
||||
$this->assertEqual($after, 2, 'Verifying that two distinct feeds were added.');
|
||||
|
|
|
@ -41,7 +41,7 @@ class IpAddressBlockingTest extends BrowserTestBase {
|
|||
$this->drupalPostForm('admin/config/people/ban', $edit, t('Add'));
|
||||
$ip = $connection->select('ban_ip', 'bi')->fields('bi', ['iid'])->condition('ip', $edit['ip'])->execute()->fetchField();
|
||||
$this->assertNotEmpty($ip, 'IP address found in database.');
|
||||
$this->assertRaw(t('The IP address %ip has been banned.', ['%ip' => $edit['ip']]), 'IP address was banned.');
|
||||
$this->assertRaw(t('The IP address %ip has been banned.', ['%ip' => $edit['ip']]));
|
||||
|
||||
// Try to block an IP address that's already blocked.
|
||||
$edit = [];
|
||||
|
@ -72,7 +72,7 @@ class IpAddressBlockingTest extends BrowserTestBase {
|
|||
$this->drupalPostForm('admin/config/people/ban/' . $submit_ip, [], t('Add'));
|
||||
$ip = $connection->select('ban_ip', 'bi')->fields('bi', ['iid'])->condition('ip', $submit_ip)->execute()->fetchField();
|
||||
$this->assertNotEmpty($ip, 'IP address found in database');
|
||||
$this->assertRaw(t('The IP address %ip has been banned.', ['%ip' => $submit_ip]), 'IP address was banned.');
|
||||
$this->assertRaw(t('The IP address %ip has been banned.', ['%ip' => $submit_ip]));
|
||||
|
||||
// Submit your own IP address. This fails, although it works when testing
|
||||
// manually.
|
||||
|
|
|
@ -184,7 +184,7 @@ class BigPipeTest extends BrowserTestBase {
|
|||
1 => $cases['html']->bigPipePlaceholderId,
|
||||
]);
|
||||
|
||||
$this->assertRaw('</body>', 'Closing body tag present.');
|
||||
$this->assertRaw('</body>');
|
||||
|
||||
// Verifying BigPipe assets are present.
|
||||
$this->assertFalse(empty($this->getDrupalSettings()), 'drupalSettings present.');
|
||||
|
@ -213,8 +213,9 @@ class BigPipeTest extends BrowserTestBase {
|
|||
// The 'edge_case__html_exception' case throws an exception.
|
||||
$this->assertRaw('The website encountered an unexpected error. Please try again later');
|
||||
$this->assertRaw('You are not allowed to say llamas are not cool!');
|
||||
$this->assertNoRaw(BigPipe::STOP_SIGNAL, 'BigPipe stop signal absent: error occurred before then.');
|
||||
$this->assertNoRaw('</body>', 'Closing body tag absent: error occurred before then.');
|
||||
// Check that stop signal and closing body tag are absent.
|
||||
$this->assertNoRaw(BigPipe::STOP_SIGNAL);
|
||||
$this->assertNoRaw('</body>');
|
||||
// The exception is expected. Do not interpret it as a test failure.
|
||||
unlink($this->root . '/' . $this->siteDirectory . '/error.log');
|
||||
}
|
||||
|
@ -264,12 +265,12 @@ class BigPipeTest extends BrowserTestBase {
|
|||
// Verifying there are no BigPipe placeholders & replacements.
|
||||
$this->assertSession()->responseHeaderEquals('BigPipe-Test-Placeholders', '<none>');
|
||||
// Verifying BigPipe start/stop signals are absent.
|
||||
$this->assertNoRaw(BigPipe::START_SIGNAL, 'BigPipe start signal absent.');
|
||||
$this->assertNoRaw(BigPipe::STOP_SIGNAL, 'BigPipe stop signal absent.');
|
||||
$this->assertNoRaw(BigPipe::START_SIGNAL);
|
||||
$this->assertNoRaw(BigPipe::STOP_SIGNAL);
|
||||
|
||||
// Verifying BigPipe assets are absent.
|
||||
$this->assertTrue(!isset($this->getDrupalSettings()['bigPipePlaceholderIds']) && empty($this->getDrupalSettings()['ajaxPageState']), 'BigPipe drupalSettings and BigPipe asset library absent.');
|
||||
$this->assertRaw('</body>', 'Closing body tag present.');
|
||||
$this->assertRaw('</body>');
|
||||
|
||||
// Verify that 4xx responses work fine. (4xx responses are handled by
|
||||
// subrequests to a route pointing to a controller with the desired output.)
|
||||
|
@ -283,7 +284,7 @@ class BigPipeTest extends BrowserTestBase {
|
|||
// The 'edge_case__html_exception' case throws an exception.
|
||||
$this->assertRaw('The website encountered an unexpected error. Please try again later');
|
||||
$this->assertRaw('You are not allowed to say llamas are not cool!');
|
||||
$this->assertNoRaw('</body>', 'Closing body tag absent: error occurred before then.');
|
||||
$this->assertNoRaw('</body>');
|
||||
// The exception is expected. Do not interpret it as a test failure.
|
||||
unlink($this->root . '/' . $this->siteDirectory . '/error.log');
|
||||
}
|
||||
|
@ -366,7 +367,7 @@ class BigPipeTest extends BrowserTestBase {
|
|||
foreach ($expected_big_pipe_placeholders as $big_pipe_placeholder_id => $expected_ajax_response) {
|
||||
// Verify expected placeholder.
|
||||
$expected_placeholder_html = '<span data-big-pipe-placeholder-id="' . $big_pipe_placeholder_id . '"></span>';
|
||||
$this->assertRaw($expected_placeholder_html, 'BigPipe placeholder for placeholder ID "' . $big_pipe_placeholder_id . '" found.');
|
||||
$this->assertRaw($expected_placeholder_html);
|
||||
$pos = strpos($this->getSession()->getPage()->getContent(), $expected_placeholder_html);
|
||||
$placeholder_positions[$pos] = $big_pipe_placeholder_id;
|
||||
// Verify expected placeholder replacement.
|
||||
|
@ -397,8 +398,8 @@ class BigPipeTest extends BrowserTestBase {
|
|||
$this->assertSame(count($expected_big_pipe_placeholders_with_replacements), preg_match_all('/' . preg_quote('<script type="application/vnd.drupal-ajax" data-big-pipe-replacement-for-placeholder-with-id="', '/') . '/', $this->getSession()->getPage()->getContent()));
|
||||
|
||||
// Verifying BigPipe start/stop signals.
|
||||
$this->assertRaw(BigPipe::START_SIGNAL, 'BigPipe start signal present.');
|
||||
$this->assertRaw(BigPipe::STOP_SIGNAL, 'BigPipe stop signal present.');
|
||||
$this->assertRaw(BigPipe::START_SIGNAL);
|
||||
$this->assertRaw(BigPipe::STOP_SIGNAL);
|
||||
$start_signal_position = strpos($this->getSession()->getPage()->getContent(), BigPipe::START_SIGNAL);
|
||||
$stop_signal_position = strpos($this->getSession()->getPage()->getContent(), BigPipe::STOP_SIGNAL);
|
||||
$this->assertTrue($start_signal_position < $stop_signal_position, 'BigPipe start signal appears before stop signal.');
|
||||
|
@ -491,7 +492,8 @@ class BigPipeTest extends BrowserTestBase {
|
|||
$this->assertTrue(empty(array_diff(['cookies:big_pipe_nojs', 'session.exists'], explode(' ', $headers[0]['X-Drupal-Cache-Contexts'][0]))), 'The first response varies by the "cookies:big_pipe_nojs" and "session.exists" cache contexts.');
|
||||
$this->assertEqual('no-store, content="BigPipe/1.0"', $headers[1]['Surrogate-Control'][0], 'The second response has a "Surrogate-Control" header.');
|
||||
|
||||
$this->assertNoRaw('<noscript><meta http-equiv="Refresh" content="0; URL=', 'Once the BigPipe no-JS cookie is set, the <meta> refresh is absent: only one redirect ever happens.');
|
||||
// Check that the <meta> refresh is absent, only one redirect ever happens.
|
||||
$this->assertNoRaw('<noscript><meta http-equiv="Refresh" content="0; URL=');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -49,11 +49,11 @@ class BlockInvalidRegionTest extends BrowserTestBase {
|
|||
|
||||
// Clearing the cache should disable the test block placed in the invalid region.
|
||||
$this->drupalPostForm('admin/config/development/performance', [], 'Clear all caches');
|
||||
$this->assertRaw($warning_message, 'Enabled block was in the invalid region and has been disabled.');
|
||||
$this->assertRaw($warning_message);
|
||||
|
||||
// Clear the cache to check if the warning message is not triggered.
|
||||
$this->drupalPostForm('admin/config/development/performance', [], 'Clear all caches');
|
||||
$this->assertNoRaw($warning_message, 'Disabled block in the invalid region will not trigger the warning.');
|
||||
$this->assertNoRaw($warning_message);
|
||||
|
||||
// Place disabled test block in the invalid region of the default theme.
|
||||
\Drupal::configFactory()->getEditable('block.block.' . $block->id())->set('region', 'invalid_region')->save();
|
||||
|
@ -61,7 +61,7 @@ class BlockInvalidRegionTest extends BrowserTestBase {
|
|||
|
||||
// Clear the cache to check if the warning message is not triggered.
|
||||
$this->drupalPostForm('admin/config/development/performance', [], 'Clear all caches');
|
||||
$this->assertNoRaw($warning_message, 'Disabled block in the invalid region will not trigger the warning.');
|
||||
$this->assertNoRaw($warning_message);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ class BlockTest extends BlockTestBase {
|
|||
|
||||
// Confirm that an empty block is not displayed.
|
||||
$this->assertNoText('Powered by Drupal', 'Empty block not displayed.');
|
||||
$this->assertNoRaw('sidebar-first', 'Empty sidebar-first region is not displayed.');
|
||||
$this->assertNoRaw('sidebar-first');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -50,7 +50,8 @@ class BlockXssTest extends BrowserTestBase {
|
|||
|
||||
\Drupal::state()->set('block_test.content', $this->randomMachineName());
|
||||
$this->drupalGet('');
|
||||
$this->assertNoRaw('<script>alert("XSS label");</script>', 'The block title was properly sanitized when rendered.');
|
||||
// Check that the block title was properly sanitized when rendered.
|
||||
$this->assertNoRaw('<script>alert("XSS label");</script>');
|
||||
|
||||
$this->drupalLogin($this->drupalCreateUser([
|
||||
'administer blocks',
|
||||
|
@ -58,7 +59,9 @@ class BlockXssTest extends BrowserTestBase {
|
|||
]));
|
||||
$default_theme = $this->config('system.theme')->get('default');
|
||||
$this->drupalGet('admin/structure/block/list/' . $default_theme);
|
||||
$this->assertNoRaw("<script>alert('XSS subject');</script>", 'The block title was properly sanitized in Block Plugin UI Admin page.');
|
||||
// Check that the block title was properly sanitized in Block Plugin UI
|
||||
// Admin page.
|
||||
$this->assertNoRaw("<script>alert('XSS subject');</script>");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,7 +91,8 @@ class BlockXssTest extends BrowserTestBase {
|
|||
|
||||
$this->drupalGet(Url::fromRoute('block.admin_display'));
|
||||
$this->clickLink('Place block');
|
||||
$this->assertNoRaw('&lt;', 'The page does not have double escaped HTML tags.');
|
||||
// Check that the page does not have double escaped HTML tags.
|
||||
$this->assertNoRaw('&lt;');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Drupal\Tests\block\Functional\Views;
|
||||
|
||||
use Drupal\Component\Render\FormattableMarkup;
|
||||
use Drupal\Component\Serialization\Json;
|
||||
use Drupal\Component\Utility\Crypt;
|
||||
use Drupal\Core\Site\Settings;
|
||||
|
@ -385,8 +384,9 @@ class DisplayBlockTest extends ViewTestBase {
|
|||
$cached_id = 'block:block=' . $cached_block->id() . ':langcode=en|entity.view.edit_form:view=test_view_block:location=block&name=test_view_block&display_id=block_1&langcode=en';
|
||||
$cached_id_token = Crypt::hmacBase64($cached_id, Settings::getHashSalt() . $this->container->get('private_key')->get());
|
||||
// @see \Drupal\contextual\Tests\ContextualDynamicContextTest:assertContextualLinkPlaceHolder()
|
||||
$this->assertRaw('<div' . new Attribute(['data-contextual-id' => $id, 'data-contextual-token' => $id_token]) . '></div>', new FormattableMarkup('Contextual link placeholder with id @id exists.', ['@id' => $id]));
|
||||
$this->assertRaw('<div' . new Attribute(['data-contextual-id' => $cached_id, 'data-contextual-token' => $cached_id_token]) . '></div>', new FormattableMarkup('Contextual link placeholder with id @id exists.', ['@id' => $cached_id]));
|
||||
// Check existence of the contextual link placeholders.
|
||||
$this->assertRaw('<div' . new Attribute(['data-contextual-id' => $id, 'data-contextual-token' => $id_token]) . '></div>');
|
||||
$this->assertRaw('<div' . new Attribute(['data-contextual-id' => $cached_id, 'data-contextual-token' => $cached_id_token]) . '></div>');
|
||||
|
||||
// Get server-rendered contextual links.
|
||||
// @see \Drupal\contextual\Tests\ContextualDynamicContextTest:renderContextualLinks()
|
||||
|
|
|
@ -62,7 +62,7 @@ class BlockContentCreationTest extends BlockContentTestBase {
|
|||
$this->assertRaw(new FormattableMarkup('@block %name has been created.', [
|
||||
'@block' => 'basic',
|
||||
'%name' => $edit['info[0][value]'],
|
||||
]), 'Basic block created.');
|
||||
]));
|
||||
|
||||
// Check that the view mode setting is hidden because only one exists.
|
||||
$this->assertNoFieldByXPath('//select[@name="settings[view_mode]"]', NULL, 'View mode setting hidden because only one exists');
|
||||
|
@ -111,7 +111,7 @@ class BlockContentCreationTest extends BlockContentTestBase {
|
|||
$this->assertRaw(new FormattableMarkup('@block %name has been created.', [
|
||||
'@block' => 'basic',
|
||||
'%name' => $edit['info[0][value]'],
|
||||
]), 'Basic block created.');
|
||||
]));
|
||||
|
||||
// Save our block permanently
|
||||
$this->drupalPostForm(NULL, ['region' => 'content'], t('Save block'));
|
||||
|
@ -186,7 +186,7 @@ class BlockContentCreationTest extends BlockContentTestBase {
|
|||
$this->assertRaw(new FormattableMarkup('@block %name has been created.', [
|
||||
'@block' => 'basic',
|
||||
'%name' => $edit['info[0][value]'],
|
||||
]), 'Basic block created.');
|
||||
]));
|
||||
|
||||
// Check that the block exists in the database.
|
||||
$blocks = \Drupal::entityTypeManager()
|
||||
|
|
|
@ -112,7 +112,7 @@ class BlockContentTypeTest extends BlockContentTestBase {
|
|||
|
||||
// Verify that title and body fields are displayed.
|
||||
$this->drupalGet('block/add/basic');
|
||||
$this->assertRaw('Block description', 'Block info field was found.');
|
||||
$this->assertRaw('Block description');
|
||||
$this->assertNotEmpty($this->cssSelect('#edit-body-0-value'), 'Body field was found.');
|
||||
|
||||
// Change the block type name.
|
||||
|
@ -132,7 +132,7 @@ class BlockContentTypeTest extends BlockContentTestBase {
|
|||
\Drupal::service('entity_field.manager')->clearCachedFieldDefinitions();
|
||||
|
||||
$this->drupalGet('block/add');
|
||||
$this->assertRaw('Bar', 'New name was displayed.');
|
||||
$this->assertRaw('Bar');
|
||||
$this->clickLink('Bar');
|
||||
// Verify that the original machine name was used in the URL.
|
||||
$this->assertSession()->addressEquals(Url::fromRoute('block_content.add_form', ['block_content_type' => 'basic']));
|
||||
|
@ -163,8 +163,7 @@ class BlockContentTypeTest extends BlockContentTestBase {
|
|||
// Attempt to delete the block type, which should not be allowed.
|
||||
$this->drupalGet('admin/structure/block/block-content/manage/' . $type->id() . '/delete');
|
||||
$this->assertRaw(
|
||||
t('%label is used by 1 custom block on your site. You can not remove this block type until you have removed all of the %label blocks.', ['%label' => $type->label()]),
|
||||
'The block type will not be deleted until all blocks of that type are removed.'
|
||||
t('%label is used by 1 custom block on your site. You can not remove this block type until you have removed all of the %label blocks.', ['%label' => $type->label()])
|
||||
);
|
||||
$this->assertNoText('This action cannot be undone.', 'The block type deletion confirmation form is not available.');
|
||||
|
||||
|
@ -173,8 +172,7 @@ class BlockContentTypeTest extends BlockContentTestBase {
|
|||
// Attempt to delete the block type, which should now be allowed.
|
||||
$this->drupalGet('admin/structure/block/block-content/manage/' . $type->id() . '/delete');
|
||||
$this->assertRaw(
|
||||
t('Are you sure you want to delete the custom block type %type?', ['%type' => $type->id()]),
|
||||
'The block type is available for deletion.'
|
||||
t('Are you sure you want to delete the custom block type %type?', ['%type' => $type->id()])
|
||||
);
|
||||
$this->assertText(t('This action cannot be undone.'), 'The custom block type deletion confirmation form is available.');
|
||||
}
|
||||
|
|
|
@ -231,7 +231,7 @@ class BookTest extends BrowserTestBase {
|
|||
// Make sure each part of the book is there.
|
||||
foreach ($nodes as $node) {
|
||||
$this->assertText($node->label(), 'Node title found in printer friendly version.');
|
||||
$this->assertRaw($node->body->processed, 'Node body found in printer friendly version.');
|
||||
$this->assertRaw($node->body->processed);
|
||||
}
|
||||
|
||||
// Make sure we can't export an unsupported format.
|
||||
|
|
|
@ -104,14 +104,14 @@ trait BookTestTrait {
|
|||
$url = $previous->toUrl();
|
||||
$url->setOptions(['attributes' => ['rel' => ['prev'], 'title' => t('Go to previous page')]]);
|
||||
$text = new FormattableMarkup('<b>‹</b> @label', ['@label' => $previous->label()]);
|
||||
$this->assertRaw(Link::fromTextAndUrl($text, $url)->toString(), 'Previous page link found.');
|
||||
$this->assertRaw(Link::fromTextAndUrl($text, $url)->toString());
|
||||
}
|
||||
|
||||
if ($up) {
|
||||
/** @var \Drupal\Core\Url $url */
|
||||
$url = $up->toUrl();
|
||||
$url->setOptions(['attributes' => ['title' => t('Go to parent page')]]);
|
||||
$this->assertRaw(Link::fromTextAndUrl('Up', $url)->toString(), 'Up page link found.');
|
||||
$this->assertRaw(Link::fromTextAndUrl('Up', $url)->toString());
|
||||
}
|
||||
|
||||
if ($next) {
|
||||
|
@ -119,7 +119,7 @@ trait BookTestTrait {
|
|||
$url = $next->toUrl();
|
||||
$url->setOptions(['attributes' => ['rel' => ['next'], 'title' => t('Go to next page')]]);
|
||||
$text = new FormattableMarkup('@label <b>›</b>', ['@label' => $next->label()]);
|
||||
$this->assertRaw(Link::fromTextAndUrl($text, $url)->toString(), 'Next page link found.');
|
||||
$this->assertRaw(Link::fromTextAndUrl($text, $url)->toString());
|
||||
}
|
||||
|
||||
// Compute the expected breadcrumb.
|
||||
|
@ -142,7 +142,7 @@ trait BookTestTrait {
|
|||
// Check printer friendly version.
|
||||
$this->drupalGet('book/export/html/' . $node->id());
|
||||
$this->assertText($node->label(), 'Printer friendly title found.');
|
||||
$this->assertRaw($node->body->processed, 'Printer friendly body found.');
|
||||
$this->assertRaw($node->body->processed);
|
||||
|
||||
$number++;
|
||||
}
|
||||
|
|
|
@ -100,11 +100,12 @@ class CKEditorLoadingTest extends BrowserTestBase {
|
|||
$this->assertCount(0, $format_selector, 'No text format selector exists on the page.');
|
||||
$hidden_input = $this->xpath('//input[@type="hidden" and contains(@class, "editor")]');
|
||||
$this->assertCount(0, $hidden_input, 'A single text format hidden input does not exist on the page.');
|
||||
$this->assertNoRaw(drupal_get_path('module', 'ckeditor') . '/js/ckeditor.js', 'CKEditor glue JS is absent.');
|
||||
// Verify that CKEditor glue JS is absent.
|
||||
$this->assertNoRaw(drupal_get_path('module', 'ckeditor') . '/js/ckeditor.js');
|
||||
|
||||
// On pages where there would never be a text editor, CKEditor JS is absent.
|
||||
$this->drupalGet('user');
|
||||
$this->assertNoRaw(drupal_get_path('module', 'ckeditor') . '/js/ckeditor.js', 'CKEditor glue JS is absent.');
|
||||
$this->assertNoRaw(drupal_get_path('module', 'ckeditor') . '/js/ckeditor.js');
|
||||
|
||||
// The normal user:
|
||||
// - has access to 2 text formats;
|
||||
|
|
|
@ -208,8 +208,10 @@ class ColorTest extends BrowserTestBase {
|
|||
$this->drupalPlaceBlock('system_branding_block', ['region' => 'header']);
|
||||
|
||||
$this->drupalGet('');
|
||||
$this->assertNoRaw('files/color/bartik-', 'Make sure the color logo is not being used.');
|
||||
$this->assertRaw('bartik/logo.svg', 'Make sure the original bartik logo exists.');
|
||||
// Make sure the color logo is not being used.
|
||||
$this->assertNoRaw('files/color/bartik-');
|
||||
// Make sure the original bartik logo exists.
|
||||
$this->assertRaw('bartik/logo.svg');
|
||||
|
||||
// Log in and set the color scheme to 'slate'.
|
||||
$this->drupalLogin($this->bigUser);
|
||||
|
@ -219,8 +221,10 @@ class ColorTest extends BrowserTestBase {
|
|||
// Visit the homepage and ensure color changes.
|
||||
$this->drupalLogout();
|
||||
$this->drupalGet('');
|
||||
$this->assertRaw('files/color/bartik-', 'Make sure the color logo is being used.');
|
||||
$this->assertNoRaw('bartik/logo.svg', 'Make sure the original bartik logo does not exist.');
|
||||
// Make sure the color logo is being used.
|
||||
$this->assertRaw('files/color/bartik-');
|
||||
// Make sure the original bartik logo does not exist.
|
||||
$this->assertNoRaw('bartik/logo.svg');
|
||||
|
||||
// Log in and set the color scheme back to default (delete config).
|
||||
$this->drupalLogin($this->bigUser);
|
||||
|
@ -230,8 +234,10 @@ class ColorTest extends BrowserTestBase {
|
|||
// Log out and ensure there is no color and we have the original logo.
|
||||
$this->drupalLogout();
|
||||
$this->drupalGet('');
|
||||
$this->assertNoRaw('files/color/bartik-', 'Make sure the color logo is not being used.');
|
||||
$this->assertRaw('bartik/logo.svg', 'Make sure the original bartik logo exists.');
|
||||
// Make sure the color logo is not being used.
|
||||
$this->assertNoRaw('files/color/bartik-');
|
||||
// Make sure the original bartik logo exists.
|
||||
$this->assertRaw('bartik/logo.svg');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -137,27 +137,27 @@ class CommentAnonymousTest extends CommentTestBase {
|
|||
// Make sure the user data appears correctly when editing the comment.
|
||||
$this->drupalLogin($this->adminUser);
|
||||
$this->drupalGet('comment/' . $anonymous_comment3->id() . '/edit');
|
||||
$this->assertRaw($author_name, "The anonymous user's name is correct when editing the comment.");
|
||||
$this->assertRaw($author_name);
|
||||
$this->assertFieldByName('uid', '', 'The author field is empty (i.e. anonymous) when editing the comment.');
|
||||
$this->assertRaw($author_mail, "The anonymous user's email address is correct when editing the comment.");
|
||||
$this->assertRaw($author_mail);
|
||||
|
||||
// Unpublish comment.
|
||||
$this->performCommentOperation($anonymous_comment3, 'unpublish');
|
||||
|
||||
$this->drupalGet('admin/content/comment/approval');
|
||||
$this->assertRaw('comments[' . $anonymous_comment3->id() . ']', 'Comment was unpublished.');
|
||||
$this->assertRaw('comments[' . $anonymous_comment3->id() . ']');
|
||||
|
||||
// Publish comment.
|
||||
$this->performCommentOperation($anonymous_comment3, 'publish', TRUE);
|
||||
|
||||
$this->drupalGet('admin/content/comment');
|
||||
$this->assertRaw('comments[' . $anonymous_comment3->id() . ']', 'Comment was published.');
|
||||
$this->assertRaw('comments[' . $anonymous_comment3->id() . ']');
|
||||
|
||||
// Delete comment.
|
||||
$this->performCommentOperation($anonymous_comment3, 'delete');
|
||||
|
||||
$this->drupalGet('admin/content/comment');
|
||||
$this->assertNoRaw('comments[' . $anonymous_comment3->id() . ']', 'Comment was deleted.');
|
||||
$this->assertNoRaw('comments[' . $anonymous_comment3->id() . ']');
|
||||
$this->drupalLogout();
|
||||
|
||||
// Comment 3 was deleted.
|
||||
|
|
|
@ -88,7 +88,7 @@ class CommentBlockTest extends CommentTestBase {
|
|||
for ($i = 0; $i < 10; $i++) {
|
||||
$this->clickLink($comments[$i]->getSubject());
|
||||
$this->assertText($comments[$i]->getSubject(), 'Comment link goes to correct page.');
|
||||
$this->assertRaw('<link rel="canonical"', 'Canonical URL was found in the HTML head');
|
||||
$this->assertRaw('<link rel="canonical"');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ class CommentCSSTest extends CommentTestBase {
|
|||
// user (the viewer) was the author of the comment. We do this in Java-
|
||||
// Script to prevent breaking the render cache.
|
||||
$this->assertCount(1, $this->xpath('//*[contains(@class, "comment") and @data-comment-user-id="' . $case['comment_uid'] . '"]'), 'data-comment-user-id attribute is set on comment.');
|
||||
$this->assertRaw(drupal_get_path('module', 'comment') . '/js/comment-by-viewer.js', 'drupal.comment-by-viewer library is present.');
|
||||
$this->assertRaw(drupal_get_path('module', 'comment') . '/js/comment-by-viewer.js');
|
||||
}
|
||||
|
||||
// Verify the unpublished class.
|
||||
|
|
|
@ -238,7 +238,7 @@ class CommentNonNodeTest extends BrowserTestBase {
|
|||
|
||||
if ($operation == 'delete') {
|
||||
$this->drupalPostForm(NULL, [], t('Delete'));
|
||||
$this->assertRaw(\Drupal::translation()->formatPlural(1, 'Deleted 1 comment.', 'Deleted @count comments.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
|
||||
$this->assertRaw(\Drupal::translation()->formatPlural(1, 'Deleted 1 comment.', 'Deleted @count comments.'));
|
||||
}
|
||||
else {
|
||||
$this->assertText(t('The update has been performed.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
|
||||
|
@ -313,17 +313,17 @@ class CommentNonNodeTest extends BrowserTestBase {
|
|||
// Unpublish the comment.
|
||||
$this->performCommentOperation($comment1, 'unpublish');
|
||||
$this->drupalGet('admin/content/comment/approval');
|
||||
$this->assertRaw('comments[' . $comment1->id() . ']', 'Comment was unpublished.');
|
||||
$this->assertRaw('comments[' . $comment1->id() . ']');
|
||||
|
||||
// Publish the comment.
|
||||
$this->performCommentOperation($comment1, 'publish', TRUE);
|
||||
$this->drupalGet('admin/content/comment');
|
||||
$this->assertRaw('comments[' . $comment1->id() . ']', 'Comment was published.');
|
||||
$this->assertRaw('comments[' . $comment1->id() . ']');
|
||||
|
||||
// Delete the comment.
|
||||
$this->performCommentOperation($comment1, 'delete');
|
||||
$this->drupalGet('admin/content/comment');
|
||||
$this->assertNoRaw('comments[' . $comment1->id() . ']', 'Comment was deleted.');
|
||||
$this->assertNoRaw('comments[' . $comment1->id() . ']');
|
||||
|
||||
// Post another comment.
|
||||
$comment1 = $this->postComment($this->entity, $this->randomMachineName(), $this->randomMachineName());
|
||||
|
@ -331,7 +331,7 @@ class CommentNonNodeTest extends BrowserTestBase {
|
|||
|
||||
// Check that the comment was found.
|
||||
$this->drupalGet('admin/content/comment');
|
||||
$this->assertRaw('comments[' . $comment1->id() . ']', 'Comment was published.');
|
||||
$this->assertRaw('comments[' . $comment1->id() . ']');
|
||||
|
||||
// Check that entity access applies to administrative page.
|
||||
$this->assertText($this->entity->label(), 'Name of commented account found.');
|
||||
|
|
|
@ -45,7 +45,7 @@ class CommentPagerTest extends CommentTestBase {
|
|||
// Check the first page of the node, and confirm the correct comments are
|
||||
// shown.
|
||||
$this->drupalGet('node/' . $node->id());
|
||||
$this->assertRaw(t('next'), 'Paging links found.');
|
||||
$this->assertRaw(t('next'));
|
||||
$this->assertTrue($this->commentExists($comments[0]), 'Comment 1 appears on page 1.');
|
||||
$this->assertFalse($this->commentExists($comments[1]), 'Comment 2 does not appear on page 1.');
|
||||
$this->assertFalse($this->commentExists($comments[2]), 'Comment 3 does not appear on page 1.');
|
||||
|
@ -380,7 +380,7 @@ class CommentPagerTest extends CommentTestBase {
|
|||
// Check the first page of the node, and confirm the correct comments are
|
||||
// shown.
|
||||
$this->drupalGet('node/' . $node->id());
|
||||
$this->assertRaw(t('next'), 'Paging links found.');
|
||||
$this->assertRaw(t('next'));
|
||||
$this->assertRaw('Comment 1 on field comment');
|
||||
$this->assertRaw('Comment 1 on field comment_2');
|
||||
// Navigate to next page of field 1.
|
||||
|
|
|
@ -72,13 +72,13 @@ class CommentRssTest extends CommentTestBase {
|
|||
]));
|
||||
|
||||
$raw = '<comments>' . $this->node->toUrl('canonical', ['fragment' => 'comments', 'absolute' => TRUE])->toString() . '</comments>';
|
||||
$this->assertRaw($raw, 'Comments as part of RSS feed.');
|
||||
$this->assertRaw($raw);
|
||||
|
||||
// Hide comments from RSS feed and check presence.
|
||||
$this->node->set('comment', CommentItemInterface::HIDDEN);
|
||||
$this->node->save();
|
||||
$this->drupalGet('rss.xml');
|
||||
$this->assertNoRaw($raw, 'Hidden comments is not a part of RSS feed.');
|
||||
$this->assertNoRaw($raw);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -364,7 +364,7 @@ abstract class CommentTestBase extends BrowserTestBase {
|
|||
|
||||
if ($operation == 'delete') {
|
||||
$this->drupalPostForm(NULL, [], t('Delete'));
|
||||
$this->assertRaw(\Drupal::translation()->formatPlural(1, 'Deleted 1 comment.', 'Deleted @count comments.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
|
||||
$this->assertRaw(\Drupal::translation()->formatPlural(1, 'Deleted 1 comment.', 'Deleted @count comments.'));
|
||||
}
|
||||
else {
|
||||
$this->assertText(t('The update has been performed.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
|
||||
|
|
|
@ -112,7 +112,7 @@ class CommentTypeTest extends CommentTestBase {
|
|||
$this->drupalPostForm('admin/structure/comment/manage/comment', $edit, t('Save'));
|
||||
|
||||
$this->drupalGet('admin/structure/comment');
|
||||
$this->assertRaw('Bar', 'New name was displayed.');
|
||||
$this->assertRaw('Bar');
|
||||
$this->clickLink('Manage fields');
|
||||
// Verify that the original machine name was used in the URL.
|
||||
$this->assertSession()->addressEquals(Url::fromRoute('entity.comment.field_ui_fields', ['comment_type' => 'comment']));
|
||||
|
@ -158,15 +158,13 @@ class CommentTypeTest extends CommentTestBase {
|
|||
// Attempt to delete the comment type, which should not be allowed.
|
||||
$this->drupalGet('admin/structure/comment/manage/' . $type->id() . '/delete');
|
||||
$this->assertRaw(
|
||||
t('%label is used by 1 comment on your site. You can not remove this comment type until you have removed all of the %label comments.', ['%label' => $type->label()]),
|
||||
'The comment type will not be deleted until all comments of that type are removed.'
|
||||
t('%label is used by 1 comment on your site. You can not remove this comment type until you have removed all of the %label comments.', ['%label' => $type->label()])
|
||||
);
|
||||
$this->assertRaw(
|
||||
t('%label is used by the %field field on your site. You can not remove this comment type until you have removed the field.', [
|
||||
'%label' => 'foo',
|
||||
'%field' => 'node.foo',
|
||||
]),
|
||||
'The comment type will not be deleted until all fields of that type are removed.'
|
||||
])
|
||||
);
|
||||
$this->assertNoText('This action cannot be undone.', 'The comment type deletion confirmation form is not available.');
|
||||
|
||||
|
@ -176,8 +174,7 @@ class CommentTypeTest extends CommentTestBase {
|
|||
// Attempt to delete the comment type, which should now be allowed.
|
||||
$this->drupalGet('admin/structure/comment/manage/' . $type->id() . '/delete');
|
||||
$this->assertRaw(
|
||||
t('Are you sure you want to delete the comment type %type?', ['%type' => $type->id()]),
|
||||
'The comment type is available for deletion.'
|
||||
t('Are you sure you want to delete the comment type %type?', ['%type' => $type->id()])
|
||||
);
|
||||
$this->assertText(t('This action cannot be undone.'), 'The comment type deletion confirmation form is available.');
|
||||
|
||||
|
|
|
@ -277,14 +277,14 @@ class ConfigEntityListTest extends BrowserTestBase {
|
|||
$this->drupalGet('admin/structure/config_test');
|
||||
|
||||
// Item 51 should not be present.
|
||||
$this->assertRaw('Test config entity 50', 'Config entity 50 is shown.');
|
||||
$this->assertNoRaw('Test config entity 51', 'Config entity 51 is on the next page.');
|
||||
$this->assertRaw('Test config entity 50');
|
||||
$this->assertNoRaw('Test config entity 51');
|
||||
|
||||
// Browse to the next page.
|
||||
// Browse to the next page, test config entity 51 is on page 2.
|
||||
$this->clickLink(t('Page 2'));
|
||||
$this->assertNoRaw('Test config entity 50', 'Test config entity 50 is on the previous page.');
|
||||
$this->assertRaw('dotted.default', 'Default config entity appears on page 2.');
|
||||
$this->assertRaw('Test config entity 51', 'Test config entity 51 is on page 2.');
|
||||
$this->assertNoRaw('Test config entity 50');
|
||||
$this->assertRaw('dotted.default');
|
||||
$this->assertRaw('Test config entity 51');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ class ConfigExportUITest extends BrowserTestBase {
|
|||
|
||||
// Check the single export form doesn't have "form-required" elements.
|
||||
$this->drupalGet('admin/config/development/configuration/single/export');
|
||||
$this->assertNoRaw('js-form-required form-required', 'No form required fields are found.');
|
||||
$this->assertNoRaw('js-form-required form-required');
|
||||
|
||||
// Ensure the temporary file is not available to users without the
|
||||
// permission.
|
||||
|
|
|
@ -255,7 +255,8 @@ class ContactPersonalTest extends BrowserTestBase {
|
|||
|
||||
// Submit contact form one over limit.
|
||||
$this->submitPersonalContact($this->contactUser);
|
||||
$this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', ['%number' => $flood_limit, '@interval' => \Drupal::service('date.formatter')->formatInterval($this->config('contact.settings')->get('flood.interval'))]), 'Normal user denied access to flooded contact form.');
|
||||
// Normal user should be denied access to flooded contact form.
|
||||
$this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', ['%number' => $flood_limit, '@interval' => \Drupal::service('date.formatter')->formatInterval($this->config('contact.settings')->get('flood.interval'))]));
|
||||
|
||||
// Test that the admin user can still access the contact form even though
|
||||
// the flood limit was reached.
|
||||
|
|
|
@ -127,7 +127,7 @@ class ContentTranslationContextualLinksTest extends BrowserTestBase {
|
|||
$this->drupalLogin($this->translator);
|
||||
$translate_link = 'node/' . $node->id() . '/translations';
|
||||
$this->drupalGet($translate_link);
|
||||
$this->assertRaw(t('Translations of %label', ['%label' => $node->label()]), 'The contextual link leads to the translate page.');
|
||||
$this->assertRaw(t('Translations of %label', ['%label' => $node->label()]));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -133,10 +133,10 @@ class DbLogTest extends BrowserTestBase {
|
|||
$this->assertSession()->linkByHrefExists($context['referer']);
|
||||
|
||||
// Verify hostname.
|
||||
$this->assertRaw($context['ip'], 'Found hostname on the detail page.');
|
||||
$this->assertRaw($context['ip']);
|
||||
|
||||
// Verify location.
|
||||
$this->assertRaw($context['request_uri'], 'Found location on the detail page.');
|
||||
$this->assertRaw($context['request_uri']);
|
||||
|
||||
// Verify severity.
|
||||
$this->assertText('Notice', 'The severity was properly displayed on the detail page.');
|
||||
|
@ -471,7 +471,7 @@ class DbLogTest extends BrowserTestBase {
|
|||
$link = mb_substr($value, strpos($value, 'admin/reports/dblog/event/'));
|
||||
$this->drupalGet($link);
|
||||
// Check for full message text on the details page.
|
||||
$this->assertRaw($message, 'DBLog event details was found: [delete user]');
|
||||
$this->assertRaw($message);
|
||||
}
|
||||
$this->assertNotEmpty($link, 'DBLog event was recorded: [delete user]');
|
||||
// Visit random URL (to generate page not found event).
|
||||
|
|
|
@ -72,7 +72,7 @@ class EditorAdminTest extends BrowserTestBase {
|
|||
$this->assertCount(1, $select_is_disabled, 'The Text Editor select is disabled.');
|
||||
$this->assertCount(1, $options, 'The Text Editor select has only one option.');
|
||||
$this->assertTrue(($options[0]->getText()) === 'None', 'Option 1 in the Text Editor select is "None".');
|
||||
$this->assertRaw('This option is disabled because no modules that provide a text editor are currently enabled.', 'Description for select present that tells users to install a text editor module.');
|
||||
$this->assertRaw('This option is disabled because no modules that provide a text editor are currently enabled.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -203,7 +203,7 @@ class EditorAdminTest extends BrowserTestBase {
|
|||
$this->assertTrue(($options[1]->getText()) === 'Unicorn Editor', 'Option 2 in the Text Editor select is "Unicorn Editor".');
|
||||
$this->assertTrue($options[0]->hasAttribute('selected'), 'Option 1 ("None") is selected.');
|
||||
// Ensure the none option is selected.
|
||||
$this->assertNoRaw('This option is disabled because no modules that provide a text editor are currently enabled.', 'Description for select absent that tells users to install a text editor module.');
|
||||
$this->assertNoRaw('This option is disabled because no modules that provide a text editor are currently enabled.');
|
||||
|
||||
// Select the "Unicorn Editor" editor and click the "Configure" button.
|
||||
$edit = [
|
||||
|
|
|
@ -108,7 +108,7 @@ class BooleanFieldTest extends BrowserTestBase {
|
|||
$this->drupalGet('entity_test/add');
|
||||
$this->assertFieldByName("{$field_name}[value]", '', 'Widget found.');
|
||||
$this->assertText($this->field->label(), 'Uses field label by default.');
|
||||
$this->assertNoRaw($on, 'Does not use the "On" label.');
|
||||
$this->assertNoRaw($on);
|
||||
|
||||
// Submit and ensure it is accepted.
|
||||
$edit = [
|
||||
|
|
|
@ -90,7 +90,7 @@ class EntityReferenceFieldDefaultValueTest extends BrowserTestBase {
|
|||
|
||||
// Check that default value is selected in default value form.
|
||||
$this->drupalGet('admin/structure/types/manage/reference_content/fields/node.reference_content.' . $field_name);
|
||||
$this->assertRaw('name="default_value_input[' . $field_name . '][0][target_id]" value="' . $referenced_node->getTitle() . ' (' . $referenced_node->id() . ')', 'The default value is selected in instance settings page');
|
||||
$this->assertRaw('name="default_value_input[' . $field_name . '][0][target_id]" value="' . $referenced_node->getTitle() . ' (' . $referenced_node->id() . ')');
|
||||
|
||||
// Check if the ID has been converted to UUID in config entity.
|
||||
$config_entity = $this->config('field.field.node.reference_content.' . $field_name)->get();
|
||||
|
|
|
@ -138,7 +138,7 @@ class FormTest extends FieldTestBase {
|
|||
"{$field_name}[0][value]" => -1,
|
||||
];
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
$this->assertRaw(t('%name does not accept the value -1.', ['%name' => $this->field['label']]), 'Field validation fails with invalid input.');
|
||||
$this->assertRaw(t('%name does not accept the value -1.', ['%name' => $this->field['label']]));
|
||||
// TODO : check that the correct field is flagged for error.
|
||||
|
||||
// Create an entity
|
||||
|
@ -230,7 +230,7 @@ class FormTest extends FieldTestBase {
|
|||
// Submit with missing required value.
|
||||
$edit = [];
|
||||
$this->drupalPostForm('entity_test/add', $edit, t('Save'));
|
||||
$this->assertRaw(t('@name field is required.', ['@name' => $this->field['label']]), 'Required field with no value fails validation');
|
||||
$this->assertRaw(t('@name field is required.', ['@name' => $this->field['label']]));
|
||||
|
||||
// Create an entity
|
||||
$value = mt_rand(1, 127);
|
||||
|
@ -250,7 +250,7 @@ class FormTest extends FieldTestBase {
|
|||
"{$field_name}[0][value]" => $value,
|
||||
];
|
||||
$this->drupalPostForm('entity_test/manage/' . $id . '/edit', $edit, t('Save'));
|
||||
$this->assertRaw(t('@name field is required.', ['@name' => $this->field['label']]), 'Required field with no value fails validation');
|
||||
$this->assertRaw(t('@name field is required.', ['@name' => $this->field['label']]));
|
||||
}
|
||||
|
||||
public function testFieldFormUnlimited() {
|
||||
|
@ -462,7 +462,7 @@ class FormTest extends FieldTestBase {
|
|||
// Submit the form with more values than the field accepts.
|
||||
$edit = [$field_name => '1, 2, 3, 4, 5'];
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
$this->assertRaw('this field cannot hold more than 4 values', 'Form validation failed.');
|
||||
$this->assertRaw('this field cannot hold more than 4 values');
|
||||
// Check that the field values were not submitted.
|
||||
$this->assertFieldValues($entity_init, $field_name, [1, 2, 3]);
|
||||
|
||||
|
|
|
@ -128,14 +128,14 @@ class NestedFormTest extends FieldTestBase {
|
|||
'field_unlimited[1][value]' => -1,
|
||||
];
|
||||
$this->drupalPostForm('test-entity/nested/1/2', $edit, t('Save'));
|
||||
$this->assertRaw(t('%label does not accept the value -1', ['%label' => 'Unlimited field']), 'Entity 1: the field validation error was reported.');
|
||||
$this->assertRaw(t('%label does not accept the value -1', ['%label' => 'Unlimited field']));
|
||||
$error_field = $this->xpath('//input[@id=:id and contains(@class, "error")]', [':id' => 'edit-field-unlimited-1-value']);
|
||||
$this->assertCount(1, $error_field, 'Entity 1: the error was flagged on the correct element.');
|
||||
$edit = [
|
||||
'entity_2[field_unlimited][1][value]' => -1,
|
||||
];
|
||||
$this->drupalPostForm('test-entity/nested/1/2', $edit, t('Save'));
|
||||
$this->assertRaw(t('%label does not accept the value -1', ['%label' => 'Unlimited field']), 'Entity 2: the field validation error was reported.');
|
||||
$this->assertRaw(t('%label does not accept the value -1', ['%label' => 'Unlimited field']));
|
||||
$error_field = $this->xpath('//input[@id=:id and contains(@class, "error")]', [':id' => 'edit-entity-2-field-unlimited-1-value']);
|
||||
$this->assertCount(1, $error_field, 'Entity 2: the error was flagged on the correct element.');
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ class NumberFieldTest extends BrowserTestBase {
|
|||
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
|
||||
$id = $match[1];
|
||||
$this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
|
||||
$this->assertRaw($value, 'Value is displayed.');
|
||||
$this->assertRaw($value);
|
||||
|
||||
// Try to create entries with more than one decimal separator; assert fail.
|
||||
$wrong_entries = [
|
||||
|
@ -104,7 +104,7 @@ class NumberFieldTest extends BrowserTestBase {
|
|||
"{$field_name}[0][value]" => $wrong_entry,
|
||||
];
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
$this->assertRaw(t('%name must be a number.', ['%name' => $field_name]), 'Correctly failed to save decimal value with more than one decimal point.');
|
||||
$this->assertRaw(t('%name must be a number.', ['%name' => $field_name]));
|
||||
}
|
||||
|
||||
// Try to create entries with minus sign not in the first position.
|
||||
|
@ -122,7 +122,7 @@ class NumberFieldTest extends BrowserTestBase {
|
|||
"{$field_name}[0][value]" => $wrong_entry,
|
||||
];
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
$this->assertRaw(t('%name must be a number.', ['%name' => $field_name]), 'Correctly failed to save decimal value with minus sign in the wrong position.');
|
||||
$this->assertRaw(t('%name must be a number.', ['%name' => $field_name]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ class NumberFieldTest extends BrowserTestBase {
|
|||
"{$field_name}[0][value]" => $minimum - 1,
|
||||
];
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
$this->assertRaw(t('%name must be higher than or equal to %minimum.', ['%name' => $field_name, '%minimum' => $minimum]), 'Correctly failed to save integer value less than minimum allowed value.');
|
||||
$this->assertRaw(t('%name must be higher than or equal to %minimum.', ['%name' => $field_name, '%minimum' => $minimum]));
|
||||
|
||||
// Try to set a decimal value
|
||||
$this->drupalGet('entity_test/add');
|
||||
|
@ -217,7 +217,7 @@ class NumberFieldTest extends BrowserTestBase {
|
|||
"{$field_name}[0][value]" => 1.5,
|
||||
];
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
$this->assertRaw(t('%name is not a valid number.', ['%name' => $field_name]), 'Correctly failed to save decimal value to integer field.');
|
||||
$this->assertRaw(t('%name is not a valid number.', ['%name' => $field_name]));
|
||||
|
||||
// Try to set a value above the maximum value
|
||||
$this->drupalGet('entity_test/add');
|
||||
|
@ -225,7 +225,7 @@ class NumberFieldTest extends BrowserTestBase {
|
|||
"{$field_name}[0][value]" => $maximum + 1,
|
||||
];
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
$this->assertRaw(t('%name must be lower than or equal to %maximum.', ['%name' => $field_name, '%maximum' => $maximum]), 'Correctly failed to save integer value greater than maximum allowed value.');
|
||||
$this->assertRaw(t('%name must be lower than or equal to %maximum.', ['%name' => $field_name, '%maximum' => $maximum]));
|
||||
|
||||
// Try to set a wrong integer value.
|
||||
$this->drupalGet('entity_test/add');
|
||||
|
@ -233,7 +233,7 @@ class NumberFieldTest extends BrowserTestBase {
|
|||
"{$field_name}[0][value]" => '20-40',
|
||||
];
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
$this->assertRaw(t('%name must be a number.', ['%name' => $field_name]), 'Correctly failed to save wrong integer value.');
|
||||
$this->assertRaw(t('%name must be a number.', ['%name' => $field_name]));
|
||||
|
||||
// Test with valid entries.
|
||||
$valid_entries = [
|
||||
|
@ -251,7 +251,7 @@ class NumberFieldTest extends BrowserTestBase {
|
|||
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
|
||||
$id = $match[1];
|
||||
$this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
|
||||
$this->assertRaw($valid_entry, 'Value is displayed.');
|
||||
$this->assertRaw($valid_entry);
|
||||
$this->assertNoFieldByXpath('//div[@content="' . $valid_entry . '"]', NULL, 'The "content" attribute is not present since the Prefix is not being displayed');
|
||||
}
|
||||
|
||||
|
@ -348,7 +348,7 @@ class NumberFieldTest extends BrowserTestBase {
|
|||
"{$field_name}[0][value]" => $wrong_entry,
|
||||
];
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
$this->assertRaw(t('%name must be a number.', ['%name' => $field_name]), 'Correctly failed to save float value with more than one decimal point.');
|
||||
$this->assertRaw(t('%name must be a number.', ['%name' => $field_name]));
|
||||
}
|
||||
|
||||
// Try to create entries with minus sign not in the first position.
|
||||
|
@ -366,7 +366,7 @@ class NumberFieldTest extends BrowserTestBase {
|
|||
"{$field_name}[0][value]" => $wrong_entry,
|
||||
];
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
$this->assertRaw(t('%name must be a number.', ['%name' => $field_name]), 'Correctly failed to save float value with minus sign in the wrong position.');
|
||||
$this->assertRaw(t('%name must be a number.', ['%name' => $field_name]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -432,7 +432,7 @@ class NumberFieldTest extends BrowserTestBase {
|
|||
];
|
||||
$this->drupalPostForm($field_configuration_url, $edit, t('Save settings'));
|
||||
// Check if an error message is shown.
|
||||
$this->assertNoRaw(t('%name is not a valid number.', ['%name' => t('Minimum')]), 'Saved ' . gettype($minimum_value) . ' value as minimal value on a ' . $field->getType() . ' field');
|
||||
$this->assertNoRaw(t('%name is not a valid number.', ['%name' => t('Minimum')]));
|
||||
// Check if a success message is shown.
|
||||
$this->assertRaw(t('Saved %label configuration.', ['%label' => $field->getLabel()]));
|
||||
// Check if the minimum value was actually set.
|
||||
|
|
|
@ -151,7 +151,7 @@ class NumberFieldTest extends WebDriverTestBase {
|
|||
// Check number_decimal and number_unformatted formatters behavior.
|
||||
$this->drupalGet('node/' . $node->id());
|
||||
$float_formatted = number_format($random_float, $scale, $decimal_separator, $thousand_separator);
|
||||
$this->assertRaw("$prefix$float_formatted$suffix", 'Prefix and suffix added');
|
||||
$this->assertRaw("$prefix$float_formatted$suffix");
|
||||
$this->assertRaw((string) $random_integer);
|
||||
|
||||
// Configure the number_decimal formatter.
|
||||
|
@ -182,7 +182,7 @@ class NumberFieldTest extends WebDriverTestBase {
|
|||
$this->drupalGet('node/' . $node->id());
|
||||
|
||||
$integer_formatted = number_format($random_integer, 0, '', $thousand_separator);
|
||||
$this->assertRaw($integer_formatted, 'Random integer formatted');
|
||||
$this->assertRaw($integer_formatted);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
|
|||
];
|
||||
foreach ($table_headers as $table_header) {
|
||||
// We check that the label appear in the table headings.
|
||||
$this->assertRaw($table_header . '</th>', new FormattableMarkup('%table_header table header was found.', ['%table_header' => $table_header]));
|
||||
$this->assertRaw($table_header . '</th>');
|
||||
}
|
||||
|
||||
// Test the "Add field" action link.
|
||||
|
@ -249,7 +249,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
|
|||
public function addExistingField() {
|
||||
// Check "Re-use existing field" appears.
|
||||
$this->drupalGet('admin/structure/types/manage/page/fields/add-field');
|
||||
$this->assertRaw(t('Re-use an existing field'), '"Re-use existing field" was found.');
|
||||
$this->assertRaw(t('Re-use an existing field'));
|
||||
|
||||
// Check that fields of other entity types (here, the 'comment_body' field)
|
||||
// do not show up in the "Re-use existing field" list.
|
||||
|
@ -307,7 +307,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
|
|||
'cardinality_number' => 1,
|
||||
];
|
||||
$this->drupalPostForm($field_edit_path, $edit, t('Save field settings'));
|
||||
$this->assertRaw(t('There is @count entity with @delta or more values in this field.', ['@count' => 1, '@delta' => 2]), 'Correctly failed to set cardinality lower than highest delta.');
|
||||
$this->assertRaw(t('There is @count entity with @delta or more values in this field.', ['@count' => 1, '@delta' => 2]));
|
||||
|
||||
// Create a second entity with three values.
|
||||
$edit = ['title[0][value]' => 'Cardinality 3', 'body[0][value]' => 'Body 1', 'body[1][value]' => 'Body 2', 'body[2][value]' => 'Body 3'];
|
||||
|
@ -330,14 +330,14 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
|
|||
'cardinality_number' => 1,
|
||||
];
|
||||
$this->drupalPostForm($field_edit_path, $edit, t('Save field settings'));
|
||||
$this->assertRaw(t('There are @count entities with @delta or more values in this field.', ['@count' => 2, '@delta' => 2]), 'Correctly failed to set cardinality lower than highest delta.');
|
||||
$this->assertRaw(t('There are @count entities with @delta or more values in this field.', ['@count' => 2, '@delta' => 2]));
|
||||
|
||||
$edit = [
|
||||
'cardinality' => 'number',
|
||||
'cardinality_number' => 2,
|
||||
];
|
||||
$this->drupalPostForm($field_edit_path, $edit, t('Save field settings'));
|
||||
$this->assertRaw(t('There is @count entity with @delta or more values in this field.', ['@count' => 1, '@delta' => 3]), 'Correctly failed to set cardinality lower than highest delta.');
|
||||
$this->assertRaw(t('There is @count entity with @delta or more values in this field.', ['@count' => 1, '@delta' => 3]));
|
||||
|
||||
$edit = [
|
||||
'cardinality' => 'number',
|
||||
|
@ -373,7 +373,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
|
|||
}
|
||||
// Check "Re-use existing field" appears.
|
||||
$this->drupalGet('admin/structure/types/manage/page/fields/add-field');
|
||||
$this->assertRaw(t('Re-use an existing field'), '"Re-use existing field" was found.');
|
||||
$this->assertRaw(t('Re-use an existing field'));
|
||||
|
||||
// Ensure that we test with a label that contains HTML.
|
||||
$label = $this->randomString(4) . '<br/>' . $this->randomString(4);
|
||||
|
|
|
@ -45,17 +45,17 @@ trait FieldUiTestTrait {
|
|||
|
||||
// First step: 'Add field' page.
|
||||
$this->drupalPostForm($bundle_path, $initial_edit, t('Save and continue'));
|
||||
$this->assertRaw(t('These settings apply to the %label field everywhere it is used.', ['%label' => $label]), 'Storage settings page was displayed.');
|
||||
$this->assertRaw(t('These settings apply to the %label field everywhere it is used.', ['%label' => $label]));
|
||||
// Test Breadcrumbs.
|
||||
$this->assertSession()->linkExists($label, 0, 'Field label is correct in the breadcrumb of the storage settings page.');
|
||||
|
||||
// Second step: 'Storage settings' form.
|
||||
$this->drupalPostForm(NULL, $storage_edit, t('Save field settings'));
|
||||
$this->assertRaw(t('Updated field %label field settings.', ['%label' => $label]), 'Redirected to field settings page.');
|
||||
$this->assertRaw(t('Updated field %label field settings.', ['%label' => $label]));
|
||||
|
||||
// Third step: 'Field settings' form.
|
||||
$this->drupalPostForm(NULL, $field_edit, t('Save settings'));
|
||||
$this->assertRaw(t('Saved %label configuration.', ['%label' => $label]), 'Redirected to "Manage fields" page.');
|
||||
$this->assertRaw(t('Saved %label configuration.', ['%label' => $label]));
|
||||
|
||||
// Check that the field appears in the overview form.
|
||||
$this->assertFieldByXPath('//table[@id="field-overview"]//tr/td[1]', $label, 'Field was created and appears in the overview page.');
|
||||
|
@ -86,12 +86,13 @@ trait FieldUiTestTrait {
|
|||
$this->drupalPostForm("$bundle_path/fields/add-field", $initial_edit, t('Save and continue'));
|
||||
// Set the main content to only the content region because the label can
|
||||
// contain HTML which will be auto-escaped by Twig.
|
||||
$this->assertRaw('field-config-edit-form', 'The field config edit form is present.');
|
||||
$this->assertNoRaw('&lt;', 'The page does not have double escaped HTML tags.');
|
||||
$this->assertRaw('field-config-edit-form');
|
||||
// Check that the page does not have double escaped HTML tags.
|
||||
$this->assertNoRaw('&lt;');
|
||||
|
||||
// Second step: 'Field settings' form.
|
||||
$this->drupalPostForm(NULL, $field_edit, t('Save settings'));
|
||||
$this->assertRaw(t('Saved %label configuration.', ['%label' => $label]), 'Redirected to "Manage fields" page.');
|
||||
$this->assertRaw(t('Saved %label configuration.', ['%label' => $label]));
|
||||
|
||||
// Check that the field appears in the overview form.
|
||||
$this->assertFieldByXPath('//table[@id="field-overview"]//tr/td[1]', $label, 'Field was created and appears in the overview page.');
|
||||
|
@ -112,14 +113,14 @@ trait FieldUiTestTrait {
|
|||
public function fieldUIDeleteField($bundle_path, $field_name, $label, $bundle_label) {
|
||||
// Display confirmation form.
|
||||
$this->drupalGet("$bundle_path/fields/$field_name/delete");
|
||||
$this->assertRaw(t('Are you sure you want to delete the field %label', ['%label' => $label]), 'Delete confirmation was found.');
|
||||
$this->assertRaw(t('Are you sure you want to delete the field %label', ['%label' => $label]));
|
||||
|
||||
// Test Breadcrumbs.
|
||||
$this->assertSession()->linkExists($label, 0, 'Field label is correct in the breadcrumb of the field delete page.');
|
||||
|
||||
// Submit confirmation form.
|
||||
$this->drupalPostForm(NULL, [], t('Delete'));
|
||||
$this->assertRaw(t('The field %label has been deleted from the %type content type.', ['%label' => $label, '%type' => $bundle_label]), 'Delete message was found.');
|
||||
$this->assertRaw(t('The field %label has been deleted from the %type content type.', ['%label' => $label, '%type' => $bundle_label]));
|
||||
|
||||
// Check that the field does not appear in the overview form.
|
||||
$this->assertNoFieldByXPath('//table[@id="field-overview"]//span[@class="label-field"]', $label, 'Field does not appear in the overview page.');
|
||||
|
|
|
@ -79,13 +79,13 @@ class FileFieldDisplayTest extends FileFieldTestBase {
|
|||
'#file' => $node_file,
|
||||
];
|
||||
$default_output = \Drupal::service('renderer')->renderRoot($file_link);
|
||||
$this->assertRaw($default_output, 'Default formatter displaying correctly on full node view.');
|
||||
$this->assertRaw($default_output);
|
||||
|
||||
// Turn the "display" option off and check that the file is no longer displayed.
|
||||
$edit = [$field_name . '[0][display]' => FALSE];
|
||||
$this->drupalPostForm('node/' . $nid . '/edit', $edit, t('Save'));
|
||||
|
||||
$this->assertNoRaw($default_output, 'Field is hidden when "display" option is unchecked.');
|
||||
$this->assertNoRaw($default_output);
|
||||
|
||||
// Add a description and make sure that it is displayed.
|
||||
$description = $this->randomMachineName();
|
||||
|
@ -110,8 +110,10 @@ class FileFieldDisplayTest extends FileFieldTestBase {
|
|||
$edit[$field_name . '[1][display]'] = FALSE;
|
||||
$this->drupalPostForm(NULL, $edit, t('Preview'));
|
||||
$this->clickLink(t('Back to content editing'));
|
||||
$this->assertRaw($field_name . '[0][display]', 'First file appears as expected.');
|
||||
$this->assertRaw($field_name . '[1][display]', 'Second file appears as expected.');
|
||||
// First file.
|
||||
$this->assertRaw($field_name . '[0][display]');
|
||||
// Second file.
|
||||
$this->assertRaw($field_name . '[1][display]');
|
||||
$this->assertSession()->responseContains($field_name . '[1][description]');
|
||||
|
||||
// Check that the file fields don't contain duplicate HTML IDs.
|
||||
|
|
|
@ -36,7 +36,7 @@ class FileFieldValidateTest extends FileFieldTestBase {
|
|||
$edit = [];
|
||||
$edit['title[0][value]'] = $this->randomMachineName();
|
||||
$this->drupalPostForm('node/add/' . $type_name, $edit, t('Save'));
|
||||
$this->assertRaw(t('@title field is required.', ['@title' => $field->getLabel()]), 'Node save failed when required file field was empty.');
|
||||
$this->assertRaw(t('@title field is required.', ['@title' => $field->getLabel()]));
|
||||
|
||||
// Create a new node with the uploaded file.
|
||||
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
|
||||
|
@ -57,7 +57,7 @@ class FileFieldValidateTest extends FileFieldTestBase {
|
|||
$edit = [];
|
||||
$edit['title[0][value]'] = $this->randomMachineName();
|
||||
$this->drupalPostForm('node/add/' . $type_name, $edit, t('Save'));
|
||||
$this->assertRaw(t('@title field is required.', ['@title' => $field->getLabel()]), 'Node save failed when required multiple value file field was empty.');
|
||||
$this->assertRaw(t('@title field is required.', ['@title' => $field->getLabel()]));
|
||||
|
||||
// Create a new node with the uploaded file into the multivalue field.
|
||||
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
|
||||
|
@ -104,7 +104,7 @@ class FileFieldValidateTest extends FileFieldTestBase {
|
|||
// Check that uploading the large file fails (1M limit).
|
||||
$this->uploadNodeFile($large_file, $field_name, $type_name);
|
||||
$error_message = t('The file is %filesize exceeding the maximum file size of %maxsize.', ['%filesize' => format_size($large_file->getSize()), '%maxsize' => format_size($file_limit)]);
|
||||
$this->assertRaw($error_message, new FormattableMarkup('Node save failed when file (%filesize) exceeded the max upload size (%maxsize).', ['%filesize' => format_size($large_file->getSize()), '%maxsize' => $max_filesize]));
|
||||
$this->assertRaw($error_message);
|
||||
}
|
||||
|
||||
// Turn off the max filesize.
|
||||
|
@ -148,7 +148,7 @@ class FileFieldValidateTest extends FileFieldTestBase {
|
|||
// Check that the file with the wrong extension cannot be uploaded.
|
||||
$this->uploadNodeFile($test_file, $field_name, $type_name);
|
||||
$error_message = t('Only files with the following extensions are allowed: %files-allowed.', ['%files-allowed' => 'txt']);
|
||||
$this->assertRaw($error_message, 'Node save failed when file uploaded with the wrong extension.');
|
||||
$this->assertRaw($error_message);
|
||||
|
||||
// Enable extension checking for text and image files.
|
||||
$this->updateFileField($field_name, $type_name, ['file_extensions' => "txt $test_file_extension"]);
|
||||
|
|
|
@ -376,12 +376,12 @@ class FileFieldWidgetTest extends FileFieldTestBase {
|
|||
$this->drupalPostForm(NULL, $edit, t('Upload'));
|
||||
|
||||
$error_message = t('Only files with the following extensions are allowed: %files-allowed.', ['%files-allowed' => 'txt']);
|
||||
$this->assertRaw($error_message, t('Validation error when file with wrong extension uploaded (JSMode=%type).', ['%type' => $type]));
|
||||
$this->assertRaw($error_message);
|
||||
|
||||
// Upload file with correct extension, check that error message is removed.
|
||||
$edit[$name] = \Drupal::service('file_system')->realpath($test_file_text->getFileUri());
|
||||
$this->drupalPostForm(NULL, $edit, t('Upload'));
|
||||
$this->assertNoRaw($error_message, t('Validation error removed when file with correct extension uploaded (JSMode=%type).', ['%type' => $type]));
|
||||
$this->assertNoRaw($error_message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,7 +38,7 @@ class FileManagedFileElementTest extends FileFieldTestBase {
|
|||
|
||||
// Submit without a file.
|
||||
$this->drupalPostForm($path, [], t('Save'));
|
||||
$this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', [])]), 'Submitted without a file.');
|
||||
$this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', [])]));
|
||||
|
||||
// Submit with a file, but with an invalid form token. Ensure the file
|
||||
// was not saved.
|
||||
|
@ -60,11 +60,11 @@ class FileManagedFileElementTest extends FileFieldTestBase {
|
|||
$this->drupalPostForm($path, $edit, t('Save'));
|
||||
$last_fid = $this->getLastFileId();
|
||||
$this->assertTrue($last_fid > $last_fid_prior, 'New file got saved.');
|
||||
$this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', [$last_fid])]), 'Submit handler has correct file info.');
|
||||
$this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', [$last_fid])]));
|
||||
|
||||
// Submit no new input, but with a default file.
|
||||
$this->drupalPostForm($path . '/' . $last_fid, [], t('Save'));
|
||||
$this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', [$last_fid])]), 'Empty submission did not change an existing file.');
|
||||
$this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', [$last_fid])]));
|
||||
|
||||
// Upload, then Submit.
|
||||
$last_fid_prior = $this->getLastFileId();
|
||||
|
@ -74,7 +74,7 @@ class FileManagedFileElementTest extends FileFieldTestBase {
|
|||
$last_fid = $this->getLastFileId();
|
||||
$this->assertTrue($last_fid > $last_fid_prior, 'New file got uploaded.');
|
||||
$this->drupalPostForm(NULL, [], t('Save'));
|
||||
$this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', [$last_fid])]), 'Submit handler has correct file info.');
|
||||
$this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', [$last_fid])]));
|
||||
|
||||
// Remove, then Submit.
|
||||
$remove_button_title = $multiple ? t('Remove selected') : t('Remove');
|
||||
|
@ -86,7 +86,7 @@ class FileManagedFileElementTest extends FileFieldTestBase {
|
|||
$this->drupalGet($path . '/' . $last_fid);
|
||||
$this->drupalPostForm(NULL, $remove_edit, $remove_button_title);
|
||||
$this->drupalPostForm(NULL, [], t('Save'));
|
||||
$this->assertRaw(t('The file ids are %fids.', ['%fids' => '']), 'Submission after file removal was successful.');
|
||||
$this->assertRaw(t('The file ids are %fids.', ['%fids' => '']));
|
||||
|
||||
// Upload, then Remove, then Submit.
|
||||
$this->drupalGet($path);
|
||||
|
@ -100,7 +100,7 @@ class FileManagedFileElementTest extends FileFieldTestBase {
|
|||
$this->drupalPostForm(NULL, $remove_edit, $remove_button_title);
|
||||
|
||||
$this->drupalPostForm(NULL, [], t('Save'));
|
||||
$this->assertRaw(t('The file ids are %fids.', ['%fids' => '']), 'Submission after file upload and removal was successful.');
|
||||
$this->assertRaw(t('The file ids are %fids.', ['%fids' => '']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,8 @@ class FileManagedFileElementTest extends FileFieldTestBase {
|
|||
|
||||
// Save the entire form.
|
||||
$this->drupalPostForm(NULL, [], t('Save'));
|
||||
$this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', $fid_list)]), 'Two files saved into a single multiple file element.');
|
||||
// Check that two files are saved into a single multiple file element.
|
||||
$this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', $fid_list)]));
|
||||
|
||||
// Delete only the first file.
|
||||
$edit = [
|
||||
|
|
|
@ -57,7 +57,7 @@ class FilePrivateTest extends FileFieldTestBase {
|
|||
$node_file = File::load($node->{$field_name}->target_id);
|
||||
// Ensure the file can be viewed.
|
||||
$this->drupalGet('node/' . $node->id());
|
||||
$this->assertRaw($node_file->getFilename(), 'File reference is displayed after attaching it');
|
||||
$this->assertRaw($node_file->getFilename());
|
||||
// Ensure the file can be downloaded.
|
||||
$this->drupalGet(file_create_url($node_file->getFileUri()));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
|
|
|
@ -87,7 +87,7 @@ class SaveUploadFormTest extends FileManagedTestBase {
|
|||
];
|
||||
$this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw(t('You WIN!'), 'Found the success message.');
|
||||
$this->assertRaw(t('You WIN!'));
|
||||
|
||||
// Check that the correct hooks were called then clean out the hook
|
||||
// counters.
|
||||
|
@ -166,8 +166,8 @@ class SaveUploadFormTest extends FileManagedTestBase {
|
|||
$this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$message = t('Only files with the following extensions are allowed:') . ' <em class="placeholder">' . $extensions . '</em>';
|
||||
$this->assertRaw($message, 'Cannot upload a disallowed extension');
|
||||
$this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.');
|
||||
$this->assertRaw($message);
|
||||
$this->assertRaw(t('Epic upload FAIL!'));
|
||||
|
||||
// Check that the correct hooks were called.
|
||||
$this->assertFileHooksCalled(['validate']);
|
||||
|
@ -185,8 +185,8 @@ class SaveUploadFormTest extends FileManagedTestBase {
|
|||
|
||||
$this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertNoRaw(t('Only files with the following extensions are allowed:'), 'Can upload an allowed extension.');
|
||||
$this->assertRaw(t('You WIN!'), 'Found the success message.');
|
||||
$this->assertNoRaw(t('Only files with the following extensions are allowed:'));
|
||||
$this->assertRaw(t('You WIN!'));
|
||||
|
||||
// Check that the correct hooks were called.
|
||||
$this->assertFileHooksCalled(['validate', 'load', 'update']);
|
||||
|
@ -202,8 +202,8 @@ class SaveUploadFormTest extends FileManagedTestBase {
|
|||
];
|
||||
$this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertNoRaw(t('Only files with the following extensions are allowed:'), 'Can upload any extension.');
|
||||
$this->assertRaw(t('You WIN!'), 'Found the success message.');
|
||||
$this->assertNoRaw(t('Only files with the following extensions are allowed:'));
|
||||
$this->assertRaw(t('You WIN!'));
|
||||
|
||||
// Check that the correct hooks were called.
|
||||
$this->assertFileHooksCalled(['validate', 'load', 'update']);
|
||||
|
@ -228,9 +228,9 @@ class SaveUploadFormTest extends FileManagedTestBase {
|
|||
$this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$message = t('For security reasons, your upload has been renamed to') . ' <em class="placeholder">' . $this->phpfile->filename . '.txt' . '</em>';
|
||||
$this->assertRaw($message, 'Dangerous file was renamed.');
|
||||
$this->assertRaw(t('File MIME type is text/plain.'), "Dangerous file's MIME type was changed.");
|
||||
$this->assertRaw(t('You WIN!'), 'Found the success message.');
|
||||
$this->assertRaw($message);
|
||||
$this->assertRaw(t('File MIME type is text/plain.'));
|
||||
$this->assertRaw(t('You WIN!'));
|
||||
|
||||
// Check that the correct hooks were called.
|
||||
$this->assertFileHooksCalled(['validate', 'insert']);
|
||||
|
@ -243,9 +243,9 @@ class SaveUploadFormTest extends FileManagedTestBase {
|
|||
|
||||
$this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertNoRaw(t('For security reasons, your upload has been renamed'), 'Found no security message.');
|
||||
$this->assertRaw(t('File name is @filename', ['@filename' => $this->phpfile->filename]), 'Dangerous file was not renamed when insecure uploads is TRUE.');
|
||||
$this->assertRaw(t('You WIN!'), 'Found the success message.');
|
||||
$this->assertNoRaw(t('For security reasons, your upload has been renamed'));
|
||||
$this->assertRaw(t('File name is @filename', ['@filename' => $this->phpfile->filename]));
|
||||
$this->assertRaw(t('You WIN!'));
|
||||
|
||||
// Check that the correct hooks were called.
|
||||
$this->assertFileHooksCalled(['validate', 'insert']);
|
||||
|
@ -279,9 +279,9 @@ class SaveUploadFormTest extends FileManagedTestBase {
|
|||
|
||||
$this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw(t('For security reasons, your upload has been renamed'), 'Found security message.');
|
||||
$this->assertRaw(t('File name is @filename', ['@filename' => $munged_filename]), 'File was successfully munged.');
|
||||
$this->assertRaw(t('You WIN!'), 'Found the success message.');
|
||||
$this->assertRaw(t('For security reasons, your upload has been renamed'));
|
||||
$this->assertRaw(t('File name is @filename', ['@filename' => $munged_filename]));
|
||||
$this->assertRaw(t('You WIN!'));
|
||||
|
||||
// Check that the correct hooks were called.
|
||||
$this->assertFileHooksCalled(['validate', 'insert']);
|
||||
|
@ -297,9 +297,9 @@ class SaveUploadFormTest extends FileManagedTestBase {
|
|||
|
||||
$this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertNoRaw(t('For security reasons, your upload has been renamed'), 'Found no security message.');
|
||||
$this->assertRaw(t('File name is @filename', ['@filename' => $this->image->getFilename()]), 'File was not munged when allowing any extension.');
|
||||
$this->assertRaw(t('You WIN!'), 'Found the success message.');
|
||||
$this->assertNoRaw(t('For security reasons, your upload has been renamed'));
|
||||
$this->assertRaw(t('File name is @filename', ['@filename' => $this->image->getFilename()]));
|
||||
$this->assertRaw(t('You WIN!'));
|
||||
|
||||
// Check that the correct hooks were called.
|
||||
$this->assertFileHooksCalled(['validate', 'insert']);
|
||||
|
@ -317,7 +317,7 @@ class SaveUploadFormTest extends FileManagedTestBase {
|
|||
];
|
||||
$this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw(t('You WIN!'), 'Found the success message.');
|
||||
$this->assertRaw(t('You WIN!'));
|
||||
|
||||
// Check that the correct hooks were called.
|
||||
$this->assertFileHooksCalled(['validate', 'insert']);
|
||||
|
@ -335,7 +335,7 @@ class SaveUploadFormTest extends FileManagedTestBase {
|
|||
];
|
||||
$this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw(t('You WIN!'), 'Found the success message.');
|
||||
$this->assertRaw(t('You WIN!'));
|
||||
|
||||
// Check that the correct hooks were called.
|
||||
$this->assertFileHooksCalled(['validate', 'load', 'update']);
|
||||
|
@ -353,7 +353,7 @@ class SaveUploadFormTest extends FileManagedTestBase {
|
|||
];
|
||||
$this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.');
|
||||
$this->assertRaw(t('Epic upload FAIL!'));
|
||||
|
||||
// Check that the no hooks were called while failing.
|
||||
$this->assertFileHooksCalled([]);
|
||||
|
@ -364,7 +364,7 @@ class SaveUploadFormTest extends FileManagedTestBase {
|
|||
*/
|
||||
public function testNoUpload() {
|
||||
$this->drupalPostForm('file-test/save_upload_from_form_test', [], t('Submit'));
|
||||
$this->assertNoRaw(t('Epic upload FAIL!'), 'Failure message not found.');
|
||||
$this->assertNoRaw(t('Epic upload FAIL!'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -386,8 +386,8 @@ class SaveUploadFormTest extends FileManagedTestBase {
|
|||
\Drupal::state()->set('file_test.disable_error_collection', TRUE);
|
||||
$this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw(t('File upload error. Could not move uploaded file.'), 'Found the failure message.');
|
||||
$this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.');
|
||||
$this->assertRaw(t('File upload error. Could not move uploaded file.'));
|
||||
$this->assertRaw(t('Epic upload FAIL!'));
|
||||
|
||||
// Uploading failed. Now check the log.
|
||||
$this->drupalGet('admin/reports/dblog');
|
||||
|
@ -395,7 +395,7 @@ class SaveUploadFormTest extends FileManagedTestBase {
|
|||
$this->assertRaw(t('Upload error. Could not move uploaded file @file to destination @destination.', [
|
||||
'@file' => $this->image->getFilename(),
|
||||
'@destination' => 'temporary://' . $test_directory . '/' . $this->image->getFilename(),
|
||||
]), 'Found upload error log entry.');
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -412,7 +412,7 @@ class SaveUploadFormTest extends FileManagedTestBase {
|
|||
];
|
||||
$this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw(t('You WIN!'), 'Found the success message.');
|
||||
$this->assertRaw(t('You WIN!'));
|
||||
|
||||
// Ensure the expected error message is present and the counts before and
|
||||
// after calling _file_save_upload_from_form() are correct.
|
||||
|
@ -428,7 +428,7 @@ class SaveUploadFormTest extends FileManagedTestBase {
|
|||
];
|
||||
$this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.');
|
||||
$this->assertRaw(t('Epic upload FAIL!'));
|
||||
|
||||
// Ensure the expected error message is present and the counts before and
|
||||
// after calling _file_save_upload_from_form() are correct.
|
||||
|
@ -442,7 +442,7 @@ class SaveUploadFormTest extends FileManagedTestBase {
|
|||
];
|
||||
$this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw(t('You WIN!'), 'Found the success message.');
|
||||
$this->assertRaw(t('You WIN!'));
|
||||
|
||||
// Ensure the error message is not present and the counts before and after
|
||||
// calling _file_save_upload_from_form() are correct.
|
||||
|
@ -476,10 +476,10 @@ class SaveUploadFormTest extends FileManagedTestBase {
|
|||
$files['files']['file_test_upload'][1] = $file_system->realpath($textfile->uri);
|
||||
$client->request($form->getMethod(), $form->getUri(), $edit, $files);
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.');
|
||||
$this->assertRaw(t('Epic upload FAIL!'));
|
||||
|
||||
// Search for combined error message followed by a formatted list of messages.
|
||||
$this->assertRaw(t('One or more files could not be uploaded.') . '<div class="item-list">', 'Error message contains combined list of validation errors.');
|
||||
$this->assertRaw(t('One or more files could not be uploaded.') . '<div class="item-list">');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -496,7 +496,7 @@ class SaveUploadFormTest extends FileManagedTestBase {
|
|||
];
|
||||
$this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.');
|
||||
$this->assertRaw(t('Epic upload FAIL!'));
|
||||
$this->assertCount(1, $this->cssSelect('input[name="files[file_test_upload][]"].error'), 'File upload field has error.');
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,8 @@ class SaveUploadTest extends FileManagedTestBase {
|
|||
];
|
||||
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw(t('You WIN!'), 'Found the success message.');
|
||||
// Check that the success message is present.
|
||||
$this->assertRaw(t('You WIN!'));
|
||||
|
||||
// Check that the correct hooks were called then clean out the hook
|
||||
// counters.
|
||||
|
@ -186,8 +187,8 @@ class SaveUploadTest extends FileManagedTestBase {
|
|||
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$message = t('Only files with the following extensions are allowed:') . ' <em class="placeholder">' . $extensions . '</em>';
|
||||
$this->assertRaw($message, 'Cannot upload a disallowed extension');
|
||||
$this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.');
|
||||
$this->assertRaw($message);
|
||||
$this->assertRaw(t('Epic upload FAIL!'));
|
||||
|
||||
// Check that the correct hooks were called.
|
||||
$this->assertFileHooksCalled(['validate']);
|
||||
|
@ -205,8 +206,8 @@ class SaveUploadTest extends FileManagedTestBase {
|
|||
|
||||
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertNoRaw(t('Only files with the following extensions are allowed:'), 'Can upload an allowed extension.');
|
||||
$this->assertRaw(t('You WIN!'), 'Found the success message.');
|
||||
$this->assertNoRaw(t('Only files with the following extensions are allowed:'));
|
||||
$this->assertRaw(t('You WIN!'));
|
||||
|
||||
// Check that the correct hooks were called.
|
||||
$this->assertFileHooksCalled(['validate', 'load', 'update']);
|
||||
|
@ -222,8 +223,8 @@ class SaveUploadTest extends FileManagedTestBase {
|
|||
];
|
||||
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertNoRaw(t('Only files with the following extensions are allowed:'), 'Can upload any extension.');
|
||||
$this->assertRaw(t('You WIN!'), 'Found the success message.');
|
||||
$this->assertNoRaw(t('Only files with the following extensions are allowed:'));
|
||||
$this->assertRaw(t('You WIN!'));
|
||||
|
||||
// Check that the correct hooks were called.
|
||||
$this->assertFileHooksCalled(['validate', 'load', 'update']);
|
||||
|
@ -246,10 +247,10 @@ class SaveUploadTest extends FileManagedTestBase {
|
|||
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$message = t('For security reasons, your upload has been renamed to') . ' <em class="placeholder">' . $this->phpfile->filename . '.txt' . '</em>';
|
||||
$this->assertRaw($message, 'Dangerous file was renamed.');
|
||||
$this->assertRaw($message);
|
||||
$this->assertSession()->pageTextContains('File name is php-2.php.txt.');
|
||||
$this->assertRaw(t('File MIME type is text/plain.'), "Dangerous file's MIME type was changed.");
|
||||
$this->assertRaw(t('You WIN!'), 'Found the success message.');
|
||||
$this->assertRaw(t('File MIME type is text/plain.'));
|
||||
$this->assertRaw(t('You WIN!'));
|
||||
|
||||
// Check that the correct hooks were called.
|
||||
$this->assertFileHooksCalled(['validate', 'insert']);
|
||||
|
@ -262,9 +263,9 @@ class SaveUploadTest extends FileManagedTestBase {
|
|||
|
||||
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertNoRaw(t('For security reasons, your upload has been renamed'), 'Found no security message.');
|
||||
$this->assertNoRaw(t('For security reasons, your upload has been renamed'));
|
||||
$this->assertSession()->pageTextContains('File name is php-2.php.');
|
||||
$this->assertRaw(t('You WIN!'), 'Found the success message.');
|
||||
$this->assertRaw(t('You WIN!'));
|
||||
|
||||
// Check that the correct hooks were called.
|
||||
$this->assertFileHooksCalled(['validate', 'insert']);
|
||||
|
@ -296,9 +297,9 @@ class SaveUploadTest extends FileManagedTestBase {
|
|||
|
||||
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw(t('For security reasons, your upload has been renamed'), 'Found security message.');
|
||||
$this->assertRaw(t('File name is @filename', ['@filename' => $munged_filename]), 'File was successfully munged.');
|
||||
$this->assertRaw(t('You WIN!'), 'Found the success message.');
|
||||
$this->assertRaw(t('For security reasons, your upload has been renamed'));
|
||||
$this->assertRaw(t('File name is @filename', ['@filename' => $munged_filename]));
|
||||
$this->assertRaw(t('You WIN!'));
|
||||
|
||||
// Check that the correct hooks were called.
|
||||
$this->assertFileHooksCalled(['validate', 'insert']);
|
||||
|
@ -314,9 +315,9 @@ class SaveUploadTest extends FileManagedTestBase {
|
|||
|
||||
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertNoRaw(t('For security reasons, your upload has been renamed'), 'Found no security message.');
|
||||
$this->assertRaw(t('File name is @filename', ['@filename' => $this->image->getFilename()]), 'File was not munged when allowing any extension.');
|
||||
$this->assertRaw(t('You WIN!'), 'Found the success message.');
|
||||
$this->assertNoRaw(t('For security reasons, your upload has been renamed'));
|
||||
$this->assertRaw(t('File name is @filename', ['@filename' => $this->image->getFilename()]));
|
||||
$this->assertRaw(t('You WIN!'));
|
||||
|
||||
// Check that the correct hooks were called.
|
||||
$this->assertFileHooksCalled(['validate', 'insert']);
|
||||
|
@ -332,7 +333,7 @@ class SaveUploadTest extends FileManagedTestBase {
|
|||
];
|
||||
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw(t('You WIN!'), 'Found the success message.');
|
||||
$this->assertRaw(t('You WIN!'));
|
||||
$this->assertSession()->pageTextContains('File name is image-test_0.png.');
|
||||
|
||||
// Check that the correct hooks were called.
|
||||
|
@ -349,7 +350,7 @@ class SaveUploadTest extends FileManagedTestBase {
|
|||
];
|
||||
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw(t('You WIN!'), 'Found the success message.');
|
||||
$this->assertRaw(t('You WIN!'));
|
||||
$this->assertSession()->pageTextContains('File name is image-test.png.');
|
||||
|
||||
// Check that the correct hooks were called.
|
||||
|
@ -366,7 +367,7 @@ class SaveUploadTest extends FileManagedTestBase {
|
|||
];
|
||||
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.');
|
||||
$this->assertRaw(t('Epic upload FAIL!'));
|
||||
|
||||
// Check that the no hooks were called while failing.
|
||||
$this->assertFileHooksCalled([]);
|
||||
|
@ -377,7 +378,7 @@ class SaveUploadTest extends FileManagedTestBase {
|
|||
*/
|
||||
public function testNoUpload() {
|
||||
$this->drupalPostForm('file-test/upload', [], t('Submit'));
|
||||
$this->assertNoRaw(t('Epic upload FAIL!'), 'Failure message not found.');
|
||||
$this->assertNoRaw(t('Epic upload FAIL!'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -399,8 +400,8 @@ class SaveUploadTest extends FileManagedTestBase {
|
|||
\Drupal::state()->set('file_test.disable_error_collection', TRUE);
|
||||
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw(t('File upload error. Could not move uploaded file.'), 'Found the failure message.');
|
||||
$this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.');
|
||||
$this->assertRaw(t('File upload error. Could not move uploaded file.'));
|
||||
$this->assertRaw(t('Epic upload FAIL!'));
|
||||
|
||||
// Uploading failed. Now check the log.
|
||||
$this->drupalGet('admin/reports/dblog');
|
||||
|
@ -408,7 +409,7 @@ class SaveUploadTest extends FileManagedTestBase {
|
|||
$this->assertRaw(t('Upload error. Could not move uploaded file @file to destination @destination.', [
|
||||
'@file' => $this->image->getFilename(),
|
||||
'@destination' => 'temporary://' . $test_directory . '/' . $this->image->getFilename(),
|
||||
]), 'Found upload error log entry.');
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -204,7 +204,7 @@ class FilterAdminTest extends BrowserTestBase {
|
|||
// Check that the fallback format exists and cannot be disabled.
|
||||
$this->assertTrue($plain == filter_fallback_format(), 'The fallback format is set to plain text.');
|
||||
$this->drupalGet('admin/config/content/formats');
|
||||
$this->assertNoRaw('admin/config/content/formats/manage/' . $plain . '/disable', 'Disable link for the fallback format not found.');
|
||||
$this->assertNoRaw('admin/config/content/formats/manage/' . $plain . '/disable');
|
||||
$this->drupalGet('admin/config/content/formats/manage/' . $plain . '/disable');
|
||||
$this->assertSession()->statusCodeEquals(403);
|
||||
|
||||
|
@ -261,7 +261,7 @@ class FilterAdminTest extends BrowserTestBase {
|
|||
$edit['filters[' . $first_filter . '][status]'] = TRUE;
|
||||
$this->drupalPostForm('admin/config/content/formats/add', $edit, t('Save configuration'));
|
||||
$this->assertSession()->addressEquals('admin/config/content/formats');
|
||||
$this->assertRaw(t('Added text format %format.', ['%format' => $edit['name']]), 'New filter created.');
|
||||
$this->assertRaw(t('Added text format %format.', ['%format' => $edit['name']]));
|
||||
|
||||
filter_formats_reset();
|
||||
$format = FilterFormat::load($edit['format']);
|
||||
|
@ -274,7 +274,7 @@ class FilterAdminTest extends BrowserTestBase {
|
|||
// Disable new filter.
|
||||
$this->drupalPostForm('admin/config/content/formats/manage/' . $format->id() . '/disable', [], t('Disable'));
|
||||
$this->assertSession()->addressEquals('admin/config/content/formats');
|
||||
$this->assertRaw(t('Disabled text format %format.', ['%format' => $edit['name']]), 'Format successfully disabled.');
|
||||
$this->assertRaw(t('Disabled text format %format.', ['%format' => $edit['name']]));
|
||||
|
||||
// Allow authenticated users on full HTML.
|
||||
$format = FilterFormat::load($full);
|
||||
|
@ -283,13 +283,13 @@ class FilterAdminTest extends BrowserTestBase {
|
|||
$edit['roles[' . RoleInterface::AUTHENTICATED_ID . ']'] = 1;
|
||||
$this->drupalPostForm('admin/config/content/formats/manage/' . $full, $edit, t('Save configuration'));
|
||||
$this->assertSession()->addressEquals('admin/config/content/formats/manage/' . $full);
|
||||
$this->assertRaw(t('The text format %format has been updated.', ['%format' => $format->label()]), 'Full HTML format successfully updated.');
|
||||
$this->assertRaw(t('The text format %format has been updated.', ['%format' => $format->label()]));
|
||||
|
||||
// Switch user.
|
||||
$this->drupalLogin($this->webUser);
|
||||
|
||||
$this->drupalGet('node/add/page');
|
||||
$this->assertRaw('<option value="' . $full . '">Full HTML</option>', 'Full HTML filter accessible.');
|
||||
$this->assertRaw('<option value="' . $full . '">Full HTML</option>');
|
||||
|
||||
// Use basic HTML and see if it removes tags that are not allowed.
|
||||
$body = '<em>' . $this->randomMachineName() . '</em>';
|
||||
|
@ -311,7 +311,8 @@ class FilterAdminTest extends BrowserTestBase {
|
|||
$this->assertNotEmpty($node, 'Node found in database.');
|
||||
|
||||
$this->drupalGet('node/' . $node->id());
|
||||
$this->assertRaw($body . $extra_text, 'Filter removed invalid tag.');
|
||||
// Check that filter removed invalid tag.
|
||||
$this->assertRaw($body . $extra_text);
|
||||
|
||||
// Use plain text and see if it escapes all tags, whether allowed or not.
|
||||
// In order to test plain text, we have to enable the hidden variable for
|
||||
|
@ -345,7 +346,7 @@ class FilterAdminTest extends BrowserTestBase {
|
|||
$edit['roles[' . RoleInterface::AUTHENTICATED_ID . ']'] = FALSE;
|
||||
$this->drupalPostForm('admin/config/content/formats/manage/' . $full, $edit, t('Save configuration'));
|
||||
$this->assertSession()->addressEquals('admin/config/content/formats/manage/' . $full);
|
||||
$this->assertRaw(t('The text format %format has been updated.', ['%format' => $format->label()]), 'Full HTML format successfully reverted.');
|
||||
$this->assertRaw(t('The text format %format has been updated.', ['%format' => $format->label()]));
|
||||
$this->drupalGet('admin/config/content/formats/manage/' . $full);
|
||||
$this->assertFieldByName('roles[' . RoleInterface::AUTHENTICATED_ID . ']', $edit['roles[' . RoleInterface::AUTHENTICATED_ID . ']'], 'Changes reverted.');
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ class ForumTest extends BrowserTestBase {
|
|||
// Check that the basic forum install creates a default forum topic
|
||||
$this->drupalGet('/forum');
|
||||
// Look for the "General discussion" default forum
|
||||
$this->assertRaw(Link::createFromRoute(t('General discussion'), 'forum.page', ['taxonomy_term' => 1])->toString(), "Found the default forum at the /forum listing");
|
||||
$this->assertRaw(Link::createFromRoute(t('General discussion'), 'forum.page', ['taxonomy_term' => 1])->toString());
|
||||
// Check the presence of expected cache tags.
|
||||
$this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:forum.settings');
|
||||
|
||||
|
@ -326,13 +326,13 @@ class ForumTest extends BrowserTestBase {
|
|||
$this->assertSession()->linkExists('Add forum');
|
||||
$this->assertSession()->linkExists('Add container');
|
||||
$this->clickLink('edit container');
|
||||
$this->assertRaw('Edit container', 'Followed the link to edit the container');
|
||||
$this->assertRaw('Edit container');
|
||||
// Create forum inside the forum container.
|
||||
$this->forum = $this->createForum('forum', $this->forumContainer['tid']);
|
||||
// Verify the "edit forum" link exists and functions correctly.
|
||||
$this->drupalGet('admin/structure/forum');
|
||||
$this->clickLink('edit forum');
|
||||
$this->assertRaw('Edit forum', 'Followed the link to edit the forum');
|
||||
$this->assertRaw('Edit forum');
|
||||
// Navigate back to forum structure page.
|
||||
$this->drupalGet('admin/structure/forum');
|
||||
// Create second forum in container, destined to be deleted below.
|
||||
|
@ -395,7 +395,7 @@ class ForumTest extends BrowserTestBase {
|
|||
// Edit the vocabulary.
|
||||
$this->drupalPostForm('admin/structure/taxonomy/manage/' . $original_vocabulary->id(), $edit, t('Save'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw(t('Updated vocabulary %name.', ['%name' => $edit['name']]), 'Vocabulary was edited');
|
||||
$this->assertRaw(t('Updated vocabulary %name.', ['%name' => $edit['name']]));
|
||||
|
||||
// Grab the newly edited vocabulary.
|
||||
$current_vocabulary = Vocabulary::load($vid);
|
||||
|
@ -581,12 +581,12 @@ class ForumTest extends BrowserTestBase {
|
|||
$type = t('Forum topic');
|
||||
if ($container) {
|
||||
$this->assertNoText("$type $title has been created.", 'Forum topic was not created');
|
||||
$this->assertRaw(t('The item %title is a forum container, not a forum.', ['%title' => $forum['name']]), 'Error message was shown');
|
||||
$this->assertRaw(t('The item %title is a forum container, not a forum.', ['%title' => $forum['name']]));
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$this->assertText(t('@type @title has been created.', ['@type' => $type, '@title' => $title]), 'Forum topic was created');
|
||||
$this->assertNoRaw(t('The item %title is a forum container, not a forum.', ['%title' => $forum['name']]), 'No error message was shown');
|
||||
$this->assertNoRaw(t('The item %title is a forum container, not a forum.', ['%title' => $forum['name']]));
|
||||
|
||||
// Verify that the creation message contains a link to a node.
|
||||
$this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "node/")]');
|
||||
|
@ -599,8 +599,8 @@ class ForumTest extends BrowserTestBase {
|
|||
|
||||
// View forum topic.
|
||||
$this->drupalGet('node/' . $node->id());
|
||||
$this->assertRaw($title, 'Subject was found');
|
||||
$this->assertRaw($body, 'Body was found');
|
||||
$this->assertRaw($title);
|
||||
$this->assertRaw($body);
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
@ -647,7 +647,7 @@ class ForumTest extends BrowserTestBase {
|
|||
'#theme' => 'breadcrumb',
|
||||
'#links' => $breadcrumb_build,
|
||||
];
|
||||
$this->assertRaw(\Drupal::service('renderer')->renderRoot($breadcrumb), 'Breadcrumbs were displayed');
|
||||
$this->assertRaw(\Drupal::service('renderer')->renderRoot($breadcrumb));
|
||||
|
||||
// View forum edit node.
|
||||
$this->drupalGet('node/' . $node->id() . '/edit');
|
||||
|
@ -681,7 +681,7 @@ class ForumTest extends BrowserTestBase {
|
|||
// Delete forum node.
|
||||
$this->drupalPostForm('node/' . $node->id() . '/delete', [], t('Delete'));
|
||||
$this->assertSession()->statusCodeEquals($response);
|
||||
$this->assertRaw(t('Forum topic %title has been deleted.', ['%title' => $edit['title[0][value]']]), 'Forum node was deleted');
|
||||
$this->assertRaw(t('Forum topic %title has been deleted.', ['%title' => $edit['title[0][value]']]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -711,7 +711,7 @@ class ForumTest extends BrowserTestBase {
|
|||
'#theme' => 'breadcrumb',
|
||||
'#links' => $breadcrumb_build,
|
||||
];
|
||||
$this->assertRaw(\Drupal::service('renderer')->renderRoot($breadcrumb), 'Breadcrumbs were displayed');
|
||||
$this->assertRaw(\Drupal::service('renderer')->renderRoot($breadcrumb));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -77,11 +77,11 @@ class HelpTest extends BrowserTestBase {
|
|||
|
||||
// Verify that hook_help() section title and description appear.
|
||||
$this->assertRaw('<h2>' . t('Module overviews') . '</h2>');
|
||||
$this->assertRaw('<p>' . t('Module overviews are provided by modules. Overviews available for your installed modules:'), '</p>');
|
||||
$this->assertRaw('<p>' . t('Module overviews are provided by modules. Overviews available for your installed modules:') . '</p>');
|
||||
|
||||
// Verify that an empty section is handled correctly.
|
||||
$this->assertRaw('<h2>' . t('Empty section') . '</h2>');
|
||||
$this->assertRaw('<p>' . t('This description should appear.'), '</p>');
|
||||
$this->assertRaw('<p>' . t('This description should appear.') . '</p>');
|
||||
$this->assertText(t('There is currently nothing in this section.'));
|
||||
|
||||
// Make sure links are properly added for modules implementing hook_help().
|
||||
|
|
|
@ -338,7 +338,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
|
|||
|
||||
// Test that image is displayed using newly created style.
|
||||
$this->drupalGet('node/' . $nid);
|
||||
$this->assertRaw(file_url_transform_relative($style->buildUrl($original_uri)), new FormattableMarkup('Image displayed using style @style.', ['@style' => $style_name]));
|
||||
$this->assertRaw(file_url_transform_relative($style->buildUrl($original_uri)));
|
||||
|
||||
// Rename the style and make sure the image field is updated.
|
||||
$new_style_name = strtolower($this->randomMachineName(10));
|
||||
|
@ -353,7 +353,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
|
|||
|
||||
// Reload the image style using the new name.
|
||||
$style = ImageStyle::load($new_style_name);
|
||||
$this->assertRaw(file_url_transform_relative($style->buildUrl($original_uri)), 'Image displayed using style replacement style.');
|
||||
$this->assertRaw(file_url_transform_relative($style->buildUrl($original_uri)));
|
||||
|
||||
// Delete the style and choose a replacement style.
|
||||
$edit = [
|
||||
|
@ -365,7 +365,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
|
|||
|
||||
$replacement_style = ImageStyle::load('thumbnail');
|
||||
$this->drupalGet('node/' . $nid);
|
||||
$this->assertRaw(file_url_transform_relative($replacement_style->buildUrl($original_uri)), 'Image displayed using style replacement style.');
|
||||
$this->assertRaw(file_url_transform_relative($replacement_style->buildUrl($original_uri)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -484,7 +484,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
|
|||
|
||||
// Test that image is displayed using newly created style.
|
||||
$this->drupalGet('node/' . $nid);
|
||||
$this->assertRaw(file_url_transform_relative($style->buildUrl($original_uri)), new FormattableMarkup('Image displayed using style @style.', ['@style' => $style_name]));
|
||||
$this->assertRaw(file_url_transform_relative($style->buildUrl($original_uri)));
|
||||
|
||||
// Copy config to sync, and delete the image style.
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
|
|
|
@ -117,7 +117,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
|
|||
'#alt' => $alt,
|
||||
];
|
||||
$default_output = str_replace("\n", NULL, $renderer->renderRoot($image));
|
||||
$this->assertRaw($default_output, 'Default formatter displaying correctly on full node view.');
|
||||
$this->assertRaw($default_output);
|
||||
|
||||
// Test the image linked to file formatter.
|
||||
$display_options = [
|
||||
|
@ -143,7 +143,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
|
|||
$this->assertCacheContext('url.site');
|
||||
// Verify that no image style cache tags are found.
|
||||
$this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'image_style:');
|
||||
$this->assertRaw($default_output, 'Image linked to file formatter displaying correctly on full node view.');
|
||||
$this->assertRaw($default_output);
|
||||
// Verify that the image can be downloaded.
|
||||
$this->assertEqual(file_get_contents($test_image->uri), $this->drupalGet(file_create_url($image_uri)), 'File was downloaded successfully.');
|
||||
if ($scheme == 'private') {
|
||||
|
@ -208,7 +208,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
|
|||
$this->drupalGet('node/' . $nid);
|
||||
$image_style = ImageStyle::load('thumbnail');
|
||||
$this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', $image_style->getCacheTags()[0]);
|
||||
$this->assertRaw($default_output, 'Image style thumbnail formatter displaying correctly on full node view.');
|
||||
$this->assertRaw($default_output);
|
||||
|
||||
if ($scheme == 'private') {
|
||||
// Log out and ensure the file cannot be accessed.
|
||||
|
@ -304,7 +304,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
|
|||
];
|
||||
$this->drupalPostForm('node/' . $nid . '/edit', $edit, t('Save'));
|
||||
$default_output = str_replace("\n", NULL, $renderer->renderRoot($image));
|
||||
$this->assertRaw($default_output, 'Image displayed using user supplied alt and title attributes.');
|
||||
$this->assertRaw($default_output);
|
||||
|
||||
// Verify that alt/title longer than allowed results in a validation error.
|
||||
$test_size = 2000;
|
||||
|
@ -401,7 +401,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
|
|||
$this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', $file->getCacheTags()[0]);
|
||||
// Verify that no image style cache tags are found.
|
||||
$this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'image_style:');
|
||||
$this->assertRaw($default_output, 'Default image displayed when no user supplied image is present.');
|
||||
$this->assertRaw($default_output);
|
||||
|
||||
// Create a node with an image attached and ensure that the default image
|
||||
// is not displayed.
|
||||
|
@ -426,8 +426,10 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
|
|||
$this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', $file->getCacheTags()[0]);
|
||||
// Verify that no image style cache tags are found.
|
||||
$this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'image_style:');
|
||||
$this->assertNoRaw($default_output, 'Default image is not displayed when user supplied image is present.');
|
||||
$this->assertRaw($image_output, 'User supplied image is displayed.');
|
||||
// Default image should not be displayed.
|
||||
$this->assertNoRaw($default_output);
|
||||
// User supplied image should be displayed.
|
||||
$this->assertRaw($image_output);
|
||||
|
||||
// Remove default image from the field and make sure it is no longer used.
|
||||
// Can't use fillField cause Mink can't fill hidden fields.
|
||||
|
@ -477,7 +479,9 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
|
|||
$this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', $file->getCacheTags()[0]);
|
||||
// Verify that no image style cache tags are found.
|
||||
$this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'image_style:');
|
||||
$this->assertRaw($default_output, 'Default private image displayed when no user supplied image is present.');
|
||||
// Default private image should be displayed when no user supplied image
|
||||
// is present.
|
||||
$this->assertRaw($default_output);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ class LanguageBrowserDetectionTest extends BrowserTestBase {
|
|||
$t_args = [
|
||||
'%browser' => $browser_langcode,
|
||||
];
|
||||
$this->assertRaw(t('The mapping for the %browser browser language code has been deleted.', $t_args), 'The test browser language code has been deleted.');
|
||||
$this->assertRaw(t('The mapping for the %browser browser language code has been deleted.', $t_args));
|
||||
|
||||
// Check we went back to the browser negotiation mapping overview.
|
||||
$this->assertSession()->addressEquals(Url::fromRoute('language.negotiation_browser'));
|
||||
|
|
|
@ -70,7 +70,7 @@ class LanguageListTest extends BrowserTestBase {
|
|||
];
|
||||
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
|
||||
$this->assertSession()->addressEquals(Url::fromRoute('entity.configurable_language.collection'));
|
||||
$this->assertRaw('"edit-languages-' . $langcode . '-weight"', 'Language code found.');
|
||||
$this->assertRaw('"edit-languages-' . $langcode . '-weight"');
|
||||
$this->assertText(t($name), 'Test language added.');
|
||||
|
||||
$language = \Drupal::service('language_manager')->getLanguage($langcode);
|
||||
|
@ -103,7 +103,7 @@ class LanguageListTest extends BrowserTestBase {
|
|||
'label' => $name,
|
||||
];
|
||||
$this->drupalPostForm('admin/config/regional/language/edit/' . $langcode, $edit, t('Save language'));
|
||||
$this->assertRaw($name, 'The language has been updated.');
|
||||
$this->assertRaw($name);
|
||||
$this->assertSession()->addressEquals(Url::fromRoute('entity.configurable_language.collection', [], ['language' => $language]));
|
||||
|
||||
// Change back the default language.
|
||||
|
@ -121,13 +121,13 @@ class LanguageListTest extends BrowserTestBase {
|
|||
// First test the 'cancel' link.
|
||||
$this->clickLink(t('Cancel'));
|
||||
$this->assertSession()->addressEquals(Url::fromRoute('entity.configurable_language.collection', [], ['language' => $english]));
|
||||
$this->assertRaw($name, 'The language was not deleted.');
|
||||
$this->assertRaw($name);
|
||||
// Delete the language for real. This a confirm form, we do not need any
|
||||
// fields changed.
|
||||
$this->drupalPostForm('admin/config/regional/language/delete/' . $langcode, [], t('Delete'));
|
||||
// We need raw here because %language and %langcode will add HTML.
|
||||
$t_args = ['%language' => $name, '%langcode' => $langcode];
|
||||
$this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args), 'The test language has been removed.');
|
||||
$this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args));
|
||||
$this->assertSession()->addressEquals(Url::fromRoute('entity.configurable_language.collection', [], ['language' => $english]));
|
||||
// Verify that language is no longer found.
|
||||
$this->drupalGet('admin/config/regional/language/delete/' . $langcode);
|
||||
|
@ -139,7 +139,7 @@ class LanguageListTest extends BrowserTestBase {
|
|||
$this->rebuildContainer();
|
||||
// We need raw here because %language and %langcode will add HTML.
|
||||
$t_args = ['%language' => 'French', '%langcode' => 'fr'];
|
||||
$this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args), 'The French language has been removed.');
|
||||
$this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args));
|
||||
$this->assertSession()->addressEquals(Url::fromRoute('entity.configurable_language.collection'));
|
||||
// Verify that language is no longer found.
|
||||
$this->drupalGet('admin/config/regional/language/delete/fr');
|
||||
|
@ -177,7 +177,7 @@ class LanguageListTest extends BrowserTestBase {
|
|||
$this->drupalPostForm('admin/config/regional/language/delete/en', [], t('Delete'));
|
||||
// We need raw here because %language and %langcode will add HTML.
|
||||
$t_args = ['%language' => 'English', '%langcode' => 'en'];
|
||||
$this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args), 'The English language has been removed.');
|
||||
$this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args));
|
||||
$this->rebuildContainer();
|
||||
|
||||
// Ensure we can't delete a locked language.
|
||||
|
|
|
@ -159,8 +159,8 @@ class LanguageNegotiationInfoTest extends BrowserTestBase {
|
|||
$this->assertFalse(isset($negotiation[$test_method_id]), 'The disabled test language negotiation method is not part of the content language negotiation settings.');
|
||||
|
||||
// Check that configuration page presents the correct options and settings.
|
||||
$this->assertNoRaw(t('Test language detection'), 'No test language type configuration available.');
|
||||
$this->assertNoRaw(t('This is a test language negotiation method'), 'No test language negotiation method available.');
|
||||
$this->assertNoRaw(t('Test language detection'));
|
||||
$this->assertNoRaw(t('This is a test language negotiation method'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -56,7 +56,7 @@ class LanguageUrlRewritingTest extends BrowserTestBase {
|
|||
|
||||
// Check that drupalSettings contains path prefix.
|
||||
$this->drupalGet('fr/admin/config/regional/language/detection');
|
||||
$this->assertRaw('"pathPrefix":"fr\/"', 'drupalSettings path prefix contains language code.');
|
||||
$this->assertRaw('"pathPrefix":"fr\/"');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -131,7 +131,7 @@ class LocaleContentTest extends BrowserTestBase {
|
|||
// Edit the content and ensure correct language is selected.
|
||||
$path = 'node/' . $node->id() . '/edit';
|
||||
$this->drupalGet($path);
|
||||
$this->assertRaw('<option value="' . $langcode . '" selected="selected">' . $name . '</option>', 'Correct language selected.');
|
||||
$this->assertRaw('<option value="' . $langcode . '" selected="selected">' . $name . '</option>');
|
||||
// Ensure we can change the node language.
|
||||
$edit = [
|
||||
'langcode[0][value]' => 'en',
|
||||
|
|
|
@ -68,9 +68,9 @@ class LocaleExportTest extends BrowserTestBase {
|
|||
], t('Export'));
|
||||
|
||||
// Ensure we have a translation file.
|
||||
$this->assertRaw('# French translation of Drupal', 'Exported French translation file.');
|
||||
$this->assertRaw('# French translation of Drupal');
|
||||
// Ensure our imported translations exist in the file.
|
||||
$this->assertRaw('msgstr "lundi"', 'French translations present in exported file.');
|
||||
$this->assertRaw('msgstr "lundi"');
|
||||
|
||||
// Import some more French translations which will be marked as customized.
|
||||
$name = $file_system->tempnam('temporary://', "po2_") . '.po';
|
||||
|
@ -98,11 +98,11 @@ class LocaleExportTest extends BrowserTestBase {
|
|||
], t('Export'));
|
||||
|
||||
// Ensure we have a translation file.
|
||||
$this->assertRaw('# French translation of Drupal', 'Exported French translation file with only customized strings.');
|
||||
$this->assertRaw('# French translation of Drupal');
|
||||
// Ensure the customized translations exist in the file.
|
||||
$this->assertRaw('msgstr "janvier"', 'French custom translation present in exported file.');
|
||||
$this->assertRaw('msgstr "janvier"');
|
||||
// Ensure no untranslated strings exist in the file.
|
||||
$this->assertNoRaw('msgid "February"', 'Untranslated string not present in exported file.');
|
||||
$this->assertNoRaw('msgid "February"');
|
||||
|
||||
// Export only untranslated French translations.
|
||||
$this->drupalPostForm('admin/config/regional/translate/export', [
|
||||
|
@ -113,11 +113,11 @@ class LocaleExportTest extends BrowserTestBase {
|
|||
], t('Export'));
|
||||
|
||||
// Ensure we have a translation file.
|
||||
$this->assertRaw('# French translation of Drupal', 'Exported French translation file with only untranslated strings.');
|
||||
$this->assertRaw('# French translation of Drupal');
|
||||
// Ensure no customized translations exist in the file.
|
||||
$this->assertNoRaw('msgstr "janvier"', 'French custom translation not present in exported file.');
|
||||
$this->assertNoRaw('msgstr "janvier"');
|
||||
// Ensure the untranslated strings exist in the file, and with right quotes.
|
||||
$this->assertRaw($this->getUntranslatedString(), 'Empty string present in exported file.');
|
||||
$this->assertRaw($this->getUntranslatedString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -131,7 +131,7 @@ class LocaleExportTest extends BrowserTestBase {
|
|||
// Get the translation template file.
|
||||
$this->drupalPostForm('admin/config/regional/translate/export', [], t('Export'));
|
||||
// Ensure we have a translation file.
|
||||
$this->assertRaw('# LANGUAGE translation of PROJECT', 'Exported translation template file.');
|
||||
$this->assertRaw('# LANGUAGE translation of PROJECT');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -86,10 +86,10 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
|
|||
]);
|
||||
$this->config('locale.settings');
|
||||
// The import should automatically create the corresponding language.
|
||||
$this->assertRaw(t('The language %language has been created.', ['%language' => 'French']), 'The language has been automatically created.');
|
||||
$this->assertRaw(t('The language %language has been created.', ['%language' => 'French']));
|
||||
|
||||
// The import should have created 8 strings.
|
||||
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 8, '%update' => 0, '%delete' => 0]), 'The translation file was successfully imported.');
|
||||
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 8, '%update' => 0, '%delete' => 0]));
|
||||
|
||||
// This import should have saved plural forms to have 2 variants.
|
||||
$locale_plurals = \Drupal::service('locale.plural.formula')->getNumberOfPlurals('fr');
|
||||
|
@ -104,10 +104,10 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
|
|||
]);
|
||||
|
||||
// The import should have created 1 string and rejected 2.
|
||||
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 1, '%update' => 0, '%delete' => 0]), 'The translation file was successfully imported.');
|
||||
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 1, '%update' => 0, '%delete' => 0]));
|
||||
|
||||
$skip_message = \Drupal::translation()->formatPlural(2, 'One translation string was skipped because of disallowed or malformed HTML. <a href=":url">See the log</a> for details.', '@count translation strings were skipped because of disallowed or malformed HTML. See the log for details.', [':url' => Url::fromRoute('dblog.overview')->toString()]);
|
||||
$this->assertRaw($skip_message, 'Unsafe strings were skipped.');
|
||||
$this->assertRaw($skip_message);
|
||||
|
||||
// Repeat the process with a user that can access site reports, and this
|
||||
// time the different warnings must contain links to the log.
|
||||
|
@ -119,7 +119,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
|
|||
]);
|
||||
|
||||
$skip_message = \Drupal::translation()->formatPlural(2, 'One translation string was skipped because of disallowed or malformed HTML. <a href=":url">See the log</a> for details.', '@count translation strings were skipped because of disallowed or malformed HTML. <a href=":url">See the log</a> for details.', [':url' => Url::fromRoute('dblog.overview')->toString()]);
|
||||
$this->assertRaw($skip_message, 'Unsafe strings were skipped.');
|
||||
$this->assertRaw($skip_message);
|
||||
|
||||
// Check empty files import with a user that cannot access site reports..
|
||||
$this->drupalLogin($this->adminUser);
|
||||
|
@ -128,7 +128,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
|
|||
'langcode' => 'fr',
|
||||
]);
|
||||
// The import should have created 0 string and rejected 0.
|
||||
$this->assertRaw(t('One translation file could not be imported. See the log for details.'), 'The empty translation file import reported no translations imported.');
|
||||
$this->assertRaw(t('One translation file could not be imported. See the log for details.'));
|
||||
|
||||
// Repeat the process with a user that can access site reports, and this
|
||||
// time the different warnings must contain links to the log.
|
||||
|
@ -138,7 +138,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
|
|||
'langcode' => 'fr',
|
||||
]);
|
||||
// The import should have created 0 string and rejected 0.
|
||||
$this->assertRaw(t('One translation file could not be imported. <a href=":url">See the log</a> for details.', [':url' => Url::fromRoute('dblog.overview')->toString()]), 'The empty translation file import reported no translations imported.');
|
||||
$this->assertRaw(t('One translation file could not be imported. <a href=":url">See the log</a> for details.', [':url' => Url::fromRoute('dblog.overview')->toString()]));
|
||||
|
||||
// Try importing a .po file which doesn't exist.
|
||||
$name = $this->randomMachineName(16);
|
||||
|
@ -156,7 +156,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
|
|||
]);
|
||||
|
||||
// The import should have created 1 string.
|
||||
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 1, '%update' => 0, '%delete' => 0]), 'The translation file was successfully imported.');
|
||||
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 1, '%update' => 0, '%delete' => 0]));
|
||||
// Ensure string wasn't overwritten.
|
||||
$search = [
|
||||
'string' => 'Montag',
|
||||
|
@ -178,7 +178,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
|
|||
]);
|
||||
|
||||
// The import should have updated 2 strings.
|
||||
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 0, '%update' => 2, '%delete' => 0]), 'The translation file was successfully imported.');
|
||||
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 0, '%update' => 2, '%delete' => 0]));
|
||||
// Ensure string was overwritten.
|
||||
$search = [
|
||||
'string' => 'Montag',
|
||||
|
@ -198,7 +198,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
|
|||
]);
|
||||
|
||||
// The import should have created 6 strings.
|
||||
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 6, '%update' => 0, '%delete' => 0]), 'The customized translation file was successfully imported.');
|
||||
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 6, '%update' => 0, '%delete' => 0]));
|
||||
|
||||
// The database should now contain 6 customized strings (two imported
|
||||
// strings are not translated).
|
||||
|
@ -218,7 +218,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
|
|||
]);
|
||||
|
||||
// The import should have created 1 string.
|
||||
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 1, '%update' => 0, '%delete' => 0]), 'The customized translation file was successfully imported.');
|
||||
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 1, '%update' => 0, '%delete' => 0]));
|
||||
// Ensure string wasn't overwritten.
|
||||
$search = [
|
||||
'string' => 'januari',
|
||||
|
@ -237,7 +237,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
|
|||
]);
|
||||
|
||||
// The import should have updated 2 strings.
|
||||
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 0, '%update' => 2, '%delete' => 0]), 'The customized translation file was successfully imported.');
|
||||
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 0, '%update' => 2, '%delete' => 0]));
|
||||
// Ensure string was overwritten.
|
||||
$search = [
|
||||
'string' => 'januari',
|
||||
|
@ -275,7 +275,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
|
|||
'langcode' => $langcode,
|
||||
]);
|
||||
|
||||
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 1, '%update' => 0, '%delete' => 0]), 'The translation file was successfully imported.');
|
||||
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 1, '%update' => 0, '%delete' => 0]));
|
||||
$this->assertIdentical((string) t('Operations', [], ['langcode' => $langcode]), 'Műveletek', 'String imported and translated.');
|
||||
|
||||
// Try importing a .po file.
|
||||
|
@ -283,7 +283,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
|
|||
'langcode' => $langcode,
|
||||
'overwrite_options[not_customized]' => TRUE,
|
||||
]);
|
||||
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 0, '%update' => 0, '%delete' => 1]), 'The translation file was successfully imported.');
|
||||
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 0, '%update' => 0, '%delete' => 1]));
|
||||
|
||||
$str = "Operations";
|
||||
$search = [
|
||||
|
|
|
@ -246,22 +246,22 @@ class LocalePluralFormatTest extends BrowserTestBase {
|
|||
'langcode' => 'fr',
|
||||
], t('Export'));
|
||||
// Ensure we have a translation file.
|
||||
$this->assertRaw('# French translation of Drupal', 'Exported French translation file.');
|
||||
$this->assertRaw('# French translation of Drupal');
|
||||
// Ensure our imported translations exist in the file.
|
||||
$this->assertRaw("msgid \"Monday\"\nmsgstr \"lundi\"", 'French translations present in exported file.');
|
||||
$this->assertRaw("msgid \"Monday\"\nmsgstr \"lundi\"");
|
||||
// Check for plural export specifically.
|
||||
$this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count heure\"\nmsgstr[1] \"@count heures\"", 'Plural translations exported properly.');
|
||||
$this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count heure\"\nmsgstr[1] \"@count heures\"");
|
||||
|
||||
// Get the Croatian translations.
|
||||
$this->drupalPostForm('admin/config/regional/translate/export', [
|
||||
'langcode' => 'hr',
|
||||
], t('Export'));
|
||||
// Ensure we have a translation file.
|
||||
$this->assertRaw('# Croatian translation of Drupal', 'Exported Croatian translation file.');
|
||||
$this->assertRaw('# Croatian translation of Drupal');
|
||||
// Ensure our imported translations exist in the file.
|
||||
$this->assertRaw("msgid \"Monday\"\nmsgstr \"Ponedjeljak\"", 'Croatian translations present in exported file.');
|
||||
$this->assertRaw("msgid \"Monday\"\nmsgstr \"Ponedjeljak\"");
|
||||
// Check for plural export specifically.
|
||||
$this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count sat\"\nmsgstr[1] \"@count sata\"\nmsgstr[2] \"@count sati\"", 'Plural translations exported properly.');
|
||||
$this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count sat\"\nmsgstr[1] \"@count sata\"\nmsgstr[2] \"@count sati\"");
|
||||
|
||||
// Check if the source appears on the translation page.
|
||||
$this->drupalGet('admin/config/regional/translate');
|
||||
|
@ -357,16 +357,16 @@ class LocalePluralFormatTest extends BrowserTestBase {
|
|||
'langcode' => 'fr',
|
||||
], t('Export'));
|
||||
// Check for plural export specifically.
|
||||
$this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count heure edited\"\nmsgstr[1] \"@count heures\"", 'Edited French plural translations for hours exported properly.');
|
||||
$this->assertRaw("msgid \"1 day\"\nmsgid_plural \"@count days\"\nmsgstr[0] \"1 jour\"\nmsgstr[1] \"@count jours\"", 'Added French plural translations for days exported properly.');
|
||||
$this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count heure edited\"\nmsgstr[1] \"@count heures\"");
|
||||
$this->assertRaw("msgid \"1 day\"\nmsgid_plural \"@count days\"\nmsgstr[0] \"1 jour\"\nmsgstr[1] \"@count jours\"");
|
||||
|
||||
// Get the Croatian translations.
|
||||
$this->drupalPostForm('admin/config/regional/translate/export', [
|
||||
'langcode' => 'hr',
|
||||
], t('Export'));
|
||||
// Check for plural export specifically.
|
||||
$this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count sat\"\nmsgstr[1] \"@count sata edited\"\nmsgstr[2] \"@count sati\"", 'Edited Croatian plural translations exported properly.');
|
||||
$this->assertRaw("msgid \"1 day\"\nmsgid_plural \"@count days\"\nmsgstr[0] \"@count dan\"\nmsgstr[1] \"@count dana\"\nmsgstr[2] \"@count dana\"", 'Added Croatian plural translations exported properly.');
|
||||
$this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count sat\"\nmsgstr[1] \"@count sata edited\"\nmsgstr[2] \"@count sati\"");
|
||||
$this->assertRaw("msgid \"1 day\"\nmsgid_plural \"@count days\"\nmsgstr[0] \"@count dan\"\nmsgstr[1] \"@count dana\"\nmsgstr[2] \"@count dana\"");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -93,7 +93,7 @@ class LocaleTranslatedSchemaDefinitionTest extends BrowserTestBase {
|
|||
$this->drupalGet($update_url . '/selection', ['external' => TRUE]);
|
||||
$this->updateRequirementsProblem();
|
||||
$this->drupalGet($update_url . '/selection', ['external' => TRUE]);
|
||||
$this->assertRaw('messages--status', 'No pending updates.');
|
||||
$this->assertRaw('messages--status');
|
||||
$this->assertSession()->linkByHrefNotExists('fr/update.php/run', 'No link to run updates.');
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ class LocaleTranslationUiTest extends BrowserTestBase {
|
|||
t($name, [], ['langcode' => $langcode])->render();
|
||||
// Reset locale cache.
|
||||
$this->container->get('string_translation')->reset();
|
||||
$this->assertRaw('"edit-languages-' . $langcode . '-weight"', 'Language code found.');
|
||||
$this->assertRaw('"edit-languages-' . $langcode . '-weight"');
|
||||
$this->assertText(t($name), 'Test language added.');
|
||||
$this->drupalLogout();
|
||||
|
||||
|
@ -119,7 +119,7 @@ class LocaleTranslationUiTest extends BrowserTestBase {
|
|||
'translation' => 'translated',
|
||||
];
|
||||
$this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
|
||||
$this->assertRaw($translation, 'Non-English translation properly saved.');
|
||||
$this->assertRaw($translation);
|
||||
|
||||
$search = [
|
||||
'string' => $name,
|
||||
|
@ -139,7 +139,7 @@ class LocaleTranslationUiTest extends BrowserTestBase {
|
|||
'translation' => 'translated',
|
||||
];
|
||||
$this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
|
||||
$this->assertRaw($translation_to_en, 'English translation properly saved.');
|
||||
$this->assertRaw($translation_to_en);
|
||||
|
||||
$this->assertTrue($name != $translation && t($name, [], ['langcode' => $langcode]) == $translation, 't() works for non-English.');
|
||||
// Refresh the locale() cache to get fresh data from t() below. We are in
|
||||
|
@ -188,7 +188,7 @@ class LocaleTranslationUiTest extends BrowserTestBase {
|
|||
$this->drupalPostForm($path, [], t('Delete'));
|
||||
// We need raw here because %language and %langcode will add HTML.
|
||||
$t_args = ['%language' => $name, '%langcode' => $langcode];
|
||||
$this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args), 'The test language has been removed.');
|
||||
$this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args));
|
||||
// Reload to remove $name.
|
||||
$this->drupalGet($path);
|
||||
// Verify that language is no longer found.
|
||||
|
@ -210,7 +210,7 @@ class LocaleTranslationUiTest extends BrowserTestBase {
|
|||
$lid => '',
|
||||
];
|
||||
$this->drupalPostForm('admin/config/regional/translate', $edit, t('Save translations'));
|
||||
$this->assertRaw($name, 'The strings have been saved.');
|
||||
$this->assertRaw($name);
|
||||
$this->drupalLogin($translate_user);
|
||||
$search = [
|
||||
'string' => $name,
|
||||
|
|
|
@ -52,7 +52,7 @@ class LocaleUpdateInterfaceTest extends LocaleUpdateBase {
|
|||
$this->assertNoText('Translation update status', 'No status message');
|
||||
|
||||
$this->drupalGet('admin/reports/translations');
|
||||
$this->assertRaw(t('No translatable languages available. <a href=":add_language">Add a language</a> first.', [':add_language' => Url::fromRoute('entity.configurable_language.collection')->toString()]), 'Language message');
|
||||
$this->assertRaw(t('No translatable languages available. <a href=":add_language">Add a language</a> first.', [':add_language' => Url::fromRoute('entity.configurable_language.collection')->toString()]));
|
||||
|
||||
// Add German language.
|
||||
$this->addLanguage('de');
|
||||
|
@ -77,7 +77,7 @@ class LocaleUpdateInterfaceTest extends LocaleUpdateBase {
|
|||
// Check if updates are available for German.
|
||||
$this->drupalGet('admin/reports/status');
|
||||
$this->assertText(t('Translation update status'), 'Status message');
|
||||
$this->assertRaw(t('Updates available for: @languages. See the <a href=":updates">Available translation updates</a> page for more information.', ['@languages' => t('German'), ':updates' => Url::fromRoute('locale.translate_status')->toString()]), 'Updates available message');
|
||||
$this->assertRaw(t('Updates available for: @languages. See the <a href=":updates">Available translation updates</a> page for more information.', ['@languages' => t('German'), ':updates' => Url::fromRoute('locale.translate_status')->toString()]));
|
||||
$this->drupalGet('admin/reports/translations');
|
||||
$this->assertText(t('Updates for: @modules', ['@modules' => 'Locale test translate']), 'Translations available');
|
||||
|
||||
|
@ -91,7 +91,7 @@ class LocaleUpdateInterfaceTest extends LocaleUpdateBase {
|
|||
// Check if no updates were found.
|
||||
$this->drupalGet('admin/reports/status');
|
||||
$this->assertText(t('Translation update status'), 'Status message');
|
||||
$this->assertRaw(t('Missing translations for: @languages. See the <a href=":updates">Available translation updates</a> page for more information.', ['@languages' => t('German'), ':updates' => Url::fromRoute('locale.translate_status')->toString()]), 'Missing translations message');
|
||||
$this->assertRaw(t('Missing translations for: @languages. See the <a href=":updates">Available translation updates</a> page for more information.', ['@languages' => t('German'), ':updates' => Url::fromRoute('locale.translate_status')->toString()]));
|
||||
$this->drupalGet('admin/reports/translations');
|
||||
$this->assertText(t('Missing translations for one project'), 'No translations found');
|
||||
$release_details = new FormattableMarkup('@module (@version). @info', [
|
||||
|
@ -99,7 +99,7 @@ class LocaleUpdateInterfaceTest extends LocaleUpdateBase {
|
|||
'@version' => '1.3-dev',
|
||||
'@info' => t('File not found at %local_path', ['%local_path' => 'core/modules/locale/tests/test.de.po']),
|
||||
]);
|
||||
$this->assertRaw($release_details->__toString(), 'Release details');
|
||||
$this->assertRaw($release_details->__toString());
|
||||
|
||||
// Override Drupal core translation status as 'no translations found'.
|
||||
$status = locale_translation_get_status();
|
||||
|
|
|
@ -127,7 +127,7 @@ class LocaleUpdateTest extends LocaleUpdateBase {
|
|||
$this->drupalGet('admin/reports/translations/check');
|
||||
|
||||
// Check the status on the Available translation status page.
|
||||
$this->assertRaw('<label for="edit-langcodes-de" class="visually-hidden">Update German</label>', 'German language found');
|
||||
$this->assertRaw('<label for="edit-langcodes-de" class="visually-hidden">Update German</label>');
|
||||
$this->assertText('Updates for: Contributed module one, Contributed module two, Custom module one, Locale test', 'Updates found');
|
||||
/** @var \Drupal\Core\Datetime\DateFormatterInterface $date_formatter */
|
||||
$date_formatter = $this->container->get('date.formatter');
|
||||
|
@ -317,7 +317,7 @@ class LocaleUpdateTest extends LocaleUpdateBase {
|
|||
|
||||
// Check if translations have been imported.
|
||||
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.',
|
||||
['%number' => 7, '%update' => 0, '%delete' => 0]), 'One translation file imported.');
|
||||
['%number' => 7, '%update' => 0, '%delete' => 0]));
|
||||
// cSpell:disable-next-line
|
||||
$this->assertTranslation('Tuesday', 'Dienstag', 'de');
|
||||
|
||||
|
@ -364,7 +364,7 @@ class LocaleUpdateTest extends LocaleUpdateBase {
|
|||
|
||||
// Check if the right number of translations are added.
|
||||
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.',
|
||||
['%number' => 8, '%update' => 0, '%delete' => 0]), 'One language added.');
|
||||
['%number' => 8, '%update' => 0, '%delete' => 0]));
|
||||
// cSpell:disable-next-line
|
||||
$this->assertTranslation('Extraday', 'extra dag', 'nl');
|
||||
|
||||
|
|
|
@ -97,10 +97,12 @@ class MenuLinkContentTranslationUITest extends ContentTranslationUITestBase {
|
|||
$edit = [];
|
||||
$edit['admin_theme'] = 'seven';
|
||||
$this->drupalPostForm('admin/appearance', $edit, t('Save configuration'));
|
||||
// Check that edit uses the admin theme.
|
||||
$this->drupalGet('admin/structure/menu/item/' . $entityId . '/edit');
|
||||
$this->assertRaw('core/themes/seven/css/base/elements.css', 'Edit uses admin theme.');
|
||||
$this->assertRaw('core/themes/seven/css/base/elements.css');
|
||||
// Check that translation uses admin theme as well.
|
||||
$this->drupalGet('admin/structure/menu/item/' . $entityId . '/edit/translations');
|
||||
$this->assertRaw('core/themes/seven/css/base/elements.css', 'Translation uses admin theme as well.');
|
||||
$this->assertRaw('core/themes/seven/css/base/elements.css');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -185,14 +185,14 @@ class MenuUiTest extends BrowserTestBase {
|
|||
|
||||
// Assert the new menu.
|
||||
$this->drupalGet('admin/structure/menu/manage/' . $menu_name);
|
||||
$this->assertRaw($label, 'Custom menu was added.');
|
||||
$this->assertRaw($label);
|
||||
|
||||
// Edit the menu.
|
||||
$new_label = $this->randomMachineName(16);
|
||||
$menu->set('label', $new_label);
|
||||
$menu->save();
|
||||
$this->drupalGet('admin/structure/menu/manage/' . $menu_name);
|
||||
$this->assertRaw($new_label, 'Custom menu was edited.');
|
||||
$this->assertRaw($new_label);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -261,7 +261,7 @@ class MenuUiTest extends BrowserTestBase {
|
|||
// Delete custom menu.
|
||||
$this->drupalPostForm("admin/structure/menu/manage/$menu_name/delete", [], t('Delete'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw(t('The menu %title has been deleted.', ['%title' => $label]), 'Custom menu was deleted');
|
||||
$this->assertRaw(t('The menu %title has been deleted.', ['%title' => $label]));
|
||||
$this->assertNull(Menu::load($menu_name), 'Custom menu was deleted');
|
||||
// Test if all menu links associated with the menu were removed from
|
||||
// database.
|
||||
|
@ -270,7 +270,7 @@ class MenuUiTest extends BrowserTestBase {
|
|||
|
||||
// Make sure there's no delete button on system menus.
|
||||
$this->drupalGet('admin/structure/menu/manage/main');
|
||||
$this->assertNoRaw('edit-delete', 'The delete button was not found');
|
||||
$this->assertNoRaw('edit-delete');
|
||||
|
||||
// Try to delete the main menu.
|
||||
$this->drupalGet('admin/structure/menu/manage/main/delete');
|
||||
|
@ -648,7 +648,7 @@ class MenuUiTest extends BrowserTestBase {
|
|||
'title[0][value]' => 'title',
|
||||
];
|
||||
$this->drupalPostForm("admin/structure/menu/manage/{$this->menu->id()}/add", $edit, t('Save'));
|
||||
$this->assertRaw(t("The path '@link_path' is inaccessible.", ['@link_path' => $link_path]), 'Menu link was not created');
|
||||
$this->assertRaw(t("The path '@link_path' is inaccessible.", ['@link_path' => $link_path]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -788,7 +788,7 @@ class MenuUiTest extends BrowserTestBase {
|
|||
// Reset menu link.
|
||||
$this->drupalPostForm("admin/structure/menu/link/{$menu_link->getPluginId()}/reset", [], t('Reset'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw(t('The menu link was reset to its default settings.'), 'Menu link was reset');
|
||||
$this->assertRaw(t('The menu link was reset to its default settings.'));
|
||||
|
||||
// Verify menu link.
|
||||
$instance = \Drupal::service('plugin.manager.menu.link')->createInstance($menu_link->getPluginId());
|
||||
|
@ -808,7 +808,7 @@ class MenuUiTest extends BrowserTestBase {
|
|||
// Delete menu link.
|
||||
$this->drupalPostForm("admin/structure/menu/item/$mlid/delete", [], t('Delete'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw(t('The menu link %title has been deleted.', ['%title' => $title]), 'Menu link was deleted');
|
||||
$this->assertRaw(t('The menu link %title has been deleted.', ['%title' => $title]));
|
||||
|
||||
// Verify deletion.
|
||||
$this->drupalGet('');
|
||||
|
|
|
@ -121,7 +121,7 @@ class NodeAccessFieldTest extends NodeTestBase {
|
|||
|
||||
// Confirm that the new default value appears when creating a new node.
|
||||
$this->drupalGet('node/add/page');
|
||||
$this->assertRaw($default, 'The updated default value is displayed when creating a new node.');
|
||||
$this->assertRaw($default);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ class NodeActionsConfigurationTest extends BrowserTestBase {
|
|||
$this->assertSession()->statusCodeEquals(200);
|
||||
|
||||
// Make sure that the action was actually deleted.
|
||||
$this->assertRaw(t('The action %action has been deleted.', ['%action' => $new_action_label]), 'The delete confirmation message appears after deleting the node_assign_owner_action action.');
|
||||
$this->assertRaw(t('The action %action has been deleted.', ['%action' => $new_action_label]));
|
||||
$this->drupalGet('admin/config/system/actions');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertNoText($new_action_label, 'The label for the node_assign_owner_action action does not appear on the actions administration page after deleting.');
|
||||
|
|
|
@ -85,7 +85,7 @@ class NodeEditFormTest extends NodeTestBase {
|
|||
|
||||
// Check that the title and body fields are displayed with the correct values.
|
||||
// @todo Ideally assertLink would support HTML, but it doesn't.
|
||||
$this->assertRaw('Edit<span class="visually-hidden">(active tab)</span>', 'Edit tab found and marked active.');
|
||||
$this->assertRaw('Edit<span class="visually-hidden">(active tab)</span>');
|
||||
$this->assertFieldByName($title_key, $edit[$title_key], 'Title field displayed.');
|
||||
$this->assertFieldByName($body_key, $edit[$body_key], 'Body field displayed.');
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ class NodeFieldMultilingualTest extends BrowserTestBase {
|
|||
'language_configuration[language_alterable]' => TRUE,
|
||||
];
|
||||
$this->drupalPostForm('admin/structure/types/manage/page', $edit, t('Save content type'));
|
||||
$this->assertRaw(t('The content type %type has been updated.', ['%type' => 'Basic page']), 'Basic page content type has been updated.');
|
||||
$this->assertRaw(t('The content type %type has been updated.', ['%type' => 'Basic page']));
|
||||
|
||||
// Make node body translatable.
|
||||
$field_storage = FieldStorageConfig::loadByName('node', 'body');
|
||||
|
@ -102,10 +102,14 @@ class NodeFieldMultilingualTest extends BrowserTestBase {
|
|||
|
||||
// Test multilingual field language fallback logic.
|
||||
$this->drupalGet("it/node/{$node->id()}");
|
||||
$this->assertRaw($body_value, 'Body correctly displayed using Italian as requested language');
|
||||
// Verify that body is correctly displayed using Italian as requested
|
||||
// language.
|
||||
$this->assertRaw($body_value);
|
||||
|
||||
$this->drupalGet("node/{$node->id()}");
|
||||
$this->assertRaw($body_value, 'Body correctly displayed using English as requested language');
|
||||
// Verify that body is correctly displayed using English as requested
|
||||
// language.
|
||||
$this->assertRaw($body_value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -62,8 +62,8 @@ class NodeRSSContentTest extends NodeTestBase {
|
|||
// Check that extra RSS elements and namespaces are added to RSS feed.
|
||||
$test_element = '<testElement>' . t('Value of testElement RSS element for node @nid.', ['@nid' => $node->id()]) . '</testElement>';
|
||||
$test_ns = 'xmlns:drupaltest="http://example.com/test-namespace"';
|
||||
$this->assertRaw($test_element, 'Extra RSS elements appear in RSS feed.');
|
||||
$this->assertRaw($test_ns, 'Extra namespaces appear in RSS feed.');
|
||||
$this->assertRaw($test_element);
|
||||
$this->assertRaw($test_ns);
|
||||
|
||||
// Check that content added in 'rss' view mode doesn't appear when
|
||||
// viewing node.
|
||||
|
@ -109,9 +109,12 @@ class NodeRSSContentTest extends NodeTestBase {
|
|||
]);
|
||||
|
||||
$this->drupalGet('rss.xml');
|
||||
$this->assertRaw(file_create_url('public://root-relative'), 'Root-relative URL is transformed to absolute.');
|
||||
$this->assertRaw($protocol_relative_url, 'Protocol-relative URL is left untouched.');
|
||||
$this->assertRaw($absolute_url, 'Absolute URL is left untouched.');
|
||||
// Verify that root-relative URL is transformed to absolute.
|
||||
$this->assertRaw(file_create_url('public://root-relative'));
|
||||
// Verify that protocol-relative URL is left untouched.
|
||||
$this->assertRaw($protocol_relative_url);
|
||||
// Verify that absolute URL is left untouched.
|
||||
$this->assertRaw($absolute_url);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -154,8 +154,7 @@ class NodeRevisionsAllTest extends NodeTestBase {
|
|||
'@type' => 'Basic page',
|
||||
'%title' => $nodes[1]->getTitle(),
|
||||
'%revision-date' => $this->container->get('date.formatter')->format($nodes[1]->getRevisionCreationTime()),
|
||||
]),
|
||||
'Revision reverted.');
|
||||
]));
|
||||
$node_storage->resetCache([$node->id()]);
|
||||
$reverted_node = $node_storage->load($node->id());
|
||||
$this->assertTrue(($nodes[1]->body->value == $reverted_node->body->value), 'Node reverted correctly.');
|
||||
|
@ -181,8 +180,7 @@ class NodeRevisionsAllTest extends NodeTestBase {
|
|||
'%revision-date' => $this->container->get('date.formatter')->format($nodes[1]->getRevisionCreationTime()),
|
||||
'@type' => 'Basic page',
|
||||
'%title' => $nodes[1]->getTitle(),
|
||||
]),
|
||||
'Revision deleted.');
|
||||
]));
|
||||
$nids = \Drupal::entityQuery('node')
|
||||
->allRevisions()
|
||||
->accessCheck(FALSE)
|
||||
|
|
|
@ -176,7 +176,7 @@ class NodeRevisionsTest extends NodeTestBase {
|
|||
'@type' => 'Basic page',
|
||||
'%title' => $nodes[1]->label(),
|
||||
'%revision-date' => $this->container->get('date.formatter')->format($nodes[1]->getRevisionCreationTime()),
|
||||
]), 'Revision reverted.');
|
||||
]));
|
||||
$node_storage->resetCache([$node->id()]);
|
||||
$reverted_node = $node_storage->load($node->id());
|
||||
$this->assertTrue(($nodes[1]->body->value == $reverted_node->body->value), 'Node reverted correctly.');
|
||||
|
@ -195,7 +195,7 @@ class NodeRevisionsTest extends NodeTestBase {
|
|||
'%revision-date' => $this->container->get('date.formatter')->format($nodes[1]->getRevisionCreationTime()),
|
||||
'@type' => 'Basic page',
|
||||
'%title' => $nodes[1]->label(),
|
||||
]), 'Revision deleted.');
|
||||
]));
|
||||
$connection = Database::getConnection();
|
||||
$nids = \Drupal::entityQuery('node')
|
||||
->accessCheck(FALSE)
|
||||
|
|
|
@ -103,11 +103,11 @@ class NodeTitleTest extends NodeTestBase {
|
|||
// the page.
|
||||
$edge_case_title_escaped = Html::escape($edge_case_title);
|
||||
$this->drupalGet('node/' . $node->id());
|
||||
$this->assertRaw('<title>' . $edge_case_title_escaped . ' | Drupal</title>', 'Page title is equal to article\'s "title".', 'Node');
|
||||
$this->assertRaw('<title>' . $edge_case_title_escaped . ' | Drupal</title>');
|
||||
|
||||
// Test that the title appears as <title> when reloading the node page.
|
||||
$this->drupalGet('node/' . $node->id());
|
||||
$this->assertRaw('<title>' . $edge_case_title_escaped . ' | Drupal</title>', 'Page title is equal to article\'s "title".', 'Node');
|
||||
$this->assertRaw('<title>' . $edge_case_title_escaped . ' | Drupal</title>');
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -34,18 +34,19 @@ class NodeTitleXSSTest extends NodeTestBase {
|
|||
$edit['title[0][value]'] = $title;
|
||||
|
||||
$this->drupalPostForm('node/add/page', $edit, t('Preview'));
|
||||
$this->assertNoRaw($xss, 'Harmful tags are escaped when previewing a node.');
|
||||
// Verify that harmful tags are escaped when previewing a node.
|
||||
$this->assertNoRaw($xss);
|
||||
|
||||
$settings = ['title' => $title];
|
||||
$node = $this->drupalCreateNode($settings);
|
||||
|
||||
$this->drupalGet('node/' . $node->id());
|
||||
// Titles should be escaped.
|
||||
$this->assertRaw('<title>' . Html::escape($title) . ' | Drupal</title>', 'Title is displayed when viewing a node.');
|
||||
$this->assertNoRaw($xss, 'Harmful tags are escaped when viewing a node.');
|
||||
$this->assertRaw('<title>' . Html::escape($title) . ' | Drupal</title>');
|
||||
$this->assertNoRaw($xss);
|
||||
|
||||
$this->drupalGet('node/' . $node->id() . '/edit');
|
||||
$this->assertNoRaw($xss, 'Harmful tags are escaped when editing a node.');
|
||||
$this->assertNoRaw($xss);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -251,13 +251,15 @@ class NodeTranslationUITest extends ContentTranslationUITestBase {
|
|||
$edit['use_admin_theme'] = TRUE;
|
||||
$this->drupalPostForm('admin/appearance', $edit, t('Save configuration'));
|
||||
$this->drupalGet('node/' . $article->id() . '/translations');
|
||||
$this->assertRaw('core/themes/seven/css/base/elements.css', 'Translation uses admin theme if edit is admin.');
|
||||
// Verify that translation uses the admin theme if edit is admin.
|
||||
$this->assertRaw('core/themes/seven/css/base/elements.css');
|
||||
|
||||
// Turn off admin theme for editing, assert inheritance to translations.
|
||||
$edit['use_admin_theme'] = FALSE;
|
||||
$this->drupalPostForm('admin/appearance', $edit, t('Save configuration'));
|
||||
$this->drupalGet('node/' . $article->id() . '/translations');
|
||||
$this->assertNoRaw('core/themes/seven/css/base/elements.css', 'Translation uses frontend theme if edit is frontend.');
|
||||
// Verify that translation uses the frontend theme if edit is frontend.
|
||||
$this->assertNoRaw('core/themes/seven/css/base/elements.css');
|
||||
|
||||
// Assert presence of translation page itself (vs. DisabledBundle below).
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
|
|
|
@ -186,8 +186,7 @@ class NodeTypeTest extends NodeTestBase {
|
|||
// Attempt to delete the content type, which should not be allowed.
|
||||
$this->drupalGet('admin/structure/types/manage/' . $type->label() . '/delete');
|
||||
$this->assertRaw(
|
||||
t('%type is used by 1 piece of content on your site. You can not remove this content type until you have removed all of the %type content.', ['%type' => $type->label()]),
|
||||
'The content type will not be deleted until all nodes of that type are removed.'
|
||||
t('%type is used by 1 piece of content on your site. You can not remove this content type until you have removed all of the %type content.', ['%type' => $type->label()])
|
||||
);
|
||||
$this->assertNoText('This action cannot be undone.', 'The node type deletion confirmation form is not available.');
|
||||
|
||||
|
@ -196,8 +195,7 @@ class NodeTypeTest extends NodeTestBase {
|
|||
// Attempt to delete the content type, which should now be allowed.
|
||||
$this->drupalGet('admin/structure/types/manage/' . $type->label() . '/delete');
|
||||
$this->assertRaw(
|
||||
t('Are you sure you want to delete the content type %type?', ['%type' => $type->label()]),
|
||||
'The content type is available for deletion.'
|
||||
t('Are you sure you want to delete the content type %type?', ['%type' => $type->label()])
|
||||
);
|
||||
$this->assertText(t('This action cannot be undone.'), 'The node type deletion confirmation form is available.');
|
||||
|
||||
|
@ -273,7 +271,7 @@ class NodeTypeTest extends NodeTestBase {
|
|||
$this->drupalGet('admin/structure/types');
|
||||
$this->assertRaw(t('No content types available. <a href=":link">Add content type</a>.', [
|
||||
':link' => Url::fromRoute('node.type_add')->toString(),
|
||||
]), 'Empty text when there are no content types in the system is correct.');
|
||||
]));
|
||||
|
||||
$bundle_info->clearCachedBundles();
|
||||
$this->assertCount(0, $bundle_info->getBundleInfo('node'), 'The bundle information service has 0 bundles for the Node entity type.');
|
||||
|
|
|
@ -227,7 +227,7 @@ class PagePreviewTest extends NodeTestBase {
|
|||
|
||||
$view_mode_edit = ['view_mode' => 'teaser'];
|
||||
$this->drupalPostForm('node/preview/' . $uuid . '/full', $view_mode_edit, t('Switch'));
|
||||
$this->assertRaw('view-mode-teaser', 'View mode teaser class found.');
|
||||
$this->assertRaw('view-mode-teaser');
|
||||
$this->assertNoText($edit[$body_key], 'Body not displayed.');
|
||||
|
||||
// Check that the title, body and term fields are displayed with the
|
||||
|
@ -275,8 +275,8 @@ class PagePreviewTest extends NodeTestBase {
|
|||
$newterm2 = $this->randomMachineName(8);
|
||||
$edit[$term_key] = $this->term->getName() . ', ' . $newterm1 . ', ' . $newterm2;
|
||||
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Preview'));
|
||||
$this->assertRaw('>' . $newterm1 . '<', 'First new term displayed.');
|
||||
$this->assertRaw('>' . $newterm2 . '<', 'Second new term displayed.');
|
||||
$this->assertRaw('>' . $newterm1 . '<');
|
||||
$this->assertRaw('>' . $newterm2 . '<');
|
||||
// The first term should be displayed as link, the others not.
|
||||
$this->assertSession()->linkExists($this->term->getName());
|
||||
$this->assertSession()->linkNotExists($newterm1);
|
||||
|
@ -290,9 +290,9 @@ class PagePreviewTest extends NodeTestBase {
|
|||
$newterm3 = $this->randomMachineName(8);
|
||||
$edit[$term_key] = $newterm1 . ', ' . $newterm3 . ', ' . $newterm2;
|
||||
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Preview'));
|
||||
$this->assertRaw('>' . $newterm1 . '<', 'First existing term displayed.');
|
||||
$this->assertRaw('>' . $newterm2 . '<', 'Second existing term displayed.');
|
||||
$this->assertRaw('>' . $newterm3 . '<', 'Third new term displayed.');
|
||||
$this->assertRaw('>' . $newterm1 . '<');
|
||||
$this->assertRaw('>' . $newterm2 . '<');
|
||||
$this->assertRaw('>' . $newterm3 . '<');
|
||||
$this->assertNoText($this->term->getName());
|
||||
$this->assertSession()->linkExists($newterm1);
|
||||
$this->assertSession()->linkExists($newterm2);
|
||||
|
|
|
@ -319,7 +319,8 @@ class OptionsFieldUITest extends FieldTestBase {
|
|||
public function assertAllowedValuesInput($input_string, $result, $message) {
|
||||
$edit = ['settings[allowed_values]' => $input_string];
|
||||
$this->drupalPostForm($this->adminPath, $edit, t('Save field settings'));
|
||||
$this->assertNoRaw('&lt;', 'The page does not have double escaped HTML tags.');
|
||||
// Verify that the page does not have double escaped HTML tags.
|
||||
$this->assertNoRaw('&lt;');
|
||||
|
||||
if (is_string($result)) {
|
||||
$this->assertText($result, $message);
|
||||
|
|
|
@ -148,7 +148,7 @@ class OptionsWidgetsTest extends FieldTestBase {
|
|||
$this->assertSession()->checkboxNotChecked('edit-card-1-0');
|
||||
$this->assertSession()->checkboxNotChecked('edit-card-1-1');
|
||||
$this->assertSession()->checkboxNotChecked('edit-card-1-2');
|
||||
$this->assertRaw('Some dangerous & unescaped <strong>markup</strong>', 'Option text was properly filtered.');
|
||||
$this->assertRaw('Some dangerous & unescaped <strong>markup</strong>');
|
||||
$this->assertRaw('Some HTML encoded markup with < & >');
|
||||
|
||||
// Select first option.
|
||||
|
@ -206,7 +206,7 @@ class OptionsWidgetsTest extends FieldTestBase {
|
|||
$this->assertSession()->checkboxNotChecked('edit-card-2-0');
|
||||
$this->assertSession()->checkboxNotChecked('edit-card-2-1');
|
||||
$this->assertSession()->checkboxNotChecked('edit-card-2-2');
|
||||
$this->assertRaw('Some dangerous & unescaped <strong>markup</strong>', 'Option text was properly filtered.');
|
||||
$this->assertRaw('Some dangerous & unescaped <strong>markup</strong>');
|
||||
|
||||
// Submit form: select first and third options.
|
||||
$edit = [
|
||||
|
@ -302,12 +302,12 @@ class OptionsWidgetsTest extends FieldTestBase {
|
|||
$this->assertFalse($this->assertSession()->optionExists('card_1', 0)->isSelected());
|
||||
$this->assertFalse($this->assertSession()->optionExists('card_1', 1)->isSelected());
|
||||
$this->assertFalse($this->assertSession()->optionExists('card_1', 2)->isSelected());
|
||||
$this->assertRaw('Some dangerous & unescaped markup', 'Option text was properly filtered.');
|
||||
$this->assertRaw('Some dangerous & unescaped markup');
|
||||
|
||||
// Submit form: select invalid 'none' option.
|
||||
$edit = ['card_1' => '_none'];
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
$this->assertRaw(t('@title field is required.', ['@title' => $field->getName()]), 'Cannot save a required field when selecting "none" from the select list.');
|
||||
$this->assertRaw(t('@title field is required.', ['@title' => $field->getName()]));
|
||||
|
||||
// Submit form: select first option.
|
||||
$edit = ['card_1' => 0];
|
||||
|
@ -346,9 +346,9 @@ class OptionsWidgetsTest extends FieldTestBase {
|
|||
$this->assertFalse($this->assertSession()->optionExists('card_1', 0)->isSelected());
|
||||
$this->assertFalse($this->assertSession()->optionExists('card_1', 1)->isSelected());
|
||||
$this->assertFalse($this->assertSession()->optionExists('card_1', 2)->isSelected());
|
||||
$this->assertRaw('Some dangerous & unescaped markup', 'Option text was properly filtered.');
|
||||
$this->assertRaw('More <script>dangerous</script> markup', 'Option group text was properly filtered.');
|
||||
$this->assertRaw('Group 1', 'Option groups are displayed.');
|
||||
$this->assertRaw('Some dangerous & unescaped markup');
|
||||
$this->assertRaw('More <script>dangerous</script> markup');
|
||||
$this->assertRaw('Group 1');
|
||||
|
||||
// Submit form: select first option.
|
||||
$edit = ['card_1' => 0];
|
||||
|
@ -398,7 +398,7 @@ class OptionsWidgetsTest extends FieldTestBase {
|
|||
$this->assertFalse($this->assertSession()->optionExists('card_2', 0)->isSelected());
|
||||
$this->assertFalse($this->assertSession()->optionExists('card_2', 1)->isSelected());
|
||||
$this->assertFalse($this->assertSession()->optionExists('card_2', 2)->isSelected());
|
||||
$this->assertRaw('Some dangerous & unescaped markup', 'Option text was properly filtered.');
|
||||
$this->assertRaw('Some dangerous & unescaped markup');
|
||||
|
||||
// Submit form: select first and third options.
|
||||
$edit = ['card_2[]' => [0 => 0, 2 => 2]];
|
||||
|
@ -468,9 +468,9 @@ class OptionsWidgetsTest extends FieldTestBase {
|
|||
$this->assertFalse($this->assertSession()->optionExists('card_2', 0)->isSelected());
|
||||
$this->assertFalse($this->assertSession()->optionExists('card_2', 1)->isSelected());
|
||||
$this->assertFalse($this->assertSession()->optionExists('card_2', 2)->isSelected());
|
||||
$this->assertRaw('Some dangerous & unescaped markup', 'Option text was properly filtered.');
|
||||
$this->assertRaw('More <script>dangerous</script> markup', 'Option group text was properly filtered.');
|
||||
$this->assertRaw('Group 1', 'Option groups are displayed.');
|
||||
$this->assertRaw('Some dangerous & unescaped markup');
|
||||
$this->assertRaw('More <script>dangerous</script> markup');
|
||||
$this->assertRaw('Group 1');
|
||||
|
||||
// Submit form: select first option.
|
||||
$edit = ['card_2[]' => [0 => 0]];
|
||||
|
|
|
@ -136,7 +136,8 @@ class PageCacheTest extends BrowserTestBase {
|
|||
$this->drupalGet($accept_header_cache_url);
|
||||
// Verify that HTML page was cached.
|
||||
$this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'HIT');
|
||||
$this->assertRaw('<p>oh hai this is html.</p>', 'The correct HTML response was returned.');
|
||||
// Verify that the correct HTML response was returned.
|
||||
$this->assertRaw('<p>oh hai this is html.</p>');
|
||||
|
||||
$this->drupalGet($accept_header_cache_url_with_json);
|
||||
// Verify that JSON response was not yet cached.
|
||||
|
@ -144,7 +145,8 @@ class PageCacheTest extends BrowserTestBase {
|
|||
$this->drupalGet($accept_header_cache_url_with_json);
|
||||
// Verify that JSON response was cached.
|
||||
$this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'HIT');
|
||||
$this->assertRaw('{"content":"oh hai this is json"}', 'The correct Json response was returned.');
|
||||
// Verify that the correct JSON response was returned.
|
||||
$this->assertRaw('{"content":"oh hai this is json"}');
|
||||
|
||||
// Enable REST support for nodes and hal+json.
|
||||
\Drupal::service('module_installer')->install(['node', 'rest', 'hal', 'basic_auth']);
|
||||
|
|
|
@ -142,7 +142,7 @@ class PathAliasTest extends PathTestBase {
|
|||
$this->drupalPostForm('admin/config/search/path/add', $edit, t('Save'));
|
||||
|
||||
// Confirm no duplicate was created.
|
||||
$this->assertRaw(t('The alias %alias is already in use in this language.', ['%alias' => $edit['alias[0][value]']]), 'Attempt to move alias was rejected.');
|
||||
$this->assertRaw(t('The alias %alias is already in use in this language.', ['%alias' => $edit['alias[0][value]']]));
|
||||
|
||||
$edit_upper = $edit;
|
||||
$edit_upper['alias[0][value]'] = mb_strtoupper($edit['alias[0][value]']);
|
||||
|
@ -150,7 +150,7 @@ class PathAliasTest extends PathTestBase {
|
|||
$this->assertRaw(t('The alias %alias could not be added because it is already in use in this language with different capitalization: %stored_alias.', [
|
||||
'%alias' => $edit_upper['alias[0][value]'],
|
||||
'%stored_alias' => $edit['alias[0][value]'],
|
||||
]), 'Attempt to move upper-case alias was rejected.');
|
||||
]));
|
||||
|
||||
// Delete alias.
|
||||
$this->drupalGet('admin/config/search/path/edit/' . $pid);
|
||||
|
|
|
@ -128,8 +128,8 @@ class QuickEditLoadingTest extends WebDriverTestBase {
|
|||
$this->drupalGet('node/1');
|
||||
|
||||
// Library and in-place editors.
|
||||
$this->assertNoRaw('core/modules/quickedit/js/quickedit.js', 'Quick Edit library not loaded.');
|
||||
$this->assertNoRaw('core/modules/quickedit/js/editors/formEditor.js', "'form' in-place editor not loaded.");
|
||||
$this->assertNoRaw('core/modules/quickedit/js/quickedit.js');
|
||||
$this->assertNoRaw('core/modules/quickedit/js/editors/formEditor.js');
|
||||
|
||||
// HTML annotation and title class does not exist for users without
|
||||
// permission to in-place edit.
|
||||
|
|
|
@ -204,7 +204,7 @@ class ResponsiveImageFieldDisplayTest extends ImageFieldTestBase {
|
|||
'#alt' => $alt,
|
||||
];
|
||||
$default_output = str_replace("\n", NULL, $renderer->renderRoot($image));
|
||||
$this->assertRaw($default_output, 'Default formatter displaying correctly on full node view.');
|
||||
$this->assertRaw($default_output);
|
||||
|
||||
// Test field not being configured. This should not cause a fatal error.
|
||||
$display_options = [
|
||||
|
@ -330,7 +330,7 @@ class ResponsiveImageFieldDisplayTest extends ImageFieldTestBase {
|
|||
// responsive-image.html.twig doesn't have one after the fallback image, so
|
||||
// we remove it here.
|
||||
$default_output = trim($renderer->renderRoot($fallback_image));
|
||||
$this->assertRaw($default_output, 'Image style large formatter displaying correctly on full node view.');
|
||||
$this->assertRaw($default_output);
|
||||
|
||||
if ($scheme == 'private') {
|
||||
// Log out and ensure the file cannot be accessed.
|
||||
|
|
|
@ -172,7 +172,8 @@ class SearchCommentTest extends BrowserTestBase {
|
|||
|
||||
// Verify that comment is rendered using proper format.
|
||||
$this->assertText($comment_body, 'Comment body text found in search results.');
|
||||
$this->assertNoRaw(t('n/a'), 'HTML in comment body is not hidden.');
|
||||
// Verify that HTML in comment body is not hidden.
|
||||
$this->assertNoRaw(t('n/a'));
|
||||
$this->assertSession()->assertNoEscaped($edit_comment['comment_body[0][value]']);
|
||||
|
||||
// Search for the evil script comment subject.
|
||||
|
|
|
@ -56,7 +56,7 @@ class StatisticsAttachedTest extends BrowserTestBase {
|
|||
$node->save();
|
||||
$this->drupalGet('node/' . $node->id());
|
||||
|
||||
$this->assertRaw('core/modules/statistics/statistics.js', 'Statistics library is available');
|
||||
$this->assertRaw('core/modules/statistics/statistics.js');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ class StatisticsReportsTest extends StatisticsTestBase {
|
|||
$this->assertCacheContexts($contexts);
|
||||
|
||||
// Check if the node link is displayed.
|
||||
$this->assertRaw(Link::fromTextAndUrl($node->label(), $node->toUrl('canonical'))->toString(), 'Found link to visited node.');
|
||||
$this->assertRaw(Link::fromTextAndUrl($node->label(), $node->toUrl('canonical'))->toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -76,12 +76,15 @@ class PageTest extends BrowserTestBase {
|
|||
// Go to the initial step only.
|
||||
$this->maximumMetaRefreshCount = 0;
|
||||
$this->drupalGet('batch-test/test-title');
|
||||
$this->assertRaw('<div class="progress__description">Initializing.<br /> </div>', 'Initial progress message appears correctly.');
|
||||
$this->assertNoRaw('&nbsp;', 'Initial progress message is not double escaped.');
|
||||
// Check that the initial progress message appears correctly and is not
|
||||
// double escaped.
|
||||
$this->assertRaw('<div class="progress__description">Initializing.<br /> </div>');
|
||||
$this->assertNoRaw('&nbsp;');
|
||||
// Now also go to the next step.
|
||||
$this->maximumMetaRefreshCount = 1;
|
||||
$this->drupalGet('batch-test/test-title');
|
||||
$this->assertRaw('<div class="progress__description">Completed 1 of 1.</div>', 'Progress message for second step appears correctly.');
|
||||
// Check that the progress message for second step appears correctly.
|
||||
$this->assertRaw('<div class="progress__description">Completed 1 of 1.</div>');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -49,13 +49,13 @@ class EntityListBuilderTest extends BrowserTestBase {
|
|||
$this->drupalGet('entity_test/list');
|
||||
|
||||
// Item 51 should not be present.
|
||||
$this->assertRaw('Test entity 50', 'Item 50 is shown.');
|
||||
$this->assertNoRaw('Test entity 51', 'Item 51 is on the next page.');
|
||||
$this->assertRaw('Test entity 50');
|
||||
$this->assertNoRaw('Test entity 51');
|
||||
|
||||
// Browse to the next page.
|
||||
// Browse to the next page, test entity 51 is shown.
|
||||
$this->clickLink(t('Page 2'));
|
||||
$this->assertNoRaw('Test entity 50', 'Test entity 50 is on the previous page.');
|
||||
$this->assertRaw('Test entity 51', 'Test entity 51 is shown.');
|
||||
$this->assertNoRaw('Test entity 50');
|
||||
$this->assertRaw('Test entity 51');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -87,7 +87,7 @@ class EntityTranslationFormTest extends BrowserTestBase {
|
|||
$this->drupalGet('admin/structure/types/manage/page');
|
||||
$edit = ['language_configuration[language_alterable]' => TRUE, 'language_configuration[langcode]' => LanguageInterface::LANGCODE_NOT_SPECIFIED];
|
||||
$this->drupalPostForm('admin/structure/types/manage/page', $edit, t('Save content type'));
|
||||
$this->assertRaw(t('The content type %type has been updated.', ['%type' => 'Basic page']), 'Basic page content type has been updated.');
|
||||
$this->assertRaw(t('The content type %type has been updated.', ['%type' => 'Basic page']));
|
||||
|
||||
// Create a node with language.
|
||||
$edit = [];
|
||||
|
|
|
@ -233,7 +233,7 @@ class FormTest extends BrowserTestBase {
|
|||
];
|
||||
$this->drupalPostForm(NULL, $edit, 'Submit');
|
||||
$this->assertNoFieldByXpath('//div[contains(@class, "error")]', FALSE, 'No error message is displayed when all required fields are filled.');
|
||||
$this->assertRaw("The form_test_validate_required_form form was submitted successfully.", 'Validation form submitted successfully.');
|
||||
$this->assertRaw("The form_test_validate_required_form form was submitted successfully.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -343,7 +343,7 @@ class FormTest extends BrowserTestBase {
|
|||
// Attempt to submit the form with no required field set.
|
||||
$edit = [];
|
||||
$this->drupalPostForm('form-test/validate-required-no-title', $edit, 'Submit');
|
||||
$this->assertNoRaw("The form_test_validate_required_form_no_title form was submitted successfully.", 'Validation form submitted successfully.');
|
||||
$this->assertNoRaw("The form_test_validate_required_form_no_title form was submitted successfully.");
|
||||
|
||||
// Check the page for the error class on the textfield.
|
||||
$this->assertFieldByXPath('//input[contains(@class, "error")]', FALSE, 'Error input form element class found.');
|
||||
|
@ -358,7 +358,7 @@ class FormTest extends BrowserTestBase {
|
|||
];
|
||||
$this->drupalPostForm(NULL, $edit, 'Submit');
|
||||
$this->assertNoFieldByXpath('//input[contains(@class, "error")]', FALSE, 'No error input form element class found.');
|
||||
$this->assertRaw("The form_test_validate_required_form_no_title form was submitted successfully.", 'Validation form submitted successfully.');
|
||||
$this->assertRaw("The form_test_validate_required_form_no_title form was submitted successfully.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -370,7 +370,7 @@ class FormTest extends BrowserTestBase {
|
|||
// First, try to submit without the required checkbox.
|
||||
$edit = [];
|
||||
$this->drupalPostForm('form-test/checkbox', $edit, t('Submit'));
|
||||
$this->assertRaw(t('@name field is required.', ['@name' => 'required_checkbox']), 'A required checkbox is actually mandatory');
|
||||
$this->assertRaw(t('@name field is required.', ['@name' => 'required_checkbox']));
|
||||
|
||||
// Now try to submit the form correctly.
|
||||
$this->drupalPostForm(NULL, ['required_checkbox' => 1], t('Submit'));
|
||||
|
|
|
@ -57,7 +57,7 @@ class StateValuesCleanAdvancedTest extends BrowserTestBase {
|
|||
|
||||
// Expecting a 200 HTTP code.
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw(t('You WIN!'), 'Found the success message.');
|
||||
$this->assertRaw(t('You WIN!'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -269,7 +269,7 @@ class MenuRouterTest extends BrowserTestBase {
|
|||
protected function doTestThemeCallbackAdministrative() {
|
||||
$this->drupalGet('menu-test/theme-callback/use-admin-theme');
|
||||
$this->assertText('Active theme: seven. Actual theme: seven.', 'The administrative theme can be correctly set in a theme negotiation.');
|
||||
$this->assertRaw('seven/css/base/elements.css', "The administrative theme's CSS appears on the page.");
|
||||
$this->assertRaw('seven/css/base/elements.css');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -281,14 +281,16 @@ class MenuRouterTest extends BrowserTestBase {
|
|||
// For a regular user, the fact that the site is in maintenance mode means
|
||||
// we expect the theme callback system to be bypassed entirely.
|
||||
$this->drupalGet('menu-test/theme-callback/use-admin-theme');
|
||||
$this->assertRaw('bartik/css/base/elements.css', "The maintenance theme's CSS appears on the page.");
|
||||
// Check that the maintenance theme's CSS appears on the page.
|
||||
$this->assertRaw('bartik/css/base/elements.css');
|
||||
|
||||
// An administrator, however, should continue to see the requested theme.
|
||||
$admin_user = $this->drupalCreateUser(['access site in maintenance mode']);
|
||||
$this->drupalLogin($admin_user);
|
||||
$this->drupalGet('menu-test/theme-callback/use-admin-theme');
|
||||
$this->assertText('Active theme: seven. Actual theme: seven.', 'The theme negotiation system is correctly triggered for an administrator when the site is in maintenance mode.');
|
||||
$this->assertRaw('seven/css/base/elements.css', "The administrative theme's CSS appears on the page.");
|
||||
// Check that the administrative theme's CSS appears on the page.
|
||||
$this->assertRaw('seven/css/base/elements.css');
|
||||
|
||||
$this->container->get('state')->set('system.maintenance_mode', FALSE);
|
||||
}
|
||||
|
@ -300,7 +302,8 @@ class MenuRouterTest extends BrowserTestBase {
|
|||
// Request a theme that is not installed.
|
||||
$this->drupalGet('menu-test/theme-callback/use-test-theme');
|
||||
$this->assertText('Active theme: bartik. Actual theme: bartik.', 'The theme negotiation system falls back on the default theme when a theme that is not installed is requested.');
|
||||
$this->assertRaw('bartik/css/base/elements.css', "The default theme's CSS appears on the page.");
|
||||
// Check that the default theme's CSS appears on the page.
|
||||
$this->assertRaw('bartik/css/base/elements.css');
|
||||
|
||||
// Now install the theme and request it again.
|
||||
/** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
|
||||
|
@ -309,7 +312,8 @@ class MenuRouterTest extends BrowserTestBase {
|
|||
|
||||
$this->drupalGet('menu-test/theme-callback/use-test-theme');
|
||||
$this->assertText('Active theme: test_theme. Actual theme: test_theme.', 'The theme negotiation system uses an optional theme once it has been installed.');
|
||||
$this->assertRaw('test_theme/kitten.css', "The optional theme's CSS appears on the page.");
|
||||
// Check that the optional theme's CSS appears on the page.
|
||||
$this->assertRaw('test_theme/kitten.css');
|
||||
|
||||
$theme_installer->uninstall(['test_theme']);
|
||||
}
|
||||
|
@ -320,7 +324,8 @@ class MenuRouterTest extends BrowserTestBase {
|
|||
protected function doTestThemeCallbackFakeTheme() {
|
||||
$this->drupalGet('menu-test/theme-callback/use-fake-theme');
|
||||
$this->assertText('Active theme: bartik. Actual theme: bartik.', 'The theme negotiation system falls back on the default theme when a theme that does not exist is requested.');
|
||||
$this->assertRaw('bartik/css/base/elements.css', "The default theme's CSS appears on the page.");
|
||||
// Check that the default theme's CSS appears on the page.
|
||||
$this->assertRaw('bartik/css/base/elements.css');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -329,7 +334,8 @@ class MenuRouterTest extends BrowserTestBase {
|
|||
protected function doTestThemeCallbackNoThemeRequested() {
|
||||
$this->drupalGet('menu-test/theme-callback/no-theme-requested');
|
||||
$this->assertText('Active theme: bartik. Actual theme: bartik.', 'The theme negotiation system falls back on the default theme when no theme is requested.');
|
||||
$this->assertRaw('bartik/css/base/elements.css', "The default theme's CSS appears on the page.");
|
||||
// Check that the default theme's CSS appears on the page.
|
||||
$this->assertRaw('bartik/css/base/elements.css');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ class DependencyTest extends ModuleTestBase {
|
|||
// Test that the system_dependencies_test module is marked
|
||||
// as missing a dependency.
|
||||
$this->drupalGet('admin/modules');
|
||||
$this->assertRaw(t('@module (<span class="admin-missing">missing</span>)', ['@module' => Unicode::ucfirst('_missing_dependency')]), 'A module with missing dependencies is marked as such.');
|
||||
$this->assertRaw(t('@module (<span class="admin-missing">missing</span>)', ['@module' => Unicode::ucfirst('_missing_dependency')]));
|
||||
$checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[system_dependencies_test][enable]"]');
|
||||
$this->assertCount(1, $checkbox, 'Checkbox for the module is disabled.');
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ class DependencyTest extends ModuleTestBase {
|
|||
$this->assertRaw(t('@module (<span class="admin-missing">incompatible with</span> version @version)', [
|
||||
'@module' => 'System incompatible module version test (>2.0)',
|
||||
'@version' => '1.0',
|
||||
]), 'A module that depends on an incompatible version of a module is marked as such.');
|
||||
]));
|
||||
$checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[system_incompatible_module_version_dependencies_test][enable]"]');
|
||||
$this->assertCount(1, $checkbox, 'Checkbox for the module is disabled.');
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ class DependencyTest extends ModuleTestBase {
|
|||
$this->drupalGet('admin/modules');
|
||||
$this->assertRaw(t('@module (<span class="admin-missing">incompatible with</span> this version of Drupal core)', [
|
||||
'@module' => 'System core incompatible semver test',
|
||||
]), 'A module that depends on a module with an incompatible core version is marked as such.');
|
||||
]));
|
||||
$checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[system_incompatible_core_version_dependencies_test][enable]"]');
|
||||
$this->assertCount(1, $checkbox, 'Checkbox for the module is disabled.');
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ class DependencyTest extends ModuleTestBase {
|
|||
*/
|
||||
public function testIncompatiblePhpVersionDependency() {
|
||||
$this->drupalGet('admin/modules');
|
||||
$this->assertRaw('This module requires PHP version 6502.* and is incompatible with PHP version ' . phpversion() . '.', 'User is informed when the PHP dependency requirement of a module is not met.');
|
||||
$this->assertRaw('This module requires PHP version 6502.* and is incompatible with PHP version ' . phpversion() . '.');
|
||||
$checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[system_incompatible_php_version_test][enable]"]');
|
||||
$this->assertCount(1, $checkbox, 'Checkbox for the module is disabled.');
|
||||
}
|
||||
|
|
|
@ -123,7 +123,8 @@ class UninstallTest extends BrowserTestBase {
|
|||
|
||||
$this->drupalPostForm(NULL, NULL, t('Uninstall'));
|
||||
$this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
|
||||
$this->assertNoRaw('<label', 'The page does not have double escaped HTML tags.');
|
||||
// Check that the page does not have double escaped HTML tags.
|
||||
$this->assertNoRaw('<label');
|
||||
|
||||
// Make sure our unique cache entry is gone.
|
||||
$cached = \Drupal::cache()->get('uninstall_test');
|
||||
|
|
|
@ -36,17 +36,20 @@ class UpcastingTest extends BrowserTestBase {
|
|||
|
||||
// paramconverter_test/test_user_node_foo/{user}/{node}/{foo}
|
||||
$this->drupalGet("paramconverter_test/test_user_node_foo/" . $user->id() . '/' . $node->id() . "/$foo");
|
||||
$this->assertRaw("user: {$user->label()}, node: {$node->label()}, foo: $foo", 'user and node upcast by entity name');
|
||||
// Verify user and node upcast by entity name.
|
||||
$this->assertRaw("user: {$user->label()}, node: {$node->label()}, foo: $foo");
|
||||
|
||||
// paramconverter_test/test_node_user_user/{node}/{foo}/{user}
|
||||
// options.parameters.foo.type = entity:user
|
||||
$this->drupalGet("paramconverter_test/test_node_user_user/" . $node->id() . "/" . $user->id() . "/" . $user->id());
|
||||
$this->assertRaw("user: {$user->label()}, node: {$node->label()}, foo: {$user->label()}", 'foo converted to user as well');
|
||||
// Verify foo converted to user as well.
|
||||
$this->assertRaw("user: {$user->label()}, node: {$node->label()}, foo: {$user->label()}");
|
||||
|
||||
// paramconverter_test/test_node_node_foo/{user}/{node}/{foo}
|
||||
// options.parameters.user.type = entity:node
|
||||
$this->drupalGet("paramconverter_test/test_node_node_foo/" . $node->id() . "/" . $node->id() . "/$foo");
|
||||
$this->assertRaw("user: {$node->label()}, node: {$node->label()}, foo: $foo", 'user is upcast to node (rather than to user)');
|
||||
// Verify that user is upcast to node (rather than to user).
|
||||
$this->assertRaw("user: {$node->label()}, node: {$node->label()}, foo: $foo");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,7 +40,7 @@ class RouterPermissionTest extends BrowserTestBase {
|
|||
$this->drupalGet('router_test/test7');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertNoRaw('Access denied');
|
||||
$this->assertRaw('test7text', 'The correct string was returned because the route was successful.');
|
||||
$this->assertRaw('test7text');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class RouterTest extends BrowserTestBase {
|
|||
|
||||
// Confirm that the router can get to a controller.
|
||||
$this->drupalGet('router_test/test1');
|
||||
$this->assertRaw('test1', 'The correct string was returned because the route was successful.');
|
||||
$this->assertRaw('test1');
|
||||
$session = $this->getSession();
|
||||
|
||||
// Check expected headers from FinishResponseSubscriber.
|
||||
|
@ -48,7 +48,7 @@ class RouterTest extends BrowserTestBase {
|
|||
$this->assertSession()->responseHeaderDoesNotExist('Vary');
|
||||
|
||||
$this->drupalGet('router_test/test2');
|
||||
$this->assertRaw('test2', 'The correct string was returned because the route was successful.');
|
||||
$this->assertRaw('test2');
|
||||
// Check expected headers from FinishResponseSubscriber.
|
||||
$headers = $session->getResponseHeaders();
|
||||
$this->assertSession()->responseHeaderEquals('X-Drupal-Cache-Contexts', implode(' ', $expected_cache_contexts));
|
||||
|
@ -56,7 +56,7 @@ class RouterTest extends BrowserTestBase {
|
|||
$this->assertSession()->responseHeaderEquals('X-Drupal-Cache-Max-Age', '-1 (Permanent)');
|
||||
// Confirm that the page wrapping is being added, so we're not getting a
|
||||
// raw body returned.
|
||||
$this->assertRaw('</html>', 'Page markup was found.');
|
||||
$this->assertRaw('</html>');
|
||||
// In some instances, the subrequest handling may get confused and render
|
||||
// a page inception style. This test verifies that is not happening.
|
||||
$this->assertSession()->responseNotMatches('#</body>.*</body>#s');
|
||||
|
@ -147,12 +147,12 @@ class RouterTest extends BrowserTestBase {
|
|||
foreach ($values as $value) {
|
||||
$this->drupalGet('router_test/test3/' . $value);
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw($value, 'The correct string was returned because the route was successful.');
|
||||
$this->assertRaw($value);
|
||||
}
|
||||
|
||||
// Confirm that the page wrapping is being added, so we're not getting a
|
||||
// raw body returned.
|
||||
$this->assertRaw('</html>', 'Page markup was found.');
|
||||
$this->assertRaw('</html>');
|
||||
|
||||
// In some instances, the subrequest handling may get confused and render
|
||||
// a page inception style. This test verifies that is not happening.
|
||||
|
@ -165,11 +165,11 @@ class RouterTest extends BrowserTestBase {
|
|||
public function testControllerPlaceholdersDefaultValues() {
|
||||
$this->drupalGet('router_test/test4');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw('narf', 'The correct string was returned because the route was successful.');
|
||||
$this->assertRaw('narf');
|
||||
|
||||
// Confirm that the page wrapping is being added, so we're not getting a
|
||||
// raw body returned.
|
||||
$this->assertRaw('</html>', 'Page markup was found.');
|
||||
$this->assertRaw('</html>');
|
||||
|
||||
// In some instances, the subrequest handling may get confused and render
|
||||
// a page inception style. This test verifies that is not happening.
|
||||
|
@ -182,11 +182,11 @@ class RouterTest extends BrowserTestBase {
|
|||
public function testControllerPlaceholdersDefaultValuesProvided() {
|
||||
$this->drupalGet('router_test/test4/barf');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw('barf', 'The correct string was returned because the route was successful.');
|
||||
$this->assertRaw('barf');
|
||||
|
||||
// Confirm that the page wrapping is being added, so we're not getting a
|
||||
// raw body returned.
|
||||
$this->assertRaw('</html>', 'Page markup was found.');
|
||||
$this->assertRaw('</html>');
|
||||
|
||||
// In some instances, the subrequest handling may get confused and render
|
||||
// a page inception style. This test verifies that is not happening.
|
||||
|
@ -202,7 +202,7 @@ class RouterTest extends BrowserTestBase {
|
|||
// Test the altered route.
|
||||
$this->drupalGet('router_test/test6');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertRaw('test5', 'The correct string was returned because the route was successful.');
|
||||
$this->assertRaw('test5');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -211,11 +211,11 @@ class RouterTest extends BrowserTestBase {
|
|||
public function testControllerResolutionPage() {
|
||||
$this->drupalGet('/router_test/test10');
|
||||
|
||||
$this->assertRaw('abcde', 'Correct body was found.');
|
||||
$this->assertRaw('abcde');
|
||||
|
||||
// Confirm that the page wrapping is being added, so we're not getting a
|
||||
// raw body returned.
|
||||
$this->assertRaw('</html>', 'Page markup was found.');
|
||||
$this->assertRaw('</html>');
|
||||
|
||||
// In some instances, the subrequest handling may get confused and render
|
||||
// a page inception style. This test verifies that is not happening.
|
||||
|
@ -294,7 +294,7 @@ class RouterTest extends BrowserTestBase {
|
|||
|
||||
$this->assertSession()->responseHeaderEquals('Content-Type', 'application/json');
|
||||
|
||||
$this->assertRaw('abcde', 'Correct body was found.');
|
||||
$this->assertRaw('abcde');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -301,7 +301,8 @@ class SessionTest extends BrowserTestBase {
|
|||
// from persisting.
|
||||
$this->mink->resetSessions();
|
||||
$this->drupalGet('session-test/id-from-cookie');
|
||||
$this->assertRaw("session_id:\n", 'Session ID is blank as sent from cookie header.');
|
||||
// Verify that session ID is blank as sent from cookie header.
|
||||
$this->assertRaw("session_id:\n");
|
||||
// Assert that we have an anonymous session now.
|
||||
$this->drupalGet('session-test/is-logged-in');
|
||||
$this->assertSession()->statusCodeEquals(403);
|
||||
|
|
|
@ -23,7 +23,7 @@ class AdminMetaTagTest extends BrowserTestBase {
|
|||
list($version,) = explode('.', \Drupal::VERSION);
|
||||
$string = '<meta name="Generator" content="Drupal ' . $version . ' (https://www.drupal.org)" />';
|
||||
$this->drupalGet('node');
|
||||
$this->assertRaw($string, 'Fingerprinting meta tag generated correctly.', 'System');
|
||||
$this->assertRaw($string);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ class DateTimeTest extends BrowserTestBase {
|
|||
$this->drupalPostForm('admin/config/regional/date-time/formats/manage/' . $date_format_id . '/delete', [], t('Delete'));
|
||||
// Verify that the user is redirected to the correct page.
|
||||
$this->assertSession()->addressEquals(Url::fromRoute('entity.date_format.collection'));
|
||||
$this->assertRaw(t('The date format %format has been deleted.', ['%format' => $name]), 'Custom date format removed.');
|
||||
$this->assertRaw(t('The date format %format has been deleted.', ['%format' => $name]));
|
||||
|
||||
// Make sure the date does not exist in config.
|
||||
$date_format = DateFormat::load($date_format_id);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Drupal\Tests\system\Functional\System;
|
||||
|
||||
use Drupal\Component\Render\FormattableMarkup;
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
|
||||
/**
|
||||
|
@ -37,7 +36,7 @@ class DefaultMobileMetaTagsTest extends BrowserTestBase {
|
|||
public function testDefaultMetaTagsExist() {
|
||||
$this->drupalGet('');
|
||||
foreach ($this->defaultMetaTags as $name => $metatag) {
|
||||
$this->assertRaw($metatag, new FormattableMarkup('Default Mobile meta tag "@name" displayed properly.', ['@name' => $name]), 'System');
|
||||
$this->assertRaw($metatag);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +47,7 @@ class DefaultMobileMetaTagsTest extends BrowserTestBase {
|
|||
\Drupal::service('module_installer')->install(['system_module_test']);
|
||||
$this->drupalGet('');
|
||||
foreach ($this->defaultMetaTags as $name => $metatag) {
|
||||
$this->assertNoRaw($metatag, new FormattableMarkup('Default Mobile meta tag "@name" removed properly.', ['@name' => $name]), 'System');
|
||||
$this->assertNoRaw($metatag);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ class ErrorHandlerTest extends BrowserTestBase {
|
|||
$this->assertErrorMessage($error_notice);
|
||||
$this->assertErrorMessage($error_warning);
|
||||
$this->assertErrorMessage($error_user_notice);
|
||||
$this->assertRaw('<pre class="backtrace">', 'Found pre element with backtrace class.');
|
||||
$this->assertRaw('<pre class="backtrace">');
|
||||
// Ensure we are escaping but not double escaping.
|
||||
$this->assertRaw('&');
|
||||
$this->assertNoRaw('&amp;');
|
||||
|
@ -70,7 +70,7 @@ class ErrorHandlerTest extends BrowserTestBase {
|
|||
$this->assertErrorMessage($error_notice);
|
||||
$this->assertErrorMessage($error_warning);
|
||||
$this->assertErrorMessage($error_user_notice);
|
||||
$this->assertNoRaw('<pre class="backtrace">', 'Did not find pre element with backtrace class.');
|
||||
$this->assertNoRaw('<pre class="backtrace">');
|
||||
|
||||
// Set error reporting to not collect notices.
|
||||
$config->set('error_level', ERROR_REPORTING_DISPLAY_SOME)->save();
|
||||
|
@ -79,7 +79,7 @@ class ErrorHandlerTest extends BrowserTestBase {
|
|||
$this->assertNoErrorMessage($error_notice);
|
||||
$this->assertErrorMessage($error_warning);
|
||||
$this->assertErrorMessage($error_user_notice);
|
||||
$this->assertNoRaw('<pre class="backtrace">', 'Did not find pre element with backtrace class.');
|
||||
$this->assertNoRaw('<pre class="backtrace">');
|
||||
|
||||
// Set error reporting to not show any errors.
|
||||
$config->set('error_level', ERROR_REPORTING_HIDE)->save();
|
||||
|
@ -89,7 +89,7 @@ class ErrorHandlerTest extends BrowserTestBase {
|
|||
$this->assertNoErrorMessage($error_warning);
|
||||
$this->assertNoErrorMessage($error_user_notice);
|
||||
$this->assertNoMessages();
|
||||
$this->assertNoRaw('<pre class="backtrace">', 'Did not find pre element with backtrace class.');
|
||||
$this->assertNoRaw('<pre class="backtrace">');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -131,8 +131,7 @@ class ErrorHandlerTest extends BrowserTestBase {
|
|||
// error message.
|
||||
$this->assertSession()->pageTextContains($error_pdo_exception['@message']);
|
||||
$error_details = new FormattableMarkup('in %function (line ', $error_pdo_exception);
|
||||
$this->assertRaw($error_details, new FormattableMarkup("Found '@message' in error page.", ['@message' => $error_details]));
|
||||
|
||||
$this->assertRaw($error_details);
|
||||
$this->drupalGet('error-test/trigger-renderer-exception');
|
||||
$this->assertSession()->statusCodeEquals(500);
|
||||
$this->assertErrorMessage($error_renderer_exception);
|
||||
|
@ -154,7 +153,7 @@ class ErrorHandlerTest extends BrowserTestBase {
|
|||
*/
|
||||
public function assertErrorMessage(array $error) {
|
||||
$message = new FormattableMarkup('%type: @message in %function (line ', $error);
|
||||
$this->assertRaw($message, new FormattableMarkup('Found error message: @message.', ['@message' => $message]));
|
||||
$this->assertRaw($message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -162,7 +161,7 @@ class ErrorHandlerTest extends BrowserTestBase {
|
|||
*/
|
||||
public function assertNoErrorMessage(array $error) {
|
||||
$message = new FormattableMarkup('%type: @message in %function (line ', $error);
|
||||
$this->assertNoRaw($message, new FormattableMarkup('Did not find error message: @message.', ['@message' => $message]));
|
||||
$this->assertNoRaw($message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue