File tree Expand file tree Collapse file tree 2 files changed +14
-14
lines changed Expand file tree Collapse file tree 2 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -64,14 +64,6 @@ public function getSecret():string{
6464 return Base64::encode ($ this ->secret );
6565 }
6666
67- /**
68- * @inheritDoc
69- * @codeCoverageIgnore
70- */
71- public function createSecret (int |null $ length = null ):string {
72- throw new RuntimeException ('Not implemented ' );
73- }
74-
7567 /**
7668 * @inheritDoc
7769 */
Original file line number Diff line number Diff line change 1919use function date ;
2020use function dechex ;
2121use function is_int ;
22+ use function strlen ;
2223use const PHP_INT_SIZE ;
2324
2425/**
@@ -53,19 +54,26 @@ public function testSetGetSecret():void{
5354 }
5455
5556 public function testCreateSecretDefaultLength ():void {
56- $ this ::markTestSkipped ('N/A ' );
57+ $ this ::assertSame (
58+ $ this ->options ->secret_length ,
59+ strlen (Base64::decode ($ this ->authenticatorInterface ->createSecret ()))
60+ );
5761 }
5862
5963 public function testCreateSecretWithLength ():void {
60- $ this ::markTestSkipped ('N/A ' );
64+
65+ for ($ secretLength = 16 ; $ secretLength <= 512 ; $ secretLength += 8 ){
66+ $ secret = Base64::decode ($ this ->authenticatorInterface ->createSecret ($ secretLength ));
67+
68+ $ this ::assertSame ($ secretLength , strlen ($ secret ));
69+ }
70+
6171 }
6272
6373 public function testCreateSecretCheckCharacterSet ():void {
64- $ this ::markTestSkipped ('N/A ' );
65- }
74+ $ secret = $ this ->authenticatorInterface ->createSecret (32 );
6675
67- public function testCreateSecretException ():void {
68- $ this ::markTestSkipped ('N/A ' );
76+ $ this ::assertMatchesRegularExpression ('#^[ ' .Base64::CHARSET .']+$# ' , $ secret );
6977 }
7078
7179 /**
You can’t perform that action at this time.
0 commit comments