public function testCountUsersFailing() { $access = $this->getAccessMock(); $access->expects($this->once())->method('countUsers')->will($this->returnValue(false)); $backend = new UserLDAP($access, $this->getMock('\\OCP\\IConfig')); $result = $backend->countUsers(); $this->assertFalse($result); }
public function testCountUsersFailing() { $access = $this->getAccessMock(); $access->connection->expects($this->once()) ->method('__get') ->will($this->returnCallback(function($name) { if($name === 'ldapLoginFilter') { return 'invalidFilter'; } return null; })); $access->expects($this->once()) ->method('countUsers') ->will($this->returnCallback(function($filter, $a, $b, $c) { if($filter !== 'uid=*') { return false; } return 5; })); $backend = new UserLDAP($access); $result = $backend->countUsers(); $this->assertFalse($result); }