You are here

public function UpgradeConfigTest::testClientKeyMessage in Commerce Authorize.Net 8

Tests the client key message.

File

tests/src/Kernel/UpgradeConfigTest.php, line 67

Class

UpgradeConfigTest
Tests config upgrades / post updates.

Namespace

Drupal\Tests\commerce_authnet\Kernel

Code

public function testClientKeyMessage() {
  $this
    ->installFixture(__DIR__ . '/../../fixtures/authorizenet-pre-acceptjs.php.gz');
  $results = [];
  $authnet_post_updates = $this->container
    ->get('update.post_update_registry')
    ->getModuleUpdateFunctions('commerce_authnet');
  $this
    ->assertCount(2, $authnet_post_updates);
  foreach ($authnet_post_updates as $authnet_post_update) {
    $sandbox = [];
    $results[] = $authnet_post_update($sandbox);
  }
  $this
    ->assertCount(2, $results);

  /** @var \Drupal\commerce_payment\Entity\PaymentGateway $gateway */
  $gateway = PaymentGateway::load('authorizenet_pre_acceptjs');
  $this
    ->assertEquals(t('Please provide a client key for %labels. It is required to continue accepting payments.', [
    '%labels' => implode(', ', [
      $gateway
        ->label(),
    ]),
  ]), $results[1]);
}