Commit d009cac0 authored by webchick's avatar webchick

Issue #2074037 by Wim Leers, effulgentsia: Add drupalPostUrl() —...

Issue #2074037 by Wim Leers, effulgentsia: Add drupalPostUrl() — drupalPost()/drupalPostAjax() are for forms only, D8 JS performs non-form HTTP requests.
parent e05902e5
......@@ -60,7 +60,7 @@ public function testBulkForm() {
// Set all nodes to sticky and check that.
$edit += array('action' => 'node_make_sticky_action');
$this->drupalPost(NULL, $edit, t('Apply'));
$this->drupalPostForm(NULL, $edit, t('Apply'));
foreach ($nodes as $node) {
$changed_node = node_load($node->id());
......@@ -74,7 +74,7 @@ public function testBulkForm() {
$this->assertTrue($node->isPublished(), 'The node is published.');
$edit = array('action_bulk_form[0]' => TRUE, 'action' => 'node_unpublish_action');
$this->drupalPost(NULL, $edit, t('Apply'));
$this->drupalPostForm(NULL, $edit, t('Apply'));
$this->assertText('Unpublish content was applied to 1 item.');
......
......@@ -41,7 +41,7 @@ function testActionConfiguration() {
// Make a POST request to admin/config/system/actions.
$edit = array();
$edit['action'] = Crypt::hashBase64('action_goto_action');
$this->drupalPost('admin/config/system/actions', $edit, t('Create'));
$this->drupalPostForm('admin/config/system/actions', $edit, t('Create'));
$this->assertResponse(200);
// Make a POST request to the individual action configuration page.
......@@ -50,7 +50,7 @@ function testActionConfiguration() {
$edit['label'] = $action_label;
$edit['id'] = strtolower($action_label);
$edit['url'] = 'admin';
$this->drupalPost('admin/config/system/actions/add/' . Crypt::hashBase64('action_goto_action'), $edit, t('Save'));
$this->drupalPostForm('admin/config/system/actions/add/' . Crypt::hashBase64('action_goto_action'), $edit, t('Save'));
$this->assertResponse(200);
// Make sure that the new complex action was saved properly.
......@@ -65,7 +65,7 @@ function testActionConfiguration() {
$new_action_label = $this->randomName();
$edit['label'] = $new_action_label;
$edit['url'] = 'admin';
$this->drupalPost(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->assertResponse(200);
// Make sure that the action updated properly.
......@@ -82,7 +82,7 @@ function testActionConfiguration() {
$this->clickLink(t('Delete'));
$this->assertResponse(200);
$edit = array();
$this->drupalPost("admin/config/system/actions/configure/$aid/delete", $edit, t('Delete'));
$this->drupalPostForm("admin/config/system/actions/configure/$aid/delete", $edit, t('Delete'));
$this->assertResponse(200);
// Make sure that the action was actually deleted.
......
......@@ -40,7 +40,7 @@ function testSettingsPage() {
'aggregator_parser' => 'aggregator_test_parser',
'aggregator_processors[aggregator_test_processor]' => 'aggregator_test_processor',
);
$this->drupalPost('admin/config/services/aggregator/settings', $edit, t('Save configuration'));
$this->drupalPostForm('admin/config/services/aggregator/settings', $edit, t('Save configuration'));
$this->assertText(t('The configuration options have been saved.'));
foreach ($edit as $name => $value) {
......@@ -53,7 +53,7 @@ function testSettingsPage() {
$edit = array(
'dummy_length' => 100,
);
$this->drupalPost('admin/config/services/aggregator/settings', $edit, t('Save configuration'));
$this->drupalPostForm('admin/config/services/aggregator/settings', $edit, t('Save configuration'));
$this->assertText(t('The configuration options have been saved.'));
$this->assertFieldByName('dummy_length', 100, '"dummy_length" has correct default value.');
......
......@@ -54,7 +54,7 @@ function setUp() {
*/
function createFeed($feed_url = NULL, array $edit = array()) {
$edit = $this->getFeedEditArray($feed_url, $edit);
$this->drupalPost('admin/config/services/aggregator/add/feed', $edit, t('Save'));
$this->drupalPostForm('admin/config/services/aggregator/add/feed', $edit, t('Save'));
$this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title'])), format_string('The feed !name has been added.', array('!name' => $edit['title'])));
$fid = db_query("SELECT fid FROM {aggregator_feed} WHERE title = :title AND url = :url", array(':title' => $edit['title'], ':url' => $edit['url']))->fetchField();
......@@ -69,7 +69,7 @@ function createFeed($feed_url = NULL, array $edit = array()) {
* Feed object representing the feed.
*/
function deleteFeed(Feed $feed) {
$this->drupalPost('admin/config/services/aggregator/delete/feed/' . $feed->id(), array(), t('Delete'));
$this->drupalPostForm('admin/config/services/aggregator/delete/feed/' . $feed->id(), array(), t('Delete'));
$this->assertRaw(t('The feed %title has been deleted.', array('%title' => $feed->label())), 'Feed deleted successfully.');
}
......@@ -186,7 +186,7 @@ function updateFeedItems(Feed $feed, $expected_count = NULL) {
* Feed object representing the feed.
*/
function removeFeedItems(Feed $feed) {
$this->drupalPost('admin/config/services/aggregator/remove/' . $feed->id(), array(), t('Remove items'));
$this->drupalPostForm('admin/config/services/aggregator/remove/' . $feed->id(), array(), t('Remove items'));
$this->assertRaw(t('The news items from %title have been removed.', array('%title' => $feed->label())), 'Feed items removed.');
}
......@@ -362,7 +362,7 @@ function createSampleNodes($count = 5) {
$edit = array();
$edit['title'] = $this->randomName();
$edit["body[$langcode][0][value]"] = $this->randomName();
$this->drupalPost('node/add/article', $edit, t('Save'));
$this->drupalPostForm('node/add/article', $edit, t('Save'));
}
}
......
......@@ -30,7 +30,7 @@ function testCategorizeFeedItem() {
// Simulate form submission on "admin/config/services/aggregator/add/category".
$edit = array('title' => $this->randomName(10), 'description' => '');
$this->drupalPost('admin/config/services/aggregator/add/category', $edit, t('Save'));
$this->drupalPostForm('admin/config/services/aggregator/add/category', $edit, t('Save'));
$this->assertRaw(t('The category %title has been added.', array('%title' => $edit['title'])), format_string('The category %title has been added.', array('%title' => $edit['title'])));
$category = db_query("SELECT * FROM {aggregator_category} WHERE title = :title", array(':title' => $edit['title']))->fetch();
......
......@@ -26,11 +26,11 @@ function testCategorizeFeed() {
// Create 2 categories.
$category_1 = array('title' => $this->randomName(10), 'description' => '');
$this->drupalPost('admin/config/services/aggregator/add/category', $category_1, t('Save'));
$this->drupalPostForm('admin/config/services/aggregator/add/category', $category_1, t('Save'));
$this->assertRaw(t('The category %title has been added.', array('%title' => $category_1['title'])), format_string('The category %title has been added.', array('%title' => $category_1['title'])));
$category_2 = array('title' => $this->randomName(10), 'description' => '');
$this->drupalPost('admin/config/services/aggregator/add/category', $category_2, t('Save'));
$this->drupalPostForm('admin/config/services/aggregator/add/category', $category_2, t('Save'));
$this->assertRaw(t('The category %title has been added.', array('%title' => $category_2['title'])), format_string('The category %title has been added.', array('%title' => $category_2['title'])));
// Get categories from database.
......
......@@ -66,7 +66,7 @@ function validateImportFormFields() {
$before = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField();
$edit = array();
$this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import'));
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import'));
$this->assertRaw(t('You must <em>either</em> upload a file or enter a URL.'), 'Error if no fields are filled.');
$path = $this->getEmptyOpml();
......@@ -74,11 +74,11 @@ function validateImportFormFields() {
'files[upload]' => $path,
'remote' => file_create_url($path),
);
$this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import'));
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import'));
$this->assertRaw(t('You must <em>either</em> upload a file or enter a URL.'), 'Error if both fields are filled.');
$edit = array('remote' => 'invalidUrl://empty');
$this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import'));
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import'));
$this->assertText(t('The URL invalidUrl://empty is not valid.'), 'Error if the URL is invalid.');
$after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField();
......@@ -92,11 +92,11 @@ function submitImportForm() {
$before = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField();
$form['files[upload]'] = $this->getInvalidOpml();
$this->drupalPost('admin/config/services/aggregator/add/opml', $form, t('Import'));
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $form, t('Import'));
$this->assertText(t('No new feed has been added.'), 'Attempting to upload invalid XML.');
$edit = array('remote' => file_create_url($this->getEmptyOpml()));
$this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import'));
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import'));
$this->assertText(t('No new feed has been added.'), 'Attempting to load empty OPML from remote URL.');
$after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField();
......@@ -123,7 +123,7 @@ function submitImportForm() {
'refresh' => '900',
'category[1]' => $category,
);
$this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import'));
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import'));
$this->assertRaw(t('A feed with the URL %url already exists.', array('%url' => $feeds[0]['url'])), 'Verifying that a duplicate URL was identified');
$this->assertRaw(t('A feed named %title already exists.', array('%title' => $feeds[1]['title'])), 'Verifying that a duplicate title was identified');
......
......@@ -44,7 +44,7 @@ function testUpdateFeedItem() {
$this->drupalGet($edit['url']);
$this->assertResponse(array(200), format_string('URL !url is accessible', array('!url' => $edit['url'])));
$this->drupalPost('admin/config/services/aggregator/add/feed', $edit, t('Save'));
$this->drupalPostForm('admin/config/services/aggregator/add/feed', $edit, t('Save'));
$this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title'])), format_string('The feed !name has been added.', array('!name' => $edit['title'])));
$fid = db_query("SELECT fid FROM {aggregator_feed} WHERE url = :url", array(':url' => $edit['url']))->fetchField();
......
......@@ -33,7 +33,7 @@ function testUpdateFeed() {
if (isset($feed->{$same_field}->value)) {
$edit[$same_field] = $feed->{$same_field}->value;
}
$this->drupalPost('admin/config/services/aggregator/edit/feed/' . $feed->id(), $edit, t('Save'));
$this->drupalPostForm('admin/config/services/aggregator/edit/feed/' . $feed->id(), $edit, t('Save'));
$this->assertRaw(t('The feed %name has been updated.', array('%name' => $edit['title'])), format_string('The feed %name has been updated.', array('%name' => $edit['title'])));
// Check feed data.
......
......@@ -38,7 +38,7 @@ function testIPAddressValidation() {
// Ban a valid IP address.
$edit = array();
$edit['ip'] = '192.168.1.1';
$this->drupalPost('admin/config/people/ban', $edit, t('Add'));
$this->drupalPostForm('admin/config/people/ban', $edit, t('Add'));
$ip = db_query("SELECT iid from {ban_ip} WHERE ip = :ip", array(':ip' => $edit['ip']))->fetchField();
$this->assertTrue($ip, 'IP address found in database.');
$this->assertRaw(t('The IP address %ip has been banned.', array('%ip' => $edit['ip'])), 'IP address was banned.');
......@@ -46,30 +46,30 @@ function testIPAddressValidation() {
// Try to block an IP address that's already blocked.
$edit = array();
$edit['ip'] = '192.168.1.1';
$this->drupalPost('admin/config/people/ban', $edit, t('Add'));
$this->drupalPostForm('admin/config/people/ban', $edit, t('Add'));
$this->assertText(t('This IP address is already banned.'));
// Try to block a reserved IP address.
$edit = array();
$edit['ip'] = '255.255.255.255';
$this->drupalPost('admin/config/people/ban', $edit, t('Add'));
$this->drupalPostForm('admin/config/people/ban', $edit, t('Add'));
$this->assertText(t('Enter a valid IP address.'));
// Try to block a reserved IP address.
$edit = array();
$edit['ip'] = 'test.example.com';
$this->drupalPost('admin/config/people/ban', $edit, t('Add'));
$this->drupalPostForm('admin/config/people/ban', $edit, t('Add'));
$this->assertText(t('Enter a valid IP address.'));
// Submit an empty form.
$edit = array();
$edit['ip'] = '';
$this->drupalPost('admin/config/people/ban', $edit, t('Add'));
$this->drupalPostForm('admin/config/people/ban', $edit, t('Add'));
$this->assertText(t('Enter a valid IP address.'));
// Pass an IP address as a URL parameter and submit it.
$submit_ip = '1.2.3.4';
$this->drupalPost('admin/config/people/ban/' . $submit_ip, NULL, t('Add'));
$this->drupalPostForm('admin/config/people/ban/' . $submit_ip, NULL, t('Add'));
$ip = db_query("SELECT iid from {ban_ip} WHERE ip = :ip", array(':ip' => $submit_ip))->fetchField();
$this->assertTrue($ip, 'IP address found in database');
$this->assertRaw(t('The IP address %ip has been banned.', array('%ip' => $submit_ip)), 'IP address was banned.');
......@@ -79,7 +79,7 @@ function testIPAddressValidation() {
// TODO: On some systems this test fails due to a bug/inconsistency in cURL.
// $edit = array();
// $edit['ip'] = \Drupal::request()->getClientIP();
// $this->drupalPost('admin/config/people/ban', $edit, t('Save'));
// $this->drupalPostForm('admin/config/people/ban', $edit, t('Save'));
// $this->assertText(t('You may not ban your own IP address.'));
}
}
......@@ -52,7 +52,7 @@ public function testCustomBlockCreation() {
$langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit['info'] = $this->randomName(8);
$edit["block_body[$langcode][0][value]"] = $this->randomName(16);
$this->drupalPost('block/add/basic', $edit, t('Save'));
$this->drupalPostForm('block/add/basic', $edit, t('Save'));
// Check that the Basic block has been created.
$this->assertRaw(format_string('!block %name has been created.', array(
......@@ -67,7 +67,7 @@ public function testCustomBlockCreation() {
// Check that attempting to create another block with the same value for
// 'info' returns an error.
$this->drupalPost('block/add/basic', $edit, t('Save'));
$this->drupalPostForm('block/add/basic', $edit, t('Save'));
// Check that the Basic block has been created.
$this->assertRaw(format_string('A block with description %name already exists.', array(
......@@ -88,7 +88,7 @@ public function testDefaultCustomBlockCreation() {
$edit['info'] = $this->randomName(8);
$edit["block_body[$langcode][0][value]"] = $this->randomName(16);
// Don't pass the custom block type in the url so the default is forced.
$this->drupalPost('block/add', $edit, t('Save'));
$this->drupalPostForm('block/add', $edit, t('Save'));
// Check that the block has been created and that it is a basic block.
$this->assertRaw(format_string('!block %name has been created.', array(
......@@ -149,7 +149,7 @@ public function testBlockDelete() {
$edit['info'] = $this->randomName(8);
$body = $this->randomName(16);
$edit["block_body[$langcode][0][value]"] = $body;
$this->drupalPost('block/add/basic', $edit, t('Save'));
$this->drupalPostForm('block/add/basic', $edit, t('Save'));
// Place the block.
$instance = array(
......@@ -159,7 +159,7 @@ public function testBlockDelete() {
);
$block = entity_load('custom_block', 1);
$url = 'admin/structure/block/add/custom_block:' . $block->uuid() . '/' . \Drupal::config('system.theme')->get('default');
$this->drupalPost($url, $instance, t('Save block'));
$this->drupalPostForm($url, $instance, t('Save block'));
$block = custom_block_load(1);
......@@ -174,7 +174,7 @@ public function testBlockDelete() {
$this->drupalGet('block/1/delete');
$this->assertText(format_plural(1, 'This will also remove 1 placed block instance.', 'This will also remove @count placed block instance.'));
$this->drupalPost(NULL, array(), 'Delete');
$this->drupalPostForm(NULL, array(), 'Delete');
$this->assertRaw(t('Custom block %name has been deleted.', array('%name' => $edit['info'])));
// Create another block and force the plugin cache to flush.
......@@ -183,7 +183,7 @@ public function testBlockDelete() {
$edit2['info'] = $this->randomName(8);
$body2 = $this->randomName(16);
$edit2["block_body[$langcode][0][value]"] = $body2;
$this->drupalPost('block/add/basic', $edit2, t('Save'));
$this->drupalPostForm('block/add/basic', $edit2, t('Save'));
$this->assertNoRaw('Error message');
......@@ -193,7 +193,7 @@ public function testBlockDelete() {
$edit3['info'] = $this->randomName(8);
$body = $this->randomName(16);
$edit3["block_body[$langcode][0][value]"] = $body;
$this->drupalPost('block/add/basic', $edit3, t('Save'));
$this->drupalPostForm('block/add/basic', $edit3, t('Save'));
// Show the delete confirm form.
$this->drupalGet('block/3/delete');
......
......@@ -99,7 +99,7 @@ public function testBlockFields() {
$this->field['field_name'] . '[und][0][url]' => 'http://example.com',
$this->field['field_name'] . '[und][0][title]' => 'Example.com'
);
$this->drupalPost(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, t('Save'));
$block = entity_load('custom_block', 1);
$url = 'admin/structure/block/add/custom_block:' . $block->uuid() . '/' . \Drupal::config('system.theme')->get('default');
// Place the block.
......@@ -108,7 +108,7 @@ public function testBlockFields() {
'settings[label]' => $edit['info'],
'region' => 'sidebar_first',
);
$this->drupalPost($url, $instance, t('Save block'));
$this->drupalPostForm($url, $instance, t('Save block'));
// Navigate to home page.
$this->drupalGet('<front>');
$this->assertLinkByHref('http://example.com');
......
......@@ -67,7 +67,7 @@ public function testListing() {
$langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit['info'] = $label;
$edit["block_body[$langcode][0][value]"] = $this->randomName(16);
$this->drupalPost(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, t('Save'));
// Confirm that once the user returns to the listing, the text of the label
// (versus elsewhere on the page).
......@@ -93,7 +93,7 @@ public function testListing() {
$this->assertResponse(200);
$this->assertTitle(strip_tags(t('Edit custom block %label', array('%label' => $label)) . ' | Drupal'));
$edit = array('info' => $new_label);
$this->drupalPost(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, t('Save'));
}
else {
$this->fail('Did not find Albatross block in the database.');
......@@ -109,7 +109,7 @@ public function testListing() {
$this->clickLink($delete_text);
$this->assertResponse(200);
$this->assertTitle(strip_tags(t('Are you sure you want to delete %label?', array('%label' => $new_label)) . ' | Drupal'));
$this->drupalPost(NULL, array(), $delete_text);
$this->drupalPostForm(NULL, array(), $delete_text);
// Verify that the text of the label and machine name does not appear in
// the list (though it may appear elsewhere on the page).
......
......@@ -61,7 +61,7 @@ public function testCustomBlockTypeCreation() {
'id' => 'foo',
'label' => 'title for foo',
);
$this->drupalPost('admin/structure/block/custom-blocks/types/add', $edit, t('Save'));
$this->drupalPostForm('admin/structure/block/custom-blocks/types/add', $edit, t('Save'));
$block_type = entity_load('custom_block_type', 'foo');
$this->assertTrue($block_type, 'The new block type has been created.');
......@@ -90,7 +90,7 @@ public function testCustomBlockTypeEditing() {
$edit = array(
'label' => 'Bar',
);
$this->drupalPost('admin/structure/block/custom-blocks/manage/basic', $edit, t('Save'));
$this->drupalPostForm('admin/structure/block/custom-blocks/manage/basic', $edit, t('Save'));
field_info_cache_clear();
$this->drupalGet('block/add');
......@@ -99,9 +99,9 @@ public function testCustomBlockTypeEditing() {
$this->assertEqual(url('block/add/basic', array('absolute' => TRUE)), $this->getUrl(), 'Original machine name was used in URL.');
// Remove the body field.
$this->drupalPost('admin/structure/block/custom-blocks/manage/basic/fields/custom_block.basic.block_body/delete', array(), t('Delete'));
$this->drupalPostForm('admin/structure/block/custom-blocks/manage/basic/fields/custom_block.basic.block_body/delete', array(), t('Delete'));
// Resave the settings for this type.
$this->drupalPost('admin/structure/block/custom-blocks/manage/basic', array(), t('Save'));
$this->drupalPostForm('admin/structure/block/custom-blocks/manage/basic', array(), t('Save'));
// Check that the body field doesn't exist.
$this->drupalGet('block/add/basic');
$this->assertNoRaw('Block body', 'Body field was not found.');
......@@ -160,7 +160,7 @@ public function testsCustomBlockAddTypes() {
$this->clickLink(t('Add custom block'));
$this->clickLink('foo');
$edit = array('info' => $this->randomName(8));
$this->drupalPost(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, t('Save'));
$blocks = $storage_controller->loadByProperties(array('info' => $edit['info']));
if (!empty($blocks)) {
$block = reset($blocks);
......@@ -177,7 +177,7 @@ public function testsCustomBlockAddTypes() {
$this->clickLink(t('Add custom block'));
$this->clickLink('foo');
$edit = array('info' => $this->randomName(8));
$this->drupalPost(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, t('Save'));
$blocks = $storage_controller->loadByProperties(array('info' => $edit['info']));
if (!empty($blocks)) {
$block = reset($blocks);
......
......@@ -38,7 +38,7 @@ public function testPageEdit() {
$edit = array();
$edit['info'] = drupal_strtolower($this->randomName(8));
$edit[$body_key] = $this->randomName(16);
$this->drupalPost('block/add/basic', $edit, t('Save'));
$this->drupalPostForm('block/add/basic', $edit, t('Save'));
// Check that the block exists in the database.
$blocks = \Drupal::entityQuery('custom_block')->condition('info', $edit['info'])->execute();
......@@ -55,7 +55,7 @@ public function testPageEdit() {
$edit[$title_key] = $this->randomName(8);
$edit[$body_key] = $this->randomName(16);
// Stay on the current page, without reloading.
$this->drupalPost(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, t('Save'));
// Edit the same block, creating a new revision.
$this->drupalGet("block/" . $block->id());
......@@ -63,7 +63,7 @@ public function testPageEdit() {
$edit['info'] = $this->randomName(8);
$edit[$body_key] = $this->randomName(16);
$edit['revision'] = TRUE;
$this->drupalPost(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, t('Save'));
// Ensure that the block revision has been created.
$revised_block = entity_load('custom_block', $block->id->value, TRUE);
......@@ -71,7 +71,7 @@ public function testPageEdit() {
// Test deleting the block.
$this->drupalGet("block/" . $revised_block->id());
$this->drupalPost(NULL, array(), t('Delete'));
$this->drupalPostForm(NULL, array(), t('Delete'));
$this->assertText(format_string('Are you sure you want to delete !label?', array('!label' => $revised_block->label())));
}
......
......@@ -44,7 +44,7 @@ function testAdminTheme() {
// Enable admin theme and confirm that tab is accessible.
theme_enable(array('bartik'));
$edit['admin_theme'] = 'bartik';
$this->drupalPost('admin/appearance', $edit, t('Save configuration'));
$this->drupalPostForm('admin/appearance', $edit, t('Save configuration'));
$this->drupalGet('admin/structure/block/list/bartik');
$this->assertResponse(200);
}
......
......@@ -52,11 +52,11 @@ function testBlockInInvalidRegion() {
$warning_message = t('The block %info was assigned to the invalid region %region and has been disabled.', array('%info' => $block->id(), '%region' => 'invalid_region'));
// Clearing the cache should disable the test block placed in the invalid region.
$this->drupalPost('admin/config/development/performance', array(), 'Clear all caches');
$this->drupalPostForm('admin/config/development/performance', array(), 'Clear all caches');
$this->assertRaw($warning_message, 'Enabled block was in the invalid region and has been disabled.');
// Clear the cache to check if the warning message is not triggered.
$this->drupalPost('admin/config/development/performance', array(), 'Clear all caches');
$this->drupalPostForm('admin/config/development/performance', array(), 'Clear all caches');
$this->assertNoRaw($warning_message, 'Disabled block in the invalid region will not trigger the warning.');
// Place disabled test block in the invalid region of the default theme.
......@@ -65,7 +65,7 @@ function testBlockInInvalidRegion() {
$block->save();
// Clear the cache to check if the warning message is not triggered.
$this->drupalPost('admin/config/development/performance', array(), 'Clear all caches');
$this->drupalPostForm('admin/config/development/performance', array(), 'Clear all caches');
$this->assertNoRaw($warning_message, 'Disabled block in the invalid region will not trigger the warning.');
}
}
......@@ -45,7 +45,7 @@ function setUp() {
$edit = array(
'predefined_langcode' => 'fr',
);
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
$this->assertText('French', 'Language added successfully.');
}
......@@ -65,13 +65,13 @@ public function testLanguageBlockVisibility() {
'machine_name' => strtolower($this->randomName(8)),
'region' => 'sidebar_first',
);
$this->drupalPost('admin/structure/block/add/system_powered_by_block' . '/' . $default_theme, $edit, t('Save block'));
$this->drupalPostForm('admin/structure/block/add/system_powered_by_block' . '/' . $default_theme, $edit, t('Save block'));
// Change the default language.
$edit = array(
'site_default_language' => 'fr',
);
$this->drupalpost('admin/config/regional/settings', $edit, t('Save configuration'));
$this->drupalPostForm('admin/config/regional/settings', $edit, t('Save configuration'));
// Reset the static cache of the language list.
drupal_static_reset('language_list');
......@@ -109,7 +109,7 @@ public function testLanguageBlockVisibilityLanguageDelete() {
$this->assertTrue('fr' === $language, 'Language is set in the block configuration.');
// Delete the language.
$this->drupalPost('admin/config/regional/language/delete/fr', array(), t('Delete'));
$this->drupalPostForm('admin/config/regional/language/delete/fr', array(), t('Delete'));
// Check that the language is no longer stored in the configuration after
// it is deleted.
......
......@@ -40,7 +40,7 @@ function testBlockVisibility() {
// authenticated users.
$edit['visibility[path][pages]'] = 'user*';
$edit['visibility[role][roles][' . DRUPAL_AUTHENTICATED_RID . ']'] = TRUE;
$this->drupalPost('admin/structure/block/add/' . $block_name . '/' . $default_theme, $edit, t('Save block'));
$this->drupalPostForm('admin/structure/block/add/' . $block_name . '/' . $default_theme, $edit, t('Save block'));
$this->assertText('The block configuration has been saved.', 'Block was saved');
$this->drupalGet('');
......@@ -80,7 +80,7 @@ function testBlockVisibilityListedEmpty() {
);
// Set the block to be hidden on any user path, and to be shown only to
// authenticated users.
$this->drupalPost('admin/structure/block/add/' . $block_name . '/' . $default_theme, $edit, t('Save block'));