| 7 aggregator.test | ImportOPMLTestCase::validateImportFormFields() |
| 8 aggregator.test | ImportOPMLTestCase::validateImportFormFields() |
Submit form filled with invalid fields.
File
- modules/
aggregator/ aggregator.test, line 657 - Tests for aggregator.module.
Code
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->assertRaw(t('You must <em>either</em> upload a file or enter a URL.'), t('Error if no fields are filled.'));
$path = $this->getEmptyOpml();
$edit = array(
'files[upload]' => $path,
'remote' => file_create_url($path),
);
$this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import'));
$this->assertRaw(t('You must <em>either</em> upload a file or enter a URL.'), t('Error if both fields are filled.'));
$edit = array('remote' => 'invalidUrl://empty');
$this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import'));
$this->assertText(t('This URL is not valid.'), t('Error if the URL is invalid.'));
$after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField();
$this->assertEqual($before, $after, t('No feeds were added during the three last form submissions.'));
}
Login or register to post comments