function DatabaseSelectOrderedTestCase::testOrderByEscaping

Tests that the sort direction is sanitized properly.

File

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

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

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