You are here

uc_catalog.test in Ubercart 7.3

Tests for the Ubercart catalog.

File

uc_catalog/tests/uc_catalog.test
View source
<?php

/**
 * @file
 * Tests for the Ubercart catalog.
 */

/**
 * Tests for the Ubercart catalog.
 */
class UbercartCatalogTestCase extends UbercartTestHelper {
  public static function getInfo() {
    return array(
      'name' => 'Catalog',
      'description' => 'Ensure that the catalog functions properly.',
      'group' => 'Ubercart',
    );
  }

  /**
   * Overrides DrupalWebTestCase::setUp().
   */
  protected function setUp($modules = array(), $permissions = array()) {
    $modules = array(
      'uc_catalog',
      'field_ui',
    );
    $permissions = array(
      'administer catalog',
      'administer content types',
      'administer fields',
    );
    parent::setUp($modules, $permissions);
  }

  /**
   * Tests the catalog repair function.
   */
  public function testCatalogRepair() {
    $this
      ->drupalLogin($this->adminUser);
    $this
      ->drupalGet('admin/structure/types/manage/product/fields');
    $this
      ->assertText('taxonomy_catalog', 'Catalog taxonomy term reference field exists.');
    $this
      ->drupalPost('admin/structure/types/manage/product/fields/taxonomy_catalog/delete', array(), t('Delete'));
    $this
      ->assertText('The field Catalog has been deleted from the Product content type.', 'Catalog taxonomy term reference field deleted.');
    $this
      ->drupalGet('admin/structure/types/manage/product/fields');
    $this
      ->assertNoText('taxonomy_catalog', 'Catalog taxonomy term reference field does not exist.');
    $this
      ->drupalGet('admin/store');
    $this
      ->assertText('The catalog taxonomy reference field is missing.', 'Store status message mentions the missing field.');
    $this
      ->drupalGet('admin/store/settings/catalog/repair');
    $this
      ->assertText('The catalog taxonomy reference field has been repaired.', 'Repair message is displayed.');
    $this
      ->drupalGet('admin/structure/types/manage/product/fields');
    $this
      ->assertText('taxonomy_catalog', 'Catalog taxonomy term reference field exists.');
  }

}

Classes

Namesort descending Description
UbercartCatalogTestCase Tests for the Ubercart catalog.