You are here

public function UbercartCartLinksTestCase::testCartLinksUISettingsPage in Ubercart 7.3

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

Tests access to admin settings page and tests default values.

File

uc_cart_links/tests/uc_cart_links.test, line 31
Ubercart Cart Links Tests.

Class

UbercartCartLinksTestCase
SimpleTests for Ubercart Cart Links.

Code

public 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('View the help page to learn how to create Cart Links.'), 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.'));
}