userManager = $this->createMock(Manager::class); $this->cmd = new PreLoginHookCommand( $this->userManager ); } public function testProcess(): void { $data = $this->getBasicLoginData(); $this->userManager->expects($this->once()) ->method('emit') ->with( '\OC\User', 'preLogin', [ $this->username, $this->password, ] ); $result = $this->cmd->process($data); $this->assertTrue($result->isSuccess()); } }