xmlsitemap_taxonomy.test 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * @file
  4. * Unit tests for the xmlsitemap_taxonomy module.
  5. */
  6. class XMLSitemapTaxonomyFunctionalTest extends XMLSitemapTestHelper {
  7. protected $normal_user;
  8. protected $terms = array();
  9. public static function getInfo() {
  10. return array(
  11. 'name' => 'XML sitemap taxonomy',
  12. 'description' => 'Functional tests for the XML sitemap taxonomy module.',
  13. 'group' => 'XML sitemap',
  14. );
  15. }
  16. function setUp($modules = array()) {
  17. $modules[] = 'xmlsitemap_taxonomy';
  18. $modules[] = 'taxonomy';
  19. parent::setUp($modules);
  20. $this->admin_user = $this->drupalCreateUser(array('administer taxonomy', 'administer xmlsitemap'));
  21. $this->normal_user = $this->drupalCreateUser(array('access content'));
  22. }
  23. function testTaxonomySettings() {
  24. $this->drupalLogin($this->admin_user);
  25. $edit = array(
  26. 'name' => $this->randomName(),
  27. 'machine_name' => drupal_strtolower($this->randomName()),
  28. 'xmlsitemap[status]' => '1',
  29. 'xmlsitemap[priority]' => '1.0',
  30. );
  31. $this->drupalPost('admin/structure/taxonomy/add', $edit, 'Save');
  32. $this->assertText("Created new vocabulary {$edit['name']}.");
  33. $vocabulary = taxonomy_vocabulary_machine_name_load($edit['machine_name']);
  34. $edit = array(
  35. 'name' => $this->randomName(),
  36. 'xmlsitemap[status]' => 'default',
  37. 'xmlsitemap[priority]' => 'default',
  38. );
  39. $this->drupalPost("admin/structure/taxonomy/{$vocabulary->machine_name}/add", $edit, 'Save');
  40. }
  41. }