You are here

function DatabaseTaggingTestCase::testMetaData in SimpleTest 7

Test that we can attach meta data to a query object.

This is how we pass additional context to alter hooks.

File

tests/database_test.test, line 2103

Class

DatabaseTaggingTestCase
Select tagging tests.

Code

function testMetaData() {
  $query = db_select('test');
  $query
    ->addField('test', 'name');
  $query
    ->addField('test', 'age', 'age');
  $data = array(
    'a' => 'A',
    'b' => 'B',
  );
  $query
    ->addMetaData('test', $data);
  $return = $query
    ->getMetaData('test');
  $this
    ->assertEqual($data, $return, t('Corect metadata returned.'));
  $return = $query
    ->getMetaData('nothere');
  $this
    ->assertNull($return, t('Non-existent key returned NULL.'));
}