@@ -114,6 +114,9 @@ private function getConnectorAndLdapMock() {
114114 $ connector = $ this ->getMockBuilder (Connection::class)
115115 ->setConstructorArgs ([$ lw , '' , null ])
116116 ->getMock ();
117+ $ connector ->expects ($ this ->any ())
118+ ->method ('getConnectionResource ' )
119+ ->willReturn (ldap_connect ('ldap://example.com ' ));
117120 $ um = $ this ->getMockBuilder (Manager::class)
118121 ->setConstructorArgs ([
119122 $ this ->createMock (IConfig::class),
@@ -287,6 +290,11 @@ public function testBatchApplyUserAttributes() {
287290 ->method ('isResource ' )
288291 ->willReturn (true );
289292
293+ $ this ->connection
294+ ->expects ($ this ->any ())
295+ ->method ('getConnectionResource ' )
296+ ->willReturn (ldap_connect ('ldap://example.com ' ));
297+
290298 $ this ->ldap ->expects ($ this ->any ())
291299 ->method ('getAttributes ' )
292300 ->willReturn (['displayname ' => ['bar ' , 'count ' => 1 ]]);
@@ -469,7 +477,7 @@ public function testSetPasswordWithLdapNotAvailable() {
469477 $ this ->connection
470478 ->method ('__get ' )
471479 ->willReturn (true );
472- $ connection = $ this -> createMock ( LDAP ::class );
480+ $ connection = ldap_connect ( ' ldap://example.com ' );
473481 $ this ->connection
474482 ->expects ($ this ->once ())
475483 ->method ('getConnectionResource ' )
@@ -492,7 +500,7 @@ public function testSetPasswordWithRejectedChange() {
492500 $ this ->connection
493501 ->method ('__get ' )
494502 ->willReturn (true );
495- $ connection = $ this -> createMock ( LDAP ::class );
503+ $ connection = ldap_connect ( ' ldap://example.com ' );
496504 $ this ->connection
497505 ->expects ($ this ->any ())
498506 ->method ('getConnectionResource ' )
@@ -516,7 +524,7 @@ public function testSetPassword() {
516524 $ this ->connection
517525 ->method ('__get ' )
518526 ->willReturn (true );
519- $ connection = $ this -> createMock ( LDAP ::class );
527+ $ connection = ldap_connect ( ' ldap://example.com ' );
520528 $ this ->connection
521529 ->expects ($ this ->any ())
522530 ->method ('getConnectionResource ' )
0 commit comments