forked from vufind-org/vufind
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace RemoteAddress with UserIpReader in EmailAuthenticator. (vufin…
- Loading branch information
1 parent
d5523b3
commit e8161e4
Showing
5 changed files
with
13 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 0 additions & 79 deletions
79
module/VuFind/src/VuFind/Http/PhpEnvironment/RemoteAddressFactory.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,6 @@ | |
|
||
use DateTime; | ||
use Laminas\Config\Config; | ||
use Laminas\Http\PhpEnvironment\RemoteAddress; | ||
use Laminas\Http\Request; | ||
use Laminas\I18n\Translator\TranslatorInterface; | ||
use Laminas\Session\SessionManager; | ||
|
@@ -43,6 +42,7 @@ | |
use VuFind\Db\Entity\AuthHashEntityInterface; | ||
use VuFind\Db\Service\AuthHashServiceInterface; | ||
use VuFind\Mailer\Mailer; | ||
use VuFind\Net\UserIpReader; | ||
use VuFind\Validator\CsrfInterface; | ||
|
||
/** | ||
|
@@ -63,7 +63,7 @@ class EmailAuthenticatorTest extends \PHPUnit\Framework\TestCase | |
* @param ?CsrfInterface $csrf CSRF validator | ||
* @param ?Mailer $mailer Mailer service | ||
* @param ?PhpRenderer $renderer View renderer | ||
* @param ?RemoteAddress $remoteAddress Remote address details | ||
* @param ?userIpReader $userIpReader User IP reader | ||
* @param array $config Configuration settings | ||
* @param ?AuthHashServiceInterface $authHashService AuthHash database service | ||
* | ||
|
@@ -77,7 +77,7 @@ protected function getEmailAuthenticator( | |
CsrfInterface $csrf = null, | ||
Mailer $mailer = null, | ||
PhpRenderer $renderer = null, | ||
RemoteAddress $remoteAddress = null, | ||
UserIpReader $userIpReader = null, | ||
array $config = [], | ||
AuthHashServiceInterface $authHashService = null | ||
): EmailAuthenticator { | ||
|
@@ -86,7 +86,7 @@ protected function getEmailAuthenticator( | |
$csrf ?? $this->createMock(CsrfInterface::class), | ||
$mailer ?? $this->createMock(Mailer::class), | ||
$renderer ?? $this->createMock(PhpRenderer::class), | ||
$remoteAddress ?? $this->createMock(RemoteAddress::class), | ||
$userIpReader ?? $this->createMock(UserIpReader::class), | ||
new Config($config), | ||
$authHashService ?? $this->createMock(AuthHashServiceInterface::class) | ||
); | ||
|
@@ -186,14 +186,14 @@ function ($name) use ($mockServerUrl, $mockUrl) { | |
$renderer->expects($this->once())->method('render') | ||
->with('Email/login-link.phtml', $this->callback($checkViewParams)) | ||
->willReturn('foo-message'); | ||
$remoteAddress = $this->createMock(RemoteAddress::class); | ||
$remoteAddress->expects($this->once())->method('getIpAddress')->willReturn('foo-ip'); | ||
$userIpReader = $this->createMock(userIpReader::class); | ||
$userIpReader->expects($this->once())->method('getUserIp')->willReturn('foo-ip'); | ||
$authenticator = $this->getEmailAuthenticator( | ||
sessionManager: $sessionManager, | ||
csrf: $csrf, | ||
mailer: $mailer, | ||
renderer: $renderer, | ||
remoteAddress: $remoteAddress, | ||
userIpReader: $userIpReader, | ||
config: ['Site' => ['title' => 'foo-site-title', 'email' => '[email protected]']], | ||
authHashService: $authHashService | ||
); | ||
|