function ContextConditionNodeTest::test in Context 6
Same name and namespace in other branches
- 6.3 tests/context.conditions.test \ContextConditionNodeTest::test()
- 7.3 tests/context.conditions.test \ContextConditionNodeTest::test()
File
- tests/
context.conditions.test, line 371
Class
Code
function test() {
ctools_include('export');
$context = ctools_export_new_object('context');
$context->name = 'testcontext';
$context->conditions = array(
'node' => array(
'values' => array(
'blog',
),
),
);
$context->reactions = array(
'debug' => array(
'debug' => TRUE,
),
);
$saved = context_save($context);
$this
->assertTrue($saved, "Context 'testcontext' saved.");
$this
->drupalGet("node/add/blog");
$this
->assertNoText('Active context: testcontext');
$this
->drupalGet("node/add/book");
$this
->assertNoText('Active context: testcontext');
$node = $this
->drupalCreateNode(array(
'type' => 'blog',
));
$this
->drupalGet("node/{$node->nid}");
$this
->assertText('Active context: testcontext');
$node = $this
->drupalCreateNode(array(
'type' => 'book',
));
$this
->drupalGet("node/{$node->nid}");
$this
->assertNoText('Active context: testcontext');
$context->conditions['node']['options']['node_form'] = 1;
$saved = context_save($context);
$this
->assertTrue($saved, "Context 'testcontext' saved.");
$this
->drupalGet("node/add/blog");
$this
->assertText('Active context: testcontext');
$this
->drupalGet("node/add/book");
$this
->assertNoText('Active context: testcontext');
// Cleanup
context_delete($context);
}