userManager = $this->createMock(Manager::class); $this->cmd = new UidLoginCommand( $this->userManager ); } public function testProcessFailingLogin(): void { $data = $this->getBasicLoginData(); $this->userManager->expects($this->once()) ->method('checkPasswordNoLogging') ->with( $this->username, $this->password ) ->willReturn(false); $result = $this->cmd->process($data); $this->assertTrue($result->isSuccess()); $this->assertFalse($data->getUser()); } public function testProcess(): void { $data = $this->getBasicLoginData(); $this->userManager->expects($this->once()) ->method('checkPasswordNoLogging') ->with( $this->username, $this->password ) ->willReturn($this->user); $result = $this->cmd->process($data); $this->assertTrue($result->isSuccess()); $this->assertEquals($this->user, $data->getUser()); } }