function ContextConditionContextTest::test in Context 7.3
Same name and namespace in other branches
- 6.3 tests/context.conditions.test \ContextConditionContextTest::test()
- 6 tests/context.conditions.test \ContextConditionContextTest::test()
File
- tests/
context.conditions.test, line 343
Class
Code
function test() {
ctools_include('export');
$context = ctools_export_new_object('context');
$context->name = 'testcontext';
$context->conditions = array(
'path' => array(
'values' => array(
'admin',
),
),
);
$context->reactions = array(
'debug' => array(
'debug' => TRUE,
),
);
$saved = context_save($context);
$this
->assertTrue($saved, "Context 'testcontext' saved.");
$subcontext = ctools_export_new_object('context');
$subcontext->name = 'subcontext';
$subcontext->conditions = array(
'context' => array(
'values' => array(
'testcontext',
),
),
);
$subcontext->reactions = array(
'debug' => array(
'debug' => TRUE,
),
);
$saved = context_save($subcontext);
$this
->assertTrue($saved, "Context 'subcontext' saved.");
$this
->drupalGet('admin');
$this
->assertText('Active context: testcontext');
$this
->assertText('Active context: subcontext');
// Cleanup
context_delete($context);
// @TODO: Test exclusion
}