You are here

public function ServiceControllerTest::testSingleLogout 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::testSingleLogout()

Tests a single logout request.

@dataProvider parameterDataProvider

File

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

Class

ServiceControllerTest
ServiceController unit tests.

Namespace

Drupal\Tests\cas\Unit\Controller

Code

public function testSingleLogout($returnto) {
  $this
    ->setupRequestParameters($returnto, TRUE, FALSE);
  $this->requestStack
    ->expects($this
    ->once())
    ->method('getCurrentRequest')
    ->will($this
    ->returnValue($this->requestObject));
  $this->casLogout
    ->expects($this
    ->once())
    ->method('handleSlo')
    ->with($this
    ->equalTo('<foobar/>'));
  $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());
  $response = $serviceController
    ->handle();
  $this
    ->assertEquals(200, $response
    ->getStatusCode());
  $this
    ->assertEquals('', $response
    ->getContent());
}