/**
  * Tests the formatter().
  */
 protected function testFormatter()
 {
     // Make sure there are no payments yet.
     $this->assertEqual(count($this->paymentStorage->loadMultiple()), 0);
     $user = $this->drupalCreateUser(['access user profiles']);
     $this->drupalLogin($user);
     $path = 'user/' . $this->user->id();
     $this->drupalPostForm($path, [], t('Pay'));
     // The front page is the currently logged-in user.
     $this->assertUrl($path);
     $this->assertResponse('200');
     // This is supposed to be the first and only payment.
     /** @var \Drupal\payment\Entity\PaymentInterface $payment */
     $payment = $this->paymentStorage->load(1);
     if ($this->assertTrue((bool) $payment)) {
         $this->assertTrue($payment->getPaymentType() instanceof PaymentForm);
         $this->assertIdentical($payment->getPaymentStatus()->getPluginId(), $this->executeStatusPluginId);
     }
 }
 /**
  * @covers ::createInstance
  * @covers ::__construct
  */
 public function testCreateInstance()
 {
     $container = $this->getMock(ContainerInterface::class);
     $map = array(array('cache.entity', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->cacheBackend), array('database', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->database), array('entity.manager', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->entityManager), array('language_manager', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->languageManager), array('plugin.manager.payment.status', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->paymentStatusManager), array('plugin.manager.payment.type', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->paymentTypeManager));
     $container->expects($this->any())->method('get')->willReturnMap($map);
     $sut = PaymentStorage::createInstance($container, $this->entityType);
     $this->assertInstanceOf(PaymentStorage::class, $sut);
 }