You are here

function BoxesSpacesTestCase::testTermSpace in Boxes 6

Same name and namespace in other branches
  1. 7 tests/boxes_spaces.test \BoxesSpacesTestCase::testTermSpace()

File

tests/boxes.test, line 231

Class

BoxesSpacesTestCase

Code

function testTermSpace() {

  // Setup; set the purl type to path.
  $edit = array(
    'purl_types[path]' => 'path',
  );
  $this
    ->drupalPost('admin/settings/purl/types', $edit, t('Save configuration'));

  // Setup; enable path prefixing for taxonomy spaces.
  $edit = array(
    'purl_method_spaces_taxonomy' => 'path',
  );
  $this
    ->drupalPost('admin/settings/purl', $edit, t('Save configuration'));

  // Setup; create a vocabulary.
  $edit = array(
    'name' => $this
      ->randomName(),
    'module' => strtolower($this
      ->randomName()),
  );
  $this
    ->drupalPost('admin/content/taxonomy/add/vocabulary', $edit, t('Save'));

  // Setup; Enable this vocab for spaces_taxonomy.
  $edit = array(
    'spaces_taxonomy_vid' => '1',
  );
  $this
    ->drupalPost('admin/build/spaces/taxonomy', $edit, t('Save configuration'));

  // Setup; Create our term space.
  $edit = array(
    'name' => $this
      ->randomName(),
    'purl[value]' => strtolower($this
      ->randomName()),
  );
  $this
    ->drupalPost('admin/content/taxonomy/1/add/term', $edit, t('Save'));

  // Testing!
  $prefix = $edit['purl[value]'];
  $this
    ->drupalGet($prefix . '/node');
  $this
    ->assertResponse('200', 'Response code 200');
  $delta = $this
    ->runTest($prefix . '/node');

  // Before this final check we make sure that user/%uid/features/override
  // path is actually available. Some of our caches are over exuberant.
  $this
    ->drupalPost('admin/settings/performance', array(), t('Clear cached data'));
  $this
    ->drupalGet('taxonomy/term/1/features/overrides');
  $this
    ->assertResponse('200', 'Response code 200');
  $this
    ->assertText($delta, 'Found overridden box: ' . $delta);
}