You are here

function ContextUiTestCase::testCreateContext in Context 7.3

Same name and namespace in other branches
  1. 6.3 context_ui/tests/context_ui.test \ContextUiTestCase::testCreateContext()
  2. 6 context_ui/tests/context_ui.test \ContextUiTestCase::testCreateContext()
  3. 6.2 context_ui/tests/context_ui.test \ContextUiTestCase::testCreateContext()

File

context_ui/tests/context_ui.test, line 34

Class

ContextUiTestCase
Functional Test for Context UI

Code

function testCreateContext() {

  // Create context
  $context = new stdClass();
  $context->name = strtolower($this
    ->randomName(15));
  $context->description = strtolower($this
    ->randomName(15));
  $context->tag = strtolower($this
    ->randomName(15));
  $this->context = $context;
  $this
    ->drupalGet('admin');
  $this
    ->drupalGet('admin/structure');
  $this
    ->drupalGet('admin/structure/context');
  $edit = array(
    'name' => $context->name,
    'description' => $context->description,
    'tag' => $context->tag,
    'conditions[plugins][node][values][blog]' => 'blog',
    'reactions[plugins][menu][]' => 'navigation:node/add/blog',
  );
  $this
    ->drupalPost('admin/structure/context/add', $edit, 'Save');
  $this
    ->assertText($context->name . ' has been created.', 'Context saved.');
  $edit = array();

  // export_ui confirm delete
  $this
    ->drupalPost('admin/structure/context/list/' . $context->name . '/edit', $edit, 'Delete');
  $this
    ->assertTrue(strpos($this
    ->getUrl(), 'admin/structure/context/list/' . $context->name . '/delete') !== FALSE, 'Context deletion confirmation page displayed');
}