function ContextConditionPathTest::test in Context 7.3
Same name and namespace in other branches
- 6.3 tests/context.conditions.test \ContextConditionPathTest::test()
- 6 tests/context.conditions.test \ContextConditionPathTest::test()
File
- tests/
context.conditions.test, line 299
Class
Code
function test() {
ctools_include('export');
$context = ctools_export_new_object('context');
$context->name = 'testcontext';
$context->conditions = array(
'path' => array(
'values' => array(
'admin',
'node/*',
),
),
);
$context->reactions = array(
'debug' => array(
'debug' => TRUE,
),
);
$saved = context_save($context);
$this
->assertTrue($saved, "Context 'testcontext' saved.");
$this
->drupalGet('admin');
$this
->assertText('Active context: testcontext');
$node = $this
->drupalCreateNode();
$this
->drupalGet("node/{$node->nid}");
$this
->assertText('Active context: testcontext');
$this
->drupalGet('node');
$this
->assertNoText('Active context: testcontext');
// Cleanup
context_delete($context);
// @TODO: Test with path alias
// @TODO: Test with language prefixes
}