You are here

function DatabaseSelectOrderedTestCase::testOrderByEscaping in Drupal 7

Tests that the sort direction is sanitized properly.

File

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

Class

DatabaseSelectOrderedTestCase
Test select with order by clauses.

Code

function testOrderByEscaping() {
  $query = db_select('test')
    ->orderBy('name', 'invalid direction');
  $order_bys = $query
    ->getOrderBy();
  $this
    ->assertEqual($order_bys['name'], 'ASC', 'Invalid order by direction is converted to ASC.');
}