You are here

function ContextConditionLanguageTest::test in Context 6

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

File

tests/context.conditions.test, line 207

Class

ContextConditionLanguageTest

Code

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

  // Cleanup
  context_delete($context);
}