You are here

public function SearchbyPageAttachNotReadable::makeContent in Search by Page 8

Makes a node with an unreadable attachment, for search testing.

This is an override of the inherited method from SearchByPageAttachTest, which attaches one file that cannot be read (no helpers).

Overrides SearchByPageAttachTest::makeContent

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

File

tests/src/Functional/search_by_page.test, line 2251
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 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);
  $info = array(
    'title' => 'Favorite foods',
    'body' => array(
      self::LANGUAGE_NONE_ => array(
        array(
          'value' => 'I eat pizza every day.',
        ),
      ),
    ),
    'type' => 'search_by_page_indexed',
    'language' => self::LANGUAGE_NONE_,
  );
  $node = $this
    ->drupalCreateNode($info);
  $this
    ->attachFileUpload($node, 'attach4.not', TRUE, 'A very lonely file');

  // 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)');
}