public function testChangePassword() { $serviceMock = $this->getMock(ApiKeyFactoryInterface::class); $serviceMock->expects($this->any())->method('generateKeyCode')->will($this->returnValue(new ApiKey('api key'))); $this->user->authenticateToken(new AuthDTO('Ma27', 'test-password'), $serviceMock); $this->user->changePassword(new ChangePasswordDTO('test-password', '123456')); $this->assertTrue($this->user->getCredentials()->getPassword()->compare('123456')); }