Skip to content
This repository was archived by the owner on Dec 2, 2021. It is now read-only.

Commit 6393d30

Browse files
committed
Add test for secret code generation
1 parent 1e450e1 commit 6393d30

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

Tests/Security/TwoFactor/Provider/Google/GoogleAuthenticatorTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,13 @@ public function getQRContent_getContentForQrCode_returnUri(): void
100100
$returnValue = $this->authenticator->getQRContent($this->user);
101101
$this->assertEquals('QRCodeContent', $returnValue);
102102
}
103+
104+
/**
105+
* @test
106+
*/
107+
public function generateSecret_getRandomSecretCode_returnString(): void
108+
{
109+
$returnValue = $this->authenticator->generateSecret();
110+
$this->assertEquals(52, strlen($returnValue));
111+
}
103112
}

Tests/Security/TwoFactor/Provider/Totp/TotpAuthenticatorTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,13 @@ public function getProvisioningUri_getContentForQrCode_returnUri(): void
100100
$returnValue = $this->authenticator->getQRContent($this->user);
101101
$this->assertEquals('provisioningUri', $returnValue);
102102
}
103+
104+
/**
105+
* @test
106+
*/
107+
public function generateSecret_getRandomSecretCode_returnString(): void
108+
{
109+
$returnValue = $this->authenticator->generateSecret();
110+
$this->assertEquals(52, strlen($returnValue));
111+
}
103112
}

0 commit comments

Comments
 (0)