function CtoolsContextIDTestCase::testContextIdNameType

Test ctools_context_id where the context has an id & name, and a type is specified.

File

tests/context.test, line 112

Class

CtoolsContextIDTestCase
@file Test the keyword substitution functionality.

Code

public function testContextIdNameType() {
  $type = 'sort';
  $context = array(
    'id' => '512',
    'name' => 'foo',
  );
  $expected = 'sort_foo_512';
  $this->assertEqual(ctools_context_id($context, $type), $expected, 'Context "512" has id ' . $expected);
  $type = NULL;
  $context = array(
    'id' => '512',
    'name' => 'foo',
  );
  $expected = '_foo_512';
  $this->assertEqual(ctools_context_id($context, $type), $expected, 'Context "512" has id ' . $expected);
}