You are here

protected function SearchApiDbTest::insertItems in Search API Database Search 7

1 call to SearchApiDbTest::insertItems()
SearchApiDbTest::testFramework in ./search_api_db.test

File

./search_api_db.test, line 68

Class

SearchApiDbTest
Class for testing index and search capabilities using the Database search module.

Code

protected function insertItems() {
  $this
    ->drupalGet('search_api_test/insert');
  $count = db_query('SELECT COUNT(*) FROM {search_api_test}')
    ->fetchField();
  $this
    ->insertItem(array(
    'id' => 1,
    'title' => 'foo bar baz foobaz',
    'body' => 'test test',
    'type' => 'item',
    'keywords' => 'orange',
  ));
  $this
    ->insertItem(array(
    'id' => 2,
    'title' => 'foo test foobuz',
    'body' => 'bar test',
    'type' => 'item',
    'keywords' => 'orange,apple,grape',
  ));
  $this
    ->insertItem(array(
    'id' => 3,
    'title' => 'bar',
    'body' => 'test foobar',
  ));
  $this
    ->insertItem(array(
    'id' => 4,
    'title' => 'foo baz',
    'body' => 'test test test',
    'type' => 'article',
    'keywords' => 'apple,strawberry,grape',
  ));
  $this
    ->insertItem(array(
    'id' => 5,
    'title' => 'bar baz',
    'body' => 'foo',
    'type' => 'article',
    'keywords' => 'orange,strawberry,grape,banana,orange,Orange',
  ));
  $count = db_query('SELECT COUNT(*) FROM {search_api_test}')
    ->fetchField() - $count;
  $this
    ->assertEqual($count, 5, "{$count} items inserted.");
}