You are here

public function SearchbyPageAttachReindexTest::makeContent in Search by Page 8

Makes several nodes with attachments, for search testing.

Overrides SearchByPageAttachTest::makeContent

1 call to SearchbyPageAttachReindexTest::makeContent()
SearchbyPageAttachReindexTest::setUp in tests/src/Functional/search_by_page.test

File

tests/src/Functional/search_by_page.test, line 2371
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 makeContent() {

  // Throw in a few nodes that won't match our tests.
  $info = array(
    'body' => array(
      self::LANGUAGE_NONE_ => array(
        array(
          'value' => 'blah',
          'summary' => 'blah',
        ),
      ),
    ),
    'title' => 'blah',
    'language' => self::LANGUAGE_NONE_,
  );
  $this
    ->drupalCreateNode($info);
  $this
    ->drupalCreateNode($info);
  $this
    ->drupalCreateNode($info);
  $this
    ->drupalCreateNode($info);

  // Create a bunch of indexed nodes, with random titles.
  // Throw in a few nodes that won't match our tests.
  $info = array(
    'body' => array(
      self::LANGUAGE_NONE_ => array(
        array(
          'value' => 'I eat pizza every day.',
          'summary' => 'blah',
        ),
      ),
    ),
    'language' => self::LANGUAGE_NONE_,
    'type' => 'search_by_page_indexed',
  );
  $this->nodes = array();
  for ($i = 0; $i < 5; $i++) {
    $this->nodes[] = $this
      ->drupalCreateNode($info);
    $this->descs[] = $this
      ->randomName();
    $this
      ->attachFileUpload($this->nodes[$i], 'attach1.txt', TRUE, $this->descs[$i]);
  }

  // Configure Search Files API helpers
  $this
    ->drupalPostForm('admin/config/search/search_files/helpers/autodetect', array(), t('Autodetect'));
  $this
    ->drupalGet('admin/config/search/search_files/helpers/list');
  $this
    ->assertText('Text files', 'Text file helper for Search Files set up (without this, no file searching is possible)');
  $this
    ->assertText('Good', 'Safe mode message found (without this, no file searching is possible)');
}