You are here

public function SearchByPageAttachTest::setUp in Search by Page 8

Overrides SearchByPageTesterTest::setUp

3 methods override SearchByPageAttachTest::setUp()
SearchbyPageAttach2Test::setUp in tests/src/Functional/search_by_page.test
SearchbyPageAttachNotReadable::setUp in tests/src/Functional/search_by_page.test
SearchbyPageAttachReindexTest::setUp in tests/src/Functional/search_by_page.test

File

tests/src/Functional/search_by_page.test, line 1776
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.

Namespace

Drupal\Tests\search_by_page\Functional

Code

public function setUp() {
  parent::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
  // "search_by_page_hidden" nodes are not. Also make it so only listed files are
  // searchable.
  $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' => TRUE,
    'search_by_page_attach_prepend_node_title' => FALSE,
    'search_by_page_attach_title_sep' => " bush ",
    'search_by_page_attach_use_description' => FALSE,
    'search_by_page_attach_role' => $this
      ->getNewRoleID($this->superuser),
    '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');
}