You are here

protected function PaymentReferenceTest::setUp in Payment 8.2

Same name in this branch
  1. 8.2 modules/payment_reference/tests/src/Unit/Element/PaymentReferenceTest.php \Drupal\Tests\payment_reference\Unit\Element\PaymentReferenceTest::setUp()
  2. 8.2 modules/payment_reference/tests/src/Unit/Plugin/Payment/Type/PaymentReferenceTest.php \Drupal\Tests\payment_reference\Unit\Plugin\Payment\Type\PaymentReferenceTest::setUp()
  3. 8.2 modules/payment_reference/tests/src/Unit/Plugin/Field/FieldWidget/PaymentReferenceTest.php \Drupal\Tests\payment_reference\Unit\Plugin\Field\FieldWidget\PaymentReferenceTest::setUp()
  4. 8.2 modules/payment_reference/tests/src/Unit/Plugin/Field/FieldType/PaymentReferenceTest.php \Drupal\Tests\payment_reference\Unit\Plugin\Field\FieldType\PaymentReferenceTest::setUp()

Overrides UnitTestCase::setUp

File

modules/payment_reference/tests/src/Unit/Plugin/Payment/Type/PaymentReferenceTest.php, line 70

Class

PaymentReferenceTest
@coversDefaultClass \Drupal\payment_reference\Plugin\Payment\Type\PaymentReference

Namespace

Drupal\Tests\payment_reference\Unit\Plugin\Payment\Type

Code

protected function setUp() : void {
  $this->eventDispatcher = $this
    ->createMock(EventDispatcherInterface::class);
  $this->entityFieldManager = $this
    ->createMock(EntityFieldManagerInterface::class);
  $this->urlGenerator = $this
    ->createMock(UrlGeneratorInterface::class);
  $this->urlGenerator
    ->expects($this
    ->any())
    ->method('generateFromRoute')
    ->willReturn('http://example.com');
  $this->stringTranslation = $this
    ->getStringTranslationStub();
  $this->payment = $this
    ->createMock(PaymentInterface::class);
  $this->sut = new PaymentReference([], 'payment_reference', [], $this->eventDispatcher, $this->urlGenerator, $this->entityFieldManager, $this->stringTranslation);
  $this->sut
    ->setPayment($this->payment);
}