You are here

public function CasHelperTest::testHandleReturnToParameter in CAS 8

Same name and namespace in other branches
  1. 2.x tests/src/Unit/Service/CasHelperTest.php \Drupal\Tests\cas\Unit\Service\CasHelperTest::testHandleReturnToParameter()

@covers ::handleReturnToParameter

File

tests/src/Unit/Service/CasHelperTest.php, line 142

Class

CasHelperTest
CasHelper unit tests.

Namespace

Drupal\Tests\cas\Unit\Service

Code

public function testHandleReturnToParameter() {
  $config_factory = $this
    ->getConfigFactoryStub([
    'cas.settings' => [
      'advanced.debug_log' => FALSE,
    ],
  ]);
  $cas_helper = new CasHelper($config_factory, new LoggerChannelFactory(), $this->token
    ->reveal());
  $request = new Request([
    'returnto' => 'node/1',
  ]);
  $this
    ->assertFalse($request->query
    ->has('destination'));
  $this
    ->assertSame('node/1', $request->query
    ->get('returnto'));
  $cas_helper
    ->handleReturnToParameter($request);

  // Check that the 'returnto' has been copied to 'destination'.
  $this
    ->assertSame('node/1', $request->query
    ->get('destination'));
  $this
    ->assertSame('node/1', $request->query
    ->get('returnto'));
}