Skip to content

Commit

Permalink
Added SAML Controller dispatchTyped test
Browse files Browse the repository at this point in the history
  • Loading branch information
x7airworker authored and blizzz committed Sep 5, 2024
1 parent d8721cd commit d4a4377
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/unit/Controller/SAMLControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use OCA\User_SAML\UserResolver;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IRequest;
Expand Down Expand Up @@ -57,6 +58,7 @@ class SAMLControllerTest extends TestCase {
/** @var SAMLController */
private $samlController;
private ITrustedDomainHelper|MockObject $trustedDomainController;
private IEventDispatcher $eventDispatcher;

protected function setUp(): void {
parent::setUp();
Expand All @@ -74,6 +76,7 @@ protected function setUp(): void {
$this->userData = $this->createMock(UserData::class);
$this->crypto = $this->createMock(ICrypto::class);
$this->trustedDomainController = $this->createMock(ITrustedDomainHelper::class);
$this->eventDispatcher = $this->createMock(IEventDispatcher::class);

$this->l->expects($this->any())->method('t')->willReturnCallback(
function ($param) {
Expand Down Expand Up @@ -294,6 +297,10 @@ public function testLoginWithEnvVariable(array $samlUserData, string $redirect,
->expects($this->exactly((int)($autoProvision < 2)))
->method('updateLastLoginTimestamp');

$this->eventDispatcher
->expects($this->once())
->method('dispatchTyped');

if ($userState === 0) {
$this->userResolver
->expects($this->any())
Expand Down

0 comments on commit d4a4377

Please sign in to comment.