function ContextConditionUserPageTest::test in Context 6
Same name and namespace in other branches
- 6.3 tests/context.conditions.test \ContextConditionUserPageTest::test()
- 7.3 tests/context.conditions.test \ContextConditionUserPageTest::test()
File
- tests/
context.conditions.test, line 93
Class
Code
function test() {
// Viewing any user profile triggers context.
$this
->drupalLogin($this->user1);
$this
->drupalGet("user/{$this->user1->uid}");
$this
->assertText('Active context: testcontext');
$this
->drupalGet("user/{$this->user2->uid}");
$this
->assertText('Active context: testcontext');
// User form does not.
$this
->drupalGet("user/{$this->user1->uid}/edit");
$this
->assertNoText('Active context: testcontext');
// Test current user mode
$this->context->conditions['user_page']['options']['mode'] = 'current';
$saved = context_save($this->context);
$this
->assertTrue($saved, "Context 'testcontext' saved.");
$this
->drupalGet("user/{$this->user1->uid}");
$this
->assertText('Active context: testcontext');
$this
->drupalGet("user/{$this->user2->uid}");
$this
->assertNoText('Active context: testcontext');
// Test other user mode
$this->context->conditions['user_page']['options']['mode'] = 'other';
$saved = context_save($this->context);
$this
->assertTrue($saved, "Context 'testcontext' saved.");
$this
->drupalGet("user/{$this->user1->uid}");
$this
->assertNoText('Active context: testcontext');
$this
->drupalGet("user/{$this->user2->uid}");
$this
->assertText('Active context: testcontext');
}