You are here

public function AppInfoTest::testStripeAppInfo in Commerce Stripe 8

Tests Stripe app info set during plugin initialization.

File

tests/src/Kernel/AppInfoTest.php, line 36

Class

AppInfoTest
Tests the Stripe app information.

Namespace

Drupal\Tests\commerce_stripe\Kernel

Code

public function testStripeAppInfo() {
  $extension_list = $this
    ->prophesize(ModuleExtensionList::class);
  $extension_list
    ->getExtensionInfo('commerce_stripe')
    ->willReturn([
    'version' => '8.x-1.0-test',
  ]);
  $secret_key = $this
    ->randomMachineName();
  new Stripe([
    'secret_key' => $secret_key,
  ], 'stripe', [
    'payment_type' => 'default',
    'payment_method_types' => [
      'credit_card',
    ],
    'forms' => [],
    'modes' => [
      'test',
      'prod',
    ],
    'display_label' => 'Stripe',
  ], $this
    ->prophesize(EntityTypeManagerInterface::class)
    ->reveal(), $this
    ->prophesize(PaymentTypeManager::class)
    ->reveal(), $this
    ->prophesize(PaymentMethodTypeManager::class)
    ->reveal(), $this
    ->prophesize(TimeInterface::class)
    ->reveal(), $this
    ->prophesize(MinorUnitsConverterInterface::class)
    ->reveal(), $this
    ->prophesize(EventDispatcherInterface::class)
    ->reveal(), $extension_list
    ->reveal());
  $app_info = StripeLibrary::getAppInfo();
  $this
    ->assertEquals([
    'name' => 'Centarro Commerce for Drupal',
    'partner_id' => 'pp_partner_Fa3jTqCJqTDtHD',
    'url' => 'https://www.drupal.org/project/commerce_stripe',
    'version' => '8.x-1.0-test',
  ], $app_info);
}