Skip to content

Commit b7c1d4a

Browse files
committed
setConfig in tests that use it, not all
1 parent 7c096eb commit b7c1d4a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/unittests/UserTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)