xmlsitemap_taxonomy.test 1.46 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
<?php

/**
 * @file
 * Unit tests for the xmlsitemap_taxonomy module.
 */

class XMLSitemapTaxonomyFunctionalTest extends XMLSitemapTestHelper {
  protected $normal_user;
  protected $terms = array();

  public static function getInfo() {
    return array(
      'name' => 'XML sitemap taxonomy',
      'description' => 'Functional tests for the XML sitemap taxonomy module.',
      'group' => 'XML sitemap',
    );
  }

20 21 22 23
  function setUp($modules = array()) {
    $modules[] = 'xmlsitemap_taxonomy';
    $modules[] = 'taxonomy';
    parent::setUp($modules);
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39

    $this->admin_user = $this->drupalCreateUser(array('administer taxonomy', 'administer xmlsitemap'));
    $this->normal_user = $this->drupalCreateUser(array('access content'));
  }

  function testTaxonomySettings() {
    $this->drupalLogin($this->admin_user);

    $edit = array(
      'name' => $this->randomName(),
      'machine_name' => drupal_strtolower($this->randomName()),
      'xmlsitemap[status]' => '1',
      'xmlsitemap[priority]' => '1.0',
    );
    $this->drupalPost('admin/structure/taxonomy/add', $edit, 'Save');
    $this->assertText("Created new vocabulary {$edit['name']}.");
40
    $vocabulary = taxonomy_vocabulary_machine_name_load($edit['machine_name']);
41 42 43 44 45 46

    $edit = array(
      'name' => $this->randomName(),
      'xmlsitemap[status]' => 'default',
      'xmlsitemap[priority]' => 'default',
    );
47
    $this->drupalPost("admin/structure/taxonomy/{$vocabulary->machine_name}/add", $edit, 'Save');
48 49
  }
}