You are here

public function ConfigDeriverTest::testGetDerivativeDefinitions in Payment 8.2

@covers ::getDerivativeDefinitions

File

tests/src/Unit/Plugin/Payment/Status/ConfigDeriverTest.php, line 71

Class

ConfigDeriverTest
@coversDefaultClass \Drupal\payment\Plugin\Payment\Status\ConfigDeriver

Namespace

Drupal\Tests\payment\Unit\Plugin\Payment\Status

Code

public function testGetDerivativeDefinitions() {
  $status_a = $this
    ->createMock(PaymentStatusInterface::class);
  $status_a
    ->expects($this
    ->once())
    ->method('getDescription')
    ->willReturn($this
    ->randomMachineName());
  $status_a
    ->expects($this
    ->once())
    ->method('id')
    ->willReturn($this
    ->randomMachineName());
  $status_a
    ->expects($this
    ->once())
    ->method('label')
    ->willReturn($this
    ->randomMachineName());
  $status_a
    ->expects($this
    ->once())
    ->method('getParentId')
    ->willReturn($this
    ->randomMachineName());
  $status_b = $this
    ->createMock(PaymentStatusInterface::class);
  $status_b
    ->expects($this
    ->once())
    ->method('getDescription')
    ->willReturn($this
    ->randomMachineName());
  $status_b
    ->expects($this
    ->once())
    ->method('id')
    ->willReturn($this
    ->randomMachineName());
  $status_b
    ->expects($this
    ->once())
    ->method('label')
    ->willReturn($this
    ->randomMachineName());
  $status_b
    ->expects($this
    ->once())
    ->method('getParentId')
    ->willReturn($this
    ->randomMachineName());
  $this->paymentStatusStorage
    ->expects($this
    ->once())
    ->method('loadMultiple')
    ->willReturn(array(
    $status_a,
    $status_b,
  ));
  $derivatives = $this->sut
    ->getDerivativeDefinitions([]);
  $this
    ->assertCount(2, $derivatives);
}