protected function SearchApiWebTest::insertItems in Search API 7
Inserts some test items into the database, via the test module.
Parameters
int $number: The number of items to insert.
See also
insertItem()
2 calls to SearchApiWebTest::insertItems()
- SearchApiWebTest::checkIndexingOrder in ./
search_api.test - Tests whether items are indexed in the right order.
- SearchApiWebTest::testFramework in ./
search_api.test - Tests correct admin UI, indexing and search behavior.
File
- ./
search_api.test, line 136 - Contains the SearchApiWebTest and the SearchApiUnitTest classes.
Class
- SearchApiWebTest
- Class for testing Search API functionality via the UI.
Code
protected function insertItems($number = 5) {
$count = db_query('SELECT COUNT(*) FROM {search_api_test}')
->fetchField();
for ($i = 1; $i <= $number; ++$i) {
$id = $count + $i;
$this
->insertItem(array(
'id' => $id,
'title' => "Title {$id}",
'body' => "Body text {$id}.",
'type' => 'Item',
));
}
$count = db_query('SELECT COUNT(*) FROM {search_api_test}')
->fetchField() - $count;
$this
->assertEqual($count, $number, "{$number} items successfully inserted.");
}