userManager = $this->createMock(IUserManager::class); $this->uid = 'test123'; $this->section = new Password( $this->userManager, $this->uid ); } public function testGetForm() { $user = $this->createMock(IUser::class); $this->userManager->expects($this->once()) ->method('get') ->with($this->uid) ->willReturn($user); $user->expects($this->once()) ->method('canChangePassword') ->willReturn(true); $form = $this->section->getForm(); $expected = new TemplateResponse('settings', 'settings/personal/security/password', [ 'passwordChangeSupported' => true, ]); $this->assertEquals($expected, $form); } }