You are here

public function LTIToolProviderControllerTest::testLtiReturnWithContext in LTI Tool Provider 8

Same name and namespace in other branches
  1. 2.x tests/src/Unit/LTIToolProviderControllerTest.php \Drupal\Tests\lti_tool_provider\Unit\LTIToolProviderControllerTest::testLtiReturnWithContext()

@dataProvider ltiReturnWithContextDataProvider @covers ::ltiReturn @covers ::__construct

Parameters

TrustedRedirectResponse $expected:

Request $request:

SessionInterface $session:

mixed $context:

string | null $destination:

File

tests/src/Unit/LTIToolProviderControllerTest.php, line 218

Class

LTIToolProviderControllerTest
LTIToolProviderController unit tests.

Namespace

Drupal\Tests\lti_tool_provider\Unit

Code

public function testLtiReturnWithContext(TrustedRedirectResponse $expected, Request $request, SessionInterface $session, $context, ?string $destination) {

  /* @var $controller LTIToolProviderController */
  $controller = $this
    ->getMockBuilder('Drupal\\lti_tool_provider\\Controller\\LTIToolProviderController')
    ->setConstructorArgs([
    $this->configFactory,
    $this->loggerFactory,
    $this->eventDispatcher,
    $this->killSwitch,
    $request,
    $session,
    $context,
    $destination,
  ])
    ->onlyMethods([
    'userLogout',
  ])
    ->getMock();
  $actual = $controller
    ->ltiReturn();
  $this
    ->assertInstanceOf(TrustedRedirectResponse::class, $actual);
  $this
    ->assertEquals($expected
    ->getTargetUrl(), $actual
    ->getTargetUrl());
}