public function ServiceControllerTest::testLoginError in CAS 2.x
Same name and namespace in other branches
- 8 tests/src/Unit/Controller/ServiceControllerTest.php \Drupal\Tests\cas\Unit\Controller\ServiceControllerTest::testLoginError()
Tests for a potential login error.
@dataProvider parameterDataProvider
File
- tests/
src/ Unit/ Controller/ ServiceControllerTest.php, line 425
Class
- ServiceControllerTest
- ServiceController unit tests.
Namespace
Drupal\Tests\cas\Unit\ControllerCode
public function testLoginError($returnto) {
$this
->setupRequestParameters($returnto, FALSE, TRUE);
$this->requestStack
->expects($this
->once())
->method('getCurrentRequest')
->will($this
->returnValue($this->requestObject));
$this
->assertSuccessfulValidation($returnto);
// Login should throw an exception.
$this->casUserManager
->expects($this
->once())
->method('login')
->will($this
->throwException(new CasLoginException()));
$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
->assertRedirectedToSpecialPageOnLoginFailure($serviceController);
}