public function testUserExistsForNeverExisting() { $access = $this->getAccessMock(); $backend = new UserLDAP($access, $this->getMock('\\OCP\\IConfig')); $this->prepareMockForUserExists($access); $access->expects($this->any())->method('readAttribute')->will($this->returnCallback(function ($dn) { if ($dn === 'dnOfRoland,dc=test') { return array(); } return false; })); //test for never-existing user $result = $backend->userExists('mallory'); $this->assertFalse($result); }