You are here

function UbercartCartCheckoutTestCase::testCheckoutLogin in Ubercart 6.2

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

File

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

Class

UbercartCartCheckoutTestCase
Tests the cart and checkout functionality.

Code

function testCheckoutLogin() {

  // Log in after checkout.
  variable_set('uc_new_customer_login', TRUE);

  // Test checkout.
  $this
    ->drupalGet('node/' . $this->product->nid);
  $this
    ->assertNotNull($this->session_id, 'Session ID is set.');
  $session_id = $this->session_id;
  $this
    ->drupalPost(NULL, array(), t('Add to cart'));
  $this
    ->checkout();
  $this
    ->assertRaw('Your order is complete!');
  $this
    ->assertRaw('you are already logged in');

  // Confirm login.
  $this
    ->assertNotNull($this->session_id, 'Session ID is set.');
  $this
    ->assertNotIdentical($this->session_id, $session_id, 'Session ID has changed.');
  $this
    ->drupalGet('<front>');
  $this
    ->assertText('My account', 'User is logged in.');

  // Check that cart is now empty.
  $this
    ->drupalGet('cart');
  $this
    ->assertText('There are no products in your shopping cart.');
}