extend tests for status quo

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2017-12-22 13:38:10 +01:00
parent 017e04521c
commit 3c87faab27
No known key found for this signature in database
GPG Key ID: 7424F1874854DF23
2 changed files with 19 additions and 0 deletions

View File

@ -184,6 +184,9 @@ class ManagerTest extends TestCase {
->method('userExists')
->with($this->equalTo('foo'))
->will($this->returnValue(true));
$backend->expects($this->once())
->method('loginName2UserName')
->willReturn(false);
$manager = new \OC\User\Manager($this->config);
$manager->registerBackend($backend);
@ -235,6 +238,9 @@ class ManagerTest extends TestCase {
->method('getUsers')
->with($this->equalTo('fo'), $this->equalTo(3), $this->equalTo(1))
->will($this->returnValue(array('foo1', 'foo2')));
$backend1->expects($this->exactly(2))
->method('loginName2UserName')
->willReturn(false);
/**
* @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend2
@ -244,6 +250,9 @@ class ManagerTest extends TestCase {
->method('getUsers')
->with($this->equalTo('fo'), $this->equalTo(3), $this->equalTo(1))
->will($this->returnValue(array('foo3')));
$backend2->expects($this->once())
->method('loginName2UserName')
->willReturn(false);
$manager = new \OC\User\Manager($this->config);
$manager->registerBackend($backend1);
@ -316,6 +325,9 @@ class ManagerTest extends TestCase {
->method('userExists')
->with($this->equalTo('foo'))
->will($this->returnValue(false));
$backend->expects($this->once())
->method('loginName2UserName')
->willReturn(false);
$manager = new \OC\User\Manager($this->config);
$manager->registerBackend($backend);

View File

@ -108,6 +108,13 @@ class Dummy extends Backend implements \OCP\IUserBackend {
}
}
public function loginName2UserName($loginName) {
if(isset($this->users[strtolower($loginName)])) {
return strtolower($loginName);
}
return false;
}
/**
* Get a list of all users
*