You are here

public function SearchByPageAttachCCKTest::setUp in Search by Page 6

Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix. A temporary files directory is created with the same name as the database prefix.

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 SearchByPageAttachUploadsTest::setUp

3 methods override SearchByPageAttachCCKTest::setUp()
SearchbyPageAttachCCK2Test::setUp in tests/search_by_page.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…
SearchbyPageAttachNotReadable::setUp in tests/search_by_page.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…
SearchbyPageAttachReindexTest::setUp in tests/search_by_page.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…

File

tests/search_by_page.test, line 2258
Tests for the Search by Page module. By Jennifer Hodgdon of Poplar ProductivityWare, www.poplarware.com

Class

SearchByPageAttachCCKTest
Functionality test 1 for Search by Page Attachments with CCK module.

Code

public function setUp() {
  DrupalWebTestCase::setUp('search', 'search_by_page', 'sbp_attach', 'content', 'filefield', 'search_files', 'sbp_test', 'dblog');

  // Note: I think SimpleTest inherits the default node access from the
  // base system. Needs to be rebuilt in order for the access stuff to work!
  node_access_rebuild();
  $this
    ->setUpEnvironments();
  $this
    ->setUpUsers($this->envinfo1);
  $this
    ->setUpTypes();
  $this
    ->makeContent();

  // Set up so "sbp_indexed" node attachments are searchable and
  // "sbp_hidden" nodes are not. Make sure our file field is searchable.
  // Also make it so only listed files are searchable.
  $this
    ->drupalPost('admin/settings/search_by_page/edit/' . $this->envid1, 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,
    'button_label' => t('Search pages'),
  ), 'Save configuration');
  cache_clear_all('variables', 'cache');
  variable_init();
  $types = search_by_page_setting_get('sbp_attach_node_types', $this->envid1, array());
  $this
    ->assertTrue($types['sbp_indexed'], "sbp_indexed is indexed");
  $this
    ->assertTrue(!isset($types['sbp_hidden']) || !$types['sbp_hidden'], "sbp_hidden is hidden");
  $this
    ->doCronrun();
  $this
    ->drupalLogin($this->superuser);
  $this
    ->drupalGet('admin/reports/dblog');
  $this
    ->assertText(t('Cron run completed'), 'Log shows cron run completed');
  $this
    ->drupalLogout();
}