public function GoogleApplianceSettingsValidateHostname::testCase in Google Search Appliance 7
File
- testing/
google_appliance.test, line 38 - Implements automated simpletest routines for integration testing of the Google Appliance module.
Class
- GoogleApplianceSettingsValidateHostname
- test the hostname settings validator
Code
public function testCase() {
$settings = array(
'hostname' => 'bad^*format.09menbdy',
// bad setting
'collection' => 'default_collection',
'frontend' => 'default_frontend',
'timeout' => 3,
'autofilter' => '1',
'query_inspection' => FALSE,
'search_title' => $this
->randomName(),
'results_per_page' => 16,
);
$this
->drupalPost('admin/config/search/google_appliance/settings', $settings, t('Save configuration'));
// ensure that we see the error message
$this
->assertText(t('GSA Host name must be a valid-format URL or IPv4 address'), t('<b>{MTP:2.2.1.5}</b> Found error message for invalid-format hostname (successful catch).'));
// ensure that we don't have the success message
$this
->assertNoText(t('The configuration options have been saved'), t('Successful save message not found (intended fail).'));
}