You are here

function ContextConditionMenuTest::test in Context 7.3

Same name and namespace in other branches
  1. 6.3 tests/context.conditions.test \ContextConditionMenuTest::test()
  2. 6 tests/context.conditions.test \ContextConditionMenuTest::test()

File

tests/context.conditions.test, line 447

Class

ContextConditionMenuTest

Code

function test() {
  ctools_include('export');
  $context = ctools_export_new_object('context');
  $context->name = 'testcontext';
  $context->conditions = array(
    'menu' => array(
      'values' => array(
        'node/add',
      ),
    ),
  );
  $context->reactions = array(
    'debug' => array(
      'debug' => TRUE,
    ),
  );
  $saved = context_save($context);
  $this
    ->assertTrue($saved, "Context 'testcontext' saved.");
  $this
    ->drupalGet("node/add/blog");
  $this
    ->assertText('Active context: testcontext');
  $this
    ->drupalGet("node/add");
  $this
    ->assertText('Active context: testcontext');
  $this
    ->drupalGet("node");
  $this
    ->assertNoText('Active context: testcontext');

  // Cleanup
  context_delete($context);
}