You are here

function PorterStemmerFunctionalTest::testSearch in Porter-Stemmer 7

Same name and namespace in other branches
  1. 6.2 porterstemmer.test \PorterStemmerFunctionalTest::testSearch()

Tests that all three pages can be found in searches.

File

./porterstemmer.test, line 73
Tests for the Porter Stemmer module. By Jennifer Hodgdon of Poplar ProductivityWare, www.poplarware.com Unit tests are based on sample words from http://snowball.tartarus.org/algorithms/english/stemmer.html which are stored in a separate file…

Class

PorterStemmerFunctionalTest
Functional test for Porter Stemmer.

Code

function testSearch() {
  $this
    ->drupalLogin($this->superuser);

  // Search for 'walk' and verify all three pages were found.
  $this
    ->drupalPost('search', array(
    'keys' => 'walk',
  ), 'Search');
  $this
    ->assertText('first', 'First page was found with search for walk');
  $this
    ->assertText('second', 'Second page was found with search for walk');
  $this
    ->assertText('third', 'Third page was found with search for walk');

  // Search for 'walking' and verify all three pages were found.
  $this
    ->drupalPost('search', array(
    'keys' => 'walking',
  ), 'Search');
  $this
    ->assertText('first', 'First page was found with search for walking');
  $this
    ->assertText('second', 'Second page was found with search for walking');
  $this
    ->assertText('third', 'Third page was found with search for walking');

  // Search for 'walked' and verify all three pages were found.
  $this
    ->drupalPost('search', array(
    'keys' => 'walked',
  ), 'Search');
  $this
    ->assertText('first', 'First page was found with search for walked');
  $this
    ->assertText('second', 'Second page was found with search for walked');
  $this
    ->assertText('third', 'Third page was found with search for walked');

  // Search for 'blahblahblah' and verify none of the pages were found.
  $this
    ->drupalPost('search', array(
    'keys' => 'blahblahblah',
  ), 'Search');
  $this
    ->assertNoText('first', 'First page was not found with bogus search');
  $this
    ->assertNoText('second', 'Second page was not found with bogus search');
  $this
    ->assertNoText('third', 'Third page was not found with bogus search');
}