You are here

public function ServiceControllerTest::testMissingTicketRedirectsHome in CAS 8

Same name and namespace in other branches
  1. 2.x tests/src/Unit/Controller/ServiceControllerTest.php \Drupal\Tests\cas\Unit\Controller\ServiceControllerTest::testMissingTicketRedirectsHome()

Tests that we redirect to the homepage when no service ticket is present.

@dataProvider parameterDataProvider

File

tests/src/Unit/Controller/ServiceControllerTest.php, line 232

Class

ServiceControllerTest
ServiceController unit tests.

Namespace

Drupal\Tests\cas\Unit\Controller

Code

public function testMissingTicketRedirectsHome($returnto) {
  $this
    ->setupRequestParameters($returnto, FALSE, FALSE);
  $this->requestStack
    ->expects($this
    ->once())
    ->method('getCurrentRequest')
    ->will($this
    ->returnValue($this->requestObject));
  if ($returnto) {
    $this
      ->assertDestinationSetFromReturnTo();
  }
  $serviceController = new ServiceController($this->casHelper, $this->casValidator, $this->casUserManager, $this->casLogout, $this->requestStack, $this->urlGenerator, $this->configFactory, $this->messenger, $this->eventDispatcher
    ->reveal(), $this->externalAuth
    ->reveal());
  $serviceController
    ->setStringTranslation($this
    ->getStringTranslationStub());
  $this
    ->assertRedirectedToFrontPageOnHandle($serviceController);
}