public function UbercartCartCheckoutTestCase::testCheckoutLogin in Ubercart 7.3
Same name and namespace in other branches
- 6.2 uc_cart/uc_cart.test \UbercartCartCheckoutTestCase::testCheckoutLogin()
Tests logging in the customer after checkout.
File
- uc_cart/
tests/ uc_cart.test, line 378 - Shopping cart and checkout tests.
Class
- UbercartCartCheckoutTestCase
- Tests the cart and checkout functionality.
Code
public function testCheckoutLogin() {
// Log in after checkout.
variable_set('uc_new_customer_login', TRUE);
// Test checkout.
$this
->drupalGet('node/' . $this->product->nid);
$this
->drupalPost(NULL, array(), t('Add to cart'));
$this
->assertNotNull($this->session_id, 'Session ID is set.');
$session_id = $this->session_id;
$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.');
}