public function PaymentReferenceBaseTest::testBuildCompletePaymentLinkWithoutPaymentMethod in Payment 8.2
@covers ::buildCompletePaymentLink
File
- tests/
src/ Unit/ Element/ PaymentReferenceBaseTest.php, line 594
Class
- PaymentReferenceBaseTest
- @coversDefaultClass \Drupal\payment\Element\PaymentReferenceBase
Namespace
Drupal\Tests\payment\Unit\ElementCode
public function testBuildCompletePaymentLinkWithoutPaymentMethod() {
$configuration = [];
$plugin_id = $this
->randomMachineName();
$this->pluginDefinition = [];
$element = array(
'#foo' => $this
->randomMachineName(),
);
$form_state = $this
->createMock(FormStateInterface::class);
$plugin_selector = $this
->createMock(PluginSelectorInterface::class);
$this->sut = $this
->getMockBuilder(PaymentReferenceBase::class)
->setConstructorArgs(array(
$configuration,
$plugin_id,
$this->pluginDefinition,
$this->requestStack,
$this->paymentStorage,
$this->stringTranslation,
$this->dateFormatter,
$this->linkGenerator,
$this->renderer,
$this->currentUser,
$this->pluginSelectorManager,
$this->paymentMethodType,
new Random(),
))
->setMethods(array(
'getPluginSelector',
))
->getMockForAbstractClass();
$this->sut
->expects($this
->atLeastOnce())
->method('getPluginSelector')
->with($element, $form_state)
->willReturn($plugin_selector);
$method = new \ReflectionMethod($this->sut, 'buildCompletePaymentLink');
$method
->setAccessible(TRUE);
$build = $method
->invoke($this->sut, $element, $form_state);
$this
->assertSame([], $build);
}