|
|
@ -499,18 +499,7 @@ class User_LDAPTest extends TestCase { |
|
|
$this->prepareMockForUserExists(); |
|
|
$this->prepareMockForUserExists(); |
|
|
|
|
|
|
|
|
$user = $this->createMock(User::class); |
|
|
$user = $this->createMock(User::class); |
|
|
$user->expects($this->any()) |
|
|
|
|
|
->method('getDN') |
|
|
|
|
|
->willReturn('dnOfRoland,dc=test'); |
|
|
|
|
|
|
|
|
|
|
|
$this->access->expects($this->any()) |
|
|
|
|
|
->method('readAttribute') |
|
|
|
|
|
->will($this->returnCallback(function($dn) { |
|
|
|
|
|
if($dn === 'dnOfRoland,dc=test') { |
|
|
|
|
|
return array(); |
|
|
|
|
|
} |
|
|
|
|
|
return false; |
|
|
|
|
|
})); |
|
|
|
|
|
$this->userManager->expects($this->atLeastOnce()) |
|
|
$this->userManager->expects($this->atLeastOnce()) |
|
|
->method('get') |
|
|
->method('get') |
|
|
->willReturn($user); |
|
|
->willReturn($user); |
|
|
@ -534,32 +523,18 @@ class User_LDAPTest extends TestCase { |
|
|
->with('dnOfFormerUser,dc=test') |
|
|
->with('dnOfFormerUser,dc=test') |
|
|
->willReturn('45673458748'); |
|
|
->willReturn('45673458748'); |
|
|
|
|
|
|
|
|
$this->access->expects($this->any()) |
|
|
|
|
|
->method('readAttribute') |
|
|
|
|
|
->will($this->returnCallback(function($dn) { |
|
|
|
|
|
if($dn === 'dnOfRoland,dc=test') { |
|
|
|
|
|
return array(); |
|
|
|
|
|
} |
|
|
|
|
|
return false; |
|
|
|
|
|
})); |
|
|
|
|
|
$this->access->expects($this->any()) |
|
|
$this->access->expects($this->any()) |
|
|
->method('getUserMapper') |
|
|
->method('getUserMapper') |
|
|
->willReturn($mapper); |
|
|
->willReturn($mapper); |
|
|
$this->access->expects($this->once()) |
|
|
|
|
|
->method('getUserDnByUuid') |
|
|
|
|
|
->willThrowException(new \Exception()); |
|
|
|
|
|
|
|
|
|
|
|
$user = $this->createMock(User::class); |
|
|
$user = $this->createMock(User::class); |
|
|
$user->expects($this->any()) |
|
|
|
|
|
->method('getDN') |
|
|
|
|
|
->willReturn('dnOfFormerUser,dc=test'); |
|
|
|
|
|
|
|
|
|
|
|
$this->userManager->expects($this->atLeastOnce()) |
|
|
$this->userManager->expects($this->atLeastOnce()) |
|
|
->method('get') |
|
|
->method('get') |
|
|
->willReturn($user); |
|
|
->willReturn($user); |
|
|
|
|
|
|
|
|
//test for deleted user
|
|
|
|
|
|
$this->assertFalse($backend->userExists('formerUser')); |
|
|
|
|
|
|
|
|
//test for deleted user – always returns true as long as we have the user in DB
|
|
|
|
|
|
$this->assertTrue($backend->userExists('formerUser')); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function testUserExistsForNeverExisting() { |
|
|
public function testUserExistsForNeverExisting() { |
|
|
@ -646,8 +621,8 @@ class User_LDAPTest extends TestCase { |
|
|
->method('get') |
|
|
->method('get') |
|
|
->willReturn($user); |
|
|
->willReturn($user); |
|
|
|
|
|
|
|
|
//test for deleted user
|
|
|
|
|
|
$this->assertFalse(\OC::$server->getUserManager()->userExists('formerUser')); |
|
|
|
|
|
|
|
|
//test for deleted user – always returns true as long as we have the user in DB
|
|
|
|
|
|
$this->assertTrue(\OC::$server->getUserManager()->userExists('formerUser')); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function testUserExistsPublicAPIForNeverExisting() { |
|
|
public function testUserExistsPublicAPIForNeverExisting() { |
|
|
|