@@ -62,8 +62,7 @@ public function testGetBackends() {
6262 $ this ->assertEquals ([$ userDummyBackend , $ dummyDatabaseBackend ], $ manager ->getBackends ());
6363 }
6464
65-
66- public function testUserExistsSingleBackendExists () {
65+ public function testUserExistsSingleBackendExists (): void {
6766 /**
6867 * @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend
6968 */
@@ -196,7 +195,28 @@ public function testCheckPasswordNotSupported() {
196195 $ this ->assertFalse ($ manager ->checkPassword ('foo ' , 'bar ' ));
197196 }
198197
199- public function testGetOneBackendExists () {
198+ public function testCheckPasswordNullByteInLoginName (): void {
199+ $ backend = $ this ->createMock (\Test \Util \User \Dummy::class);
200+ $ backend ->expects ($ this ->never ())
201+ ->method ('checkPassword ' );
202+
203+ $ backend ->expects ($ this ->any ())
204+ ->method ('implementsActions ' )
205+ ->willReturnCallback (function ($ actions ) {
206+ if ($ actions === BACKEND ::CHECK_PASSWORD ) {
207+ return true ;
208+ } else {
209+ return false ;
210+ }
211+ });
212+
213+ $ manager = new Manager ($ this ->config , $ this ->cacheFactory , $ this ->eventDispatcher , $ this ->logger );
214+ $ manager ->registerBackend ($ backend );
215+
216+ $ this ->assertFalse ($ manager ->checkPassword ("foo \0" , 'bar ' ));
217+ }
218+
219+ public function testGetOneBackendExists (): void {
200220 /**
201221 * @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend
202222 */
@@ -347,8 +367,7 @@ public function testCreateUserInvalid($uid, $password, $exception) {
347367 ->with (\OC \User \Backend::CREATE_USER )
348368 ->willReturn (true );
349369
350-
351- $ manager = new \OC \User \Manager ($ this ->config , $ this ->oldDispatcher , $ this ->cacheFactory , $ this ->eventDispatcher );
370+ $ manager = new Manager ($ this ->config , $ this ->cacheFactory , $ this ->eventDispatcher , $ this ->logger );
352371 $ manager ->registerBackend ($ backend );
353372
354373 $ this ->expectException (\InvalidArgumentException::class, $ exception );
@@ -382,8 +401,7 @@ public function testCreateUserSingleBackendNotExists() {
382401 $ this ->assertEquals ('foo ' , $ user ->getUID ());
383402 }
384403
385-
386- public function testCreateUserSingleBackendExists () {
404+ public function testCreateUserSingleBackendExists (): void {
387405 $ this ->expectException (\Exception::class);
388406
389407 /**
@@ -435,8 +453,7 @@ public function testCreateUserNoBackends() {
435453 $ this ->assertFalse ($ manager ->createUser ('foo ' , 'bar ' ));
436454 }
437455
438-
439- public function testCreateUserFromBackendWithBackendError () {
456+ public function testCreateUserFromBackendWithBackendError (): void {
440457 $ this ->expectException (\InvalidArgumentException::class);
441458 $ this ->expectExceptionMessage ('Could not create user ' );
442459
@@ -454,8 +471,7 @@ public function testCreateUserFromBackendWithBackendError() {
454471 $ manager ->createUserFromBackend ('MyUid ' , 'MyPassword ' , $ backend );
455472 }
456473
457-
458- public function testCreateUserTwoBackendExists () {
474+ public function testCreateUserTwoBackendExists (): void {
459475 $ this ->expectException (\Exception::class);
460476
461477 /**
0 commit comments