-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: adjust test for static method invocation
Signed-off-by: ernolf <[email protected]>
- Loading branch information
Showing
1 changed file
with
14 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,17 +109,25 @@ public function testCreateSecret() { | |
->method('getCloudId') | ||
->willReturn('[email protected]'); | ||
|
||
$secret = 'newsecret'; | ||
$algorithm = ITotp::getAlgorithmById(1); | ||
$digits = 6; | ||
$period = ITotp::DEFAULT_PERIOD; | ||
$this->totp->expects($this->once()) | ||
->method('createSecret') | ||
->with($user, null, 1, 6, 30) | ||
->willReturn('newsecret'); | ||
|
||
// Mock the default algorithm and digits | ||
$this->totp->expects($this->once()) | ||
->method('getDefaultAlgorithm') | ||
->willReturn(1); | ||
$this->totp->expects($this->once()) | ||
->method('getDefaultDigits') | ||
->willReturn(6); | ||
|
||
$issuer = rawurlencode($this->defaults->getName()); | ||
$qrUrl = "otpauth://totp/{$issuer}:user%40instance.com?secret=$secret&issuer=$issuer&algorithm=SHA1&digits=$digits&period=$period&image="; | ||
$qrUrl = "otpauth://totp/{$issuer}:user%40instance.com?secret=newsecret&issuer=$issuer&algorithm=SHA1&digits=6&period=30&image="; | ||
|
||
$expected = new JSONResponse([ | ||
'state' => ITotp::STATE_CREATED, | ||
'secret' => $secret, | ||
'secret' => 'newsecret', | ||
'qrUrl' => $qrUrl | ||
]); | ||
|
||
|