File tree Expand file tree Collapse file tree 4 files changed +100
-2
lines changed
Test/Integration/Model/Config Expand file tree Collapse file tree 4 files changed +100
-2
lines changed Original file line number Diff line number Diff line change 99namespace Magento \TwoFactorAuth \Model \Config ;
1010
1111use Magento \Framework \App \Config \ScopeConfigInterface ;
12- use Magento \Framework \UrlInterface ;
12+ use Magento \Backend \ Model \UrlInterface ;
1313
1414/**
1515 * Represents configuration for notifying the user
Original file line number Diff line number Diff line change 99namespace Magento \TwoFactorAuth \Model \Config ;
1010
1111use Magento \Framework \App \Config \ScopeConfigInterface ;
12- use Magento \Framework \UrlInterface ;
12+ use Magento \Backend \ Model \UrlInterface ;
1313use Magento \TwoFactorAuth \Api \UserNotifierInterface ;
1414
1515/**
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Copyright © Magento, Inc. All rights reserved.
4+ * See COPYING.txt for license details.
5+ */
6+
7+ declare (strict_types=1 );
8+
9+ namespace Magento \TwoFactorAuth \Test \Integration \Model \Config ;
10+
11+ use Magento \Framework \App \ObjectManager ;
12+ use Magento \TwoFactorAuth \Model \Config \UserNotifier ;
13+ use PHPUnit \Framework \TestCase ;
14+
15+ class UserNotifierTest extends TestCase
16+ {
17+ /**
18+ * @var UserNotifier
19+ */
20+ private $ notifier ;
21+
22+ protected function setUp (): void
23+ {
24+ $ this ->notifier = ObjectManager::getInstance ()->get (UserNotifier::class);
25+ }
26+
27+ /**
28+ * @magentoAppArea adminhtml
29+ */
30+ public function testPersonalRequestConfigUrl ()
31+ {
32+ $ url = $ this ->notifier ->getPersonalRequestConfigUrl ('mytoken ' );
33+ self ::assertStringContainsString ('backend/tfa/tfa/index/tfat/mytoken ' , $ url );
34+ }
35+
36+ /**
37+ * @magentoAppArea webapi_rest
38+ */
39+ public function testPersonalRequestConfigUrlInWebApi ()
40+ {
41+ $ url = $ this ->notifier ->getPersonalRequestConfigUrl ('mytoken ' );
42+ self ::assertStringContainsString ('backend/tfa/tfa/index/tfat/mytoken ' , $ url );
43+ }
44+
45+ /**
46+ * @magentoAppArea adminhtml
47+ */
48+ public function testGetAppRequestConfigUrl ()
49+ {
50+ $ url = $ this ->notifier ->getAppRequestConfigUrl ('mytoken ' );
51+ self ::assertStringContainsString ('backend/tfa/tfa/index/tfat/mytoken ' , $ url );
52+ }
53+ }
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Copyright © Magento, Inc. All rights reserved.
4+ * See COPYING.txt for license details.
5+ */
6+
7+ declare (strict_types=1 );
8+
9+ namespace Magento \TwoFactorAuth \Test \Integration \Model \Config ;
10+
11+ use Magento \Framework \App \ObjectManager ;
12+ use Magento \TwoFactorAuth \Model \Config \WebApiUserNotifier ;
13+ use PHPUnit \Framework \TestCase ;
14+
15+ class WebApiUserNotifierTest extends TestCase
16+ {
17+ /**
18+ * @var WebApiUserNotifier
19+ */
20+ private $ notifier ;
21+
22+ protected function setUp (): void
23+ {
24+ $ this ->notifier = ObjectManager::getInstance ()->get (WebApiUserNotifier::class);
25+ }
26+
27+ /**
28+ * @magentoConfigFixture default/twofactorauth/general/webapi_notification_url example.com/:tfat/abc
29+ * @magentoAppArea webapi_rest
30+ */
31+ public function testCustomUrlIsUsed ()
32+ {
33+ $ url = $ this ->notifier ->getPersonalRequestConfigUrl ('mytoken ' );
34+ self ::assertEquals ('example.com/mytoken/abc ' , $ url );
35+ }
36+
37+ /**
38+ * @magentoAppArea webapi_rest
39+ */
40+ public function testDefaultUrl ()
41+ {
42+ $ url = $ this ->notifier ->getPersonalRequestConfigUrl ('mytoken ' );
43+ self ::assertStringContainsString ('backend/tfa/tfa/index/tfat/mytoken ' , $ url );
44+ }
45+ }
You can’t perform that action at this time.
0 commit comments