uc_catalog.test 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * @file
  4. * Tests for the Ubercart catalog.
  5. */
  6. class UbercartCatalogTestCase extends UbercartTestHelper {
  7. public static function getInfo() {
  8. return array(
  9. 'name' => 'Catalog',
  10. 'description' => 'Ensure that the catalog functions properly.',
  11. 'group' => 'Ubercart',
  12. );
  13. }
  14. /**
  15. * Overrides DrupalWebTestCase::setUp().
  16. */
  17. public function setUp() {
  18. $modules = array('uc_catalog', 'field_ui');
  19. $permissions = array('administer catalog', 'administer content types');
  20. parent::setUp($modules, $permissions);
  21. }
  22. public function testCatalogRepair() {
  23. $this->drupalLogin($this->adminUser);
  24. $this->drupalGet('admin/structure/types/manage/product/fields');
  25. $this->assertText('taxonomy_catalog', 'Catalog taxonomy term reference field exists.');
  26. $this->drupalPost('admin/structure/types/manage/product/fields/taxonomy_catalog/delete', array(), t('Delete'));
  27. $this->assertText('The field Catalog has been deleted from the Product content type.', 'Catalog taxonomy term reference field deleted.');
  28. $this->drupalGet('admin/structure/types/manage/product/fields');
  29. $this->assertNoText('taxonomy_catalog', 'Catalog taxonomy term reference field does not exist.');
  30. $this->drupalGet('admin/store');
  31. $this->assertText('The catalog taxonomy reference field is missing.', 'Store status message mentions the missing field.');
  32. $this->drupalGet('admin/store/settings/catalog/repair');
  33. $this->assertText('The catalog taxonomy reference field has been repaired.', 'Repair message is displayed.');
  34. $this->drupalGet('admin/structure/types/manage/product/fields');
  35. $this->assertText('taxonomy_catalog', 'Catalog taxonomy term reference field exists.');
  36. }
  37. }