You are here

protected function UbercartCreditCardTestCase::configureCreditCard in Ubercart 7.3

Same name and namespace in other branches
  1. 6.2 payment/uc_credit/uc_credit.test \UbercartCreditCardTestCase::configureCreditCard()

Helper function to configure Credit Card payment method settings.

1 call to UbercartCreditCardTestCase::configureCreditCard()
UbercartCreditCardTestCase::setUp in payment/uc_credit/tests/uc_credit.test
Implements DrupalWebTestCase::setUp().

File

payment/uc_credit/tests/uc_credit.test, line 80
Credit card payment method tests.

Class

UbercartCreditCardTestCase
Tests credit card payments with the test gateway.

Code

protected function configureCreditCard() {
  $this
    ->drupalPost('admin/store/settings/payment', array(
    'uc_payment_method_credit_checkout' => TRUE,
  ), t('Save configuration'));
  $this
    ->assertFieldByName('uc_payment_method_credit_checkout', TRUE, t('Credit card payment method is enabled'));

  // Create key directory, make it readable and writeable.
  // Putting this under sites/default/files because SimpleTest needs to be
  // able to create the directory - this is NOT where you'd put the key file
  // on a live site.  On a live site, it should be outside the web root.
  drupal_mkdir('sites/default/files/simpletest.keys', 0755);
  $this
    ->drupalPost('admin/store/settings/payment/method/credit', array(
    'uc_credit_encryption_path' => 'sites/default/files/simpletest.keys',
  ), t('Save configuration'));
  $this
    ->assertFieldByName('uc_credit_encryption_path', 'sites/default/files/simpletest.keys', t('Key file path has been set.'));
  $this
    ->assertTrue(file_exists('sites/default/files/simpletest.keys/' . UC_CREDIT_KEYFILE_NAME), t('Key has been generated and stored.'));
  $this
    ->pass('Key = ' . uc_credit_encryption_key());
}