You are here

public function SearchbyPageAttachNotReadable::setUp in Search by Page 8

Overrides SearchByPageAttachTest::setUp

File

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

Class

SearchbyPageAttachNotReadable
Tests attachments that cannot be read.

Namespace

Drupal\Tests\search_by_page\Functional

Code

public function setUp() {
  BrowserTestBase::setUp('search', 'search_by_page_test', 'search_by_page_attach', 'file', 'search_files', 'dblog', 'search_by_page');
  $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
    ->assertEqual(search_by_page_setting_get('search_by_page_attach_only_listed', $this->envid2, 0), 0, 'Search only listed files is set to FALSE');
  $this
    ->doCronrun();
  $this
    ->drupalLogin($this->superuser);
  $this
    ->drupalGet('admin/reports/dblog');
  $this
    ->assertText(t('Cron run completed'), 'Log shows cron run completed');
  $this
    ->drupalLogout();
}