You are here

public function SearchbyPageAttachReindexTest::setUp in Search by Page 8

Overrides SearchByPageAttachTest::setUp

File

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

Class

SearchbyPageAttachReindexTest
Tests attachment reindexing.

Namespace

Drupal\Tests\search_by_page\Functional

Code

public function setUp() {
  BrowserTestBase::setUp('search', 'search_by_page', 'search_by_page_attach', 'file', 'search_files', 'search_by_page_test', 'dblog');
  $this
    ->setUpEnvironments();
  $this
    ->setUpUsers($this->envinfo2);
  $this
    ->setUpTypes();
  $this
    ->makeContent();

  // Set up so "search_by_page_indexed" node attachments are searchable, and that our
  // file field is searchable.
  // NOTE: When posting to a page with checkboxes, it is VITAL to pass in
  // FALSE rather than 0 for the value, if you want to unset the checkbox!
  $this
    ->drupalPostForm('admin/config/search/search_by_page/edit/' . $this->envid2, array(
    'search_by_page_attach_node_types[]' => 'search_by_page_indexed',
    'search_by_page_attach_field_types[]' => 'field_myfile',
    'search_by_page_attach_only_listed' => FALSE,
    'search_by_page_attach_prepend_node_title' => TRUE,
    'search_by_page_attach_title_sep' => " bush ",
    'search_by_page_attach_use_description' => TRUE,
    'button_label' => t('Search pages'),
  ), 'Save configuration');
  \Drupal::service('cache.bootstrap')
    ->invalidateAll();
  variable_initialize();
  $this
    ->doCronrun();
  $this
    ->drupalLogin($this->superuser);
  $this
    ->drupalGet('admin/reports/dblog');
  $this
    ->assertText(t('Cron run completed'), 'Log shows cron run completed');
  $this
    ->drupalLogout();
}