You are here

public function SearchByPageAttachTest::makeContent in Search by Page 7

Makes 2 nodes with attachments, for search testing.

2 calls to SearchByPageAttachTest::makeContent()
SearchbyPageAttach2Test::setUp in tests/search_by_page.test
Sets up a Drupal site for running functional and integration tests.
SearchByPageAttachTest::setUp in tests/search_by_page.test
Sets up a Drupal site for running functional and integration tests.
2 methods override SearchByPageAttachTest::makeContent()
SearchbyPageAttachNotReadable::makeContent in tests/search_by_page.test
Makes a node with an unreadable attachment, for search testing.
SearchbyPageAttachReindexTest::makeContent in tests/search_by_page.test
Makes several nodes with attachments, for search testing.

File

tests/search_by_page.test, line 2283
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.

Code

public function makeContent() {

  // Throw in a few nodes that won't match our tests.
  $info = array(
    'body' => array(
      LANGUAGE_NONE => array(
        array(
          'value' => 'blah',
          'summary' => 'blah',
        ),
      ),
    ),
    'title' => 'blah',
    'language' => LANGUAGE_NONE,
  );
  $this
    ->drupalCreateNode($info);
  $this
    ->drupalCreateNode($info);
  $this
    ->drupalCreateNode($info);
  $this
    ->drupalCreateNode($info);
  $info = array(
    'title' => 'Favorite foods',
    'body' => array(
      LANGUAGE_NONE => array(
        array(
          'value' => 'I eat pizza every day.',
        ),
      ),
    ),
    'type' => 'sbp_indexed',
    'language' => LANGUAGE_NONE,
  );
  $node = $this
    ->drupalCreateNode($info);
  $this
    ->attachFileUpload($node, 'attach2.txt', 0, 'A very happy file');
  $this
    ->attachFileUpload($node, 'attach1.txt', 1, 'A very lonely file');
  $this
    ->attachFileUpload($node, 'attach5.TXT', 1, 'An upper-case extension file');
  $info = array(
    'title' => 'Favorite cars',
    'body' => array(
      LANGUAGE_NONE => array(
        array(
          'value' => 'I drive a hatchback.',
        ),
      ),
    ),
    'type' => 'sbp_hidden',
    'language' => LANGUAGE_NONE,
  );
  $node = $this
    ->drupalCreateNode($info);
  $this
    ->attachFileUpload($node, 'attach3.txt', 1, 'A very pretty file');

  // Configure Search Files API helpers
  $this
    ->drupalPost('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)');
}