You are here

protected function ManagePaymentMethodsTest::setUp in Commerce Authorize.Net 8

Overrides CommerceBrowserTestBase::setUp

File

tests/src/Functional/ManagePaymentMethodsTest.php, line 44

Class

ManagePaymentMethodsTest
Tests the managing Authorize.net payment methods.

Namespace

Drupal\Tests\commerce_authnet\Functional

Code

protected function setUp() : void {
  $this
    ->markTestIncomplete();
  parent::setUp();

  /** @var \Drupal\commerce_payment\Entity\PaymentGateway $gateway */
  $gateway = PaymentGateway::create([
    'id' => 'authorize_net_us',
    'label' => 'Authorize.net US',
    'plugin' => 'authorizenet',
  ]);
  $gateway
    ->getPlugin()
    ->setConfiguration([
    'api_login' => '5KP3u95bQpv',
    'transaction_key' => '346HZ32z3fP4hTG2',
    'mode' => 'test',
    'payment_method_types' => [
      'credit_card',
    ],
  ]);
  $gateway
    ->save();

  // Cheat so we don't need JS to interact w/ Address field widget.

  /** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $customer_form_display */
  $customer_form_display = EntityFormDisplay::load('profile.customer.default');
  $address_component = $customer_form_display
    ->getComponent('address');
  $address_component['settings']['default_country'] = 'US';
  $customer_form_display
    ->setComponent('address', $address_component);
  $customer_form_display
    ->save();
}