Issue #3186661 by Spokje, longwave, mondrake, paulocs, daffie: [May 24, 2021] Remove usage of drupalPostForm

merge-requests/721/head
catch 2021-05-24 14:27:52 +01:00
parent f3ad0680a3
commit 3066423e43
431 changed files with 3921 additions and 2086 deletions

View File

@ -15,7 +15,7 @@ trait RefreshVariablesTrait {
* Useful after a page request is made that changes configuration or state in
* a different thread.
*
* In other words calling a settings page with $this->drupalPostForm() with a
* In other words calling a settings page with $this->submitForm() with a
* changed value would update configuration to reflect that change, but in the
* thread that made the call (thread running the test) the changed values
* would not be picked up.

View File

@ -37,7 +37,8 @@ class ConfigurationTest extends BrowserTestBase {
// Make a POST request to admin/config/system/actions.
$edit = [];
$edit['action'] = 'action_goto_action';
$this->drupalPostForm('admin/config/system/actions', $edit, 'Create');
$this->drupalGet('admin/config/system/actions');
$this->submitForm($edit, 'Create');
$this->assertSession()->statusCodeEquals(200);
// Make a POST request to the individual action configuration page.
@ -46,7 +47,8 @@ class ConfigurationTest extends BrowserTestBase {
$edit['label'] = $action_label;
$edit['id'] = strtolower($action_label);
$edit['url'] = 'admin';
$this->drupalPostForm('admin/config/system/actions/add/action_goto_action', $edit, 'Save');
$this->drupalGet('admin/config/system/actions/add/action_goto_action');
$this->submitForm($edit, 'Save');
$this->assertSession()->statusCodeEquals(200);
$action_id = $edit['id'];

View File

@ -46,7 +46,8 @@ class AddFeedTest extends AggregatorTestBase {
'url[0][value]' => $feed->getUrl(),
'refresh' => '900',
];
$this->drupalPostForm('aggregator/sources/add', $edit, 'Save');
$this->drupalGet('aggregator/sources/add');
$this->submitForm($edit, 'Save');
$this->assertRaw(t('A feed named %feed already exists. Enter a unique title.', ['%feed' => $feed->label()]));
$this->assertRaw(t('A feed with this URL %url already exists. Enter a unique URL.', ['%url' => $feed->getUrl()]));

View File

@ -36,7 +36,8 @@ class AggregatorAdminTest extends AggregatorTestBase {
'aggregator_parser' => 'aggregator_test_parser',
'aggregator_processors[aggregator_test_processor]' => 'aggregator_test_processor',
];
$this->drupalPostForm('admin/config/services/aggregator/settings', $edit, 'Save configuration');
$this->drupalGet('admin/config/services/aggregator/settings');
$this->submitForm($edit, 'Save configuration');
$this->assertSession()->pageTextContains('The configuration options have been saved.');
// Check that settings have the correct default value.
@ -50,7 +51,8 @@ class AggregatorAdminTest extends AggregatorTestBase {
$edit = [
'dummy_length' => 100,
];
$this->drupalPostForm('admin/config/services/aggregator/settings', $edit, 'Save configuration');
$this->drupalGet('admin/config/services/aggregator/settings');
$this->submitForm($edit, 'Save configuration');
$this->assertSession()->pageTextContains('The configuration options have been saved.');
$this->assertSession()->fieldValueEquals('dummy_length', 100);

View File

@ -74,7 +74,8 @@ abstract class AggregatorTestBase extends BrowserTestBase {
*/
public function createFeed($feed_url = NULL, array $edit = []) {
$edit = $this->getFeedEditArray($feed_url, $edit);
$this->drupalPostForm('aggregator/sources/add', $edit, 'Save');
$this->drupalGet('aggregator/sources/add');
$this->submitForm($edit, 'Save');
$this->assertSession()->pageTextContains('The feed ' . $edit['title[0][value]'] . ' has been added.');
// Verify that the creation message contains a link to a feed.
@ -96,7 +97,8 @@ abstract class AggregatorTestBase extends BrowserTestBase {
* Feed object representing the feed.
*/
public function deleteFeed(FeedInterface $feed) {
$this->drupalPostForm('aggregator/sources/' . $feed->id() . '/delete', [], 'Delete');
$this->drupalGet('aggregator/sources/' . $feed->id() . '/delete');
$this->submitForm([], 'Delete');
$this->assertRaw(t('The feed %title has been deleted.', ['%title' => $feed->label()]));
}
@ -218,7 +220,8 @@ abstract class AggregatorTestBase extends BrowserTestBase {
* Feed object representing the feed.
*/
public function deleteFeedItems(FeedInterface $feed) {
$this->drupalPostForm('admin/config/services/aggregator/delete/' . $feed->id(), [], 'Delete items');
$this->drupalGet('admin/config/services/aggregator/delete/' . $feed->id());
$this->submitForm([], 'Delete items');
$this->assertRaw(t('The news items from %title have been deleted.', ['%title' => $feed->label()]));
}
@ -390,7 +393,8 @@ EOF;
$edit = [];
$edit['title[0][value]'] = $this->randomMachineName();
$edit['body[0][value]'] = $this->randomMachineName();
$this->drupalPostForm('node/add/article', $edit, 'Save');
$this->drupalGet('node/add/article');
$this->submitForm($edit, 'Save');
}
}

View File

@ -68,7 +68,8 @@ class FeedLanguageTest extends AggregatorTestBase {
$edit['entity_types[aggregator_feed]'] = TRUE;
$edit['settings[aggregator_feed][aggregator_feed][settings][language][language_alterable]'] = TRUE;
$this->drupalPostForm('admin/config/regional/content-language', $edit, 'Save configuration');
$this->drupalGet('admin/config/regional/content-language');
$this->submitForm($edit, 'Save configuration');
/** @var \Drupal\aggregator\FeedInterface[] $feeds */
$feeds = [];

View File

@ -61,7 +61,8 @@ class ImportOpmlTest extends AggregatorTestBase {
$before = $count_query->execute();
$edit = [];
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, 'Import');
$this->drupalGet('admin/config/services/aggregator/add/opml');
$this->submitForm($edit, 'Import');
$this->assertRaw(t('<em>Either</em> upload a file or enter a URL.'));
$path = $this->getEmptyOpml();
@ -69,12 +70,14 @@ class ImportOpmlTest extends AggregatorTestBase {
'files[upload]' => $path,
'remote' => file_create_url($path),
];
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, 'Import');
$this->drupalGet('admin/config/services/aggregator/add/opml');
$this->submitForm($edit, 'Import');
$this->assertRaw(t('<em>Either</em> upload a file or enter a URL.'));
// Error if the URL is invalid.
$edit = ['remote' => 'invalidUrl://empty'];
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, 'Import');
$this->drupalGet('admin/config/services/aggregator/add/opml');
$this->submitForm($edit, 'Import');
$this->assertSession()->pageTextContains('The URL invalidUrl://empty is not valid.');
$after = $count_query->execute();
@ -90,12 +93,14 @@ class ImportOpmlTest extends AggregatorTestBase {
// Attempting to upload invalid XML.
$form['files[upload]'] = $this->getInvalidOpml();
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $form, 'Import');
$this->drupalGet('admin/config/services/aggregator/add/opml');
$this->submitForm($form, 'Import');
$this->assertSession()->pageTextContains('No new feed has been added.');
// Attempting to load empty OPML from remote URL
$edit = ['remote' => file_create_url($this->getEmptyOpml())];
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, 'Import');
$this->drupalGet('admin/config/services/aggregator/add/opml');
$this->submitForm($edit, 'Import');
$this->assertSession()->pageTextContains('No new feed has been added.');
$after = $count_query->execute();
@ -112,7 +117,8 @@ class ImportOpmlTest extends AggregatorTestBase {
'files[upload]' => $this->getValidOpml($feeds),
'refresh' => '900',
];
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, 'Import');
$this->drupalGet('admin/config/services/aggregator/add/opml');
$this->submitForm($edit, 'Import');
// 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.

View File

@ -43,7 +43,8 @@ class UpdateFeedItemTest extends AggregatorTestBase {
$this->drupalGet($edit['url[0][value]']);
$this->assertSession()->statusCodeEquals(200);
$this->drupalPostForm('aggregator/sources/add', $edit, 'Save');
$this->drupalGet('aggregator/sources/add');
$this->submitForm($edit, 'Save');
$this->assertSession()->pageTextContains('The feed ' . $edit['title[0][value]'] . ' has been added.');
// Verify that the creation message contains a link to a feed.

View File

@ -29,7 +29,8 @@ class UpdateFeedTest extends AggregatorTestBase {
if (isset($feed->{$same_field}->value)) {
$edit[$same_field] = $feed->{$same_field}->value;
}
$this->drupalPostForm('aggregator/sources/' . $feed->id() . '/configure', $edit, 'Save');
$this->drupalGet('aggregator/sources/' . $feed->id() . '/configure');
$this->submitForm($edit, 'Save');
$this->assertSession()->pageTextContains('The feed ' . $edit['title[0][value]'] . ' has been updated.');
// Verify that the creation message contains a link to a feed.

View File

@ -38,7 +38,8 @@ class IpAddressBlockingTest extends BrowserTestBase {
// Ban a valid IP address.
$edit = [];
$edit['ip'] = '1.2.3.3';
$this->drupalPostForm('admin/config/people/ban', $edit, 'Add');
$this->drupalGet('admin/config/people/ban');
$this->submitForm($edit, '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']]));
@ -46,30 +47,35 @@ class IpAddressBlockingTest extends BrowserTestBase {
// Try to block an IP address that's already blocked.
$edit = [];
$edit['ip'] = '1.2.3.3';
$this->drupalPostForm('admin/config/people/ban', $edit, 'Add');
$this->drupalGet('admin/config/people/ban');
$this->submitForm($edit, 'Add');
$this->assertSession()->pageTextContains('This IP address is already banned.');
// Try to block a reserved IP address.
$edit = [];
$edit['ip'] = '255.255.255.255';
$this->drupalPostForm('admin/config/people/ban', $edit, 'Add');
$this->drupalGet('admin/config/people/ban');
$this->submitForm($edit, 'Add');
$this->assertSession()->pageTextContains('Enter a valid IP address.');
// Try to block a reserved IP address.
$edit = [];
$edit['ip'] = 'test.example.com';
$this->drupalPostForm('admin/config/people/ban', $edit, 'Add');
$this->drupalGet('admin/config/people/ban');
$this->submitForm($edit, 'Add');
$this->assertSession()->pageTextContains('Enter a valid IP address.');
// Submit an empty form.
$edit = [];
$edit['ip'] = '';
$this->drupalPostForm('admin/config/people/ban', $edit, 'Add');
$this->drupalGet('admin/config/people/ban');
$this->submitForm($edit, 'Add');
$this->assertSession()->pageTextContains('Enter a valid IP address.');
// Pass an IP address as a URL parameter and submit it.
$submit_ip = '1.2.3.4';
$this->drupalPostForm('admin/config/people/ban/' . $submit_ip, [], 'Add');
$this->drupalGet('admin/config/people/ban/' . $submit_ip);
$this->submitForm([], '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]));
@ -79,7 +85,8 @@ class IpAddressBlockingTest extends BrowserTestBase {
// TODO: On some systems this test fails due to a bug/inconsistency in cURL.
// $edit = array();
// $edit['ip'] = \Drupal::request()->getClientIP();
// $this->drupalPostForm('admin/config/people/ban', $edit, 'Save');
// $this->drupalGet('admin/config/people/ban');
// $this->submitForm($edit, 'Save');
// $this->assertSession()->pageTextContains('You may not ban your own IP address.');
// Test duplicate ip address are not present in the 'blocked_ips' table.

View File

@ -42,7 +42,8 @@ class BlockAdminThemeTest extends BrowserTestBase {
// Install admin theme and confirm that tab is accessible.
\Drupal::service('theme_installer')->install(['bartik']);
$edit['admin_theme'] = 'bartik';
$this->drupalPostForm('admin/appearance', $edit, 'Save configuration');
$this->drupalGet('admin/appearance');
$this->submitForm($edit, 'Save configuration');
$this->drupalGet('admin/structure/block/list/bartik');
$this->assertSession()->statusCodeEquals(200);
}
@ -63,7 +64,8 @@ class BlockAdminThemeTest extends BrowserTestBase {
// Install admin theme and confirm that tab is accessible.
\Drupal::service('theme_installer')->install(['seven']);
$edit['admin_theme'] = 'seven';
$this->drupalPostForm('admin/appearance', $edit, 'Save configuration');
$this->drupalGet('admin/appearance');
$this->submitForm($edit, 'Save configuration');
// Define our block settings.
$settings = [

View File

@ -48,11 +48,13 @@ class BlockInvalidRegionTest extends BrowserTestBase {
$warning_message = t('The block %info was assigned to the invalid region %region and has been disabled.', ['%info' => $block->id(), '%region' => 'invalid_region']);
// Clearing the cache should disable the test block placed in the invalid region.
$this->drupalPostForm('admin/config/development/performance', [], 'Clear all caches');
$this->drupalGet('admin/config/development/performance');
$this->submitForm([], 'Clear all caches');
$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->drupalGet('admin/config/development/performance');
$this->submitForm([], 'Clear all caches');
$this->assertNoRaw($warning_message);
// Place disabled test block in the invalid region of the default theme.
@ -60,7 +62,8 @@ class BlockInvalidRegionTest extends BrowserTestBase {
$block = Block::load($block->id());
// Clear the cache to check if the warning message is not triggered.
$this->drupalPostForm('admin/config/development/performance', [], 'Clear all caches');
$this->drupalGet('admin/config/development/performance');
$this->submitForm([], 'Clear all caches');
$this->assertNoRaw($warning_message);
}

View File

@ -67,7 +67,8 @@ class BlockLanguageCacheTest extends BrowserTestBase {
// Create a menu in the default language.
$edit['label'] = $this->randomMachineName();
$edit['id'] = mb_strtolower($edit['label']);
$this->drupalPostForm('admin/structure/menu/add', $edit, 'Save');
$this->drupalGet('admin/structure/menu/add');
$this->submitForm($edit, 'Save');
$this->assertSession()->pageTextContains('Menu ' . $edit['label'] . ' has been added.');
// Check that the block is listed for all languages.

View File

@ -43,7 +43,8 @@ class BlockLanguageTest extends BrowserTestBase {
$edit = [
'predefined_langcode' => 'fr',
];
$this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add language');
$this->drupalGet('admin/config/regional/language/add');
$this->submitForm($edit, 'Add language');
// Verify that language was added successfully.
$this->assertSession()->pageTextContains('French');
@ -67,13 +68,15 @@ class BlockLanguageTest extends BrowserTestBase {
'id' => strtolower($this->randomMachineName(8)),
'region' => 'sidebar_first',
];
$this->drupalPostForm('admin/structure/block/add/system_powered_by_block' . '/' . $default_theme, $edit, 'Save block');
$this->drupalGet('admin/structure/block/add/system_powered_by_block' . '/' . $default_theme);
$this->submitForm($edit, 'Save block');
// Change the default language.
$edit = [
'site_default_language' => 'fr',
];
$this->drupalPostForm('admin/config/regional/language', $edit, 'Save configuration');
$this->drupalGet('admin/config/regional/language');
$this->submitForm($edit, 'Save configuration');
// Check that a page has a block.
$this->drupalGet('en');
@ -106,7 +109,8 @@ class BlockLanguageTest extends BrowserTestBase {
$this->assertEquals('fr', $visibility['language']['langcodes']['fr'], 'Language is set in the block configuration.');
// Delete the language.
$this->drupalPostForm('admin/config/regional/language/delete/fr', [], 'Delete');
$this->drupalGet('admin/config/regional/language/delete/fr');
$this->submitForm([], 'Delete');
// Check that the language is no longer stored in the configuration after
// it is deleted.
@ -136,7 +140,8 @@ class BlockLanguageTest extends BrowserTestBase {
'language_content[enabled][language-url]' => TRUE,
'language_content[enabled][language-interface]' => FALSE,
];
$this->drupalPostForm('admin/config/regional/language/detection', $edit, 'Save settings');
$this->drupalGet('admin/config/regional/language/detection');
$this->submitForm($edit, 'Save settings');
// Check if the visibility setting is available with a type setting.
$default_theme = $this->config('system.theme')->get('default');
@ -152,7 +157,8 @@ class BlockLanguageTest extends BrowserTestBase {
'id' => $block_id,
'region' => 'sidebar_first',
];
$this->drupalPostForm('admin/structure/block/add/system_powered_by_block' . '/' . $default_theme, $edit, 'Save block');
$this->drupalGet('admin/structure/block/add/system_powered_by_block' . '/' . $default_theme);
$this->submitForm($edit, 'Save block');
// Interface negotiation depends on request arguments.
$this->drupalGet('node', ['query' => ['language' => 'en']]);
@ -176,7 +182,8 @@ class BlockLanguageTest extends BrowserTestBase {
$edit = [
'visibility[language][context_mapping][language]' => '@language.current_language_context:language_content',
];
$this->drupalPostForm('admin/structure/block/manage/' . $block_id, $edit, 'Save block');
$this->drupalGet('admin/structure/block/manage/' . $block_id);
$this->submitForm($edit, 'Save block');
// Content language negotiation does not depend on request arguments.
// It will fall back on English (site default) and not display the block.

View File

@ -85,7 +85,8 @@ class BlockTest extends BlockTestBase {
$block_id = $edit['id'];
// Set the block to be shown only to authenticated users.
$edit['visibility[user_role][roles][' . RoleInterface::AUTHENTICATED_ID . ']'] = TRUE;
$this->drupalPostForm('admin/structure/block/add/' . $block_name . '/' . $default_theme, $edit, 'Save block');
$this->drupalGet('admin/structure/block/add/' . $block_name . '/' . $default_theme);
$this->submitForm($edit, 'Save block');
$this->clickLink('Configure');
$this->assertSession()->checkboxChecked('edit-visibility-user-role-roles-authenticated');
@ -121,7 +122,8 @@ class BlockTest extends BlockTestBase {
];
// Set the block to be hidden on any user path, and to be shown only to
// authenticated users.
$this->drupalPostForm('admin/structure/block/add/' . $block_name . '/' . $default_theme, $edit, 'Save block');
$this->drupalGet('admin/structure/block/add/' . $block_name . '/' . $default_theme);
$this->submitForm($edit, 'Save block');
$this->assertSession()->pageTextContains('The block configuration has been saved.');
// Confirm that block was not displayed according to block visibility
@ -176,7 +178,8 @@ class BlockTest extends BlockTestBase {
'settings[label]' => $title,
];
// Create the block using the link parsed from the library page.
$this->drupalPostForm($this->getAbsoluteUrl($links[0]->getAttribute('href')), $edit, 'Save block');
$this->drupalGet($this->getAbsoluteUrl($links[0]->getAttribute('href')));
$this->submitForm($edit, 'Save block');
// Ensure that the block was created with the expected weight.
/** @var \Drupal\block\BlockInterface $block */
@ -205,7 +208,13 @@ class BlockTest extends BlockTestBase {
$block['region'] = 'header';
// Set block title to confirm that interface works and override any custom titles.
$this->drupalPostForm('admin/structure/block/add/' . $block['id'] . '/' . $block['theme'], ['settings[label]' => $block['settings[label]'], 'settings[label_display]' => $block['settings[label_display]'], 'id' => $block['id'], 'region' => $block['region']], 'Save block');
$this->drupalGet('admin/structure/block/add/' . $block['id'] . '/' . $block['theme']);
$this->submitForm([
'settings[label]' => $block['settings[label]'],
'settings[label_display]' => $block['settings[label_display]'],
'id' => $block['id'],
'region' => $block['region'],
], 'Save block');
$this->assertSession()->pageTextContains('The block configuration has been saved.');
// Check to see if the block was created by checking its configuration.
$instance = Block::load($block['id']);
@ -265,7 +274,8 @@ class BlockTest extends BlockTestBase {
$block['id'] = strtolower($this->randomMachineName());
$block['theme'] = $theme;
$block['region'] = 'content';
$this->drupalPostForm('admin/structure/block/add/system_powered_by_block', $block, 'Save block');
$this->drupalGet('admin/structure/block/add/system_powered_by_block');
$this->submitForm($block, 'Save block');
$this->assertSession()->pageTextContains('The block configuration has been saved.');
$this->assertSession()->addressEquals('admin/structure/block/list/' . $theme . '?block-placement=' . Html::getClass($block['id']));
@ -308,7 +318,8 @@ class BlockTest extends BlockTestBase {
'region' => 'sidebar_first',
'settings[label]' => $title,
];
$this->drupalPostForm('admin/structure/block/add/' . $block_name . '/' . $default_theme, $edit, 'Save block');
$this->drupalGet('admin/structure/block/add/' . $block_name . '/' . $default_theme);
$this->submitForm($edit, 'Save block');
$this->assertSession()->pageTextContains('The block configuration has been saved.');
// Confirm that the block is not displayed by default.
@ -318,7 +329,8 @@ class BlockTest extends BlockTestBase {
$edit = [
'settings[label_display]' => TRUE,
];
$this->drupalPostForm('admin/structure/block/manage/' . $id, $edit, 'Save block');
$this->drupalGet('admin/structure/block/manage/' . $id);
$this->submitForm($edit, 'Save block');
$this->assertSession()->pageTextContains('The block configuration has been saved.');
$this->drupalGet('admin/structure/block/manage/' . $id);
@ -346,7 +358,8 @@ class BlockTest extends BlockTestBase {
$block += ['theme' => $this->config('system.theme')->get('default')];
$edit = [];
$edit['blocks[' . $block['id'] . '][region]'] = $region;
$this->drupalPostForm('admin/structure/block', $edit, 'Save blocks');
$this->drupalGet('admin/structure/block');
$this->submitForm($edit, 'Save blocks');
// Confirm that the block was moved to the proper region.
$this->assertSession()->pageTextContains('The block settings have been updated.');

View File

@ -130,7 +130,8 @@ class BlockUiTest extends BrowserTestBase {
// Change the test block's weight.
$edit['blocks[' . $values['settings']['id'] . '][weight]'] = $values['test_weight'];
}
$this->drupalPostForm('admin/structure/block', $edit, 'Save blocks');
$this->drupalGet('admin/structure/block');
$this->submitForm($edit, 'Save blocks');
foreach ($this->blockValues as $values) {
// Check if the region and weight settings changes have persisted.
$this->assertTrue($this->assertSession()->optionExists('edit-blocks-' . $values['settings']['id'] . '-region', 'header')->isSelected());
@ -236,7 +237,8 @@ class BlockUiTest extends BrowserTestBase {
'region' => 'content',
'settings[context_mapping][user]' => '@block_test.multiple_static_context:userB',
];
$this->drupalPostForm($block_url, $edit, 'Save block');
$this->drupalGet($block_url);
$this->submitForm($edit, 'Save block');
$this->drupalGet('');
$this->assertSession()->pageTextContains('Test context-aware block');
@ -276,13 +278,15 @@ class BlockUiTest extends BrowserTestBase {
$this->drupalGet($url);
$this->assertSession()->fieldValueEquals('id', 'displaymessage');
$edit = ['region' => 'content'];
$this->drupalPostForm($url, $edit, 'Save block');
$this->drupalGet($url);
$this->submitForm($edit, 'Save block');
$this->assertSession()->pageTextContains('The block configuration has been saved.');
// Now, check to make sure the form starts by autoincrementing correctly.
$this->drupalGet($url);
$this->assertSession()->fieldValueEquals('id', 'displaymessage_2');
$this->drupalPostForm($url, $edit, 'Save block');
$this->drupalGet($url);
$this->submitForm($edit, 'Save block');
$this->assertSession()->pageTextContains('The block configuration has been saved.');
// And verify that it continues working beyond just the first two.
@ -319,7 +323,8 @@ class BlockUiTest extends BrowserTestBase {
$block['region'] = 'content';
// After adding a block, it will indicate which block was just added.
$this->drupalPostForm('admin/structure/block/add/system_powered_by_block', $block, 'Save block');
$this->drupalGet('admin/structure/block/add/system_powered_by_block');
$this->submitForm($block, 'Save block');
$this->assertSession()->addressEquals('admin/structure/block/list/classy?block-placement=' . Html::getClass($block['id']));
// Resaving the block page will remove the block placement indicator.
@ -349,7 +354,11 @@ class BlockUiTest extends BrowserTestBase {
* Tests if validation errors are passed plugin form to the parent form.
*/
public function testBlockValidateErrors() {
$this->drupalPostForm('admin/structure/block/add/test_settings_validation/classy', ['region' => 'content', 'settings[digits]' => 'abc'], 'Save block');
$this->drupalGet('admin/structure/block/add/test_settings_validation/classy');
$this->submitForm([
'region' => 'content',
'settings[digits]' => 'abc',
], 'Save block');
$arguments = [':message' => 'Only digits are allowed'];
$pattern = '//div[contains(@class,"messages messages--error")]/div[contains(text()[2],:message)]';

View File

@ -77,7 +77,8 @@ class DisplayBlockTest extends ViewTestBase {
$edit['description'] = $this->randomString();
$edit['block[create]'] = TRUE;
$edit['block[style][row_plugin]'] = 'fields';
$this->drupalPostForm('admin/structure/views/add', $edit, 'Save and edit');
$this->drupalGet('admin/structure/views/add');
$this->submitForm($edit, 'Save and edit');
$pattern = '//tr[.//td[text()=:category] and .//td//a[contains(@href, :href)]]';
@ -96,7 +97,8 @@ class DisplayBlockTest extends ViewTestBase {
$this->assertTrue(!empty($elements), 'The test block appears in the category for its base table.');
// Duplicate the block before changing the category.
$this->drupalPostForm('admin/structure/views/view/' . $edit['id'] . '/edit/block_1', [], 'Duplicate Block');
$this->drupalGet('admin/structure/views/view/' . $edit['id'] . '/edit/block_1');
$this->submitForm([], 'Duplicate Block');
$this->assertSession()->addressEquals('admin/structure/views/view/' . $edit['id'] . '/edit/block_2');
// Change the block category to a random string.
@ -217,7 +219,8 @@ class DisplayBlockTest extends ViewTestBase {
for ($i = 2; $i <= 3; $i++) {
// Place the same block again and make sure we have a new ID.
$this->drupalPostForm('admin/structure/block/add/views_block:test_view_block-block_1/' . $default_theme, $edit, 'Save block');
$this->drupalGet('admin/structure/block/add/views_block:test_view_block-block_1/' . $default_theme);
$this->submitForm($edit, 'Save block');
$block = $storage->load('views_block__test_view_block_block_1_' . $i);
// This will only return a result if our new block has been created with the
// expected machine name.
@ -229,14 +232,16 @@ class DisplayBlockTest extends ViewTestBase {
$edit = ['region' => 'content'];
$edit['settings[override][items_per_page]'] = 10;
$this->drupalPostForm('admin/structure/block/add/views_block:test_view_block-block_1/' . $default_theme, $edit, 'Save block');
$this->drupalGet('admin/structure/block/add/views_block:test_view_block-block_1/' . $default_theme);
$this->submitForm($edit, 'Save block');
$block = $storage->load('views_block__test_view_block_block_1_4');
$config = $block->getPlugin()->getConfiguration();
$this->assertEquals(10, $config['items_per_page'], "'Items per page' is properly saved.");
$edit['settings[override][items_per_page]'] = 5;
$this->drupalPostForm('admin/structure/block/manage/views_block__test_view_block_block_1_4', $edit, 'Save block');
$this->drupalGet('admin/structure/block/manage/views_block__test_view_block_block_1_4');
$this->submitForm($edit, 'Save block');
$block = $storage->load('views_block__test_view_block_block_1_4');
@ -247,7 +252,8 @@ class DisplayBlockTest extends ViewTestBase {
$edit = ['region' => 'content'];
$edit['settings[views_label_checkbox]'] = 1;
$edit['settings[views_label]'] = 'Custom title';
$this->drupalPostForm('admin/structure/block/add/views_block:test_view_block-block_1/' . $default_theme, $edit, 'Save block');
$this->drupalGet('admin/structure/block/add/views_block:test_view_block-block_1/' . $default_theme);
$this->submitForm($edit, 'Save block');
$block = $storage->load('views_block__test_view_block_block_1_5');
$config = $block->getPlugin()->getConfiguration();

View File

@ -56,7 +56,8 @@ class BlockContentCreationTest extends BlockContentTestBase {
$edit = [];
$edit['info[0][value]'] = 'Test Block';
$edit['body[0][value]'] = $this->randomMachineName(16);
$this->drupalPostForm('block/add/basic', $edit, 'Save');
$this->drupalGet('block/add/basic');
$this->submitForm($edit, 'Save');
// Check that the Basic block has been created.
$this->assertRaw(new FormattableMarkup('@block %name has been created.', [
@ -76,7 +77,8 @@ class BlockContentCreationTest extends BlockContentTestBase {
// Check that attempting to create another block with the same value for
// 'info' returns an error.
$this->drupalPostForm('block/add/basic', $edit, 'Save');
$this->drupalGet('block/add/basic');
$this->submitForm($edit, 'Save');
// Check that the Basic block has been created.
$this->assertRaw(new FormattableMarkup('A custom block with block description %value already exists.', [
@ -105,7 +107,8 @@ class BlockContentCreationTest extends BlockContentTestBase {
$edit = [];
$edit['info[0][value]'] = 'Test Block';
$edit['body[0][value]'] = $this->randomMachineName(16);
$this->drupalPostForm('block/add/basic', $edit, 'Save');
$this->drupalGet('block/add/basic');
$this->submitForm($edit, 'Save');
// Check that the Basic block has been created.
$this->assertRaw(new FormattableMarkup('@block %name has been created.', [
@ -160,7 +163,8 @@ class BlockContentCreationTest extends BlockContentTestBase {
// Check that attempting to create another block with the same value for
// 'info' returns an error.
$this->drupalPostForm('block/add/basic', $edit, 'Save');
$this->drupalGet('block/add/basic');
$this->submitForm($edit, 'Save');
// Check that the Basic block has been created.
$this->assertRaw(new FormattableMarkup('A custom block with block description %value already exists.', [
@ -180,7 +184,8 @@ class BlockContentCreationTest extends BlockContentTestBase {
$edit['info[0][value]'] = $this->randomMachineName(8);
$edit['body[0][value]'] = $this->randomMachineName(16);
// Don't pass the custom block type in the url so the default is forced.
$this->drupalPostForm('block/add', $edit, 'Save');
$this->drupalGet('block/add');
$this->submitForm($edit, 'Save');
// Check that the block has been created and that it is a basic block.
$this->assertRaw(new FormattableMarkup('@block %name has been created.', [
@ -229,7 +234,8 @@ class BlockContentCreationTest extends BlockContentTestBase {
$edit['info[0][value]'] = $this->randomMachineName(8);
$body = $this->randomMachineName(16);
$edit['body[0][value]'] = $body;
$this->drupalPostForm('block/add/basic', $edit, 'Save');
$this->drupalGet('block/add/basic');
$this->submitForm($edit, 'Save');
// Place the block.
$instance = [
@ -239,7 +245,8 @@ class BlockContentCreationTest extends BlockContentTestBase {
];
$block = BlockContent::load(1);
$url = 'admin/structure/block/add/block_content:' . $block->uuid() . '/' . $this->config('system.theme')->get('default');
$this->drupalPostForm($url, $instance, 'Save block');
$this->drupalGet($url);
$this->submitForm($instance, 'Save block');
$block = BlockContent::load(1);
@ -262,7 +269,8 @@ class BlockContentCreationTest extends BlockContentTestBase {
$edit2['info[0][value]'] = $this->randomMachineName(8);
$body2 = $this->randomMachineName(16);
$edit2['body[0][value]'] = $body2;
$this->drupalPostForm('block/add/basic', $edit2, 'Save');
$this->drupalGet('block/add/basic');
$this->submitForm($edit2, 'Save');
$this->assertNoRaw('Error message');
@ -272,7 +280,8 @@ class BlockContentCreationTest extends BlockContentTestBase {
$edit3['info[0][value]'] = $this->randomMachineName(8);
$body = $this->randomMachineName(16);
$edit3['body[0][value]'] = $body;
$this->drupalPostForm('block/add/basic', $edit3, 'Save');
$this->drupalGet('block/add/basic');
$this->submitForm($edit3, 'Save');
// Show the delete confirm form.
$this->drupalGet('block/3/delete');
@ -293,7 +302,8 @@ class BlockContentCreationTest extends BlockContentTestBase {
];
$block = BlockContent::load(1);
$url = 'admin/structure/block/add/block_content:' . $block->uuid() . '/' . $this->config('system.theme')->get('default');
$this->drupalPostForm($url, $instance, 'Save block');
$this->drupalGet($url);
$this->submitForm($instance, 'Save block');
$dependencies = \Drupal::service('config.manager')->findConfigEntityDependentsAsEntities('content', [$block->getConfigDependencyName()]);
$block_placement = reset($dependencies);

View File

@ -149,9 +149,11 @@ class BlockContentTypeTest extends BlockContentTestBase {
$this->assertSession()->addressEquals(Url::fromRoute('block_content.add_form', ['block_content_type' => 'basic']));
// Remove the body field.
$this->drupalPostForm('admin/structure/block/block-content/manage/basic/fields/block_content.basic.body/delete', [], 'Delete');
$this->drupalGet('admin/structure/block/block-content/manage/basic/fields/block_content.basic.body/delete');
$this->submitForm([], 'Delete');
// Resave the settings for this type.
$this->drupalPostForm('admin/structure/block/block-content/manage/basic', [], 'Save');
$this->drupalGet('admin/structure/block/block-content/manage/basic');
$this->submitForm([], 'Save');
// Check that the body field doesn't exist.
$this->drupalGet('block/add/basic');
$this->assertEmpty($this->cssSelect('#edit-body-0-value'), 'Body field was not found.');

View File

@ -34,7 +34,8 @@ class PageEditTest extends BlockContentTestBase {
$edit = [];
$edit['info[0][value]'] = mb_strtolower($this->randomMachineName(8));
$edit[$body_key] = $this->randomMachineName(16);
$this->drupalPostForm('block/add/basic', $edit, 'Save');
$this->drupalGet('block/add/basic');
$this->submitForm($edit, 'Save');
// Check that the block exists in the database.
$blocks = \Drupal::entityQuery('block_content')

View File

@ -40,7 +40,8 @@ class BlockContentWizardTest extends BlockContentTestBase {
$view['description'] = $this->randomMachineName(16);
$view['page[create]'] = FALSE;
$view['show[wizard_key]'] = 'block_content';
$this->drupalPostForm('admin/structure/views/add', $view, 'Save and edit');
$this->drupalGet('admin/structure/views/add');
$this->submitForm($view, 'Save and edit');
$view_storage_controller = $this->container->get('entity_type.manager')->getStorage('view');
/** @var \Drupal\views\Entity\View $view */

View File

@ -134,7 +134,8 @@ class BookBreadcrumbTest extends BrowserTestBase {
$edit['book[bid]'] = $book_nid;
if ($parent !== NULL) {
$this->drupalPostForm('node/add/book', $edit, 'Change book (update list of parents)');
$this->drupalGet('node/add/book');
$this->submitForm($edit, 'Change book (update list of parents)');
$edit['book[pid]'] = $parent;
$this->submitForm($edit, 'Save');
@ -143,7 +144,8 @@ class BookBreadcrumbTest extends BrowserTestBase {
$this->assertFalse(empty($parent_node->book['has_children']), 'Parent node is marked as having children');
}
else {
$this->drupalPostForm('node/add/book', $edit, 'Save');
$this->drupalGet('node/add/book');
$this->submitForm($edit, 'Save');
}
// Check to make sure the book node was created.
@ -177,7 +179,8 @@ class BookBreadcrumbTest extends BrowserTestBase {
$edit = [
'title[0][value]' => 'Updated node5 title',
];
$this->drupalPostForm($nodes[3]->toUrl('edit-form'), $edit, 'Save');
$this->drupalGet($nodes[3]->toUrl('edit-form'));
$this->submitForm($edit, 'Save');
$this->drupalGet($nodes[4]->toUrl());
// Fetch each node title in the current breadcrumb.
$links = $this->xpath('//nav[@class="breadcrumb"]/ol/li/a');
@ -199,7 +202,8 @@ class BookBreadcrumbTest extends BrowserTestBase {
$edit = [
'title[0][value]' => "you can't see me",
];
$this->drupalPostForm($nodes[3]->toUrl('edit-form'), $edit, 'Save');
$this->drupalGet($nodes[3]->toUrl('edit-form'));
$this->submitForm($edit, 'Save');
$this->drupalGet($nodes[4]->toUrl());
$links = $this->xpath('//nav[@class="breadcrumb"]/ol/li/a');
$got_breadcrumb = [];

View File

@ -82,33 +82,38 @@ class BookContentModerationTest extends BrowserTestBase {
'title[0][value]' => $this->randomString(),
'moderation_state[0][state]' => 'published',
];
$this->drupalPostForm('node/add/book', $edit, 'Save');
$this->drupalGet('node/add/book');
$this->submitForm($edit, 'Save');
$node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
$this->assertNotEmpty($node);
$edit = [
'moderation_state[0][state]' => 'draft',
];
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save');
$this->drupalGet('node/' . $node->id() . '/edit');
$this->submitForm($edit, 'Save');
$this->assertSession()->pageTextNotContains('You can only change the book outline for the published version of this content.');
// Create a book draft with no changes, then publish it.
$edit = [
'moderation_state[0][state]' => 'draft',
];
$this->drupalPostForm('node/' . $book_1->id() . '/edit', $edit, 'Save');
$this->drupalGet('node/' . $book_1->id() . '/edit');
$this->submitForm($edit, 'Save');
$this->assertSession()->pageTextNotContains('You can only change the book outline for the published version of this content.');
$edit = [
'moderation_state[0][state]' => 'published',
];
$this->drupalPostForm('node/' . $book_1->id() . '/edit', $edit, 'Save');
$this->drupalGet('node/' . $book_1->id() . '/edit');
$this->submitForm($edit, 'Save');
// Try to move Node 2 to a different parent.
$edit = [
'book[pid]' => $book_1_nodes[3]->id(),
'moderation_state[0][state]' => 'draft',
];
$this->drupalPostForm('node/' . $book_1_nodes[1]->id() . '/edit', $edit, 'Save');
$this->drupalGet('node/' . $book_1_nodes[1]->id() . '/edit');
$this->submitForm($edit, 'Save');
$this->assertSession()->pageTextContains('You can only change the book outline for the published version of this content.');
@ -122,7 +127,8 @@ class BookContentModerationTest extends BrowserTestBase {
'book[bid]' => $book_2->id(),
'moderation_state[0][state]' => 'draft',
];
$this->drupalPostForm('node/' . $book_1_nodes[1]->id() . '/edit', $edit, 'Save');
$this->drupalGet('node/' . $book_1_nodes[1]->id() . '/edit');
$this->submitForm($edit, 'Save');
$this->assertSession()->pageTextContains('You can only change the book outline for the published version of this content.');
@ -136,7 +142,8 @@ class BookContentModerationTest extends BrowserTestBase {
'book[weight]' => 2,
'moderation_state[0][state]' => 'draft',
];
$this->drupalPostForm('node/' . $book_1_nodes[1]->id() . '/edit', $edit, 'Save');
$this->drupalGet('node/' . $book_1_nodes[1]->id() . '/edit');
$this->submitForm($edit, 'Save');
$this->assertSession()->pageTextContains('You can only change the book outline for the published version of this content.');
@ -150,7 +157,8 @@ class BookContentModerationTest extends BrowserTestBase {
$edit = [
'moderation_state[0][state]' => 'draft',
];
$this->drupalPostForm('node/' . $book_1_nodes[1]->id() . '/edit', $edit, 'Save');
$this->drupalGet('node/' . $book_1_nodes[1]->id() . '/edit');
$this->submitForm($edit, 'Save');
$this->assertSession()->pageTextNotContains('You can only change the book outline for the published version of this content.');
}

View File

@ -160,7 +160,8 @@ class BookTest extends BrowserTestBase {
// Log in as a user with access to the book outline and save the form.
$this->drupalLogin($this->adminUser);
$this->drupalPostForm('admin/structure/book/' . $book->id(), [], 'Save book pages');
$this->drupalGet('admin/structure/book/' . $book->id());
$this->submitForm([], 'Save book pages');
$this->assertSession()->pageTextContains('Updated book ' . $book->label() . '.');
}
@ -213,7 +214,8 @@ class BookTest extends BrowserTestBase {
$other_book = $this->createBookNode('new');
$node = $this->createBookNode($book->id());
$edit = ['book[bid]' => $other_book->id()];
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save');
$this->drupalGet('node/' . $node->id() . '/edit');
$this->submitForm($edit, 'Save');
$this->drupalLogout();
$this->drupalLogin($this->webUser);
@ -296,7 +298,8 @@ class BookTest extends BrowserTestBase {
// Give anonymous users the permission 'node test view'.
$edit = [];
$edit[RoleInterface::ANONYMOUS_ID . '[node test view]'] = TRUE;
$this->drupalPostForm('admin/people/permissions/' . RoleInterface::ANONYMOUS_ID, $edit, 'Save permissions');
$this->drupalGet('admin/people/permissions/' . RoleInterface::ANONYMOUS_ID);
$this->submitForm($edit, 'Save permissions');
$this->assertSession()->pageTextContains('The changes have been saved.');
// Test correct display of the block.
@ -397,7 +400,8 @@ class BookTest extends BrowserTestBase {
// Give anonymous users the permission 'node test view'.
$edit = [];
$edit[RoleInterface::ANONYMOUS_ID . '[node test view]'] = TRUE;
$this->drupalPostForm('admin/people/permissions/' . RoleInterface::ANONYMOUS_ID, $edit, 'Save permissions');
$this->drupalGet('admin/people/permissions/' . RoleInterface::ANONYMOUS_ID);
$this->submitForm($edit, 'Save permissions');
$this->assertSession()->pageTextContains('The changes have been saved.');
// Create a book.
@ -432,7 +436,8 @@ class BookTest extends BrowserTestBase {
$this->assertSession()->statusCodeEquals(403);
// Ensure that a child book node can be deleted.
$this->drupalPostForm('node/' . $nodes[4]->id() . '/outline/remove', $edit, 'Remove');
$this->drupalGet('node/' . $nodes[4]->id() . '/outline/remove');
$this->submitForm($edit, 'Remove');
$node_storage->resetCache([$nodes[4]->id()]);
$node4 = $node_storage->load($nodes[4]->id());
$this->assertTrue(empty($node4->book), 'Deleting child book node properly allowed.');
@ -444,7 +449,8 @@ class BookTest extends BrowserTestBase {
// Delete all child book nodes and retest top-level node deletion.
$node_storage->delete($nodes);
$this->drupalPostForm('node/' . $this->book->id() . '/outline/remove', $edit, 'Remove');
$this->drupalGet('node/' . $this->book->id() . '/outline/remove');
$this->submitForm($edit, 'Remove');
$node_storage->resetCache([$this->book->id()]);
$node = $node_storage->load($this->book->id());
$this->assertTrue(empty($node->book), 'Deleting childless top-level book node properly allowed.');
@ -455,7 +461,8 @@ class BookTest extends BrowserTestBase {
$this->drupalGet($this->book->toUrl('delete-form'));
$this->assertRaw(t('%title is part of a book outline, and has associated child pages. If you proceed with deletion, the child pages will be relocated automatically.', ['%title' => $this->book->label()]));
// Delete parent, and visit a child page.
$this->drupalPostForm($this->book->toUrl('delete-form'), [], 'Delete');
$this->drupalGet($this->book->toUrl('delete-form'));
$this->submitForm([], 'Delete');
$this->drupalGet($nodes[0]->toUrl());
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextContains($nodes[0]->label());
@ -489,7 +496,8 @@ class BookTest extends BrowserTestBase {
$edit = [];
$edit['book[bid]'] = '1';
$this->drupalPostForm('node/' . $empty_book->id() . '/outline', $edit, 'Add to book outline');
$this->drupalGet('node/' . $empty_book->id() . '/outline');
$this->submitForm($edit, 'Add to book outline');
$node = \Drupal::entityTypeManager()->getStorage('node')->load($empty_book->id());
// Test the book array.
$this->assertEquals($empty_book->id(), $node->book['nid']);
@ -512,7 +520,8 @@ class BookTest extends BrowserTestBase {
$node = $this->drupalCreateNode(['type' => 'book']);
$edit = [];
$edit['book[bid]'] = $node->id();
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save');
$this->drupalGet('node/' . $node->id() . '/edit');
$this->submitForm($edit, 'Save');
$node = \Drupal::entityTypeManager()->getStorage('node')->load($node->id());
// Test the book array.
@ -706,7 +715,8 @@ class BookTest extends BrowserTestBase {
// Unpublish book node.
$edit = ['status[value]' => FALSE];
$this->drupalPostForm('node/' . $this->book->id() . '/edit', $edit, 'Save');
$this->drupalGet('node/' . $this->book->id() . '/edit');
$this->submitForm($edit, 'Save');
// Test node page.
$this->drupalGet('node/' . $this->book->id());
@ -720,7 +730,8 @@ class BookTest extends BrowserTestBase {
*/
public function testSettingsForm() {
$this->drupalLogin($this->adminUser);
$this->drupalPostForm('admin/structure/book/settings', [], 'Save configuration');
$this->drupalGet('admin/structure/book/settings');
$this->submitForm([], 'Save configuration');
}
}

View File

@ -191,7 +191,8 @@ trait BookTestTrait {
$edit['book[bid]'] = $book_nid;
if ($parent !== NULL) {
$this->drupalPostForm('node/add/book', $edit, 'Change book (update list of parents)');
$this->drupalGet('node/add/book');
$this->submitForm($edit, 'Change book (update list of parents)');
$edit['book[pid]'] = $parent;
$this->submitForm($edit, 'Save');
@ -200,7 +201,8 @@ trait BookTestTrait {
$this->assertFalse(empty($parent_node->book['has_children']), 'Parent node is marked as having children');
}
else {
$this->drupalPostForm('node/add/book', $edit, 'Save');
$this->drupalGet('node/add/book');
$this->submitForm($edit, 'Save');
}
// Check to make sure the book node was created.

View File

@ -121,7 +121,8 @@ class BookRelationshipTest extends ViewTestBase {
$edit['book[bid]'] = $book_nid;
if ($parent !== NULL) {
$this->drupalPostForm('node/add/book', $edit, 'Change book (update list of parents)');
$this->drupalGet('node/add/book');
$this->submitForm($edit, 'Change book (update list of parents)');
$edit['book[pid]'] = $parent;
$this->submitForm($edit, 'Save');
@ -130,7 +131,8 @@ class BookRelationshipTest extends ViewTestBase {
$this->assertFalse(empty($parent_node->book['has_children']), 'Parent node is marked as having children');
}
else {
$this->drupalPostForm('node/add/book', $edit, 'Save');
$this->drupalGet('node/add/book');
$this->submitForm($edit, 'Save');
}
// Check to make sure the book node was created.

View File

@ -73,7 +73,8 @@ class CKEditorStylesComboTranslationTest extends BrowserTestBase {
$edit = [
'editor[settings][plugins][stylescombo][styles]' => 'h1.title|Title',
];
$this->drupalPostForm('admin/config/content/formats/manage/' . $this->format, $edit, 'Save configuration');
$this->drupalGet('admin/config/content/formats/manage/' . $this->format);
$this->submitForm($edit, 'Save configuration');
$this->drupalGet('admin/config/content/formats/manage/' . $this->format . '/translate/de/add');
$this->assertEquals('textarea', $this->assertSession()->fieldExists('List of styles')->getTagName());

View File

@ -62,10 +62,12 @@ class CKEditorToolbarButtonTest extends BrowserTestBase {
// Install the Arabic language (which is RTL) and configure as the default.
$edit = [];
$edit['predefined_langcode'] = 'ar';
$this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add language');
$this->drupalGet('admin/config/regional/language/add');
$this->submitForm($edit, 'Add language');
$edit = ['site_default_language' => 'ar'];
$this->drupalPostForm('admin/config/regional/language', $edit, 'Save configuration');
$this->drupalGet('admin/config/regional/language');
$this->submitForm($edit, 'Save configuration');
// Once the default language is changed, go to the tested text format
// configuration page.
$this->drupalGet('admin/config/content/formats/manage/full_html');

View File

@ -49,7 +49,8 @@ class ColorConfigSchemaTest extends BrowserTestBase {
$settings_path = 'admin/appearance/settings/bartik';
$edit['scheme'] = '';
$edit['palette[bg]'] = '#123456';
$this->drupalPostForm($settings_path, $edit, 'Save configuration');
$this->drupalGet($settings_path);
$this->submitForm($edit, 'Save configuration');
}
}

View File

@ -116,7 +116,8 @@ class ColorTest extends BrowserTestBase {
$this->assertSession()->pageTextContainsOnce('Color set');
$edit['scheme'] = '';
$edit[$test_values['palette_input']] = '#123456';
$this->drupalPostForm($settings_path, $edit, 'Save configuration');
$this->drupalGet($settings_path);
$this->submitForm($edit, 'Save configuration');
$this->drupalGet('<front>');
$stylesheets = $this->config('color.theme.' . $theme)->get('stylesheets');
@ -130,7 +131,8 @@ class ColorTest extends BrowserTestBase {
$this->drupalGet($settings_path);
$this->assertSession()->statusCodeEquals(200);
$edit['scheme'] = $test_values['scheme'];
$this->drupalPostForm($settings_path, $edit, 'Save configuration');
$this->drupalGet($settings_path);
$this->submitForm($edit, 'Save configuration');
$this->drupalGet('<front>');
$stylesheets = $this->config('color.theme.' . $theme)->get('stylesheets');
@ -168,7 +170,8 @@ class ColorTest extends BrowserTestBase {
foreach ($this->colorTests as $color => $is_valid) {
$edit['palette[bg]'] = $color;
$this->drupalPostForm($settings_path, $edit, 'Save configuration');
$this->drupalGet($settings_path);
$this->submitForm($edit, 'Save configuration');
if ($is_valid) {
$this->assertSession()->pageTextContains('The configuration options have been saved.');
@ -188,7 +191,8 @@ class ColorTest extends BrowserTestBase {
'default_logo' => FALSE,
'logo_path' => 'core/misc/druplicon.png',
];
$this->drupalPostForm('admin/appearance/settings', $edit, 'Save configuration');
$this->drupalGet('admin/appearance/settings');
$this->submitForm($edit, 'Save configuration');
// Ensure that the overridden logo is present in Bartik, which is colorable.
$this->drupalGet('admin/appearance/settings/bartik');
@ -216,7 +220,8 @@ class ColorTest extends BrowserTestBase {
// Log in and set the color scheme to 'slate'.
$this->drupalLogin($this->bigUser);
$edit['scheme'] = 'slate';
$this->drupalPostForm($settings_path, $edit, 'Save configuration');
$this->drupalGet($settings_path);
$this->submitForm($edit, 'Save configuration');
// Visit the homepage and ensure color changes.
$this->drupalLogout();
@ -229,7 +234,8 @@ class ColorTest extends BrowserTestBase {
// Log in and set the color scheme back to default (delete config).
$this->drupalLogin($this->bigUser);
$edit['scheme'] = 'default';
$this->drupalPostForm($settings_path, $edit, 'Save configuration');
$this->drupalGet($settings_path);
$this->submitForm($edit, 'Save configuration');
// Log out and ensure there is no color and we have the original logo.
$this->drupalLogout();

View File

@ -277,7 +277,8 @@ class CommentAdminTest extends CommentTestBase {
"comments[{$comment1->id()}]" => 1,
"comments[{$comment2->id()}]" => 1,
];
$this->drupalPostForm('admin/content/comment', $edit, 'Update');
$this->drupalGet('admin/content/comment');
$this->submitForm($edit, 'Update');
$this->assertRaw(new FormattableMarkup('@label (Original translation) - <em>The following comment translations will be deleted:</em>', ['@label' => $comment1->label()]));
$this->assertRaw(new FormattableMarkup('@label (Original translation) - <em>The following comment translations will be deleted:</em>', ['@label' => $comment2->label()]));
$this->assertSession()->pageTextContains('English');

View File

@ -47,7 +47,8 @@ class CommentAnonymousTest extends CommentTestBase {
$body = 'comment body with skip comment approval';
$edit['subject[0][value]'] = $title;
$edit['comment_body[0][value]'] = $body;
$this->drupalPostForm($this->node->toUrl(), $edit, 'Preview');
$this->drupalGet($this->node->toUrl());
$this->submitForm($edit, 'Preview');
// Cannot use assertRaw here since both title and body are in the form.
$preview = (string) $this->cssSelect('.preview')[0]->getHtml();
$this->assertStringContainsString($title, $preview, 'Anonymous user can preview comment title.');
@ -60,7 +61,8 @@ class CommentAnonymousTest extends CommentTestBase {
$body = 'comment body without skip comment approval';
$edit['subject[0][value]'] = $title;
$edit['comment_body[0][value]'] = $body;
$this->drupalPostForm($this->node->toUrl(), $edit, 'Preview');
$this->drupalGet($this->node->toUrl());
$this->submitForm($edit, 'Preview');
// Cannot use assertRaw here since both title and body are in the form.
$preview = (string) $this->cssSelect('.preview')[0]->getHtml();
$this->assertStringContainsString($title, $preview, 'Anonymous user can preview comment title.');
@ -76,7 +78,8 @@ class CommentAnonymousTest extends CommentTestBase {
'name' => $this->adminUser->getAccountName(),
'comment_body[0][value]' => $this->randomMachineName(),
];
$this->drupalPostForm('comment/reply/node/' . $this->node->id() . '/comment', $edit, 'Save');
$this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment');
$this->submitForm($edit, 'Save');
$this->assertRaw(t('The name you used (%name) belongs to a registered user.', [
'%name' => $this->adminUser->getAccountName(),
]));
@ -109,7 +112,8 @@ class CommentAnonymousTest extends CommentTestBase {
'subject[0][value]' => $this->randomMachineName(),
'comment_body[0][value]' => $this->randomMachineName(),
];
$this->drupalPostForm('comment/reply/node/' . $this->node->id() . '/comment', $edit, 'Save');
$this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment');
$this->submitForm($edit, 'Save');
$this->assertRaw(t('The name you used (%name) belongs to a registered user.', [
'%name' => $this->adminUser->getAccountName(),
]));

View File

@ -157,11 +157,13 @@ class CommentFieldsTest extends CommentTestBase {
'label' => 'User comment',
'field_name' => 'user_comment',
];
$this->drupalPostForm('admin/config/people/accounts/fields/add-field', $edit, 'Save and continue');
$this->drupalGet('admin/config/people/accounts/fields/add-field');
$this->submitForm($edit, 'Save and continue');
// Try to save the comment field without selecting a comment type.
$edit = [];
$this->drupalPostForm('admin/config/people/accounts/fields/user.user.field_user_comment/storage', $edit, 'Save field settings');
$this->drupalGet('admin/config/people/accounts/fields/user.user.field_user_comment/storage');
$this->submitForm($edit, 'Save field settings');
// We should get an error message.
$this->assertSession()->pageTextContains('An illegal choice has been detected. Please contact the site administrator.');
@ -178,7 +180,8 @@ class CommentFieldsTest extends CommentTestBase {
$edit = [
'settings[comment_type]' => 'user_comment_type',
];
$this->drupalPostForm('admin/config/people/accounts/fields/user.user.field_user_comment/storage', $edit, 'Save field settings');
$this->drupalGet('admin/config/people/accounts/fields/user.user.field_user_comment/storage');
$this->submitForm($edit, 'Save field settings');
// We shouldn't get an error message.
$this->assertNoText('An illegal choice has been detected. Please contact the site administrator.');
}
@ -207,7 +210,8 @@ class CommentFieldsTest extends CommentTestBase {
// Uninstall the comment module.
$edit = [];
$edit['uninstall[comment]'] = TRUE;
$this->drupalPostForm('admin/modules/uninstall', $edit, 'Uninstall');
$this->drupalGet('admin/modules/uninstall');
$this->submitForm($edit, 'Uninstall');
$this->submitForm([], 'Uninstall');
$this->rebuildContainer();
$this->assertFalse($this->container->get('module_handler')->moduleExists('comment'), 'Comment module uninstalled.');
@ -215,12 +219,14 @@ class CommentFieldsTest extends CommentTestBase {
// Install core content type module (book).
$edit = [];
$edit['modules[book][enable]'] = 'book';
$this->drupalPostForm('admin/modules', $edit, 'Install');
$this->drupalGet('admin/modules');
$this->submitForm($edit, 'Install');
// Now install the comment module.
$edit = [];
$edit['modules[comment][enable]'] = 'comment';
$this->drupalPostForm('admin/modules', $edit, 'Install');
$this->drupalGet('admin/modules');
$this->submitForm($edit, 'Install');
$this->rebuildContainer();
$this->assertTrue($this->container->get('module_handler')->moduleExists('comment'), 'Comment module enabled.');

View File

@ -60,11 +60,13 @@ class CommentLanguageTest extends BrowserTestBase {
// Add language.
$edit = ['predefined_langcode' => 'fr'];
$this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add language');
$this->drupalGet('admin/config/regional/language/add');
$this->submitForm($edit, 'Add language');
// Set "Article" content type to use multilingual support.
$edit = ['language_configuration[language_alterable]' => TRUE];
$this->drupalPostForm('admin/structure/types/manage/article', $edit, 'Save content type');
$this->drupalGet('admin/structure/types/manage/article');
$this->submitForm($edit, 'Save content type');
// Enable content language negotiation UI.
\Drupal::state()->set('language_test.content_language_type', TRUE);
@ -78,12 +80,14 @@ class CommentLanguageTest extends BrowserTestBase {
'language_content[enabled][language-url]' => TRUE,
'language_content[enabled][language-interface]' => FALSE,
];
$this->drupalPostForm('admin/config/regional/language/detection', $edit, 'Save settings');
$this->drupalGet('admin/config/regional/language/detection');
$this->submitForm($edit, 'Save settings');
// Change user language preference, this way interface language is always
// French no matter what path prefix the URLs have.
$edit = ['preferred_langcode' => 'fr'];
$this->drupalPostForm("user/" . $admin_user->id() . "/edit", $edit, 'Save');
$this->drupalGet("user/" . $admin_user->id() . "/edit");
$this->submitForm($edit, 'Save');
// Create comment field on article.
$this->addDefaultCommentField('node', 'article');
@ -115,7 +119,8 @@ class CommentLanguageTest extends BrowserTestBase {
'langcode[0][value]' => $node_langcode,
'comment[0][status]' => CommentItemInterface::OPEN,
];
$this->drupalPostForm("node/add/article", $edit, 'Save');
$this->drupalGet("node/add/article");
$this->submitForm($edit, 'Save');
$node = $this->drupalGetNodeByTitle($title);
$prefixes = $this->config('language.negotiation')->get('url.prefixes');
@ -127,7 +132,8 @@ class CommentLanguageTest extends BrowserTestBase {
'subject[0][value]' => $this->randomMachineName(),
'comment_body[0][value]' => $comment_values[$node_langcode][$langcode],
];
$this->drupalPostForm($prefix . 'node/' . $node->id(), $edit, 'Preview');
$this->drupalGet($prefix . 'node/' . $node->id());
$this->submitForm($edit, 'Preview');
$this->submitForm($edit, 'Save');
// Check that comment language matches the current content language.

View File

@ -234,7 +234,8 @@ class CommentNonNodeTest extends BrowserTestBase {
$edit = [];
$edit['operation'] = $operation;
$edit['comments[' . $comment->id() . ']'] = TRUE;
$this->drupalPostForm('admin/content/comment' . ($approval ? '/approval' : ''), $edit, 'Update');
$this->drupalGet('admin/content/comment' . ($approval ? '/approval' : ''));
$this->submitForm($edit, 'Update');
if ($operation == 'delete') {
$this->submitForm([], 'Delete');

View File

@ -49,11 +49,13 @@ class CommentPreviewTest extends CommentTestBase {
$edit = [];
$edit['subject[0][value]'] = $this->randomMachineName(8);
$edit['comment_body[0][value]'] = $this->randomMachineName(16);
$this->drupalPostForm('node/' . $this->node->id(), $edit, 'Preview');
$this->drupalGet('node/' . $this->node->id());
$this->submitForm($edit, 'Preview');
$this->assertSession()->assertEscaped('<em>' . $this->webUser->id() . '</em>');
\Drupal::state()->set('user_hooks_test_user_format_name_alter_safe', TRUE);
$this->drupalPostForm('node/' . $this->node->id(), $edit, 'Preview');
$this->drupalGet('node/' . $this->node->id());
$this->submitForm($edit, 'Preview');
$this->assertInstanceOf(MarkupInterface::class, $this->webUser->getDisplayName());
$this->assertSession()->assertNoEscaped('<em>' . $this->webUser->id() . '</em>');
$this->assertRaw('<em>' . $this->webUser->id() . '</em>');
@ -61,10 +63,12 @@ class CommentPreviewTest extends CommentTestBase {
// Add a user picture.
$image = current($this->drupalGetTestFiles('image'));
$user_edit['files[user_picture_0]'] = \Drupal::service('file_system')->realpath($image->uri);
$this->drupalPostForm('user/' . $this->webUser->id() . '/edit', $user_edit, 'Save');
$this->drupalGet('user/' . $this->webUser->id() . '/edit');
$this->submitForm($user_edit, 'Save');
// As the web user, fill in the comment form and preview the comment.
$this->drupalPostForm('node/' . $this->node->id(), $edit, 'Preview');
$this->drupalGet('node/' . $this->node->id());
$this->submitForm($edit, 'Preview');
// Check that the preview is displaying the title and body.
$this->assertSession()->titleEquals('Preview comment | Drupal');
@ -98,7 +102,8 @@ class CommentPreviewTest extends CommentTestBase {
$edit = [];
$edit['subject[0][value]'] = $this->randomMachineName(8);
$edit['comment_body[0][value]'] = $this->randomMachineName(16);
$this->drupalPostForm('node/' . $this->node->id(), $edit, 'Preview');
$this->drupalGet('node/' . $this->node->id());
$this->submitForm($edit, 'Preview');
// Check that the preview is displaying the title and body.
$this->assertSession()->titleEquals('Preview comment | Drupal');
@ -152,7 +157,8 @@ class CommentPreviewTest extends CommentTestBase {
$expected_form_date = $date->format('Y-m-d');
$expected_form_time = $date->format('H:i:s');
$comment = $this->postComment($this->node, $edit['subject[0][value]'], $edit['comment_body[0][value]'], TRUE);
$this->drupalPostForm('comment/' . $comment->id() . '/edit', $edit, 'Preview');
$this->drupalGet('comment/' . $comment->id() . '/edit');
$this->submitForm($edit, 'Preview');
// Check that the preview is displaying the subject, comment, author and date correctly.
$this->assertSession()->titleEquals('Preview comment | Drupal');
@ -169,7 +175,8 @@ class CommentPreviewTest extends CommentTestBase {
$this->assertSession()->fieldValueEquals('date[time]', $edit['date[time]']);
// Check that saving a comment produces a success message.
$this->drupalPostForm('comment/' . $comment->id() . '/edit', $edit, 'Save');
$this->drupalGet('comment/' . $comment->id() . '/edit');
$this->submitForm($edit, 'Save');
$this->assertSession()->pageTextContains('Your comment has been posted.');
// Check that the comment fields are correct after loading the saved comment.
@ -187,7 +194,8 @@ class CommentPreviewTest extends CommentTestBase {
$displayed['uid'] = $this->assertSession()->fieldExists('edit-uid')->getValue();
$displayed['date[date]'] = $this->assertSession()->fieldExists('edit-date-date')->getValue();
$displayed['date[time]'] = $this->assertSession()->fieldExists('edit-date-time')->getValue();
$this->drupalPostForm('comment/' . $comment->id() . '/edit', $displayed, 'Save');
$this->drupalGet('comment/' . $comment->id() . '/edit');
$this->submitForm($displayed, 'Save');
// Check that the saved comment is still correct.
$comment_storage = \Drupal::entityTypeManager()->getStorage('comment');
@ -207,7 +215,8 @@ class CommentPreviewTest extends CommentTestBase {
$this->drupalLogin($web_user);
// Web user cannot change the comment author.
unset($edit['uid']);
$this->drupalPostForm('comment/' . $comment->id() . '/edit', $user_edit, 'Save');
$this->drupalGet('comment/' . $comment->id() . '/edit');
$this->submitForm($user_edit, 'Save');
$comment_storage->resetCache([$comment->id()]);
$comment_loaded = Comment::load($comment->id());
$this->assertEquals($expected_created_time, $comment_loaded->getCreatedTime(), 'Expected date and time for comment edited.');

View File

@ -227,7 +227,8 @@ abstract class CommentTestBase extends BrowserTestBase {
* Comment to delete.
*/
public function deleteComment(CommentInterface $comment) {
$this->drupalPostForm('comment/' . $comment->id() . '/delete', [], 'Delete');
$this->drupalGet('comment/' . $comment->id() . '/delete');
$this->submitForm([], 'Delete');
$this->assertSession()->pageTextContains('The comment and all its replies have been deleted.');
}
@ -361,7 +362,8 @@ abstract class CommentTestBase extends BrowserTestBase {
$edit = [];
$edit['operation'] = $operation;
$edit['comments[' . $comment->id() . ']'] = TRUE;
$this->drupalPostForm('admin/content/comment' . ($approval ? '/approval' : ''), $edit, 'Update');
$this->drupalGet('admin/content/comment' . ($approval ? '/approval' : ''));
$this->submitForm($edit, 'Update');
if ($operation == 'delete') {
$this->submitForm([], 'Delete');

View File

@ -148,7 +148,8 @@ class CommentTranslationUITest extends ContentTranslationUITestBase {
if ($index > 0) {
$edit = ['status' => 0];
$url = $entity->toUrl('edit-form', ['language' => ConfigurableLanguage::load($langcode)]);
$this->drupalPostForm($url, $edit, $this->getFormSubmitAction($entity, $langcode));
$this->drupalGet($url);
$this->submitForm($edit, $this->getFormSubmitAction($entity, $langcode));
$storage->resetCache();
$entity = $storage->load($this->entityId);
$this->assertFalse($this->manager->getTranslationMetadata($entity->getTranslation($langcode))->isPublished(), 'The translation has been correctly unpublished.');
@ -182,7 +183,8 @@ class CommentTranslationUITest extends ContentTranslationUITestBase {
'date[date]' => $date_formatter->format($values[$langcode]['created'], 'custom', 'Y-m-d'),
'date[time]' => $date_formatter->format($values[$langcode]['created'], 'custom', 'H:i:s'),
];
$this->drupalPostForm($url, $edit, $this->getFormSubmitAction($entity, $langcode));
$this->drupalGet($url);
$this->submitForm($edit, $this->getFormSubmitAction($entity, $langcode));
}
$storage->resetCache([$this->entityId]);

View File

@ -75,7 +75,8 @@ class CommentTypeTest extends CommentTestBase {
'description' => '',
'target_entity_type_id' => 'node',
];
$this->drupalPostForm('admin/structure/comment/types/add', $edit, 'Save');
$this->drupalGet('admin/structure/comment/types/add');
$this->submitForm($edit, 'Save');
$comment_type = CommentType::load('foo');
$this->assertInstanceOf(CommentType::class, $comment_type);
@ -109,7 +110,8 @@ class CommentTypeTest extends CommentTestBase {
$edit = [
'label' => 'Bar',
];
$this->drupalPostForm('admin/structure/comment/manage/comment', $edit, 'Save');
$this->drupalGet('admin/structure/comment/manage/comment');
$this->submitForm($edit, 'Save');
$this->drupalGet('admin/structure/comment');
$this->assertRaw('Bar');
@ -119,9 +121,11 @@ class CommentTypeTest extends CommentTestBase {
$this->assertCount(1, $this->cssSelect('tr#comment-body'), 'Body field exists.');
// Remove the body field.
$this->drupalPostForm('admin/structure/comment/manage/comment/fields/comment.comment.comment_body/delete', [], 'Delete');
$this->drupalGet('admin/structure/comment/manage/comment/fields/comment.comment.comment_body/delete');
$this->submitForm([], 'Delete');
// Resave the settings for this type.
$this->drupalPostForm('admin/structure/comment/manage/comment', [], 'Save');
$this->drupalGet('admin/structure/comment/manage/comment');
$this->submitForm([], 'Save');
// Check that the body field doesn't exist.
$this->drupalGet('admin/structure/comment/manage/comment/fields');
$this->assertCount(0, $this->cssSelect('tr#comment-body'), 'Body field does not exist.');
@ -188,7 +192,8 @@ class CommentTypeTest extends CommentTestBase {
}
// Delete the comment type.
$this->drupalPostForm('admin/structure/comment/manage/' . $type->id() . '/delete', [], 'Delete');
$this->drupalGet('admin/structure/comment/manage/' . $type->id() . '/delete');
$this->submitForm([], 'Delete');
$this->assertNull(CommentType::load($type->id()), 'Comment type deleted.');
$this->assertRaw(t('The comment type %label has been deleted.', ['%label' => $type->label()]));
}

View File

@ -65,7 +65,8 @@ class CommentAdminTest extends CommentBrowserTestBase {
$body = $this->getRandomGenerator()->sentences(4);
$subject = Unicode::truncate(trim(Html::decodeEntities(strip_tags($body))), 29, TRUE, TRUE);
$author_name = $this->randomMachineName();
$this->drupalPostForm('comment/reply/node/' . $this->node->id() . '/comment', [
$this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment');
$this->submitForm([
'name' => $author_name,
'comment_body[0][value]' => $body,
], 'Save');
@ -91,7 +92,8 @@ class CommentAdminTest extends CommentBrowserTestBase {
$edit = [];
$edit['action'] = 'comment_publish_action';
$edit['comment_bulk_form[0]'] = $anonymous_comment4->id();
$this->drupalPostForm('admin/content/comment/approval', $edit, 'Apply to selected items');
$this->drupalGet('admin/content/comment/approval');
$this->submitForm($edit, 'Apply to selected items');
$this->assertSession()->pageTextContains('Publish comment was applied to 1 item.');
$this->drupalLogout();
@ -122,7 +124,8 @@ class CommentAdminTest extends CommentBrowserTestBase {
$this->assertSession()->pageTextContains('Unapproved comments (0)');
// Test message when no comments selected.
$this->drupalPostForm('admin/content/comment', [], 'Apply to selected items');
$this->drupalGet('admin/content/comment');
$this->submitForm([], 'Apply to selected items');
$this->assertSession()->pageTextContains('Select one or more comments to perform the update on.');
$subject_link = $this->xpath('//table/tbody/tr/td/a[contains(@href, :href) and contains(@title, :title) and text()=:text]', [

View File

@ -51,7 +51,8 @@ class WizardTest extends WizardTestBase {
// Just triggering the saving should automatically choose a proper row
// plugin.
$this->drupalPostForm('admin/structure/views/add', $view, 'Save and edit');
$this->drupalGet('admin/structure/views/add');
$this->submitForm($view, 'Save and edit');
// Verify that the view saving was successful and the browser got redirected
// to the edit page.
$this->assertSession()->addressEquals('admin/structure/views/view/' . $view['id']);
@ -60,7 +61,8 @@ class WizardTest extends WizardTestBase {
// row plugins as the select field.
$this->drupalGet('admin/structure/views/add');
$this->drupalPostForm('admin/structure/views/add', $view, 'Update "of type" choice');
$this->drupalGet('admin/structure/views/add');
$this->submitForm($view, 'Update "of type" choice');
// Check for available options of the row plugin.
$expected_options = ['entity:comment', 'fields'];

View File

@ -72,7 +72,8 @@ class ConfigDependencyWebTest extends BrowserTestBase {
$this->assertNoText('Configuration updates');
$this->assertSession()->pageTextContains('Configuration deletions');
$this->assertSession()->pageTextContains($entity2->id());
$this->drupalPostForm($entity1->toUrl('delete-form'), [], 'Delete');
$this->drupalGet($entity1->toUrl('delete-form'));
$this->submitForm([], 'Delete');
$storage->resetCache();
$this->assertEmpty($storage->loadMultiple([$entity1->id(), $entity2->id()]), 'Test entities deleted');
@ -122,7 +123,8 @@ class ConfigDependencyWebTest extends BrowserTestBase {
$this->assertNoText($entity2->id());
$this->assertSession()->pageTextContains($entity2->label());
$this->assertNoText($entity3->id());
$this->drupalPostForm($entity1->toUrl('delete-form'), [], 'Delete');
$this->drupalGet($entity1->toUrl('delete-form'));
$this->submitForm([], 'Delete');
$storage->resetCache();
$this->assertNull($storage->load('entity1'), 'Test entity 1 deleted');
$entity2 = $storage->load('entity2');

View File

@ -36,7 +36,8 @@ class ConfigEntityStatusUITest extends BrowserTestBase {
'id' => $id,
'label' => $this->randomMachineName(),
];
$this->drupalPostForm('admin/structure/config_test/add', $edit, 'Save');
$this->drupalGet('admin/structure/config_test/add');
$this->submitForm($edit, 'Save');
$entity = \Drupal::entityTypeManager()->getStorage('config_test')->load($id);

View File

@ -243,7 +243,8 @@ class ConfigEntityTest extends BrowserTestBase {
'id' => $id,
'label' => $label1,
];
$this->drupalPostForm('admin/structure/config_test/add', $edit, 'Save');
$this->drupalGet('admin/structure/config_test/add');
$this->submitForm($edit, 'Save');
$this->assertSession()->addressEquals('admin/structure/config_test');
$this->assertSession()->statusCodeEquals(200);
$this->assertRaw($message_insert);
@ -254,7 +255,8 @@ class ConfigEntityTest extends BrowserTestBase {
$edit = [
'label' => $label2,
];
$this->drupalPostForm("admin/structure/config_test/manage/$id", $edit, 'Save');
$this->drupalGet("admin/structure/config_test/manage/{$id}");
$this->submitForm($edit, 'Save');
$this->assertSession()->addressEquals('admin/structure/config_test');
$this->assertSession()->statusCodeEquals(200);
$this->assertNoRaw($message_insert);
@ -279,7 +281,8 @@ class ConfigEntityTest extends BrowserTestBase {
'id' => $id,
'label' => $label1,
];
$this->drupalPostForm('admin/structure/config_test/add', $edit, 'Save');
$this->drupalGet('admin/structure/config_test/add');
$this->submitForm($edit, 'Save');
$this->assertSession()->addressEquals('admin/structure/config_test');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextContains($label1);
@ -290,7 +293,8 @@ class ConfigEntityTest extends BrowserTestBase {
'id' => strtolower($this->randomMachineName()),
'label' => $label3,
];
$this->drupalPostForm("admin/structure/config_test/manage/$id", $edit, 'Save');
$this->drupalGet("admin/structure/config_test/manage/{$id}");
$this->submitForm($edit, 'Save');
$this->assertSession()->addressEquals('admin/structure/config_test');
$this->assertSession()->statusCodeEquals(200);
$this->assertNoText($label1);
@ -305,13 +309,15 @@ class ConfigEntityTest extends BrowserTestBase {
'id' => '0',
'label' => '0',
];
$this->drupalPostForm('admin/structure/config_test/add', $edit, 'Save');
$this->drupalGet('admin/structure/config_test/add');
$this->submitForm($edit, 'Save');
$this->assertSession()->statusCodeEquals(200);
$message_insert = new FormattableMarkup('%label configuration has been created.', ['%label' => $edit['label']]);
$this->assertRaw($message_insert);
$this->assertSession()->linkByHrefExists('admin/structure/config_test/manage/0');
$this->assertSession()->linkByHrefExists('admin/structure/config_test/manage/0/delete');
$this->drupalPostForm('admin/structure/config_test/manage/0/delete', [], 'Delete');
$this->drupalGet('admin/structure/config_test/manage/0/delete');
$this->submitForm([], 'Delete');
$storage = \Drupal::entityTypeManager()->getStorage('config_test');
$this->assertNull($storage->load(0), 'Test entity deleted');

View File

@ -139,7 +139,8 @@ class ConfigExportImportUITest extends BrowserTestBase {
$this->assertSession()->fieldValueEquals("{$this->fieldName}[0][value]", '');
// Export the configuration.
$this->drupalPostForm('admin/config/development/configuration/full/export', [], 'Export');
$this->drupalGet('admin/config/development/configuration/full/export');
$this->submitForm([], 'Export');
$this->tarball = $this->getSession()->getPage()->getContent();
$this->config('system.site')
@ -166,7 +167,8 @@ class ConfigExportImportUITest extends BrowserTestBase {
// Import the configuration.
$filename = 'temporary://' . $this->randomMachineName();
file_put_contents($filename, $this->tarball);
$this->drupalPostForm('admin/config/development/configuration/full/import', ['files[import_tarball]' => $filename], 'Upload');
$this->drupalGet('admin/config/development/configuration/full/import');
$this->submitForm(['files[import_tarball]' => $filename], 'Upload');
// There is no snapshot yet because an import has never run.
$this->assertNoText('Warning message');
$this->assertNoText('There are no configuration changes to import.');
@ -229,7 +231,8 @@ class ConfigExportImportUITest extends BrowserTestBase {
$test2_storage->write('config_test.another_update', ['foo' => 'bar']);
// Export the configuration.
$this->drupalPostForm('admin/config/development/configuration/full/export', [], 'Export');
$this->drupalGet('admin/config/development/configuration/full/export');
$this->submitForm([], 'Export');
$this->tarball = $this->getSession()->getPage()->getContent();
$filename = \Drupal::service('file_system')->getTempDirectory() . '/' . $this->randomMachineName();
file_put_contents($filename, $this->tarball);
@ -275,7 +278,8 @@ class ConfigExportImportUITest extends BrowserTestBase {
$this->assertNotContains('collection/test1/config_test.delete.yml', $files, 'Config export does not contain collection/test1/config_test.delete.yml.');
$this->assertNotContains('collection/test2/config_test.another_delete.yml', $files, 'Config export does not contain collection/test2/config_test.another_delete.yml.');
$this->drupalPostForm('admin/config/development/configuration/full/import', ['files[import_tarball]' => $filename], 'Upload');
$this->drupalGet('admin/config/development/configuration/full/import');
$this->submitForm(['files[import_tarball]' => $filename], 'Upload');
// Verify that there are configuration differences to import.
$this->drupalGet('admin/config/development/configuration');
$this->assertNoText('There are no configuration changes to import.');

View File

@ -52,7 +52,8 @@ class ConfigExportUITest extends BrowserTestBase {
// Submit the export form and verify response. This will create a file in
// temporary directory with the default name config.tar.gz.
$this->drupalPostForm('admin/config/development/configuration/full/export', [], 'Export');
$this->drupalGet('admin/config/development/configuration/full/export');
$this->submitForm([], 'Export');
$this->assertSession()->statusCodeEquals(200);
// Test if header contains file name with hostname and timestamp.

View File

@ -45,7 +45,8 @@ class ConfigFormOverrideTest extends BrowserTestBase {
$edit = [
'site_name' => 'Custom site name',
];
$this->drupalPostForm('admin/config/system/site-information', $edit, 'Save configuration');
$this->drupalGet('admin/config/system/site-information');
$this->submitForm($edit, 'Save configuration');
$this->assertSession()->titleEquals('Basic site settings | ' . $overridden_name);
$this->assertSession()->fieldValueEquals("site_name", $edit['site_name']);
}

View File

@ -117,7 +117,8 @@ class ConfigImportAllTest extends ModuleTestBase {
}
// Import the configuration thereby re-installing all the modules.
$this->drupalPostForm('admin/config/development/configuration', [], 'Import all');
$this->drupalGet('admin/config/development/configuration');
$this->submitForm([], 'Import all');
// Modules have been installed that have services.
$this->rebuildContainer();

View File

@ -59,7 +59,8 @@ class ConfigImportInstallProfileTest extends BrowserTestBase {
unset($core['module']['testing_config_import']);
$sync->write('core.extension', $core);
$this->drupalPostForm('admin/config/development/configuration', [], 'Import all');
$this->drupalGet('admin/config/development/configuration');
$this->submitForm([], 'Import all');
$this->assertSession()->pageTextContains('The configuration cannot be imported because it failed validation for the following reasons:');
$this->assertSession()->pageTextContains('Unable to uninstall the Testing config import profile since it is the install profile.');
@ -74,7 +75,8 @@ class ConfigImportInstallProfileTest extends BrowserTestBase {
$theme = $sync->read('system.theme');
$theme['default'] = 'classy';
$sync->write('system.theme', $theme);
$this->drupalPostForm('admin/config/development/configuration', [], 'Import all');
$this->drupalGet('admin/config/development/configuration');
$this->submitForm([], 'Import all');
$this->assertSession()->pageTextContains('The configuration was imported successfully.');
$this->rebuildContainer();
$this->assertFalse(\Drupal::moduleHandler()->moduleExists('syslog'), 'The syslog module has been uninstalled.');

View File

@ -518,7 +518,8 @@ class ConfigImportUITest extends BrowserTestBase {
$core['theme']['does_not_exist'] = 0;
$sync->write('core.extension', $core);
$this->drupalPostForm('admin/config/development/configuration', [], 'Import all');
$this->drupalGet('admin/config/development/configuration');
$this->submitForm([], 'Import all');
$this->assertSession()->pageTextContains('The configuration cannot be imported because it failed validation for the following reasons:');
$this->assertSession()->pageTextContains('Unable to uninstall the Text module since the Node module is installed.');
$this->assertSession()->pageTextContains('Unable to uninstall the Theme test base theme theme since the Theme test subtheme theme is installed.');
@ -533,7 +534,8 @@ class ConfigImportUITest extends BrowserTestBase {
$new_site_name = 'Config import test ' . $this->randomString();
$this->prepareSiteNameUpdate($new_site_name);
\Drupal::state()->set('config_import_steps_alter.error', TRUE);
$this->drupalPostForm('admin/config/development/configuration', [], 'Import all');
$this->drupalGet('admin/config/development/configuration');
$this->submitForm([], 'Import all');
$this->assertSession()->responseContains('_config_import_test_config_import_steps_alter batch error');
$this->assertSession()->responseContains('_config_import_test_config_import_steps_alter ConfigImporter error');
$this->assertSession()->responseContains('The configuration was imported with errors.');

View File

@ -52,7 +52,8 @@ class ConfigImportUploadTest extends BrowserTestBase {
// Attempt to upload a non-tar file.
$text_file = $this->getTestFiles('text')[0];
$edit = ['files[import_tarball]' => \Drupal::service('file_system')->realpath($text_file->uri)];
$this->drupalPostForm('admin/config/development/configuration/full/import', $edit, 'Upload');
$this->drupalGet('admin/config/development/configuration/full/import');
$this->submitForm($edit, 'Upload');
$this->assertSession()->pageTextContains('Could not extract the contents of the tar file');
// Make the sync directory read-only.

View File

@ -135,18 +135,24 @@ class ConfigInstallWebTest extends BrowserTestBase {
// will install the config_test module first because it is a dependency of
// config_install_fail_test.
// @see \Drupal\system\Form\ModulesListForm::submitForm()
$this->drupalPostForm('admin/modules', ['modules[config_test][enable]' => TRUE, 'modules[config_install_fail_test][enable]' => TRUE], 'Install');
$this->drupalGet('admin/modules');
$this->submitForm([
'modules[config_test][enable]' => TRUE,
'modules[config_install_fail_test][enable]' => TRUE,
], 'Install');
$this->assertRaw('Unable to install Configuration install fail test, <em class="placeholder">config_test.dynamic.dotted.default</em> already exists in active configuration.');
// Uninstall the config_test module to test the confirm form.
$this->drupalPostForm('admin/modules/uninstall', ['uninstall[config_test]' => TRUE], 'Uninstall');
$this->drupalGet('admin/modules/uninstall');
$this->submitForm(['uninstall[config_test]' => TRUE], 'Uninstall');
$this->submitForm([], 'Uninstall');
// Try to install config_install_fail_test without selecting config_test.
// The user is shown a confirm form because the config_test module is a
// dependency.
// @see \Drupal\system\Form\ModulesListConfirmForm::submitForm()
$this->drupalPostForm('admin/modules', ['modules[config_install_fail_test][enable]' => TRUE], 'Install');
$this->drupalGet('admin/modules');
$this->submitForm(['modules[config_install_fail_test][enable]' => TRUE], 'Install');
$this->submitForm([], 'Continue');
$this->assertRaw('Unable to install Configuration install fail test, <em class="placeholder">config_test.dynamic.dotted.default</em> already exists in active configuration.');
@ -160,7 +166,8 @@ class ConfigInstallWebTest extends BrowserTestBase {
->set('label', 'Je suis Charlie')
->save();
$this->drupalPostForm('admin/modules', ['modules[config_install_fail_test][enable]' => TRUE], 'Install');
$this->drupalGet('admin/modules');
$this->submitForm(['modules[config_install_fail_test][enable]' => TRUE], 'Install');
$this->assertRaw('Unable to install Configuration install fail test, <em class="placeholder">config_test.dynamic.dotted.default, language/fr/config_test.dynamic.dotted.default</em> already exist in active configuration.');
// Test installing a theme through the UI that has existing configuration.
@ -191,16 +198,22 @@ class ConfigInstallWebTest extends BrowserTestBase {
$this->drupalLogin($this->adminUser);
// We need to install separately since config_install_dependency_test does
// not depend on config_test and order is important.
$this->drupalPostForm('admin/modules', ['modules[config_test][enable]' => TRUE], 'Install');
$this->drupalPostForm('admin/modules', ['modules[config_install_dependency_test][enable]' => TRUE], 'Install');
$this->drupalGet('admin/modules');
$this->submitForm(['modules[config_test][enable]' => TRUE], 'Install');
$this->drupalGet('admin/modules');
$this->submitForm(['modules[config_install_dependency_test][enable]' => TRUE], 'Install');
$this->assertRaw('Unable to install <em class="placeholder">Config install dependency test</em> due to unmet dependencies: <em class="placeholder">config_test.dynamic.other_module_test_with_dependency (config_other_module_config_test, config_test.dynamic.dotted.english)</em>');
$this->drupalPostForm('admin/modules', ['modules[config_test_language][enable]' => TRUE], 'Install');
$this->drupalPostForm('admin/modules', ['modules[config_install_dependency_test][enable]' => TRUE], 'Install');
$this->drupalGet('admin/modules');
$this->submitForm(['modules[config_test_language][enable]' => TRUE], 'Install');
$this->drupalGet('admin/modules');
$this->submitForm(['modules[config_install_dependency_test][enable]' => TRUE], 'Install');
$this->assertRaw('Unable to install <em class="placeholder">Config install dependency test</em> due to unmet dependencies: <em class="placeholder">config_test.dynamic.other_module_test_with_dependency (config_other_module_config_test)</em>');
$this->drupalPostForm('admin/modules', ['modules[config_other_module_config_test][enable]' => TRUE], 'Install');
$this->drupalPostForm('admin/modules', ['modules[config_install_dependency_test][enable]' => TRUE], 'Install');
$this->drupalGet('admin/modules');
$this->submitForm(['modules[config_other_module_config_test][enable]' => TRUE], 'Install');
$this->drupalGet('admin/modules');
$this->submitForm(['modules[config_install_dependency_test][enable]' => TRUE], 'Install');
$this->rebuildContainer();
$this->assertInstanceOf(ConfigTest::class, \Drupal::entityTypeManager()->getStorage('config_test')->load('other_module_test_with_dependency'));
}
@ -210,7 +223,8 @@ class ConfigInstallWebTest extends BrowserTestBase {
*/
public function testConfigModuleRequirements() {
$this->drupalLogin($this->adminUser);
$this->drupalPostForm('admin/modules', ['modules[config][enable]' => TRUE], 'Install');
$this->drupalGet('admin/modules');
$this->submitForm(['modules[config][enable]' => TRUE], 'Install');
$directory = Settings::get('config_sync_directory');
try {

View File

@ -55,7 +55,8 @@ class ConfigLanguageOverrideWebTest extends BrowserTestBase {
'label' => $name,
'direction' => LanguageInterface::DIRECTION_LTR,
];
$this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add custom language');
$this->drupalGet('admin/config/regional/language/add');
$this->submitForm($edit, 'Add custom language');
\Drupal::languageManager()
->getLanguageConfigOverride($langcode, 'system.site')
->set('name', 'XX site name')

View File

@ -52,7 +52,8 @@ class ConfigSingleImportExportTest extends BrowserTestBase {
'import' => '{{{',
];
$this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import');
$this->drupalGet('admin/config/development/configuration/single/import');
$this->submitForm($edit, 'Import');
// Assert the static portion of the error since different parsers could give different text in their error.
$this->assertSession()->pageTextContains('The import failed with the following message: ');
@ -67,13 +68,15 @@ EOD;
'import' => $import,
];
// Attempt an import with a missing ID.
$this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import');
$this->drupalGet('admin/config/development/configuration/single/import');
$this->submitForm($edit, 'Import');
$this->assertSession()->pageTextContains('Missing ID key "id" for this Test configuration import.');
// Perform an import with no specified UUID and a unique ID.
$this->assertNull($storage->load('first'));
$edit['import'] = "id: first\n" . $edit['import'];
$this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import');
$this->drupalGet('admin/config/development/configuration/single/import');
$this->submitForm($edit, 'Import');
$this->assertRaw(t('Are you sure you want to create a new %name @type?', ['%name' => 'first', '@type' => 'test configuration']));
$this->submitForm([], 'Confirm');
$entity = $storage->load('first');
@ -83,17 +86,20 @@ EOD;
$this->assertRaw(t('The configuration was imported successfully.'));
// Attempt an import with an existing ID but missing UUID.
$this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import');
$this->drupalGet('admin/config/development/configuration/single/import');
$this->submitForm($edit, 'Import');
$this->assertSession()->pageTextContains('An entity with this machine name already exists but the import did not specify a UUID.');
// Attempt an import with a mismatched UUID and existing ID.
$edit['import'] .= "\nuuid: " . $uuid->generate();
$this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import');
$this->drupalGet('admin/config/development/configuration/single/import');
$this->submitForm($edit, 'Import');
$this->assertSession()->pageTextContains('An entity with this machine name already exists but the UUID does not match.');
// Attempt an import with a custom ID.
$edit['custom_entity_id'] = 'custom_id';
$this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import');
$this->drupalGet('admin/config/development/configuration/single/import');
$this->submitForm($edit, 'Import');
$this->assertRaw(t('Are you sure you want to create a new %name @type?', ['%name' => 'custom_id', '@type' => 'test configuration']));
$this->submitForm([], 'Confirm');
$this->assertRaw(t('The configuration was imported successfully.'));
@ -112,7 +118,8 @@ EOD;
];
$second_uuid = $uuid->generate();
$edit['import'] .= "\nuuid: " . $second_uuid;
$this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import');
$this->drupalGet('admin/config/development/configuration/single/import');
$this->submitForm($edit, 'Import');
$this->assertRaw(t('Are you sure you want to create a new %name @type?', ['%name' => 'second', '@type' => 'test configuration']));
$this->submitForm([], 'Confirm');
$entity = $storage->load('second');
@ -135,7 +142,8 @@ EOD;
'config_type' => 'config_test',
'import' => $import,
];
$this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import');
$this->drupalGet('admin/config/development/configuration/single/import');
$this->submitForm($edit, 'Import');
$this->assertRaw(t('Are you sure you want to update the %name @type?', ['%name' => 'second', '@type' => 'test configuration']));
$this->submitForm([], 'Confirm');
$entity = $storage->load('second');
@ -158,7 +166,8 @@ EOD;
'config_type' => 'config_test',
'import' => $import,
];
$this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import');
$this->drupalGet('admin/config/development/configuration/single/import');
$this->submitForm($edit, 'Import');
$this->assertRaw(t('Configuration %name depends on the %owner module that will not be installed after import.', ['%name' => 'config_test.dynamic.second', '%owner' => 'does_not_exist']));
// Try to preform an update which would create a PHP object if Yaml parsing
@ -176,7 +185,8 @@ EOD;
'config_type' => 'config_test',
'import' => $import,
];
$this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import');
$this->drupalGet('admin/config/development/configuration/single/import');
$this->submitForm($edit, 'Import');
if (extension_loaded('yaml')) {
// If the yaml extension is loaded it will work but not create the PHP
// object.
@ -212,7 +222,8 @@ EOD;
'config_name' => $config->getName(),
'import' => Yaml::encode($config->get()),
];
$this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import');
$this->drupalGet('admin/config/development/configuration/single/import');
$this->submitForm($edit, 'Import');
$this->assertRaw(t('Are you sure you want to update the %name @type?', ['%name' => $config->getName(), '@type' => 'simple configuration']));
$this->submitForm([], 'Confirm');
$this->drupalGet('');
@ -228,11 +239,13 @@ EOD;
'config_name' => 'core.extension',
'import' => Yaml::encode($config_data),
];
$this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import');
$this->drupalGet('admin/config/development/configuration/single/import');
$this->submitForm($edit, 'Import');
$this->assertSession()->pageTextContains('Can not uninstall the Configuration module as part of a configuration synchronization through the user interface.');
// Try to import without any values.
$this->drupalPostForm('admin/config/development/configuration/single/import', [], 'Import');
$this->drupalGet('admin/config/development/configuration/single/import');
$this->submitForm([], 'Import');
$this->assertSession()->pageTextContains('Configuration type field is required.');
$this->assertSession()->pageTextContains('Paste your configuration here field is required.');
}

View File

@ -38,7 +38,8 @@ class LanguageNegotiationFormOverrideTest extends BrowserTestBase {
$edit = [
'predefined_langcode' => 'es',
];
$this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add language');
$this->drupalGet('admin/config/regional/language/add');
$this->submitForm($edit, 'Add language');
// Overridden string for language-negotiation should not exist in the form.
$this->drupalGet('admin/config/regional/language/detection/url');

View File

@ -72,13 +72,15 @@ class TransformedConfigExportImportUITest extends BrowserTestBase {
$this->assertSession()->pageTextContains("slogan: $newSlogan");
// Export the configuration.
$this->drupalPostForm('admin/config/development/configuration/full/export', [], 'Export');
$this->drupalGet('admin/config/development/configuration/full/export');
$this->submitForm([], 'Export');
$tarball = $this->getSession()->getPage()->getContent();
// Import the configuration from the tarball.
$filename = 'temporary://' . $this->randomMachineName();
file_put_contents($filename, $tarball);
$this->drupalPostForm('admin/config/development/configuration/full/import', ['files[import_tarball]' => $filename], 'Upload');
$this->drupalGet('admin/config/development/configuration/full/import');
$this->submitForm(['files[import_tarball]' => $filename], 'Upload');
// Assert the new name and slogan.
$this->drupalGet('admin/config/development/configuration/sync/diff/system.site');
@ -88,7 +90,8 @@ class TransformedConfigExportImportUITest extends BrowserTestBase {
$this->assertEquals($newSlogan, $this->config('system.site')->get('slogan'));
// Sync the configuration.
$this->drupalPostForm('admin/config/development/configuration', [], 'Import all');
$this->drupalGet('admin/config/development/configuration');
$this->submitForm([], 'Import all');
$this->assertEquals('Drupal Arrr', $this->config('system.site')->get('name'));
$this->assertEquals($originalSlogan . " Arrr", $this->config('system.site')->get('slogan'));

View File

@ -166,13 +166,15 @@ class ConfigTranslationCacheTest extends BrowserTestBase {
$this->assertSession()->assertEscaped($field_label_fr);
// Clear cache on French version and check for translated label.
$this->drupalPostForm('/fr/admin/config/development/performance', [], 'Clear all caches');
$this->drupalGet('/fr/admin/config/development/performance');
$this->submitForm([], 'Clear all caches');
$this->drupalGet("/fr/entity_test/structure/$bundle/fields");
// Check if the translation is still there.
$this->assertSession()->assertEscaped($field_label_fr);
// Clear cache on default version and check for translated label.
$this->drupalPostForm('/admin/config/development/performance', [], 'Clear all caches');
$this->drupalGet('/admin/config/development/performance');
$this->submitForm([], 'Clear all caches');
$this->drupalGet("/fr/entity_test/structure/$bundle/fields");
// Check if the translation is still there.
$this->assertSession()->assertEscaped($field_label_fr);

View File

@ -60,13 +60,16 @@ ENDPO;
}
public function testConfigTranslation() {
$this->drupalPostForm('admin/config/regional/language/add', ['predefined_langcode' => 'en'], 'Add custom language');
$this->drupalPostForm('admin/config/regional/language/add', ['predefined_langcode' => 'fr'], 'Add custom language');
$this->drupalGet('admin/config/regional/language/add');
$this->submitForm(['predefined_langcode' => 'en'], 'Add custom language');
$this->drupalGet('admin/config/regional/language/add');
$this->submitForm(['predefined_langcode' => 'fr'], 'Add custom language');
$edit = [
'modules[config_translation][enable]' => TRUE,
];
$this->drupalPostForm('admin/modules', $edit, 'Install');
$this->drupalGet('admin/modules');
$this->submitForm($edit, 'Install');
$this->drupalGet('/admin/structure/types/manage/article/fields');
$this->assertSession()->statusCodeEquals(200);

View File

@ -129,7 +129,8 @@ class ConfigTranslationListUiTest extends BrowserTestBase {
'label' => $label,
];
// Create the menu by posting the form.
$this->drupalPostForm('admin/structure/menu/add', $edit, 'Save');
$this->drupalGet('admin/structure/menu/add');
$this->submitForm($edit, 'Save');
// Get the Menu listing.
$this->drupalGet('admin/structure/menu');
@ -371,7 +372,8 @@ class ConfigTranslationListUiTest extends BrowserTestBase {
$edit['id'] = strtolower($edit['label']);
$edit['fallback_image_style'] = 'thumbnail';
$this->drupalPostForm('admin/config/media/responsive-image-style/add', $edit, 'Save');
$this->drupalGet('admin/config/media/responsive-image-style/add');
$this->submitForm($edit, 'Save');
$this->assertRaw(t('Responsive image style %label saved.', ['%label' => $edit['label']]));
// Get the responsive image style listing.

View File

@ -170,7 +170,8 @@ class ConfigTranslationUiTest extends BrowserTestBase {
'translation[config_names][system.site][slogan]' => $fr_site_slogan,
];
$this->drupalPostForm("$translation_base_url/fr/add", $edit, 'Save translation');
$this->drupalGet("{$translation_base_url}/fr/add");
$this->submitForm($edit, 'Save translation');
$this->assertRaw(t('Successfully saved @language translation.', ['@language' => 'French']));
// Check for edit, delete links (and no 'add' link) for French language.
@ -202,14 +203,16 @@ class ConfigTranslationUiTest extends BrowserTestBase {
'langcode' => 'fr',
'translation' => 'untranslated',
];
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->drupalGet('admin/config/regional/translate');
$this->submitForm($search, 'Filter');
$textarea = $this->assertSession()->elementExists('xpath', '//textarea');
$lid = $textarea->getAttribute('name');
$edit = [
$lid => $fr_site_name_label,
];
$this->drupalPostForm('admin/config/regional/translate', $edit, 'Save translations');
$this->drupalGet('admin/config/regional/translate');
$this->submitForm($edit, 'Save translations');
// Ensure that the label is in French (and not in English).
$this->drupalGet("fr/$translation_base_url/fr/edit");
@ -247,7 +250,8 @@ class ConfigTranslationUiTest extends BrowserTestBase {
'translation[config_names][system.site][slogan]' => 'FR ' . $site_slogan,
];
// First time, no overrides, so just Add link.
$this->drupalPostForm("$translation_base_url/fr/add", $edit, 'Save translation');
$this->drupalGet("{$translation_base_url}/fr/add");
$this->submitForm($edit, 'Save translation');
// Read overridden file from active config.
$override = \Drupal::languageManager()->getLanguageConfigOverride('fr', 'system.site');
@ -323,7 +327,8 @@ class ConfigTranslationUiTest extends BrowserTestBase {
'recipients' => 'sales@example.com,support@example.com',
'reply' => 'Thank you for your mail',
];
$this->drupalPostForm('admin/structure/contact/manage/feedback', $edit, 'Save');
$this->drupalGet('admin/structure/contact/manage/feedback');
$this->submitForm($edit, 'Save');
// Ensure translation link is present.
$translation_base_url = 'admin/structure/contact/manage/feedback/translate';
@ -356,7 +361,8 @@ class ConfigTranslationUiTest extends BrowserTestBase {
];
// Save language specific version of form.
$this->drupalPostForm($translation_page_url, $edit, 'Save translation');
$this->drupalGet($translation_page_url);
$this->submitForm($edit, 'Save translation');
// Expect translated values in language specific file.
$override = \Drupal::languageManager()->getLanguageConfigOverride($langcode, 'contact.form.feedback');
@ -458,7 +464,8 @@ class ConfigTranslationUiTest extends BrowserTestBase {
'id' => 'custom_medium',
'date_format_pattern' => 'Y. m. d. H:i',
];
$this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, 'Add format');
$this->drupalGet('admin/config/regional/date-time/formats/add');
$this->submitForm($edit, 'Add format');
// Test translating a default shipped format and our custom format.
$formats = [
@ -488,7 +495,8 @@ class ConfigTranslationUiTest extends BrowserTestBase {
];
// Save language specific version of form.
$this->drupalPostForm($translation_page_url, $edit, 'Save translation');
$this->drupalGet($translation_page_url);
$this->submitForm($edit, 'Save translation');
// Get translation and check we've got the right value.
$override = \Drupal::languageManager()->getLanguageConfigOverride('fr', 'core.date_format.' . $id);
@ -529,7 +537,8 @@ class ConfigTranslationUiTest extends BrowserTestBase {
'translation[config_names][user.mail][status_blocked][body]' => 'Testing account blocked body.',
];
$this->drupalPostForm('admin/config/people/accounts/translate/fr/add', $edit, 'Save translation');
$this->drupalGet('admin/config/people/accounts/translate/fr/add');
$this->submitForm($edit, 'Save translation');
// Make sure the changes are saved and loaded back properly.
$this->drupalGet('admin/config/people/accounts/translate/fr/edit');
@ -617,7 +626,8 @@ class ConfigTranslationUiTest extends BrowserTestBase {
'translation[config_names][views.view.frontpage][display][default][display_title]' => $display_settings_default . " FR",
'translation[config_names][views.view.frontpage][display][default][display_options][title]' => $display_options_default . " FR",
];
$this->drupalPostForm("$translation_base_url/fr/add", $edit, 'Save translation');
$this->drupalGet("{$translation_base_url}/fr/add");
$this->submitForm($edit, 'Save translation');
$this->assertRaw(t('Successfully saved @language translation.', ['@language' => 'French']));
// Check for edit, delete links (and no 'add' link) for French language.
@ -651,7 +661,8 @@ class ConfigTranslationUiTest extends BrowserTestBase {
// Import a .po file to add a new language with a given number of plural forms
$name = \Drupal::service('file_system')->tempnam('temporary://', $langcode . '_') . '.po';
file_put_contents($name, $this->getPoFile($data['plurals']));
$this->drupalPostForm('admin/config/regional/translate/import', [
$this->drupalGet('admin/config/regional/translate/import');
$this->submitForm([
'langcode' => $langcode,
'files[file]' => $name,
], 'Import');
@ -687,7 +698,8 @@ class ConfigTranslationUiTest extends BrowserTestBase {
// This will also automatically add the 'sl' language.
$name = \Drupal::service('file_system')->tempnam('temporary://', "sl_") . '.po';
file_put_contents($name, $this->getPoFile(4));
$this->drupalPostForm('admin/config/regional/translate/import', [
$this->drupalGet('admin/config/regional/translate/import');
$this->submitForm([
'langcode' => 'sl',
'files[file]' => $name,
], 'Import');
@ -714,7 +726,8 @@ class ConfigTranslationUiTest extends BrowserTestBase {
'translation[config_names][views.view.files][display][default][display_options][fields][count][format_plural_string][2]' => $field_value_plural . ' 2 SL',
'translation[config_names][views.view.files][display][default][display_options][fields][count][format_plural_string][3]' => $field_value_plural . ' 3 SL',
];
$this->drupalPostForm($translation_url, $edit, 'Save translation');
$this->drupalGet($translation_url);
$this->submitForm($edit, 'Save translation');
// Make sure the values have changed.
$this->drupalGet($translation_url);
@ -825,7 +838,8 @@ class ConfigTranslationUiTest extends BrowserTestBase {
'label' => $name,
'direction' => Language::DIRECTION_LTR,
];
$this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add custom language');
$this->drupalGet('admin/config/regional/language/add');
$this->submitForm($edit, 'Add custom language');
// Make sure there is no translation stored in locale storage before edit.
$translation = $this->getTranslation('user.settings', 'anonymous', 'fr');
@ -835,7 +849,8 @@ class ConfigTranslationUiTest extends BrowserTestBase {
$edit = [
'translation[config_names][user.settings][anonymous]' => 'Anonyme',
];
$this->drupalPostForm('admin/config/people/accounts/translate/fr/add', $edit, 'Save translation');
$this->drupalGet('admin/config/people/accounts/translate/fr/add');
$this->submitForm($edit, 'Save translation');
// Make sure translation stored in locale storage after saved language
// specific configuration translation.
@ -846,7 +861,8 @@ class ConfigTranslationUiTest extends BrowserTestBase {
$edit = [
'translation[config_names][user.settings][anonymous]' => 'Anonymous',
];
$this->drupalPostForm('admin/config/people/accounts/translate/fr/edit', $edit, 'Save translation');
$this->drupalGet('admin/config/people/accounts/translate/fr/edit');
$this->submitForm($edit, 'Save translation');
// Make sure there is no translation stored in locale storage after revert.
$translation = $this->getTranslation('user.settings', 'anonymous', 'fr');
@ -860,18 +876,21 @@ class ConfigTranslationUiTest extends BrowserTestBase {
$this->drupalLogin($this->adminUser);
// Delete French language
$this->drupalPostForm('admin/config/regional/language/delete/fr', [], 'Delete');
$this->drupalGet('admin/config/regional/language/delete/fr');
$this->submitForm([], 'Delete');
$this->assertRaw(t('The %language (%langcode) language has been removed.', ['%language' => 'French', '%langcode' => 'fr']));
// Change default language to Tamil.
$edit = [
'site_default_language' => 'ta',
];
$this->drupalPostForm('admin/config/regional/language', $edit, 'Save configuration');
$this->drupalGet('admin/config/regional/language');
$this->submitForm($edit, 'Save configuration');
$this->assertRaw(t('Configuration saved.'));
// Delete English language
$this->drupalPostForm('admin/config/regional/language/delete/en', [], 'Delete');
$this->drupalGet('admin/config/regional/language/delete/en');
$this->submitForm([], 'Delete');
$this->assertRaw(t('The %language (%langcode) language has been removed.', ['%language' => 'English', '%langcode' => 'en']));
// Visit account setting translation page, this should not
@ -920,7 +939,8 @@ class ConfigTranslationUiTest extends BrowserTestBase {
'translation[config_names][config_translation_test.content][animals][1]' => 'llama - FR',
'translation[config_names][config_translation_test.content][animals][2]' => 'elephant - FR',
];
$this->drupalPostForm('admin/config/media/file-system/translate/fr/add', $edit, 'Save translation');
$this->drupalGet('admin/config/media/file-system/translate/fr/add');
$this->submitForm($edit, 'Save translation');
$this->container->get('language.config_factory_override')
->setLanguage(new Language(['id' => 'fr']));
@ -972,7 +992,8 @@ class ConfigTranslationUiTest extends BrowserTestBase {
];
// Save language specific version of form.
$this->drupalPostForm($translation_page_url, $edit, 'Save translation');
$this->drupalGet($translation_page_url);
$this->submitForm($edit, 'Save translation');
// Get translation and check we've got the right value.
$expected = [
@ -1019,7 +1040,8 @@ class ConfigTranslationUiTest extends BrowserTestBase {
$edit = [
'translation[config_names][config_translation_test.content][content][format]' => 'full_html',
];
$this->drupalPostForm($translation_page_url, $edit, 'Save translation');
$this->drupalGet($translation_page_url);
$this->submitForm($edit, 'Save translation');
$expected = [
'value' => '<p><strong>Hello World</strong> - FR</p>',
'format' => 'full_html',
@ -1132,7 +1154,8 @@ class ConfigTranslationUiTest extends BrowserTestBase {
'site_name' => $site_name,
'site_slogan' => $site_slogan,
];
$this->drupalPostForm('admin/config/system/site-information', $edit, 'Save configuration');
$this->drupalGet('admin/config/system/site-information');
$this->submitForm($edit, 'Save configuration');
$this->assertRaw(t('The configuration options have been saved.'));
}

View File

@ -58,7 +58,8 @@ class ContactLanguageTest extends BrowserTestBase {
$settings_path = 'admin/config/regional/content-language';
$edit['entity_types[contact_message]'] = TRUE;
$edit['settings[contact_message][feedback][settings][language][language_alterable]'] = TRUE;
$this->drupalPostForm($settings_path, $edit, 'Save configuration');
$this->drupalGet($settings_path);
$this->submitForm($edit, 'Save configuration');
// Ensure that contact form now shows the language select.
$this->drupalGet('contact');

View File

@ -202,7 +202,8 @@ class ContactPersonalTest extends BrowserTestBase {
// Disable the personal contact form.
$this->drupalLogin($this->adminUser);
$edit = ['contact_default_status' => FALSE];
$this->drupalPostForm('admin/config/people/accounts', $edit, 'Save configuration');
$this->drupalGet('admin/config/people/accounts');
$this->submitForm($edit, 'Save configuration');
$this->assertSession()->pageTextContains('The configuration options have been saved.');
$this->drupalLogout();
@ -320,7 +321,8 @@ class ContactPersonalTest extends BrowserTestBase {
if (isset($contact_value)) {
$edit['contact'] = $contact_value;
}
$this->drupalPostForm('admin/people/create', $edit, 'Create new account');
$this->drupalGet('admin/people/create');
$this->submitForm($edit, 'Create new account');
$user = user_load_by_name($name);
$this->drupalLogout();
@ -345,7 +347,8 @@ class ContactPersonalTest extends BrowserTestBase {
'subject[0][value]' => $this->randomMachineName(16) . '< " =+ >',
'message[0][value]' => $this->randomMachineName(64) . '< " =+ >',
];
$this->drupalPostForm('user/' . $account->id() . '/contact', $message, 'Send message');
$this->drupalGet('user/' . $account->id() . '/contact');
$this->submitForm($message, 'Send message');
return $message;
}

View File

@ -107,7 +107,8 @@ class ContactSitewideTest extends BrowserTestBase {
// Set settings.
$edit = [];
$edit['contact_default_status'] = TRUE;
$this->drupalPostForm('admin/config/people/accounts', $edit, 'Save configuration');
$this->drupalGet('admin/config/people/accounts');
$this->submitForm($edit, 'Save configuration');
$this->assertSession()->pageTextContains('The configuration options have been saved.');
$this->drupalGet('admin/structure/contact');
@ -391,7 +392,8 @@ class ContactSitewideTest extends BrowserTestBase {
'message[0][value]' => $this->randomMachineName(),
$field_name . '[0][value]' => $this->randomMachineName(),
];
$this->drupalPostForm($form->toUrl('canonical'), $edit, 'Preview');
$this->drupalGet($form->toUrl('canonical'));
$this->submitForm($edit, 'Preview');
// Message is now by default displayed twice, once for the form element and
// once for the viewed message.
@ -404,9 +406,11 @@ class ContactSitewideTest extends BrowserTestBase {
$display_edit = [
'fields[message][label]' => 'hidden',
];
$this->drupalPostForm('admin/structure/contact/manage/' . $contact_form . '/display', $display_edit, 'Save');
$this->drupalGet('admin/structure/contact/manage/' . $contact_form . '/display');
$this->submitForm($display_edit, 'Save');
$this->drupalPostForm($form->toUrl('canonical'), $edit, 'Preview');
$this->drupalGet($form->toUrl('canonical'));
$this->submitForm($edit, 'Preview');
// Message should only be displayed once now.
$page_text = $this->getSession()->getPage()->getText();
$this->assertEquals(1, substr_count($page_text, t('Message')));
@ -418,7 +422,8 @@ class ContactSitewideTest extends BrowserTestBase {
$edit = [
'fields[preview][region]' => 'hidden',
];
$this->drupalPostForm('admin/structure/contact/manage/' . $contact_form . '/form-display', $edit, 'Save');
$this->drupalGet('admin/structure/contact/manage/' . $contact_form . '/form-display');
$this->submitForm($edit, 'Save');
$this->assertSession()->fieldExists('fields[preview][region]');
// Check that the field preview is not displayed in the form.
@ -521,7 +526,8 @@ class ContactSitewideTest extends BrowserTestBase {
$edit['reply'] = $reply;
$edit['selected'] = ($selected ? TRUE : FALSE);
$edit += $third_party_settings;
$this->drupalPostForm('admin/structure/contact/add', $edit, 'Save');
$this->drupalGet('admin/structure/contact/add');
$this->submitForm($edit, 'Save');
}
/**
@ -552,7 +558,8 @@ class ContactSitewideTest extends BrowserTestBase {
$edit['selected'] = ($selected ? TRUE : FALSE);
$edit['message'] = $message;
$edit['redirect'] = $redirect;
$this->drupalPostForm("admin/structure/contact/manage/$id", $edit, 'Save');
$this->drupalGet("admin/structure/contact/manage/{$id}");
$this->submitForm($edit, 'Save');
}
/**
@ -576,10 +583,12 @@ class ContactSitewideTest extends BrowserTestBase {
$edit['subject[0][value]'] = $subject;
$edit['message[0][value]'] = $message;
if ($id == $this->config('contact.settings')->get('default_form')) {
$this->drupalPostForm('contact', $edit, 'Send message');
$this->drupalGet('contact');
$this->submitForm($edit, 'Send message');
}
else {
$this->drupalPostForm('contact/' . $id, $edit, 'Send message');
$this->drupalGet('contact/' . $id);
$this->submitForm($edit, 'Send message');
}
}
@ -595,7 +604,8 @@ class ContactSitewideTest extends BrowserTestBase {
$this->assertSession()->statusCodeEquals(403);
}
else {
$this->drupalPostForm("admin/structure/contact/manage/$id/delete", [], 'Delete');
$this->drupalGet("admin/structure/contact/manage/{$id}/delete");
$this->submitForm([], 'Delete');
$this->assertRaw(t('The contact form %label has been deleted.', ['%label' => $contact_form->label()]));
$this->assertNull(ContactForm::load($id), new FormattableMarkup('Form %contact_form not found', ['%contact_form' => $contact_form->label()]));
}

View File

@ -48,7 +48,8 @@ class ContentModerationWorkflowTypeTest extends BrowserTestBase {
$entity_bundle_info = \Drupal::service('entity_type.bundle.info');
$this->drupalPostForm('admin/config/workflow/workflows/add', [
$this->drupalGet('admin/config/workflow/workflows/add');
$this->submitForm([
'label' => 'Test',
'id' => 'test',
'workflow_type' => 'content_moderation',

View File

@ -29,9 +29,8 @@ class DefaultModerationStateTest extends ModerationStateTestBase {
*/
public function testPublishedDefaultState() {
// Set the default moderation state to be "published".
$this->drupalPostForm('admin/config/workflow/workflows/manage/' . $this->workflow->id(), [
'type_settings[workflow_settings][default_moderation_state]' => 'published',
], 'Save');
$this->drupalGet('admin/config/workflow/workflows/manage/' . $this->workflow->id());
$this->submitForm(['type_settings[workflow_settings][default_moderation_state]' => 'published'], 'Save');
$this->drupalGet('node/add/moderated_content');
$this->assertEquals('published', $this->assertSession()->selectExists('moderation_state[0][state]')->getValue());
@ -50,9 +49,8 @@ class DefaultModerationStateTest extends ModerationStateTestBase {
$this->drupalGet('admin/config/workflow/workflows/manage/editorial/state/archived/delete');
$this->assertSession()->statusCodeEquals(200);
$this->drupalPostForm('admin/config/workflow/workflows/manage/' . $this->workflow->id(), [
'type_settings[workflow_settings][default_moderation_state]' => 'archived',
], 'Save');
$this->drupalGet('admin/config/workflow/workflows/manage/' . $this->workflow->id());
$this->submitForm(['type_settings[workflow_settings][default_moderation_state]' => 'archived'], 'Save');
$this->drupalGet('admin/config/workflow/workflows/manage/editorial/state/archived/delete');
$this->assertSession()->statusCodeEquals(403);

View File

@ -73,7 +73,8 @@ class ModerationActionsTest extends BrowserTestBase {
}
$node->save();
$this->drupalPostForm('admin/content', [
$this->drupalGet('admin/content');
$this->submitForm([
'node_bulk_form[0]' => TRUE,
'action' => $action,
], 'Apply to selected items');

View File

@ -48,7 +48,8 @@ class ModerationContentTranslationTest extends BrowserTestBase {
$edit = [
'predefined_langcode' => 'fr',
];
$this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add language');
$this->drupalGet('admin/config/regional/language/add');
$this->submitForm($edit, 'Add language');
// Enable content translation on articles.
$this->drupalGet('admin/config/regional/content-language');
$edit = [
@ -71,7 +72,8 @@ class ModerationContentTranslationTest extends BrowserTestBase {
'title[0][value]' => 'Published English node',
'langcode[0][value]' => 'en',
];
$this->drupalPostForm('node/add/article', $edit, 'Save');
$this->drupalGet('node/add/article');
$this->submitForm($edit, 'Save');
$this->assertSession()->pageTextContains('Article Published English node has been created.');
$english_node = $this->drupalGetNodeByTitle('Published English node');

View File

@ -87,7 +87,8 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->assertSession()->statusCodeEquals(403);
// Update the draft.
$this->drupalPostForm($edit_path, [
$this->drupalGet($edit_path);
$this->submitForm([
'body[0][value]' => 'Second version of the content.',
'moderation_state[0][state]' => 'draft',
], 'Save');
@ -99,7 +100,8 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->assertSession()->fieldExists('edit-new-state');
// Preview the draft.
$this->drupalPostForm($edit_path, [
$this->drupalGet($edit_path);
$this->submitForm([
'body[0][value]' => 'Second version of the content.',
'moderation_state[0][state]' => 'draft',
], 'Preview');
@ -119,7 +121,8 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->assertSession()->statusCodeEquals(403);
// Publish the draft.
$this->drupalPostForm($edit_path, [
$this->drupalGet($edit_path);
$this->submitForm([
'body[0][value]' => 'Third version of the content.',
'moderation_state[0][state]' => 'published',
], 'Save');
@ -149,7 +152,8 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->assertSession()->statusCodeEquals(403);
// Make a pending revision.
$this->drupalPostForm($edit_path, [
$this->drupalGet($edit_path);
$this->submitForm([
'body[0][value]' => 'Fourth version of the content.',
'moderation_state[0][state]' => 'draft',
], 'Save');
@ -168,9 +172,8 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->assertSession()->pageTextContains('Draft');
// Submit the moderation form to change status to published.
$this->drupalPostForm($latest_version_path, [
'new_state' => 'published',
], 'Apply');
$this->drupalGet($latest_version_path);
$this->submitForm(['new_state' => 'published'], 'Apply');
// The latest version page should not show, because there is no
// pending revision.
@ -187,7 +190,8 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->workflow->save();
// Create new moderated content in draft.
$this->drupalPostForm('entity_test_mulrevpub/add', ['moderation_state[0][state]' => 'draft'], 'Save');
$this->drupalGet('entity_test_mulrevpub/add');
$this->submitForm(['moderation_state[0][state]' => 'draft'], 'Save');
// The latest version page should not show, because there is no pending
// revision.
@ -195,7 +199,8 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->assertSession()->statusCodeEquals(403);
// Update the draft.
$this->drupalPostForm('entity_test_mulrevpub/manage/1/edit', ['moderation_state[0][state]' => 'draft'], 'Save');
$this->drupalGet('entity_test_mulrevpub/manage/1/edit');
$this->submitForm(['moderation_state[0][state]' => 'draft'], 'Save');
// The latest version page should not show, because there is still no
// pending revision.
@ -203,7 +208,8 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->assertSession()->statusCodeEquals(403);
// Publish the draft.
$this->drupalPostForm('entity_test_mulrevpub/manage/1/edit', ['moderation_state[0][state]' => 'published'], 'Save');
$this->drupalGet('entity_test_mulrevpub/manage/1/edit');
$this->submitForm(['moderation_state[0][state]' => 'published'], 'Save');
// The published view should not have a moderation form, because it is the
// default revision.
@ -217,7 +223,8 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->assertSession()->statusCodeEquals(403);
// Make a pending revision.
$this->drupalPostForm('entity_test_mulrevpub/manage/1/edit', ['moderation_state[0][state]' => 'draft'], 'Save');
$this->drupalGet('entity_test_mulrevpub/manage/1/edit');
$this->submitForm(['moderation_state[0][state]' => 'draft'], 'Save');
// The published view should not have a moderation form, because it is the
// default revision.
@ -233,9 +240,8 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->assertSession()->pageTextContains('Draft');
// Submit the moderation form to change status to published.
$this->drupalPostForm('entity_test_mulrevpub/manage/1/latest', [
'new_state' => 'published',
], 'Apply');
$this->drupalGet('entity_test_mulrevpub/manage/1/latest');
$this->submitForm(['new_state' => 'published'], 'Apply');
// The latest version page should not show, because there is no
// pending revision.
@ -258,9 +264,8 @@ class ModerationFormTest extends ModerationStateTestBase {
$another_user = $this->drupalCreateUser($this->permissions);
$this->grantUserPermissionToCreateContentOfType($another_user, 'moderated_content');
$this->drupalLogin($another_user);
$this->drupalPostForm(sprintf('node/%d/latest', $node->id()), [
'new_state' => 'published',
], 'Apply');
$this->drupalGet(sprintf('node/%d/latest', $node->id()));
$this->submitForm(['new_state' => 'published'], 'Apply');
$this->drupalGet(sprintf('node/%d/revisions', $node->id()));
$this->assertSession()->pageTextContains('by ' . $another_user->getAccountName());
@ -280,7 +285,8 @@ class ModerationFormTest extends ModerationStateTestBase {
$edit = [
'predefined_langcode' => 'fr',
];
$this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add language');
$this->drupalGet('admin/config/regional/language/add');
$this->submitForm($edit, 'Add language');
// Enable content translation on articles.
$this->drupalGet('admin/config/regional/content-language');
@ -296,7 +302,8 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->rebuildContainer();
// Create new moderated content in draft (revision 1).
$this->drupalPostForm('node/add/moderated_content', [
$this->drupalGet('node/add/moderated_content');
$this->submitForm([
'title[0][value]' => 'Some moderated content',
'body[0][value]' => 'First version of the content.',
'moderation_state[0][state]' => 'draft',
@ -431,7 +438,8 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->assertSession()->optionExists('moderation_state[0][state]', 'archived');
// Create new moderated content (revision 1).
$this->drupalPostForm('node/add/moderated_content', [
$this->drupalGet('node/add/moderated_content');
$this->submitForm([
'title[0][value]' => 'Third moderated content',
'moderation_state[0][state]' => 'published',
], 'Save');
@ -488,7 +496,8 @@ class ModerationFormTest extends ModerationStateTestBase {
'region' => 'content',
]);
$entity_form_display->save();
$this->drupalPostForm('node/add/moderated_content', [
$this->drupalGet('node/add/moderated_content');
$this->submitForm([
'title[0][value]' => 'Test content',
'moderation_state[0][value]' => 'published',
], 'Save');
@ -524,7 +533,8 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->assertSession()->buttonExists('Delete');
}
// Create new moderated content in draft.
$this->drupalPostForm('node/add/moderated_content', [
$this->drupalGet('node/add/moderated_content');
$this->submitForm([
'title[0][value]' => 'Some moderated content',
'body[0][value]' => 'First version of the content.',
'moderation_state[0][state]' => 'draft',
@ -541,12 +551,10 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->assertSession()->pageTextContains($messages['editorial_workflow']);
$node = $this->drupalGetNodeByTitle('Some moderated content');
$this->drupalPostForm('node/' . $node->id() . '/edit', [
'moderation_state[0][state]' => 'published',
], 'Save');
$this->drupalPostForm('node/' . $node->id() . '/edit', [
'moderation_state[0][state]' => 'archived',
], 'Save');
$this->drupalGet('node/' . $node->id() . '/edit');
$this->submitForm(['moderation_state[0][state]' => 'published'], 'Save');
$this->drupalGet('node/' . $node->id() . '/edit');
$this->submitForm(['moderation_state[0][state]' => 'archived'], 'Save');
// Now the archived state is being used so it can not be deleted either.
foreach ($paths as $type => $path) {

View File

@ -44,7 +44,8 @@ class ModerationLocaleTest extends ModerationStateTestBase {
$edit = [
'predefined_langcode' => $langcode,
];
$this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add language');
$this->drupalGet('admin/config/regional/language/add');
$this->submitForm($edit, 'Add language');
}
// Enable content translation on articles.
@ -71,7 +72,8 @@ class ModerationLocaleTest extends ModerationStateTestBase {
'langcode[0][value]' => 'en',
'moderation_state[0][state]' => 'published',
];
$this->drupalPostForm('node/add/article', $edit, 'Save');
$this->drupalGet('node/add/article');
$this->submitForm($edit, 'Save');
$this->assertSession()->pageTextContains('Article Published English node has been created.');
$english_node = $this->drupalGetNodeByTitle('Published English node');
@ -94,7 +96,8 @@ class ModerationLocaleTest extends ModerationStateTestBase {
'langcode[0][value]' => 'en',
'moderation_state[0][state]' => 'draft',
];
$this->drupalPostForm('node/add/article', $edit, 'Save');
$this->drupalGet('node/add/article');
$this->submitForm($edit, 'Save');
$this->assertSession()->pageTextContains('Article English node has been created.');
$english_node = $this->drupalGetNodeByTitle('English node');
@ -111,9 +114,8 @@ class ModerationLocaleTest extends ModerationStateTestBase {
// Publish the English article and check that the translation stays
// unpublished.
$this->drupalPostForm('node/' . $english_node->id() . '/edit', [
'moderation_state[0][state]' => 'published',
], 'Save (this translation)');
$this->drupalGet('node/' . $english_node->id() . '/edit');
$this->submitForm(['moderation_state[0][state]' => 'published'], 'Save (this translation)');
$this->assertSession()->pageTextContains('Article English node has been updated.');
$english_node = $this->drupalGetNodeByTitle('English node', TRUE);
$french_node = $english_node->getTranslation('fr');
@ -130,7 +132,8 @@ class ModerationLocaleTest extends ModerationStateTestBase {
'title[0][value]' => 'Another node',
'moderation_state[0][state]' => 'draft',
];
$this->drupalPostForm('node/add/article', $edit, 'Save');
$this->drupalGet('node/add/article');
$this->submitForm($edit, 'Save');
$this->assertSession()->pageTextContains('Article Another node has been created.');
$english_node = $this->drupalGetNodeByTitle('Another node');
@ -147,9 +150,8 @@ class ModerationLocaleTest extends ModerationStateTestBase {
// Publish the translation and check that the source language version stays
// unpublished.
$this->drupalPostForm('fr/node/' . $english_node->id() . '/edit', [
'moderation_state[0][state]' => 'published',
], 'Save (this translation)');
$this->drupalGet('fr/node/' . $english_node->id() . '/edit');
$this->submitForm(['moderation_state[0][state]' => 'published'], 'Save (this translation)');
$this->assertSession()->pageTextContains('Article Translated node has been updated.');
$english_node = $this->drupalGetNodeByTitle('Another node', TRUE);
$french_node = $english_node->getTranslation('fr');
@ -163,7 +165,8 @@ class ModerationLocaleTest extends ModerationStateTestBase {
'title[0][value]' => 'New draft of translated node',
'moderation_state[0][state]' => 'draft',
];
$this->drupalPostForm('fr/node/' . $english_node->id() . '/edit', $edit, 'Save (this translation)');
$this->drupalGet('fr/node/' . $english_node->id() . '/edit');
$this->submitForm($edit, 'Save (this translation)');
$this->assertSession()->pageTextContains('Article New draft of translated node has been updated.');
$english_node = $this->drupalGetNodeByTitle('Another node', TRUE);
$french_node = $english_node->getTranslation('fr');
@ -172,9 +175,8 @@ class ModerationLocaleTest extends ModerationStateTestBase {
$this->assertEquals('Translated node', $french_node->getTitle(), 'The default revision of the published translation remains the same.');
// Publish the French article before testing the archive transition.
$this->drupalPostForm('fr/node/' . $english_node->id() . '/edit', [
'moderation_state[0][state]' => 'published',
], 'Save (this translation)');
$this->drupalGet('fr/node/' . $english_node->id() . '/edit');
$this->submitForm(['moderation_state[0][state]' => 'published'], 'Save (this translation)');
$this->assertSession()->pageTextContains('Article New draft of translated node has been updated.');
$english_node = $this->drupalGetNodeByTitle('Another node', TRUE);
$french_node = $english_node->getTranslation('fr');
@ -183,7 +185,8 @@ class ModerationLocaleTest extends ModerationStateTestBase {
$this->assertEquals('New draft of translated node', $french_node->getTitle(), 'The draft has replaced the published revision.');
// Publish the English article before testing the archive transition.
$this->drupalPostForm('node/' . $english_node->id() . '/edit', [
$this->drupalGet('node/' . $english_node->id() . '/edit');
$this->submitForm([
'moderation_state[0][state]' => 'published',
], 'Save (this translation)');
$this->assertSession()->pageTextContains('Article Another node has been updated.');
@ -191,11 +194,13 @@ class ModerationLocaleTest extends ModerationStateTestBase {
$this->assertEquals('published', $english_node->moderation_state->value);
// Archive the node and its translation.
$this->drupalPostForm('node/' . $english_node->id() . '/edit', [
$this->drupalGet('node/' . $english_node->id() . '/edit');
$this->submitForm([
'moderation_state[0][state]' => 'archived',
], 'Save (this translation)');
$this->assertSession()->pageTextContains('Article Another node has been updated.');
$this->drupalPostForm('fr/node/' . $english_node->id() . '/edit', [
$this->drupalGet('fr/node/' . $english_node->id() . '/edit');
$this->submitForm([
'moderation_state[0][state]' => 'archived',
], 'Save (this translation)');
$this->assertSession()->pageTextContains('Article New draft of translated node has been updated.');

View File

@ -64,13 +64,15 @@ class ModerationRevisionRevertTest extends BrowserTestBase {
*/
public function testEditingAfterRevertRevision() {
// Create a draft.
$this->drupalPostForm('node/add/moderated_bundle', [
$this->drupalGet('node/add/moderated_bundle');
$this->submitForm([
'title[0][value]' => 'First draft node',
'moderation_state[0][state]' => 'draft',
], 'Save');
// Now make it published.
$this->drupalPostForm('node/1/edit', [
$this->drupalGet('node/1/edit');
$this->submitForm([
'title[0][value]' => 'Published node',
'moderation_state[0][state]' => 'published',
], 'Save');
@ -91,9 +93,8 @@ class ModerationRevisionRevertTest extends BrowserTestBase {
$this->assertSession()
->pageTextContains('First draft node');
// Try to save the node.
$this->drupalPostForm('node/1/edit', [
'moderation_state[0][state]' => 'draft',
], 'Save');
$this->drupalGet('node/1/edit');
$this->submitForm(['moderation_state[0][state]' => 'draft'], 'Save');
// Check if the submission passed the EntityChangedConstraintValidator.
$this->assertSession()

View File

@ -58,7 +58,8 @@ class ModerationStateBlockTest extends ModerationStateTestBase {
// Enable moderation for custom blocks.
$edit['bundles[basic]'] = TRUE;
$this->drupalPostForm('admin/config/workflow/workflows/manage/editorial/type/block_content', $edit, 'Save');
$this->drupalGet('admin/config/workflow/workflows/manage/editorial/type/block_content');
$this->submitForm($edit, 'Save');
// Create a custom block at block/add and save it as draft.
$body = 'Body of moderated block';
@ -67,7 +68,8 @@ class ModerationStateBlockTest extends ModerationStateTestBase {
'moderation_state[0][state]' => 'draft',
'body[0][value]' => $body,
];
$this->drupalPostForm('block/add', $edit, 'Save');
$this->drupalGet('block/add');
$this->submitForm($edit, 'Save');
$this->assertSession()->pageTextContains('basic Moderated block has been created.');
// Place the block in the Sidebar First region.
@ -78,7 +80,8 @@ class ModerationStateBlockTest extends ModerationStateTestBase {
];
$block = BlockContent::load(1);
$url = 'admin/structure/block/add/block_content:' . $block->uuid() . '/' . $this->config('system.theme')->get('default');
$this->drupalPostForm($url, $instance, 'Save block');
$this->drupalGet($url);
$this->submitForm($instance, 'Save block');
// Navigate to home page and check that the block is visible. It should be
// visible because it is the default revision.
@ -91,7 +94,8 @@ class ModerationStateBlockTest extends ModerationStateTestBase {
'body[0][value]' => $updated_body,
'moderation_state[0][state]' => 'draft',
];
$this->drupalPostForm('block/' . $block->id(), $edit, 'Save');
$this->drupalGet('block/' . $block->id());
$this->submitForm($edit, 'Save');
$this->assertSession()->pageTextContains('basic Moderated block has been updated.');
// Navigate to the home page and check that the block shows the updated
@ -101,9 +105,8 @@ class ModerationStateBlockTest extends ModerationStateTestBase {
$this->assertSession()->pageTextContains($updated_body);
// Publish the block so we can create a pending revision.
$this->drupalPostForm('block/' . $block->id(), [
'moderation_state[0][state]' => 'published',
], 'Save');
$this->drupalGet('block/' . $block->id());
$this->submitForm(['moderation_state[0][state]' => 'published'], 'Save');
// Create a pending revision.
$pending_revision_body = 'This is the pending revision body value';
@ -111,7 +114,8 @@ class ModerationStateBlockTest extends ModerationStateTestBase {
'body[0][value]' => $pending_revision_body,
'moderation_state[0][state]' => 'draft',
];
$this->drupalPostForm('block/' . $block->id(), $edit, 'Save');
$this->drupalGet('block/' . $block->id());
$this->submitForm($edit, 'Save');
$this->assertSession()->pageTextContains('basic Moderated block has been updated.');
// Navigate to home page and check that the pending revision doesn't show,
@ -123,7 +127,8 @@ class ModerationStateBlockTest extends ModerationStateTestBase {
$edit = [
'new_state' => 'published',
];
$this->drupalPostForm('block/' . $block->id() . '/latest', $edit, 'Apply');
$this->drupalGet('block/' . $block->id() . '/latest');
$this->submitForm($edit, 'Apply');
$this->assertSession()->pageTextContains('The moderation state has been updated.');
// Navigate to home page and check that the pending revision is now the

View File

@ -31,7 +31,8 @@ class ModerationStateNodeTest extends ModerationStateTestBase {
* Tests creating and deleting content.
*/
public function testCreatingContent() {
$this->drupalPostForm('node/add/moderated_content', [
$this->drupalGet('node/add/moderated_content');
$this->submitForm([
'title[0][value]' => 'moderated content',
'moderation_state[0][state]' => 'draft',
], 'Save');
@ -43,9 +44,8 @@ class ModerationStateNodeTest extends ModerationStateTestBase {
$path = 'node/' . $node->id() . '/edit';
// Set up published revision.
$this->drupalPostForm($path, [
'moderation_state[0][state]' => 'published',
], 'Save');
$this->drupalGet($path);
$this->submitForm(['moderation_state[0][state]' => 'published'], 'Save');
\Drupal::entityTypeManager()->getStorage('node')->resetCache([$node->id()]);
/** @var \Drupal\node\NodeInterface $node */
$node = \Drupal::entityTypeManager()->getStorage('node')->load($node->id());
@ -56,21 +56,22 @@ class ModerationStateNodeTest extends ModerationStateTestBase {
$this->assertNoText('Published');
// Delete the node.
$this->drupalPostForm('node/' . $node->id() . '/delete', [], 'Delete');
$this->drupalGet('node/' . $node->id() . '/delete');
$this->submitForm([], 'Delete');
$this->assertSession()->pageTextContains('The Moderated content moderated content has been deleted.');
// Disable content moderation.
$edit['bundles[moderated_content]'] = FALSE;
$this->drupalPostForm('admin/config/workflow/workflows/manage/editorial/type/node', $edit, 'Save');
$this->drupalGet('admin/config/workflow/workflows/manage/editorial/type/node');
$this->submitForm($edit, 'Save');
// Ensure the parent environment is up-to-date.
// @see content_moderation_workflow_insert()
\Drupal::service('entity_type.bundle.info')->clearCachedBundles();
\Drupal::service('entity_field.manager')->clearCachedFieldDefinitions();
// Create a new node.
$this->drupalPostForm('node/add/moderated_content', [
'title[0][value]' => 'non-moderated content',
], 'Save');
$this->drupalGet('node/add/moderated_content');
$this->submitForm(['title[0][value]' => 'non-moderated content'], 'Save');
$node = $this->getNodeByTitle('non-moderated content');
if (!$node) {
@ -84,7 +85,8 @@ class ModerationStateNodeTest extends ModerationStateTestBase {
*/
public function testFormSaveDestination() {
// Create new moderated content in draft.
$this->drupalPostForm('node/add/moderated_content', [
$this->drupalGet('node/add/moderated_content');
$this->submitForm([
'title[0][value]' => 'Some moderated content',
'body[0][value]' => 'First version of the content.',
'moderation_state[0][state]' => 'draft',
@ -100,7 +102,8 @@ class ModerationStateNodeTest extends ModerationStateTestBase {
// Create a new draft; after saving, we should still be on the canonical
// URL, but viewing the second revision.
$this->drupalPostForm($edit_path, [
$this->drupalGet($edit_path);
$this->submitForm([
'body[0][value]' => 'Second version of the content.',
'moderation_state[0][state]' => 'draft',
], 'Save');
@ -109,7 +112,8 @@ class ModerationStateNodeTest extends ModerationStateTestBase {
// Make a new published revision; after saving, we should be at the
// canonical URL.
$this->drupalPostForm($edit_path, [
$this->drupalGet($edit_path);
$this->submitForm([
'body[0][value]' => 'Third version of the content.',
'moderation_state[0][state]' => 'published',
], 'Save');
@ -118,7 +122,8 @@ class ModerationStateNodeTest extends ModerationStateTestBase {
// Make a new pending revision; after saving, we should be on the "Latest
// version" tab.
$this->drupalPostForm($edit_path, [
$this->drupalGet($edit_path);
$this->submitForm([
'body[0][value]' => 'Fourth version of the content.',
'moderation_state[0][state]' => 'draft',
], 'Save');

View File

@ -112,9 +112,8 @@ class ModerationStateNodeTypeTest extends ModerationStateTestBase {
// Ensure checkboxes in the 'workflow' section can be altered, even when
// 'revision' is enforced and disabled.
$this->drupalGet('admin/structure/types/manage/moderated');
$this->drupalPostForm('admin/structure/types/manage/moderated', [
'options[promote]' => TRUE,
], 'Save content type');
$this->drupalGet('admin/structure/types/manage/moderated');
$this->submitForm(['options[promote]' => TRUE], 'Save content type');
$this->drupalGet('admin/structure/types/manage/moderated');
$this->assertSession()->checkboxChecked('options[promote]');
}

View File

@ -138,7 +138,8 @@ abstract class ModerationStateTestBase extends BrowserTestBase {
$this->drupalGet('/admin/config/workflow/workflows');
$this->assertSession()->linkByHrefExists('admin/config/workflow/workflows/manage/' . $workflow_id);
$edit['bundles[' . $content_type_id . ']'] = TRUE;
$this->drupalPostForm('admin/config/workflow/workflows/manage/' . $workflow_id . '/type/node', $edit, 'Save');
$this->drupalGet('admin/config/workflow/workflows/manage/' . $workflow_id . '/type/node');
$this->submitForm($edit, 'Save');
// Ensure the parent environment is up-to-date.
// @see content_moderation_workflow_insert()
\Drupal::service('entity_type.bundle.info')->clearCachedBundles();

View File

@ -118,9 +118,8 @@ class NodeAccessTest extends ModerationStateTestBase {
// Publish the node.
$this->drupalLogin($this->adminUser);
$this->drupalPostForm($edit_path, [
'moderation_state[0][state]' => 'published',
], 'Save');
$this->drupalGet($edit_path);
$this->submitForm(['moderation_state[0][state]' => 'published'], 'Save');
// Ensure access works correctly for anonymous users.
$this->drupalLogout();
@ -135,7 +134,8 @@ class NodeAccessTest extends ModerationStateTestBase {
// Create a pending revision for the 'Latest revision' tab.
$this->drupalLogin($this->adminUser);
$this->drupalPostForm($edit_path, [
$this->drupalGet($edit_path);
$this->submitForm([
'title[0][value]' => 'moderated content revised',
'moderation_state[0][state]' => 'draft',
], 'Save');

View File

@ -95,35 +95,39 @@ class ViewsModerationStateFilterTest extends ViewTestBase {
// Configure the Editorial workflow for a node bundle, set the filter value
// to use one of its states and check that the workflow is now a dependency
// of the view.
$this->drupalPostForm('admin/config/workflow/workflows/manage/editorial/type/node', [
'bundles[example_a]' => TRUE,
], 'Save');
$this->drupalGet('admin/config/workflow/workflows/manage/editorial/type/node');
$this->submitForm(['bundles[example_a]' => TRUE], 'Save');
$edit['options[value][]'] = ['editorial-published'];
$this->drupalPostForm("admin/structure/views/nojs/handler/$view_id/default/filter/moderation_state", $edit, 'Apply');
$this->drupalPostForm("admin/structure/views/view/$view_id", [], 'Save');
$this->drupalGet("admin/structure/views/nojs/handler/{$view_id}/default/filter/moderation_state");
$this->submitForm($edit, 'Apply');
$this->drupalGet("admin/structure/views/view/{$view_id}");
$this->submitForm([], 'Save');
$view = $this->loadViewUnchanged($view_id);
$this->assertWorkflowDependencies(['editorial'], $view);
$this->assertTrue($view->status());
// Create another workflow and repeat the checks above.
$this->drupalPostForm('admin/config/workflow/workflows/add', [
$this->drupalGet('admin/config/workflow/workflows/add');
$this->submitForm([
'label' => 'Translation',
'id' => 'translation',
'workflow_type' => 'content_moderation',
], 'Save');
$this->drupalPostForm('admin/config/workflow/workflows/manage/translation/add_state', [
$this->drupalGet('admin/config/workflow/workflows/manage/translation/add_state');
$this->submitForm([
'label' => 'Needs Review',
'id' => 'needs_review',
], 'Save');
$this->drupalPostForm('admin/config/workflow/workflows/manage/translation/type/node', [
'bundles[example_b]' => TRUE,
], 'Save');
$this->drupalGet('admin/config/workflow/workflows/manage/translation/type/node');
$this->submitForm(['bundles[example_b]' => TRUE], 'Save');
$edit['options[value][]'] = ['editorial-published', 'translation-needs_review'];
$this->drupalPostForm("admin/structure/views/nojs/handler/$view_id/default/filter/moderation_state", $edit, 'Apply');
$this->drupalPostForm("admin/structure/views/view/$view_id", [], 'Save');
$this->drupalGet("admin/structure/views/nojs/handler/{$view_id}/default/filter/moderation_state");
$this->submitForm($edit, 'Apply');
$this->drupalGet("admin/structure/views/view/{$view_id}");
$this->submitForm([], 'Save');
$view = $this->loadViewUnchanged($view_id);
$this->assertWorkflowDependencies(['editorial', 'translation'], $view);
@ -131,14 +135,16 @@ class ViewsModerationStateFilterTest extends ViewTestBase {
$this->assertTrue($view->status());
// Remove the 'Translation' workflow.
$this->drupalPostForm('admin/config/workflow/workflows/manage/translation/delete', [], 'Delete');
$this->drupalGet('admin/config/workflow/workflows/manage/translation/delete');
$this->submitForm([], 'Delete');
// Check that the view has been disabled, the filter has been deleted, the
// view can be saved and there are no more config dependencies.
$view = $this->loadViewUnchanged($view_id);
$this->assertFalse($view->status());
$this->assertFalse(isset($view->getDisplay('default')['display_options']['filters']['moderation_state']));
$this->drupalPostForm("admin/structure/views/view/$view_id", [], 'Save');
$this->drupalGet("admin/structure/views/view/{$view_id}");
$this->submitForm([], 'Save');
$this->assertWorkflowDependencies([], $view);
}
@ -164,7 +170,8 @@ class ViewsModerationStateFilterTest extends ViewTestBase {
*/
public function testWorkflowChanges($view_id) {
// First, apply the Editorial workflow to both of our content types.
$this->drupalPostForm('admin/config/workflow/workflows/manage/editorial/type/node', [
$this->drupalGet('admin/config/workflow/workflows/manage/editorial/type/node');
$this->submitForm([
'bundles[example_a]' => TRUE,
'bundles[example_b]' => TRUE,
], 'Save');
@ -173,8 +180,10 @@ class ViewsModerationStateFilterTest extends ViewTestBase {
// Update the view and make the default filter not exposed anymore,
// otherwise all results will be shown when there are no more moderated
// bundles left.
$this->drupalPostForm("admin/structure/views/nojs/handler/$view_id/default/filter/moderation_state", [], 'Hide filter');
$this->drupalPostForm("admin/structure/views/view/$view_id", [], 'Save');
$this->drupalGet("admin/structure/views/nojs/handler/{$view_id}/default/filter/moderation_state");
$this->submitForm([], 'Hide filter');
$this->drupalGet("admin/structure/views/view/{$view_id}");
$this->submitForm([], 'Save');
// Add a few nodes in various moderation states.
$this->createNode(['type' => 'example_a', 'moderation_state' => 'published']);
@ -184,8 +193,10 @@ class ViewsModerationStateFilterTest extends ViewTestBase {
// Configure the view to only show nodes in the 'archived' moderation state.
$edit['options[value][]'] = ['editorial-archived'];
$this->drupalPostForm("admin/structure/views/nojs/handler/$view_id/default/filter/moderation_state", $edit, 'Apply');
$this->drupalPostForm("admin/structure/views/view/$view_id", [], 'Save');
$this->drupalGet("admin/structure/views/nojs/handler/{$view_id}/default/filter/moderation_state");
$this->submitForm($edit, 'Apply');
$this->drupalGet("admin/structure/views/view/{$view_id}");
$this->submitForm([], 'Save');
// Check that only the archived nodes from both bundles are displayed by the
// view.
@ -193,7 +204,8 @@ class ViewsModerationStateFilterTest extends ViewTestBase {
$this->executeAndAssertIdenticalResultset($view, [['nid' => $archived_node_a->id()], ['nid' => $archived_node_b->id()]], ['nid' => 'nid']);
// Remove the Editorial workflow from one of the bundles.
$this->drupalPostForm('admin/config/workflow/workflows/manage/editorial/type/node', [
$this->drupalGet('admin/config/workflow/workflows/manage/editorial/type/node');
$this->submitForm([
'bundles[example_a]' => TRUE,
'bundles[example_b]' => FALSE,
], 'Save');
@ -204,10 +216,12 @@ class ViewsModerationStateFilterTest extends ViewTestBase {
// Check that the view can still be edited and saved without any
// intervention.
$this->drupalPostForm("admin/structure/views/view/$view_id", [], 'Save');
$this->drupalGet("admin/structure/views/view/{$view_id}");
$this->submitForm([], 'Save');
// Remove the Editorial workflow from both bundles.
$this->drupalPostForm('admin/config/workflow/workflows/manage/editorial/type/node', [
$this->drupalGet('admin/config/workflow/workflows/manage/editorial/type/node');
$this->submitForm([
'bundles[example_a]' => FALSE,
'bundles[example_b]' => FALSE,
], 'Save');
@ -219,7 +233,8 @@ class ViewsModerationStateFilterTest extends ViewTestBase {
// Check that the view contains a broken filter, since the moderation_state
// field was removed from the entity type.
$this->drupalPostForm("admin/structure/views/view/$view_id", [], 'Save');
$this->drupalGet("admin/structure/views/view/{$view_id}");
$this->submitForm([], 'Save');
$this->assertSession()->pageTextContains("Broken/missing handler");
}
@ -262,41 +277,44 @@ class ViewsModerationStateFilterTest extends ViewTestBase {
*/
public function testFilterRenderCache() {
// Initially all states of the workflow are displayed.
$this->drupalPostForm('admin/config/workflow/workflows/manage/editorial/type/node', [
'bundles[example_a]' => TRUE,
], 'Save');
$this->drupalGet('admin/config/workflow/workflows/manage/editorial/type/node');
$this->submitForm(['bundles[example_a]' => TRUE], 'Save');
$this->assertFilterStates(['All', 'editorial-draft', 'editorial-published', 'editorial-archived']);
// Adding a new state to the editorial workflow will display that state in
// the list of filters.
$this->drupalPostForm('admin/config/workflow/workflows/manage/editorial/add_state', [
$this->drupalGet('admin/config/workflow/workflows/manage/editorial/add_state');
$this->submitForm([
'label' => 'Foo',
'id' => 'foo',
], 'Save');
$this->assertFilterStates(['All', 'editorial-draft', 'editorial-published', 'editorial-archived', 'editorial-foo']);
// Adding a second workflow to nodes will also show new states.
$this->drupalPostForm('admin/config/workflow/workflows/manage/new_workflow/type/node', [
'bundles[example_b]' => TRUE,
], 'Save');
$this->drupalGet('admin/config/workflow/workflows/manage/new_workflow/type/node');
$this->submitForm(['bundles[example_b]' => TRUE], 'Save');
$this->assertFilterStates(['All', 'editorial-draft', 'editorial-published', 'editorial-archived', 'editorial-foo', 'new_workflow-draft', 'new_workflow-published', 'new_workflow-bar']);
// Add a few more states and change the exposed filter to allow multiple
// selections so we can check that the size of the select element does not
// exceed 8 options.
$this->drupalPostForm('admin/config/workflow/workflows/manage/editorial/add_state', [
$this->drupalGet('admin/config/workflow/workflows/manage/editorial/add_state');
$this->submitForm([
'label' => 'Foo 2',
'id' => 'foo2',
], 'Save');
$this->drupalPostForm('admin/config/workflow/workflows/manage/editorial/add_state', [
$this->drupalGet('admin/config/workflow/workflows/manage/editorial/add_state');
$this->submitForm([
'label' => 'Foo 3',
'id' => 'foo3',
], 'Save');
$view_id = 'test_content_moderation_state_filter_base_table';
$edit['options[expose][multiple]'] = TRUE;
$this->drupalPostForm("admin/structure/views/nojs/handler/$view_id/default/filter/moderation_state", $edit, 'Apply');
$this->drupalPostForm("admin/structure/views/view/$view_id", [], 'Save');
$this->drupalGet("admin/structure/views/nojs/handler/{$view_id}/default/filter/moderation_state");
$this->submitForm($edit, 'Apply');
$this->drupalGet("admin/structure/views/view/{$view_id}");
$this->submitForm([], 'Save');
$this->assertFilterStates(['editorial-draft', 'editorial-published', 'editorial-archived', 'editorial-foo', 'editorial-foo2', 'editorial-foo3', 'new_workflow-draft', 'new_workflow-published', 'new_workflow-bar'], TRUE);
}

View File

@ -47,11 +47,13 @@ class WorkspaceContentModerationIntegrationTest extends ModerationStateTestBase
$this->switchToWorkspace($stage);
// Create two nodes, a published and a draft one.
$this->drupalPostForm('node/add/article', [
$this->drupalGet('node/add/article');
$this->submitForm([
'title[0][value]' => 'First article - published',
'moderation_state[0][state]' => 'published',
], 'Save');
$this->drupalPostForm('node/add/article', [
$this->drupalGet('node/add/article');
$this->submitForm([
'title[0][value]' => 'Second article - draft',
'moderation_state[0][state]' => 'draft',
], 'Save');
@ -91,7 +93,8 @@ class WorkspaceContentModerationIntegrationTest extends ModerationStateTestBase
'moderation_state[0][state]' => 'published',
], 'Save');
$this->drupalPostForm('/node/1/edit', [
$this->drupalGet('/node/1/edit');
$this->submitForm([
'title[0][value]' => 'First article - archived',
'moderation_state[0][state]' => 'archived',
], 'Save');
@ -101,7 +104,8 @@ class WorkspaceContentModerationIntegrationTest extends ModerationStateTestBase
// Get the second node to a default revision state and publish the
// workspace.
$this->drupalPostForm('/node/2/edit', [
$this->drupalGet('/node/2/edit');
$this->submitForm([
'title[0][value]' => 'Second article - published',
'moderation_state[0][state]' => 'published',
], 'Save');

View File

@ -120,7 +120,8 @@ class ContentTranslationContextualLinksTest extends BrowserTestBase {
'settings[node][' . $this->bundle . '][translatable]' => TRUE,
'settings[node][' . $this->bundle . '][fields][field_test_text]' => TRUE,
];
$this->drupalPostForm('admin/config/regional/content-language', $edit, 'Save configuration');
$this->drupalGet('admin/config/regional/content-language');
$this->submitForm($edit, 'Save configuration');
$this->drupalLogout();
// Check that the link leads to the translate page.

View File

@ -32,7 +32,8 @@ class ContentTranslationEnableTest extends BrowserTestBase {
'modules[content_translation][enable]' => TRUE,
'modules[language][enable]' => TRUE,
];
$this->drupalPostForm('admin/modules', $edit, 'Install');
$this->drupalGet('admin/modules');
$this->submitForm($edit, 'Install');
// Status messages are shown.
$this->assertSession()->pageTextContains('This site has only a single language enabled. Add at least one more language in order to translate content.');
@ -68,7 +69,8 @@ class ContentTranslationEnableTest extends BrowserTestBase {
'title_label' => 'title for foo',
'type' => 'foo',
];
$this->drupalPostForm('admin/structure/types/add', $edit, 'Save content type');
$this->drupalGet('admin/structure/types/add');
$this->submitForm($edit, 'Save content type');
$this->drupalGet('admin/config/regional/content-language');
$this->assertRaw('entity_types[node]');
}

View File

@ -43,7 +43,8 @@ class ContentTranslationEntityBundleUITest extends BrowserTestBase {
$this->drupalCreateContentType(['type' => 'article']);
// Enable content translation.
$edit = ['language_configuration[content_translation]' => TRUE];
$this->drupalPostForm('admin/structure/types/manage/article', $edit, 'Save content type');
$this->drupalGet('admin/structure/types/manage/article');
$this->submitForm($edit, 'Save content type');
// Make sure add page does not inherit translation configuration from first
// content type.
@ -56,7 +57,8 @@ class ContentTranslationEntityBundleUITest extends BrowserTestBase {
'type' => 'page',
'language_configuration[content_translation]' => TRUE,
];
$this->drupalPostForm('admin/structure/types/add', $edit, 'Save and manage fields');
$this->drupalGet('admin/structure/types/add');
$this->submitForm($edit, 'Save and manage fields');
// Make sure the settings are saved when creating the content type.
$this->drupalGet('admin/structure/types/manage/page');

View File

@ -68,7 +68,8 @@ class ContentTranslationLanguageChangeTest extends NodeTestBase {
'settings[node][article][translatable]' => TRUE,
'settings[node][article][settings][language][language_alterable]' => TRUE,
];
$this->drupalPostForm('admin/config/regional/content-language', $edit, 'Save configuration');
$this->drupalGet('admin/config/regional/content-language');
$this->submitForm($edit, 'Save configuration');
// Add an image field.
$this->drupalGet('admin/structure/types/manage/article/fields/add-field');

View File

@ -129,7 +129,8 @@ class ContentTranslationOperationsTest extends NodeTestBase {
$this->drupalLogin($this->baseUser2);
$this->drupalGet('node/' . $node->id());
$this->assertSession()->linkByHrefExists('node/' . $node->id() . '/translations');
$this->drupalPostForm('admin/config/regional/content-language', ['settings[node][article][translatable]' => FALSE], 'Save configuration');
$this->drupalGet('admin/config/regional/content-language');
$this->submitForm(['settings[node][article][translatable]' => FALSE], 'Save configuration');
$this->drupalGet('node/' . $node->id());
$this->assertSession()->linkByHrefNotExists('node/' . $node->id() . '/translations');
}

View File

@ -81,7 +81,8 @@ abstract class ContentTranslationPendingRevisionTestBase extends ContentTranslat
$workflow_id = 'editorial';
$this->drupalGet('/admin/config/workflow/workflows');
$edit['bundles[' . $this->bundle . ']'] = TRUE;
$this->drupalPostForm('admin/config/workflow/workflows/manage/' . $workflow_id . '/type/' . $this->entityTypeId, $edit, 'Save');
$this->drupalGet('admin/config/workflow/workflows/manage/' . $workflow_id . '/type/' . $this->entityTypeId);
$this->submitForm($edit, 'Save');
// Ensure the parent environment is up-to-date.
// @see content_moderation_workflow_insert()
\Drupal::service('entity_type.bundle.info')->clearCachedBundles();

View File

@ -169,7 +169,8 @@ class ContentTranslationSettingsTest extends BrowserTestBase {
$this->drupalGet('admin/structure/types/manage/article');
$this->assertSession()->fieldExists('language_configuration[content_translation]');
$this->assertSession()->checkboxNotChecked('edit-language-configuration-content-translation');
$this->drupalPostForm('admin/structure/types/manage/article', $edit, 'Save content type');
$this->drupalGet('admin/structure/types/manage/article');
$this->submitForm($edit, 'Save content type');
$this->drupalGet('admin/structure/types/manage/article');
$this->assertSession()->checkboxChecked('edit-language-configuration-content-translation');
@ -195,7 +196,8 @@ class ContentTranslationSettingsTest extends BrowserTestBase {
// Test that also the Field UI form behaves correctly.
$translatable = !$translatable;
$edit = ['translatable' => $translatable];
$this->drupalPostForm('admin/structure/types/manage/article/fields/node.article.body', $edit, 'Save settings');
$this->drupalGet('admin/structure/types/manage/article/fields/node.article.body');
$this->submitForm($edit, 'Save settings');
$entity_field_manager->clearCachedFieldDefinitions();
$field = FieldConfig::loadByName('node', 'article', 'body');
$definitions = $entity_field_manager->getFieldDefinitions('node', 'article');
@ -234,12 +236,14 @@ class ContentTranslationSettingsTest extends BrowserTestBase {
$edit = [
'language[content_translation]' => TRUE,
];
$this->drupalPostForm('admin/config/people/accounts', $edit, 'Save configuration');
$this->drupalGet('admin/config/people/accounts');
$this->submitForm($edit, 'Save configuration');
$this->drupalGet('admin/config/people/accounts');
$this->assertSession()->checkboxChecked('edit-language-content-translation');
// Make sure account settings can be saved.
$this->drupalPostForm('admin/config/people/accounts', ['anonymous' => 'Save me please!'], 'Save configuration');
$this->drupalGet('admin/config/people/accounts');
$this->submitForm(['anonymous' => 'Save me please!'], 'Save configuration');
$this->assertSession()->fieldValueEquals('anonymous', 'Save me please!');
$this->assertSession()->pageTextContains('The configuration options have been saved.');
}
@ -260,7 +264,8 @@ class ContentTranslationSettingsTest extends BrowserTestBase {
* TRUE if the assertion succeeded, FALSE otherwise.
*/
protected function assertSettings($entity_type, $bundle, $enabled, $edit) {
$this->drupalPostForm('admin/config/regional/content-language', $edit, 'Save configuration');
$this->drupalGet('admin/config/regional/content-language');
$this->submitForm($edit, 'Save configuration');
$args = ['@entity_type' => $entity_type, '@bundle' => $bundle, '@enabled' => $enabled ? 'enabled' : 'disabled'];
$message = new FormattableMarkup('Translation for entity @entity_type (@bundle) is @enabled.', $args);
return $this->assertEquals($enabled, \Drupal::service('content_translation.manager')->isEnabled($entity_type, $bundle), $message);
@ -278,7 +283,8 @@ class ContentTranslationSettingsTest extends BrowserTestBase {
'label' => 'Test',
'field_name' => 'article_text',
];
$this->drupalPostForm('admin/structure/types/manage/article/fields/add-field', $edit, 'Save and continue');
$this->drupalGet('admin/structure/types/manage/article/fields/add-field');
$this->submitForm($edit, 'Save and continue');
// Tests that field doesn't have translatable setting if bundle is not
// translatable.

View File

@ -121,7 +121,8 @@ class ContentTranslationSyncImageTest extends ContentTranslationTestBase {
'settings[entity_test_mul][entity_test_mul][columns][field_test_et_ui_image][alt]' => TRUE,
'settings[entity_test_mul][entity_test_mul][columns][field_test_et_ui_image][title]' => TRUE,
];
$this->drupalPostForm('admin/config/regional/content-language', $edit, 'Save configuration');
$this->drupalGet('admin/config/regional/content-language');
$this->submitForm($edit, 'Save configuration');
$this->assertSession()->elementNotExists('xpath', '//div[contains(@class, "messages--error")]');
$this->assertSession()->checkboxChecked('edit-settings-entity-test-mul-entity-test-mul-columns-field-test-et-ui-image-alt');
$this->assertSession()->checkboxChecked('edit-settings-entity-test-mul-entity-test-mul-columns-field-test-et-ui-image-title');

View File

@ -111,7 +111,8 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
'source' => $default_langcode,
'target' => $langcode,
], ['language' => $language]);
$this->drupalPostForm($add_url, $this->getEditValues($values, $langcode), $this->getFormSubmitActionForNewTranslation($entity, $langcode));
$this->drupalGet($add_url);
$this->submitForm($this->getEditValues($values, $langcode), $this->getFormSubmitActionForNewTranslation($entity, $langcode));
// Assert that HTML is not escaped unexpectedly.
if ($this->testHTMLEscapeForAllLanguages) {
@ -178,7 +179,8 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
], ['language' => $language]);
// This does not save anything, it merely reloads the form and fills in the
// fields with the values from the different source language.
$this->drupalPostForm($add_url, $edit, 'Change');
$this->drupalGet($add_url);
$this->submitForm($edit, 'Change');
$this->assertSession()->fieldValueEquals("{$this->fieldName}[0][value]", $values[$source_langcode][$this->fieldName][0]['value']);
// Add another translation and mark the other ones as outdated.
@ -190,7 +192,8 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
'source' => $source_langcode,
'target' => $langcode,
], ['language' => $language]);
$this->drupalPostForm($add_url, $edit, $this->getFormSubmitActionForNewTranslation($entity, $langcode));
$this->drupalGet($add_url);
$this->submitForm($edit, $this->getFormSubmitActionForNewTranslation($entity, $langcode));
$storage->resetCache([$this->entityId]);
$entity = $storage->load($this->entityId);
$this->drupalGet($entity->toUrl('drupal:content-translation-overview'));
@ -247,7 +250,8 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
// Mark translations as outdated.
$edit = ['content_translation[retranslate]' => TRUE];
$edit_path = $entity->toUrl('edit-form', ['language' => $languages[$langcode]]);
$this->drupalPostForm($edit_path, $edit, $this->getFormSubmitAction($entity, $langcode));
$this->drupalGet($edit_path);
$this->submitForm($edit, $this->getFormSubmitAction($entity, $langcode));
$storage->resetCache([$this->entityId]);
$entity = $storage->load($this->entityId);
@ -266,7 +270,8 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
$this->assertSession()->fieldValueEquals('content_translation[outdated]', TRUE);
$this->assertNotEmpty($this->xpath('//details[@id="edit-content-translation" and @open="open"]'), 'The translation tab is correctly expanded when the translation is outdated.');
$edit = ['content_translation[outdated]' => FALSE];
$this->drupalPostForm($url, $edit, $this->getFormSubmitAction($entity, $added_langcode));
$this->drupalGet($url);
$this->submitForm($edit, $this->getFormSubmitAction($entity, $added_langcode));
$this->drupalGet($url);
// Verify that retranslate flag is now shown.
$this->assertSession()->fieldValueEquals('content_translation[retranslate]', FALSE);
@ -293,7 +298,8 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
if ($index > 0) {
$url = $entity->toUrl('edit-form', ['language' => ConfigurableLanguage::load($langcode)]);
$edit = ['content_translation[status]' => FALSE];
$this->drupalPostForm($url, $edit, $this->getFormSubmitAction($entity, $langcode));
$this->drupalGet($url);
$this->submitForm($edit, $this->getFormSubmitAction($entity, $langcode));
$storage = $this->container->get('entity_type.manager')
->getStorage($this->entityTypeId);
$storage->resetCache([$this->entityId]);
@ -330,7 +336,8 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
'content_translation[created]' => $this->container->get('date.formatter')->format($values[$langcode]['created'], 'custom', 'Y-m-d H:i:s O'),
];
$url = $entity->toUrl('edit-form', ['language' => ConfigurableLanguage::load($langcode)]);
$this->drupalPostForm($url, $edit, $this->getFormSubmitAction($entity, $langcode));
$this->drupalGet($url);
$this->submitForm($edit, $this->getFormSubmitAction($entity, $langcode));
}
$storage = $this->container->get('entity_type.manager')
@ -350,7 +357,8 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
'content_translation[uid]' => $this->randomMachineName(12),
'content_translation[created]' => '19/11/1978',
];
$this->drupalPostForm($entity->toUrl('edit-form'), $edit, $this->getFormSubmitAction($entity, $langcode));
$this->drupalGet($entity->toUrl('edit-form'));
$this->submitForm($edit, $this->getFormSubmitAction($entity, $langcode));
$this->assertSession()->elementExists('xpath', '//div[contains(@class, "error")]//ul');
$metadata = $this->manager->getTranslationMetadata($entity->getTranslation($langcode));
$this->assertEquals($values[$langcode]['uid'], $metadata->getAuthor()->id(), 'Translation author correctly kept.');
@ -370,7 +378,8 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
$entity = $storage->load($this->entityId);
$language = ConfigurableLanguage::load($langcode);
$url = $entity->toUrl('edit-form', ['language' => $language]);
$this->drupalPostForm($url, [], 'Delete translation');
$this->drupalGet($url);
$this->submitForm([], 'Delete translation');
$this->submitForm([], 'Delete ' . $language->getName() . ' translation');
$storage->resetCache([$this->entityId]);
$entity = $storage->load($this->entityId, TRUE);
@ -559,7 +568,8 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
$this->fieldName . '[0][value]' => $this->randomString(),
];
$edit_path = $entity->toUrl('edit-form', ['language' => $language]);
$this->drupalPostForm($edit_path, $edit, $this->getFormSubmitAction($entity, $langcode));
$this->drupalGet($edit_path);
$this->submitForm($edit, $this->getFormSubmitAction($entity, $langcode));
$storage = $this->container->get('entity_type.manager')
->getStorage($this->entityTypeId);
@ -613,7 +623,8 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
// Save the entity on the regular edit form.
$language = $entity->language();
$edit_path = $entity->toUrl('edit-form', ['language' => $language]);
$this->drupalPostForm($edit_path, [], $this->getFormSubmitAction($entity, $language->getId()));
$this->drupalGet($edit_path);
$this->submitForm([], $this->getFormSubmitAction($entity, $language->getId()));
$storage->resetCache([$this->entityId]);
$entity = $storage->load($this->entityId);

View File

@ -35,7 +35,8 @@ class ContentTranslationUntranslatableFieldsTest extends ContentTranslationPendi
$edit = [
'settings[' . $this->entityTypeId . '][' . $this->bundle . '][fields][' . $this->fieldName . ']' => 0,
];
$this->drupalPostForm('admin/config/regional/content-language', $edit, 'Save configuration');
$this->drupalGet('admin/config/regional/content-language');
$this->submitForm($edit, 'Save configuration');
/** @var \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager */
$entity_field_manager = $this->container->get('entity_field.manager');
@ -120,7 +121,8 @@ class ContentTranslationUntranslatableFieldsTest extends ContentTranslationPendi
// language edit forms.
$settings_key = 'settings[' . $this->entityTypeId . '][' . $this->bundle . '][settings][content_translation][untranslatable_fields_hide]';
$settings_url = 'admin/config/regional/content-language';
$this->drupalPostForm($settings_url, [$settings_key => 1], 'Save configuration');
$this->drupalGet($settings_url);
$this->submitForm([$settings_key => 1], 'Save configuration');
// Verify that the widget is displayed in the default language edit form,
// but no clue is displayed.
@ -145,7 +147,8 @@ class ContentTranslationUntranslatableFieldsTest extends ContentTranslationPendi
// Configure untranslatable field widgets to be displayed on non-default
// language edit forms.
$this->drupalPostForm($settings_url, [$settings_key => 0], 'Save configuration');
$this->drupalGet($settings_url);
$this->submitForm([$settings_key => 0], 'Save configuration');
// Check that the widget is displayed along with its clue in the edit form
// for both languages.

View File

@ -172,7 +172,8 @@ class ContentTranslationWorkflowsTest extends ContentTranslationTestBase {
'name[0][value]' => 'translation name',
'content_translation[status]' => FALSE,
];
$this->drupalPostForm($add_translation_url, $edit, 'Save');
$this->drupalGet($add_translation_url);
$this->submitForm($edit, 'Save');
$storage->resetCache([$id]);
$this->entity = $storage->load($id);

View File

@ -99,8 +99,10 @@ class DateFilterTest extends ViewTestBase {
$edit = [];
$edit['options[operator]'] = '>';
$edit['options[expose][operator_list][]'] = ['>', '>=', 'between'];
$this->drupalPostForm('admin/structure/views/nojs/handler/test_exposed_filter_datetime/default/filter/field_date_value', $edit, 'Apply');
$this->drupalPostForm('admin/structure/views/view/test_exposed_filter_datetime/edit/default', [], 'Save');
$this->drupalGet('admin/structure/views/nojs/handler/test_exposed_filter_datetime/default/filter/field_date_value');
$this->submitForm($edit, 'Apply');
$this->drupalGet('admin/structure/views/view/test_exposed_filter_datetime/edit/default');
$this->submitForm([], 'Save');
$this->drupalGet('test_exposed_filter_datetime');
$this->assertSession()->statusCodeEquals(200);
@ -118,7 +120,8 @@ class DateFilterTest extends ViewTestBase {
$edit = [];
$edit['options[operator]'] = '=';
$edit['options[expose][operator_list][]'] = ['<', '>'];
$this->drupalPostForm('admin/structure/views/nojs/handler/test_exposed_filter_datetime/default/filter/field_date_value', $edit, 'Apply');
$this->drupalGet('admin/structure/views/nojs/handler/test_exposed_filter_datetime/default/filter/field_date_value');
$this->submitForm($edit, 'Apply');
$this->assertSession()->pageTextContains('You selected the "Is equal to" operator as the default value but is not included in the list of limited operators.');
}

View File

@ -700,7 +700,8 @@ class DateTimeFieldTest extends DateTestBase {
$field_edit = [
'default_value_input[default_date_type]' => 'now',
];
$this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings');
$this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name);
$this->submitForm($field_edit, 'Save settings');
// Check that default value is selected in default value form.
$this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name);
@ -726,7 +727,8 @@ class DateTimeFieldTest extends DateTestBase {
'default_value_input[default_date_type]' => 'relative',
'default_value_input[default_date]' => 'invalid date',
];
$this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings');
$this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name);
$this->submitForm($field_edit, 'Save settings');
$this->assertSession()->pageTextContains('The relative date value entered is invalid.');
@ -735,7 +737,8 @@ class DateTimeFieldTest extends DateTestBase {
'default_value_input[default_date_type]' => 'relative',
'default_value_input[default_date]' => '+90 days',
];
$this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings');
$this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name);
$this->submitForm($field_edit, 'Save settings');
// Check that default value is selected in default value form.
$this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name);
@ -761,7 +764,8 @@ class DateTimeFieldTest extends DateTestBase {
$field_edit = [
'default_value_input[default_date_type]' => '',
];
$this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings');
$this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name);
$this->submitForm($field_edit, 'Save settings');
// Check that default value is selected in default value form.
$this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name);
@ -911,7 +915,8 @@ class DateTimeFieldTest extends DateTestBase {
'body[0][value]' => $this->randomString(),
$field_name . '[0][value][date]' => '2016-04-01',
];
$this->drupalPostForm('node/add/date_content', $edit, 'Save');
$this->drupalGet('node/add/date_content');
$this->submitForm($edit, 'Save');
$this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name . '/storage');
$result = $this->xpath("//*[@id='edit-settings-datetime-type' and contains(@disabled, 'disabled')]");
$this->assertCount(1, $result, "Changing datetime setting is disabled.");

View File

@ -117,7 +117,8 @@ class FilterDateTest extends BrowserTestBase {
*/
public function testExposedGroupedFilters() {
// Expose the empty and not empty operators in a grouped filter.
$this->drupalPostForm('admin/structure/views/nojs/handler/test_filter_datetime/default/filter/' . $this->fieldName . '_value', [], 'Expose filter');
$this->drupalGet('admin/structure/views/nojs/handler/test_filter_datetime/default/filter/' . $this->fieldName . '_value');
$this->submitForm([], 'Expose filter');
$this->submitForm([], 'Grouped filters');
$edit = [];
@ -130,8 +131,10 @@ class FilterDateTest extends BrowserTestBase {
// Test that the exposed filter works as expected.
$path = 'test_filter_datetime-path';
$this->drupalPostForm('admin/structure/views/view/test_filter_datetime/edit', [], 'Add Page');
$this->drupalPostForm('admin/structure/views/nojs/display/test_filter_datetime/page_1/path', ['path' => $path], 'Apply');
$this->drupalGet('admin/structure/views/view/test_filter_datetime/edit');
$this->submitForm([], 'Add Page');
$this->drupalGet('admin/structure/views/nojs/display/test_filter_datetime/page_1/path');
$this->submitForm(['path' => $path], 'Apply');
$this->submitForm([], 'Save');
$this->drupalGet($path);

View File

@ -1020,7 +1020,8 @@ class DateRangeFieldTest extends DateTestBase {
'default_value_input[default_date_type]' => 'now',
'default_value_input[default_end_date_type]' => 'now',
];
$this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings');
$this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name);
$this->submitForm($field_edit, 'Save settings');
// Check that default value is selected in default value form.
$this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name);
@ -1051,7 +1052,8 @@ class DateRangeFieldTest extends DateTestBase {
'default_value_input[default_end_date_type]' => 'relative',
'default_value_input[default_end_date]' => '+1 day',
];
$this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings');
$this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name);
$this->submitForm($field_edit, 'Save settings');
$this->assertSession()->pageTextContains('The relative start date value entered is invalid.');
$field_edit = [
@ -1060,7 +1062,8 @@ class DateRangeFieldTest extends DateTestBase {
'default_value_input[default_end_date_type]' => 'relative',
'default_value_input[default_end_date]' => 'invalid date',
];
$this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings');
$this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name);
$this->submitForm($field_edit, 'Save settings');
$this->assertSession()->pageTextContains('The relative end date value entered is invalid.');
// Set a relative default_value.
@ -1070,7 +1073,8 @@ class DateRangeFieldTest extends DateTestBase {
'default_value_input[default_end_date_type]' => 'relative',
'default_value_input[default_end_date]' => '+90 days',
];
$this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings');
$this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name);
$this->submitForm($field_edit, 'Save settings');
// Check that default value is selected in default value form.
$this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name);
@ -1100,7 +1104,8 @@ class DateRangeFieldTest extends DateTestBase {
'default_value_input[default_date_type]' => '',
'default_value_input[default_end_date_type]' => '',
];
$this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings');
$this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name);
$this->submitForm($field_edit, 'Save settings');
// Check that default value is selected in default value form.
$this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name);
@ -1136,7 +1141,8 @@ class DateRangeFieldTest extends DateTestBase {
'default_value_input[default_date_type]' => 'now',
'default_value_input[default_end_date_type]' => '',
];
$this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings');
$this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name);
$this->submitForm($field_edit, 'Save settings');
// Make sure only the start value is populated on node add page.
$this->drupalGet('node/add/date_content');
@ -1148,7 +1154,8 @@ class DateRangeFieldTest extends DateTestBase {
'default_value_input[default_date_type]' => '',
'default_value_input[default_end_date_type]' => 'now',
];
$this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings');
$this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name);
$this->submitForm($field_edit, 'Save settings');
// Make sure only the start value is populated on node add page.
$this->drupalGet('node/add/date_content');
@ -1406,7 +1413,8 @@ class DateRangeFieldTest extends DateTestBase {
$field_name . '[0][value][date]' => '2016-04-01',
$field_name . '[0][end_value][date]' => '2016-04-02',
];
$this->drupalPostForm('node/add/date_content', $edit, 'Save');
$this->drupalGet('node/add/date_content');
$this->submitForm($edit, 'Save');
$this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name . '/storage');
$result = $this->xpath("//*[@id='edit-settings-datetime-type' and contains(@disabled, 'disabled')]");
$this->assertCount(1, $result, "Changing datetime setting is disabled.");

View File

@ -255,7 +255,8 @@ class DbLogTest extends BrowserTestBase {
// Change the database log row limit.
$edit = [];
$edit['dblog_row_limit'] = $row_limit;
$this->drupalPostForm('admin/config/development/logging', $edit, 'Save configuration');
$this->drupalGet('admin/config/development/logging');
$this->submitForm($edit, 'Save configuration');
$this->assertSession()->statusCodeEquals(200);
// Check row limit variable.
@ -419,7 +420,8 @@ class DbLogTest extends BrowserTestBase {
$edit['pass[pass1]'] = $pass;
$edit['pass[pass2]'] = $pass;
$edit['status'] = 1;
$this->drupalPostForm('admin/people/create', $edit, 'Create new account');
$this->drupalGet('admin/people/create');
$this->submitForm($edit, 'Create new account');
$this->assertSession()->statusCodeEquals(200);
// Retrieve the user object.
$user = user_load_by_name($name);
@ -442,7 +444,8 @@ class DbLogTest extends BrowserTestBase {
$this->drupalLogin($this->adminUser);
// Delete the user created at the start of this test.
// We need to POST here to invoke batch_process() in the internal browser.
$this->drupalPostForm('user/' . $user->id() . '/cancel', ['user_cancel_method' => 'user_cancel_reassign'], 'Cancel account');
$this->drupalGet('user/' . $user->id() . '/cancel');
$this->submitForm(['user_cancel_method' => 'user_cancel_reassign'], 'Cancel account');
// View the database log report.
$this->drupalGet('admin/reports/dblog');
@ -502,17 +505,20 @@ class DbLogTest extends BrowserTestBase {
// (which is not triggered by drupalCreateNode).
$edit = $this->getContent($type);
$title = $edit['title[0][value]'];
$this->drupalPostForm('node/add/' . $type, $edit, 'Save');
$this->drupalGet('node/add/' . $type);
$this->submitForm($edit, 'Save');
$this->assertSession()->statusCodeEquals(200);
// Retrieve the node object.
$node = $this->drupalGetNodeByTitle($title);
$this->assertNotNull($node, new FormattableMarkup('Node @title was loaded', ['@title' => $title]));
// Edit the node.
$edit = $this->getContentUpdate($type);
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save');
$this->drupalGet('node/' . $node->id() . '/edit');
$this->submitForm($edit, 'Save');
$this->assertSession()->statusCodeEquals(200);
// Delete the node.
$this->drupalPostForm('node/' . $node->id() . '/delete', [], 'Delete');
$this->drupalGet('node/' . $node->id() . '/delete');
$this->submitForm([], 'Delete');
$this->assertSession()->statusCodeEquals(200);
// View the node (to generate page not found event).
$this->drupalGet('node/' . $node->id());

View File

@ -203,7 +203,8 @@ class EditorUploadImageScaleTest extends BrowserTestBase {
'files[fid]' => \Drupal::service('file_system')->realpath($uri),
];
$this->drupalGet('editor/dialog/image/basic_html');
$this->drupalPostForm('editor/dialog/image/basic_html', $edit, 'Upload');
$this->drupalGet('editor/dialog/image/basic_html');
$this->submitForm($edit, 'Upload');
$uploaded_image_file = $this->container->get('image.factory')->get('public://inline-images/' . basename($uri));
return [
(int) $uploaded_image_file->getWidth(),

View File

@ -144,7 +144,8 @@ class BooleanFieldTest extends BrowserTestBase {
$edit = [
'settings[on_label]' => $on,
];
$this->drupalPostForm('entity_test/structure/entity_test/fields/entity_test.entity_test.' . $field_name, $edit, 'Save settings');
$this->drupalGet('entity_test/structure/entity_test/fields/entity_test.entity_test.' . $field_name);
$this->submitForm($edit, 'Save settings');
// Check if we see the updated labels in the creation form.
$this->drupalGet('entity_test/add');
$this->assertRaw($on);

View File

@ -90,7 +90,8 @@ class EntityReferenceAdminTest extends BrowserTestBase {
'page[style][style_plugin]' => 'default',
'page[style][row_plugin]' => 'fields',
];
$this->drupalPostForm('admin/structure/views/add', $edit, 'Save and edit');
$this->drupalGet('admin/structure/views/add');
$this->submitForm($edit, 'Save and edit');
$this->submitForm([], 'Duplicate as Entity Reference');
$this->clickLink(t('Settings'));
$edit = [
@ -102,10 +103,12 @@ class EntityReferenceAdminTest extends BrowserTestBase {
$edit = [
'name[node_field_data.nid]' => 1,
];
$this->drupalPostForm('admin/structure/views/nojs/add-handler/node_test_view/entity_reference_1/sort', $edit, 'Add and configure sort criteria');
$this->drupalGet('admin/structure/views/nojs/add-handler/node_test_view/entity_reference_1/sort');
$this->submitForm($edit, 'Add and configure sort criteria');
$this->submitForm([], 'Apply');
$this->drupalPostForm('admin/structure/views/view/node_test_view/edit/entity_reference_1', [], 'Save');
$this->drupalGet('admin/structure/views/view/node_test_view/edit/entity_reference_1');
$this->submitForm([], 'Save');
$this->clickLink(t('Settings'));
// Create a test entity reference field.
@ -115,7 +118,8 @@ class EntityReferenceAdminTest extends BrowserTestBase {
'label' => 'Test Entity Reference Field',
'field_name' => $field_name,
];
$this->drupalPostForm($bundle_path . '/fields/add-field', $edit, 'Save and continue');
$this->drupalGet($bundle_path . '/fields/add-field');
$this->submitForm($edit, 'Save and continue');
// Set to unlimited.
$edit = [
@ -157,7 +161,8 @@ class EntityReferenceAdminTest extends BrowserTestBase {
// Try to add a new node, fill the entity reference field and submit the
// form.
$this->drupalPostForm('node/add/' . $this->type, [], 'Add another item');
$this->drupalGet('node/add/' . $this->type);
$this->submitForm([], 'Add another item');
$edit = [
'title[0][value]' => 'Example',
'field_test_entity_ref_field[0][target_id]' => 'Foo Node (' . $node1->id() . ')',
@ -170,7 +175,8 @@ class EntityReferenceAdminTest extends BrowserTestBase {
'title[0][value]' => 'Example',
'field_test_entity_ref_field[0][target_id]' => 'Test',
];
$this->drupalPostForm('node/add/' . $this->type, $edit, 'Save');
$this->drupalGet('node/add/' . $this->type);
$this->submitForm($edit, 'Save');
// Assert that entity reference autocomplete field is validated.
$this->assertSession()->pageTextContains('There are no content items matching "Test"');
@ -179,7 +185,8 @@ class EntityReferenceAdminTest extends BrowserTestBase {
'title[0][value]' => 'Test',
'field_test_entity_ref_field[0][target_id]' => $node1->getTitle(),
];
$this->drupalPostForm('node/add/' . $this->type, $edit, 'Save');
$this->drupalGet('node/add/' . $this->type);
$this->submitForm($edit, 'Save');
// Assert the results multiple times to avoid sorting problem of nodes with
// the same title.
@ -192,7 +199,8 @@ class EntityReferenceAdminTest extends BrowserTestBase {
'title[0][value]' => 'Test',
'field_test_entity_ref_field[0][target_id]' => $node1->getTitle() . ' (' . $node1->id() . ')',
];
$this->drupalPostForm('node/add/' . $this->type, $edit, 'Save');
$this->drupalGet('node/add/' . $this->type);
$this->submitForm($edit, 'Save');
$this->assertSession()->linkExists($node1->getTitle());
// Tests adding default values to autocomplete widgets.
@ -321,7 +329,8 @@ class EntityReferenceAdminTest extends BrowserTestBase {
'settings[handler_settings][target_bundles][' . $vocabularies[1]->id() . ']' => TRUE,
];
// Enable the second vocabulary as a target bundle.
$this->drupalPostForm($path, $edit, 'Save settings');
$this->drupalGet($path);
$this->submitForm($edit, 'Save settings');
$this->drupalGet($path);
// Expect a select element with the two vocabularies as options.
$this->assertSession()->optionExists('settings[handler_settings][auto_create_bundle]', $vocabularies[0]->id());

View File

@ -124,7 +124,8 @@ class EntityReferenceAutoCreateTest extends BrowserTestBase {
'title[0][value]' => $this->randomMachineName(),
'test_field[0][target_id]' => $new_title,
];
$this->drupalPostForm("node/add/$this->referencingType", $edit, 'Save');
$this->drupalGet("node/add/{$this->referencingType}");
$this->submitForm($edit, 'Save');
// Assert referenced node was created.
$query = clone $base_query;
@ -190,7 +191,8 @@ class EntityReferenceAutoCreateTest extends BrowserTestBase {
'title[0][value]' => $this->randomString(),
];
$this->drupalPostForm('node/add/' . $this->referencingType, $edit, 'Save');
$this->drupalGet('node/add/' . $this->referencingType);
$this->submitForm($edit, 'Save');
/** @var \Drupal\taxonomy\Entity\Term $term */
$term = taxonomy_term_load_multiple_by_name($term_name);
$term = reset($term);
@ -214,7 +216,8 @@ class EntityReferenceAutoCreateTest extends BrowserTestBase {
'title[0][value]' => $this->randomString(),
];
$this->drupalPostForm('node/add/' . $this->referencingType, $edit, 'Save');
$this->drupalGet('node/add/' . $this->referencingType);
$this->submitForm($edit, 'Save');
/** @var \Drupal\taxonomy\Entity\Term $term */
$term = taxonomy_term_load_multiple_by_name($term_name);
$term = reset($term);
@ -267,7 +270,8 @@ class EntityReferenceAutoCreateTest extends BrowserTestBase {
'title[0][value]' => $node_title,
];
$this->drupalPostForm('node/add/' . $this->referencingType, $edit, 'Save');
$this->drupalGet('node/add/' . $this->referencingType);
$this->submitForm($edit, 'Save');
// Assert referenced entity was created.
$result = \Drupal::entityQuery('entity_test_no_bundle_with_label')

View File

@ -86,7 +86,8 @@ class EntityReferenceFieldDefaultValueTest extends BrowserTestBase {
$field_edit = [
'default_value_input[' . $field_name . '][0][target_id]' => $referenced_node->getTitle() . ' (' . $referenced_node->id() . ')',
];
$this->drupalPostForm('admin/structure/types/manage/reference_content/fields/node.reference_content.' . $field_name, $field_edit, 'Save settings');
$this->drupalGet('admin/structure/types/manage/reference_content/fields/node.reference_content.' . $field_name);
$this->submitForm($field_edit, 'Save settings');
// Check that default value is selected in default value form.
$this->drupalGet('admin/structure/types/manage/reference_content/fields/node.reference_content.' . $field_name);
@ -150,7 +151,8 @@ class EntityReferenceFieldDefaultValueTest extends BrowserTestBase {
'default_value_input[' . $field_name . '][0][target_id]' => $referenced_node_type->label() . ' (' . $referenced_node_type->id() . ')',
'default_value_input[' . $field_name . '][1][target_id]' => $referenced_node_type2->label() . ' (' . $referenced_node_type2->id() . ')',
];
$this->drupalPostForm('admin/structure/types/manage/reference_content/fields/node.reference_content.' . $field_name, $field_edit, 'Save settings');
$this->drupalGet('admin/structure/types/manage/reference_content/fields/node.reference_content.' . $field_name);
$this->submitForm($field_edit, 'Save settings');
// Check that the field has a dependency on the default value.
$config_entity = $this->config('field.field.node.reference_content.' . $field_name)->get();

View File

@ -163,7 +163,8 @@ class EntityReferenceFieldTranslatedReferenceViewTest extends BrowserTestBase {
// Disable translation for referrer content type.
$this->drupalLogin($this->rootUser);
$this->drupalPostForm('admin/config/regional/content-language', ['settings[node][referrer][translatable]' => FALSE], 'Save configuration');
$this->drupalGet('admin/config/regional/content-language');
$this->submitForm(['settings[node][referrer][translatable]' => FALSE], 'Save configuration');
$this->drupalLogout();
// Create a referrer entity without translation.

View File

@ -129,7 +129,8 @@ class EntityReferenceFileUploadTest extends BrowserTestBase {
$test_file = current($this->getTestFiles('text'));
$edit['files[file_field_0]'] = \Drupal::service('file_system')->realpath($test_file->uri);
$this->drupalPostForm('node/add/' . $this->referencingType, $edit, 'Upload');
$this->drupalGet('node/add/' . $this->referencingType);
$this->submitForm($edit, 'Upload');
$this->assertSession()->statusCodeEquals(200);
$edit = [
'title[0][value]' => $this->randomMachineName(),

Some files were not shown because too many files have changed in this diff Show More