You are here

function DatabaseEmptyStatementTestCase::testEmptyIteration in Drupal 7

Test that the empty result set iterates safely.

File

modules/simpletest/tests/database_test.test, line 4024

Class

DatabaseEmptyStatementTestCase
Tests the empty pseudo-statement class.

Code

function testEmptyIteration() {
  $result = new DatabaseStatementEmpty();
  foreach ($result as $record) {
    $this
      ->fail('Iterating empty result set should not iterate.');
    return;
  }
  $this
    ->pass('Iterating empty result set skipped iteration.');
}