Skip to content

Commit

Permalink
setConfig in tests that use it, not all
Browse files Browse the repository at this point in the history
  • Loading branch information
driusan committed Mar 7, 2023
1 parent 7c096eb commit 8190d65
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/unittests/UserTest.php
Expand Up @@ -291,8 +291,6 @@ protected function setUp(): void
$this->_mockDB = $mockdb;
$this->_mockConfig = $mockconfig;

$this->_factory->setConfig($this->_mockConfig);

$this->_userInfoComplete = $this->_userInfo;
$this->_userInfoComplete['ID'] = '1';
$this->_userInfoComplete['Privilege'] = '1';
Expand Down Expand Up @@ -661,6 +659,9 @@ public function testUpdatePasswordWithExpiration()
// Cause usePwnedPasswordsAPI config option to return false.
$mockConfig = &$this->_mockConfig;
'@phan-var \PHPUnit\Framework\MockObject\MockObject $mockConfig';

$this->_factory->setConfig($mockConfig);

$mockConfig->expects($this->any())
->method('settingEnabled')
->willReturn(false);
Expand Down Expand Up @@ -696,6 +697,8 @@ public function testUpdatePasswordWithoutExpiry()
->method('settingEnabled')
->willReturn(false);

$this->_factory->setConfig($mockConfig);

$this->_user->updatePassword(
new \Password(\Utility::randomString(16))
);
Expand Down

0 comments on commit 8190d65

Please sign in to comment.