You are here

public function SearchbyPageAttachNotReadable::makeContent in Search by Page 6

Same name and namespace in other branches
  1. 7 tests/search_by_page.test \SearchbyPageAttachNotReadable::makeContent()

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

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

Overrides SearchByPageAttachUploadsTest::makeContent

1 call to SearchbyPageAttachNotReadable::makeContent()
SearchbyPageAttachNotReadable::setUp in tests/search_by_page.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…

File

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

Class

SearchbyPageAttachNotReadable
Tests attachments that cannot be read.

Code

public function makeContent() {

  // Throw in a few nodes that won't match our tests.
  $info = array(
    'body' => 'blah',
    'teaser' => 'blah',
    'title' => 'blah',
  );
  $this
    ->drupalCreateNode($info);
  $this
    ->drupalCreateNode($info);
  $this
    ->drupalCreateNode($info);
  $this
    ->drupalCreateNode($info);
  $info = array(
    'title' => 'Favorite foods',
    'body' => 'I eat pizza every day.',
    'type' => 'sbp_indexed',
  );
  $node = $this
    ->drupalCreateNode($info);
  $this
    ->attachFileUpload($node, 'attach4.not', TRUE, 'A very lonely file');

  // Configure Search Files API helpers
  $this
    ->drupalPost('admin/settings/search_files/helpers/autodetect', array(), t('Autodetect'));
  $this
    ->drupalGet('admin/settings/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)');
}