function DatabaseEmptyStatementTestCase::testEmptyIteration

Test that the empty result set iterates safely.

File

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

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.