You are here

public function CtoolsContextIDTestCase::testContextId in Chaos Tool Suite (ctools) 7

Test ctools_context_id where the context only has an id.

File

tests/context.test, line 79
Test the keyword substitution functionality.

Class

CtoolsContextIDTestCase
@file Test the keyword substitution functionality.

Code

public function testContextId() {
  $context = array();
  $expected = 'context__1';
  $actual = ctools_context_id($context);
  $this
    ->assertEqual($actual, $expected, 'Empty context has id ' . $expected);
  $context = array(
    'id' => 4,
  );
  $expected = 'context__4';
  $actual = ctools_context_id($context);
  $this
    ->assertEqual($actual, $expected, 'Context 4 has id ' . $expected);
  $context = array(
    'id' => 'a',
  );
  $expected = 'context__a';
  $actual = ctools_context_id($context);
  $this
    ->assertEqual($actual, $expected, 'Context "a" has id ' . $expected);
}