You are here

function BoxesSpacesTestCase::testTermSpace in Boxes 7

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

File

tests/boxes_spaces.test, line 76

Class

BoxesSpacesTestCase

Code

function testTermSpace() {

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

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

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

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

  // Setup; Create our term space.
  $edit = array(
    'name' => $this
      ->randomName(),
    'purl[value]' => strtolower($this
      ->randomName()),
  );
  $this
    ->drupalPost('admin/structure/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/config/development/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);
}