public function GoogleApplianceRelatedSearchesBlock::testCase in Google Search Appliance 7
File
- testing/google_appliance.test, line 838
- Implements automated simpletest routines for integration testing of the Google
Appliance module.
Class
- GoogleApplianceRelatedSearchesBlock
- Block related searches: test that the block is available and displays as expected.
Code
public function testCase() {
$block_title = $this
->randomName(16);
$this
->drupalPost('admin/structure/block/manage/google_appliance/ga_related_searches/configure', array(
'title' => $block_title,
), t('Save block'));
$this
->assertText(t('The block configuration has been saved.'), t('<b>{MTP:2.3.6.5}</b> Block title set (successful interaction).'));
$edit = array();
$edit['blocks[google_appliance_ga_related_searches][region]'] = 'content';
$this
->drupalPost('admin/structure/block', $edit, t('Save blocks'));
$this
->assertText(t('The block settings have been updated.'), t('<b>{MTP:2.3.6.6}</b> Block successfully moved to footer region (successful interaction).'));
$testing_dir = drupal_get_path('module', 'google_appliance') . '/testing';
$settings_fn = $testing_dir . '/test-settings.inc';
$example_settings_fn = $testing_dir . '/test-settings.example.inc';
if (file_exists($settings_fn)) {
include_once $settings_fn;
$settings = array(
'hostname' => $file_spec['hostname'],
'collection' => $file_spec['collection'],
'frontend' => $file_spec['frontend'],
'timeout' => 10,
'autofilter' => '1',
'query_inspection' => FALSE,
'search_title' => $this
->randomName(16),
'results_per_page' => 16,
);
$this
->drupalPost('admin/config/search/google_appliance/settings', $settings, t('Save configuration'));
$this
->assertText(t('The configuration options have been saved'), t('Successful module settings save .'));
$this
->drupalGet('gsearch/' . $file_spec['query']);
$this
->assertResponse(200);
$this
->assertNoText(t('No Results'), t('Search via URL succeeded, and produced a results listing.'));
$this
->assertText(t('@block_title', array(
'@block_title' => $block_title,
)), t('<b>{MTP:2.3.6.7}</b> Found block title for related search block on the page (expected behavior)'));
}
else {
$this
->error('Test settings file not found, aborting test. See ' . $example_settings_fn . ' for more information.');
}
}