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 88
99namespace Magento \TwoFactorAuth \Test \Unit \Model \Provider \Engine ;
1010
11+ use Magento \User \Api \Data \UserInterface ;
1112use Magento \Framework \App \Config \ScopeConfigInterface ;
1213use Magento \TwoFactorAuth \Model \Provider \Engine \DuoSecurity ;
1314use PHPUnit \Framework \MockObject \MockObject ;
@@ -26,13 +27,19 @@ class DuoSecurityTest extends TestCase
2627 */
2728 private $ configMock ;
2829
30+ /**
31+ * @var UserInterface|MockObject
32+ */
33+ private $ user ;
34+
2935 /**
3036 * @inheritDoc
3137 */
3238 protected function setUp (): void
3339 {
3440 $ objectManager = new ObjectManager ($ this );
3541 $ this ->configMock = $ this ->getMockBuilder (ScopeConfigInterface::class)->disableOriginalConstructor ()->getMock ();
42+ $ this ->user = $ this ->getMockBuilder (UserInterface::class)->disableOriginalConstructor ()->getMock ();
3643
3744 $ this ->model = $ objectManager ->getObject (DuoSecurity::class, ['scopeConfig ' => $ this ->configMock ]);
3845 }
@@ -119,4 +126,16 @@ public function testIsEnabled(
119126
120127 $ this ->assertEquals ($ expected , $ this ->model ->isEnabled ());
121128 }
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+ }
122141}
You can’t perform that action at this time.
0 commit comments