You are here

function UbercartCartLinksTestCase::testCartLinksUISettingsPage in Ubercart 6.2

Same name and namespace in other branches
  1. 7.3 uc_cart_links/tests/uc_cart_links.test \UbercartCartLinksTestCase::testCartLinksUISettingsPage()

Tests access to admin settings page and test default values.

File

uc_cart_links/uc_cart_links.test, line 34
Ubercart Cart Links Tests.

Class

UbercartCartLinksTestCase
SimpleTests for Ubercart Cart Links.

Code

function testCartLinksUISettingsPage() {

  // Access settings page by anonymous user
  $this
    ->drupalGet('admin/store/settings/cart_links');
  $this
    ->assertText(t('Access denied'));
  $this
    ->assertText(t('You are not authorized to access this page.'));

  // Access settings page by privileged user
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet('admin/store/settings/cart_links');
  $this
    ->assertText(t('Cart links settings'), t('Settings page found.'));
  $this
    ->assertFieldByName('uc_cart_links_add_show', 0, t('Display cart links product action messages is off.'));
  $this
    ->assertFieldByName('uc_cart_links_track', 1, t('Track clicks is on.'));
  $this
    ->assertFieldByName('uc_cart_links_empty', 1, t('Allow cart links to empty carts is on.'));
  $this
    ->assertFieldByName('uc_cart_links_messages', '', t('Cart links messages  is empty.'));
  $this
    ->assertFieldByName('uc_cart_links_restrictions', '', t('Cart links restrictions is empty.'));

  // Test presence of and contents of Help page
  $this
    ->clickLink(t('View the help page'));
  $this
    ->assertText('http://www.example.com/cart/add/<cart_link_content>', t('Help text found.'));
}