public function testSharePasswordLinkInvalidSession() { $share = $this->getMock('OCP\\Share\\IShare'); $share->method('getPassword')->willReturn('password'); $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_LINK); $share->method('getId')->willReturn('42'); $this->shareManager->expects($this->once())->method('getShareByToken')->willReturn($share); $this->shareManager->method('checkPassword')->with($this->equalTo($share), $this->equalTo('password'))->willReturn(false); $this->session->method('exists')->with('public_link_authenticated')->willReturn(true); $this->session->method('get')->with('public_link_authenticated')->willReturn('43'); $result = $this->invokePrivate($this->auth, 'validateUserPass', ['username', 'password']); $this->assertFalse($result); }