public function SearchByPageAttachTest::setUp in Search by Page 7
Sets up a Drupal site for running functional and integration tests.
Generates a random database prefix and installs Drupal with the specified installation profile in DrupalWebTestCase::$profile into the prefixed database. Afterwards, installs any additional modules specified by the test.
After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.
Parameters
...: List of modules to enable for the duration of the test. This can be either a single array or a variable number of string arguments.
Overrides DrupalWebTestCase::setUp
See also
DrupalWebTestCase::prepareDatabasePrefix()
DrupalWebTestCase::changeDatabasePrefix()
DrupalWebTestCase::prepareEnvironment()
3 methods override SearchByPageAttachTest::setUp()
- SearchbyPageAttach2Test::setUp in tests/
search_by_page.test - Sets up a Drupal site for running functional and integration tests.
- SearchbyPageAttachNotReadable::setUp in tests/
search_by_page.test - Sets up a Drupal site for running functional and integration tests.
- SearchbyPageAttachReindexTest::setUp in tests/
search_by_page.test - Sets up a Drupal site for running functional and integration tests.
File
- tests/
search_by_page.test, line 2090 - Tests for the Search by Page module. By Jennifer Hodgdon of Poplar ProductivityWare, www.poplarware.com
Class
- SearchByPageAttachTest
- Functionality test 1 for Search by Page Attachments.
Code
public function setUp() {
parent::setUp('search', 'sbp_test', 'sbp_attach', 'file', 'search_files', 'dblog', 'search_by_page');
$this
->setUpEnvironments();
$this
->setUpUsers($this->envinfo2);
$this
->setUpTypes();
$this
->makeContent();
// Set up so "sbp_indexed" node attachments are searchable and
// "sbp_hidden" nodes are not. Also make it so only listed files are
// searchable.
$this
->drupalPost('admin/config/search/search_by_page/edit/' . $this->envid2, array(
'sbp_attach_node_types[]' => 'sbp_indexed',
'sbp_attach_field_types[]' => 'field_myfile',
'sbp_attach_only_listed' => TRUE,
'sbp_attach_prepend_node_title' => FALSE,
'sbp_attach_title_sep' => " bush ",
'sbp_attach_use_description' => FALSE,
'sbp_attach_role' => $this
->getNewRoleID($this->superuser),
'button_label' => t('Search pages'),
), 'Save configuration');
cache_clear_all('variables', 'cache_bootstrap');
variable_initialize();
$this
->doCronRun();
$this
->drupalLogin($this->superuser);
$this
->drupalGet('admin/reports/dblog');
$this
->assertText(t('Cron run completed'), 'Log shows cron run completed');
}