You are here

function ContextConditionLanguageTest::test in Context 7.3

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

File

tests/context.conditions.test, line 228

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);
}