1 database_test.test DatabaseSelectTestCase::testSimpleSelect()

Test rudimentary SELECT statements.

File

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

Class

DatabaseSelectTestCase
Test the SELECT builder.

Code

function testSimpleSelect() {
  $query = db_select('test');
  $name_field = $query->addField('test', 'name');
  $age_field = $query->addField('test', 'age', 'age');
  $result = $query->execute();

  $num_records = 0;
  foreach ($result as $record) {
    $num_records++;
  }

  $this->assertEqual($num_records, 4, 'Returned the correct number of rows.');
}