File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
TwoFactorAuth/Test/Unit/Model/Provider/Engine Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 8
8
9
9
namespace Magento \TwoFactorAuth \Test \Unit \Model \Provider \Engine ;
10
10
11
+ use Magento \User \Api \Data \UserInterface ;
11
12
use Magento \Framework \App \Config \ScopeConfigInterface ;
12
13
use Magento \TwoFactorAuth \Model \Provider \Engine \DuoSecurity ;
13
14
use PHPUnit \Framework \MockObject \MockObject ;
@@ -26,13 +27,19 @@ class DuoSecurityTest extends TestCase
26
27
*/
27
28
private $ configMock ;
28
29
30
+ /**
31
+ * @var UserInterface|MockObject
32
+ */
33
+ private $ user ;
34
+
29
35
/**
30
36
* @inheritDoc
31
37
*/
32
38
protected function setUp (): void
33
39
{
34
40
$ objectManager = new ObjectManager ($ this );
35
41
$ this ->configMock = $ this ->getMockBuilder (ScopeConfigInterface::class)->disableOriginalConstructor ()->getMock ();
42
+ $ this ->user = $ this ->getMockBuilder (UserInterface::class)->disableOriginalConstructor ()->getMock ();
36
43
37
44
$ this ->model = $ objectManager ->getObject (DuoSecurity::class, ['scopeConfig ' => $ this ->configMock ]);
38
45
}
@@ -119,4 +126,16 @@ public function testIsEnabled(
119
126
120
127
$ this ->assertEquals ($ expected , $ this ->model ->isEnabled ());
121
128
}
129
+
130
+ public function testGetRequestSignature () : void
131
+ {
132
+ $ this ->user ->expects ($ this ->any ())
133
+ ->method ('getUserName ' )
134
+ ->willReturn ('admin ' );
135
+ $ this ->configMock ->expects ($ this ->any ())
136
+ ->method ('getValue ' )
137
+ ->willReturn ('SECRET ' );
138
+
139
+ $ this ->assertStringContainsString ($ this ->model ::AUTH_PREFIX , $ this ->model ->getRequestSignature ($ this ->user ));
140
+ }
122
141
}
You can’t perform that action at this time.
0 commit comments