protected function CreditCardTest::configureCreditCard in Ubercart 8.4
Helper function to configure Credit Card payment method settings.
1 call to CreditCardTest::configureCreditCard()
- CreditCardTest::setUp in payment/
uc_credit/ tests/ src/ Functional/ CreditCardTest.php
File
- payment/
uc_credit/ tests/ src/ Functional/ CreditCardTest.php, line 287
Class
- CreditCardTest
- Tests credit card payments with the test gateway.
Namespace
Drupal\Tests\uc_credit\FunctionalCode
protected function configureCreditCard() {
/** @var \Drupal\Tests\WebAssert $assert */
$assert = $this
->assertSession();
// 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::service('file_system')
->mkdir('sites/default/files/simpletest.keys', 0755);
$this
->drupalGet('admin/store/config/payment/credit');
$this
->submitForm([
'uc_credit_encryption_path' => 'sites/default/files/simpletest.keys',
], 'Save configuration');
// Check that key file path has been set.
$assert
->fieldValueEquals('uc_credit_encryption_path', 'sites/default/files/simpletest.keys');
$this
->assertTrue(file_exists('sites/default/files/simpletest.keys/' . UC_CREDIT_KEYFILE_NAME), 'Key has been generated and stored.');
$this
->assertTrue(TRUE, 'Key = ' . uc_credit_encryption_key());
}