@@ -276,7 +276,7 @@ class UserTest extends TestCase
276276 protected function setUp (): void
277277 {
278278 parent ::setUp ();
279- $ this ->_factory = \NDB_Factory::singleton ();
279+ $ this ->_factory = & \NDB_Factory::singleton ();
280280 $ this ->_factory ->reset ();
281281 $ this ->_configMock = $ this ->_factory ->Config (CONFIG_XML );
282282 $ database = $ this ->_configMock ->getSetting ('database ' );
@@ -291,8 +291,6 @@ protected function setUp(): void
291291 $ this ->_mockDB = $ mockdb ;
292292 $ this ->_mockConfig = $ mockconfig ;
293293
294- $ this ->_factory ->setConfig ($ this ->_mockConfig );
295-
296294 $ this ->_userInfoComplete = $ this ->_userInfo ;
297295 $ this ->_userInfoComplete ['ID ' ] = '1 ' ;
298296 $ this ->_userInfoComplete ['Privilege ' ] = '1 ' ;
@@ -661,6 +659,9 @@ public function testUpdatePasswordWithExpiration()
661659 // Cause usePwnedPasswordsAPI config option to return false.
662660 $ mockConfig = &$ this ->_mockConfig ;
663661 '@phan-var \PHPUnit\Framework\MockObject\MockObject $mockConfig ' ;
662+
663+ $ this ->_factory ->setConfig ($ mockConfig );
664+
664665 $ mockConfig ->expects ($ this ->any ())
665666 ->method ('settingEnabled ' )
666667 ->willReturn (false );
@@ -696,6 +697,8 @@ public function testUpdatePasswordWithoutExpiry()
696697 ->method ('settingEnabled ' )
697698 ->willReturn (false );
698699
700+ $ this ->_factory ->setConfig ($ mockConfig );
701+
699702 $ this ->_user ->updatePassword (
700703 new \Password (\Utility::randomString (16 ))
701704 );
0 commit comments