You are here

function ContextReactionBlockTest::test in Context 6

Same name and namespace in other branches
  1. 6.3 tests/context.reactions.test \ContextReactionBlockTest::test()
  2. 7.3 tests/context.reactions.test \ContextReactionBlockTest::test()

File

tests/context.reactions.test, line 20

Class

ContextReactionBlockTest

Code

function test() {
  ctools_include('export');
  $context = ctools_export_new_object('context');
  $context->name = 'testcontext';
  $context->conditions = array(
    'sitewide' => array(
      'values' => array(
        1,
      ),
    ),
  );
  $context->reactions = array(
    'block' => array(
      'blocks' => array(
        'user-3' => array(
          'module' => 'user',
          'delta' => 3,
          'region' => 'right',
          'weight' => 0,
        ),
      ),
    ),
  );
  $saved = context_save($context);
  $this
    ->assertTrue($saved, "Context 'testcontext' saved.");
  $this
    ->drupalGet('node');
  $this
    ->assertText('Who\'s online');

  // Cleanup
  context_delete($context);

  // @TODO:
  // - Implement & test title overrides (if we plan to support them).
  // - Implement & test core + context block visibility conditions
}