You are here

function BoxesSpacesTestCase::runTest in Boxes 6

Same name and namespace in other branches
  1. 7 tests/boxes_spaces.test \BoxesSpacesTestCase::runTest()
2 calls to BoxesSpacesTestCase::runTest()
BoxesSpacesTestCase::testTermSpace in tests/boxes.test
BoxesSpacesTestCase::testUserSpace in tests/boxes.test

File

tests/boxes.test, line 187

Class

BoxesSpacesTestCase

Code

function runTest($path) {
  $this
    ->ajaxLoadBoxesBlock('boxes_add__simple', $path);
  $this
    ->assertResponse('200', 'Response code 200');
  $this
    ->assertText(t('Add custom box'), 'Found box add form');
  $edit = array(
    'description' => $this
      ->randomName(),
    'title' => $this
      ->randomName(),
    'body' => $this
      ->randomName(32),
  );
  $this
    ->drupalPost(NULL, $edit, t('Save'));
  $response = $this
    ->parseJSON();
  $delta = null;
  foreach ($response as $command) {
    if ($command->command == 'getBlock') {
      $delta = $command->delta;
      break;
    }
  }
  if (!$delta) {
    $this
      ->fail('AJAX block submission failed');
  }
  $this
    ->ajaxLoadBoxesBlock($delta, $path);
  $this
    ->assertResponse('200', 'Response code 200');
  $this
    ->assertText($edit['title'], 'Found box');
  $this
    ->ajaxLoadBoxesBlock($delta, 'node');
  $this
    ->assertNoText($edit['title'], "Block not available outside spaces.");
  return $delta;
}