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/Field/FieldType/PaymentReferenceTest.php, line 58

Class

PaymentReferenceTest
@coversDefaultClass \Drupal\payment_reference\Plugin\Field\FieldType\PaymentReference

Namespace

Drupal\Tests\payment_reference\Unit\Plugin\Field\FieldType

Code

protected function setUp() : void {
  $this->moduleHandler = $this
    ->createMock(ModuleHandlerInterface::class);
  $this->queue = $this
    ->createMock(QueueInterface::class);
  $this->stringTranslation = $this
    ->getStringTranslationStub();
  $this->targetId = $this
    ->createMock(TypedDataInterface::class);
  $container = new ContainerBuilder();
  $container
    ->set('module_handler', $this->moduleHandler);
  $container
    ->set('payment_reference.queue', $this->queue);
  $container
    ->set('string_translation', $this->stringTranslation);
  \Drupal::setContainer($container);
  $this->sut = $this
    ->getMockBuilder(PaymentReference::class)
    ->disableOriginalConstructor()
    ->setMethods([
    'get',
  ])
    ->getMock();
  $this->sut
    ->expects($this
    ->any())
    ->method('get')
    ->with('target_id')
    ->willReturn($this->targetId);
}