xmlsitemap_taxonomy.test 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. /**
  3. * @file
  4. * Unit tests for the xmlsitemap_taxonomy module.
  5. */
  6. /**
  7. * Functional Test.
  8. */
  9. class XMLSitemapTaxonomyFunctionalTest extends XMLSitemapTestHelper {
  10. /**
  11. * Normal User.
  12. *
  13. * @var string
  14. *
  15. * @codingStandardsIgnoreStart
  16. */
  17. protected $normal_user;
  18. /**
  19. * Terms.
  20. *
  21. * @var array
  22. */
  23. protected $terms = array();
  24. /**
  25. * Get Info.
  26. *
  27. * @codingStandardsIgnoreEnd
  28. */
  29. public static function getInfo() {
  30. return array(
  31. 'name' => 'XML sitemap taxonomy',
  32. 'description' => 'Functional tests for the XML sitemap taxonomy module.',
  33. 'group' => 'XML sitemap',
  34. );
  35. }
  36. /**
  37. * SetUp.
  38. */
  39. public function setUp($modules = array()) {
  40. $modules[] = 'xmlsitemap_taxonomy';
  41. $modules[] = 'taxonomy';
  42. parent::setUp($modules);
  43. $this->admin_user = $this->drupalCreateUser(array('administer taxonomy', 'administer xmlsitemap'));
  44. $this->normal_user = $this->drupalCreateUser(array('access content'));
  45. }
  46. /**
  47. * TaxonomySettings.
  48. */
  49. public function testTaxonomySettings() {
  50. $this->drupalLogin($this->admin_user);
  51. $edit = array(
  52. 'name' => $this->randomName(),
  53. 'machine_name' => drupal_strtolower($this->randomName()),
  54. 'xmlsitemap[status]' => '1',
  55. 'xmlsitemap[priority]' => '1.0',
  56. );
  57. $this->drupalPost('admin/structure/taxonomy/add', $edit, 'Save');
  58. $this->assertText("Created new vocabulary {$edit['name']}.");
  59. $vocabulary = taxonomy_vocabulary_machine_name_load($edit['machine_name']);
  60. $edit = array(
  61. 'name' => $this->randomName(),
  62. 'xmlsitemap[status]' => 'default',
  63. 'xmlsitemap[priority]' => 'default',
  64. );
  65. $this->drupalPost("admin/structure/taxonomy/{$vocabulary->machine_name}/add", $edit, 'Save');
  66. }
  67. }