metatag.bulk_revert.test 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Tests for the Metatag module to ensure the bulk revert functionality works
  4. */
  5. class MetatagBulkRevertTest extends MetatagTestHelper {
  6. /**
  7. * {@inheritdoc}
  8. */
  9. public static function getInfo() {
  10. return array(
  11. 'name' => 'Metatag bulk revert',
  12. 'description' => 'Test the Metatag bulk revert functionality.',
  13. 'group' => 'Metatag',
  14. 'dependencies' => array('ctools', 'token'),
  15. );
  16. }
  17. /**
  18. * Test the Bulk Revert functionality works.
  19. */
  20. function testBulkRevertPageLoads() {
  21. $this->adminUser = $this->createAdminUser();
  22. $this->drupalLogin($this->adminUser);
  23. $this->drupalGet('admin/config/search/metatags/bulk-revert');
  24. $this->assertResponse(200);
  25. // Confirm each of the entity checkboxes is present.
  26. foreach (entity_get_info() as $entity_type => $entity_info) {
  27. foreach (array_keys($entity_info['bundles']) as $bundle) {
  28. if (metatag_entity_supports_metatags($entity_type, $bundle)) {
  29. $this->assertFieldByName("update[{$entity_type}:{$bundle}]");
  30. }
  31. }
  32. }
  33. // Confirm each of the meta tags is available as a checkbox.
  34. foreach (metatag_get_info('tags') as $tag_name => $tag) {
  35. $this->assertFieldByName("tags[{$tag_name}]");
  36. }
  37. // Confirm each of the languages has a checkbox.
  38. $this->assertFieldByName("languages[" . LANGUAGE_NONE . "]");
  39. foreach (language_list() as $language) {
  40. $this->assertFieldByName("languages[{$language->language}]");
  41. }
  42. }
  43. }