You are here

function UbercartCartSettingsTestCase::testAddToCartRedirect in Ubercart 6.2

Same name and namespace in other branches
  1. 7.3 uc_cart/tests/uc_cart.test \UbercartCartSettingsTestCase::testAddToCartRedirect()

File

uc_cart/uc_cart.test, line 481
Shopping cart and checkout tests.

Class

UbercartCartSettingsTestCase
Tests the cart settings page.

Code

function testAddToCartRedirect() {
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet('admin/store/settings/cart/edit');
  $this
    ->assertField('uc_add_item_redirect', t('Add to cart redirect field exists'));
  $redirect = $this
    ->randomName(8);
  $this
    ->drupalPost('admin/store/settings/cart/edit', array(
    'uc_add_item_redirect' => $redirect,
  ), t('Save configuration'));
  $this
    ->drupalPost('node/' . $this->product->nid, array(), t('Add to cart'));
  $url_pass = $this
    ->getUrl() == url($redirect, array(
    'absolute' => TRUE,
  ));
  $this
    ->assertTrue($url_pass, t('Add to cart redirect takes user to the correct URL.'));
}