/**
  * @covers ::createInstance
  */
 public function testCreateInstance()
 {
     $plugin_id_a = $this->randomMachineName();
     $plugin_a = $this->getMock(PluginInspectionInterface::class);
     $plugin_id_b = $this->randomMachineName();
     $plugin_b = $this->getMock(PaymentAwarePluginFilteredPluginManagerUnitTestPaymentAwarePlugin::class);
     $plugin_b->expects($this->atLeastOnce())->method('setPayment')->with($this->payment);
     $map = [[$plugin_id_a, [], $plugin_a], [$plugin_id_b, [], $plugin_b]];
     $this->pluginManager->expects($this->atLeast(count($map)))->method('createInstance')->willReturnMap($map);
     $this->assertSame($plugin_a, $this->sut->createInstance($plugin_id_a));
     $this->assertSame($plugin_b, $this->sut->createInstance($plugin_id_b));
 }
 /**
  * Creates a new instance.
  *
  * @param \Drupal\payment\Entity\PaymentInterface
  *   The payment to check execution access for.
  * @param \Drupal\Core\Session\AccountInterface $account
  *   The account to check payment execution access for.
  * @param \Drupal\payment\Plugin\Payment\Method\PaymentMethodManagerInterface $payment_method_manager
  *   The payment method manager.
  * @param \Drupal\Component\Plugin\Discovery\DiscoveryInterface|null $discovery
  *   A plugin discovery to use instead of the decorated plugin manager, or
  *   NULL to use the decorated plugin manager.
  */
 public function __construct(PaymentInterface $payment, AccountInterface $account, PaymentMethodManagerInterface $payment_method_manager, DiscoveryInterface $discovery = NULL)
 {
     parent::__construct($payment, $payment_method_manager, $discovery);
     $this->account = $account;
     $this->decoratedPaymentMethodManager = $payment_method_manager;
 }