@@ -185,9 +185,8 @@ public function testGetOneBackendExists() {
185185 ->method ('userExists ' )
186186 ->with ($ this ->equalTo ('foo ' ))
187187 ->will ($ this ->returnValue (true ));
188- $ backend ->expects ($ this ->once ())
189- ->method ('loginName2UserName ' )
190- ->willReturn (false );
188+ $ backend ->expects ($ this ->never ())
189+ ->method ('loginName2UserName ' );
191190
192191 $ manager = new \OC \User \Manager ($ this ->config );
193192 $ manager ->registerBackend ($ backend );
@@ -211,6 +210,24 @@ public function testGetOneBackendNotExists() {
211210 $ this ->assertEquals (null , $ manager ->get ('foo ' ));
212211 }
213212
213+ public function testGetOneBackendDoNotTranslateLoginNames () {
214+ /**
215+ * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend
216+ */
217+ $ backend = $ this ->createMock (\Test \Util \User \Dummy::class);
218+ $ backend ->expects ($ this ->once ())
219+ ->method ('userExists ' )
220+ ->with ($ this ->equalTo ('bLeNdEr ' ))
221+ ->will ($ this ->returnValue (true ));
222+ $ backend ->expects ($ this ->never ())
223+ ->method ('loginName2UserName ' );
224+
225+ $ manager = new \OC \User \Manager ($ this ->config );
226+ $ manager ->registerBackend ($ backend );
227+
228+ $ this ->assertEquals ('bLeNdEr ' , $ manager ->get ('bLeNdEr ' )->getUID ());
229+ }
230+
214231 public function testSearchOneBackend () {
215232 /**
216233 * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend
@@ -220,6 +237,8 @@ public function testSearchOneBackend() {
220237 ->method ('getUsers ' )
221238 ->with ($ this ->equalTo ('fo ' ))
222239 ->will ($ this ->returnValue (array ('foo ' , 'afoo ' )));
240+ $ backend ->expects ($ this ->never ())
241+ ->method ('loginName2UserName ' );
223242
224243 $ manager = new \OC \User \Manager ($ this ->config );
225244 $ manager ->registerBackend ($ backend );
@@ -239,9 +258,8 @@ public function testSearchTwoBackendLimitOffset() {
239258 ->method ('getUsers ' )
240259 ->with ($ this ->equalTo ('fo ' ), $ this ->equalTo (3 ), $ this ->equalTo (1 ))
241260 ->will ($ this ->returnValue (array ('foo1 ' , 'foo2 ' )));
242- $ backend1 ->expects ($ this ->exactly (2 ))
243- ->method ('loginName2UserName ' )
244- ->willReturn (false );
261+ $ backend1 ->expects ($ this ->never ())
262+ ->method ('loginName2UserName ' );
245263
246264 /**
247265 * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend2
@@ -251,9 +269,8 @@ public function testSearchTwoBackendLimitOffset() {
251269 ->method ('getUsers ' )
252270 ->with ($ this ->equalTo ('fo ' ), $ this ->equalTo (3 ), $ this ->equalTo (1 ))
253271 ->will ($ this ->returnValue (array ('foo3 ' )));
254- $ backend2 ->expects ($ this ->once ())
255- ->method ('loginName2UserName ' )
256- ->willReturn (false );
272+ $ backend2 ->expects ($ this ->never ())
273+ ->method ('loginName2UserName ' );
257274
258275 $ manager = new \OC \User \Manager ($ this ->config );
259276 $ manager ->registerBackend ($ backend1 );
@@ -333,9 +350,8 @@ public function testCreateUserSingleBackendNotExists() {
333350 ->method ('userExists ' )
334351 ->with ($ this ->equalTo ('foo ' ))
335352 ->will ($ this ->returnValue (false ));
336- $ backend ->expects ($ this ->once ())
337- ->method ('loginName2UserName ' )
338- ->willReturn (false );
353+ $ backend ->expects ($ this ->never ())
354+ ->method ('loginName2UserName ' );
339355
340356 $ manager = new \OC \User \Manager ($ this ->config );
341357 $ manager ->registerBackend ($ backend );
0 commit comments