1 database_test.test DatabaseEmptyStatementTestCase::testEmptyIteration()

Test that the empty result set iterates safely.

File

core/modules/simpletest/tests/database_test.test, line 3887
Database tests.

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.');
}