From c94c2c48a613d3ca4f77fb3b77b7d453ee3eea46 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Fri, 22 Dec 2017 13:38:10 +0100 Subject: [PATCH] extend tests for status quo Signed-off-by: Arthur Schiwon --- tests/lib/User/ManagerTest.php | 12 ++++++++++++ tests/lib/Util/User/Dummy.php | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/tests/lib/User/ManagerTest.php b/tests/lib/User/ManagerTest.php index cf725aae671..02200b05d05 100644 --- a/tests/lib/User/ManagerTest.php +++ b/tests/lib/User/ManagerTest.php @@ -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); @@ -324,6 +333,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); diff --git a/tests/lib/Util/User/Dummy.php b/tests/lib/Util/User/Dummy.php index ea47f5d7d15..375a5f4b8e6 100644 --- a/tests/lib/Util/User/Dummy.php +++ b/tests/lib/Util/User/Dummy.php @@ -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 *