You are here

public function CommercePayleapTest::testCommercePayleapAuthTransaction in Commerce Payleap 7

Test the PayLeap Auth transaction.

File

tests/commerce_payleap.test, line 114
Functional tests for the commerce payment module user interface.

Class

CommercePayleapTest
Test payment user interface.

Code

public function testCommercePayleapAuthTransaction() {
  $user = $this->store_customer;

  // Log in as normal user.
  $this
    ->drupalLogin($user);
  $product = $this
    ->createDummyProduct($this
    ->randomName(), $this
    ->randomName(), 2, 'USD', $this->store_admin->uid);
  $this->order = $this
    ->createDummyOrder($user->uid, array(
    $product->product_id => 20,
  ));

  // Generate random information, as city, postal code, etc.
  $payment_method = $this
    ->getPayleapSettings(PAYLEAP_TXN_TYPE_DELAYED_CAPTURE);

  // We must pass a new credit card to avoid Duplicate transaction error.
  $info = $this
    ->createDummyCreditCardInfo($this->order, 'Auth', '4012888888881881');
  $response = commerce_payleap_request($payment_method, $info);
  $this
    ->assertTrue($response['status']);
}