metatag.bulk_revert.test 1.6 KB

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