diff --git a/plugins/baser-core/tests/TestCase/Service/TwoFactorAuthenticationsServiceTest.php b/plugins/baser-core/tests/TestCase/Service/TwoFactorAuthenticationsServiceTest.php index fe9e54bc06..d1c0bb8055 100644 --- a/plugins/baser-core/tests/TestCase/Service/TwoFactorAuthenticationsServiceTest.php +++ b/plugins/baser-core/tests/TestCase/Service/TwoFactorAuthenticationsServiceTest.php @@ -14,6 +14,7 @@ use BaserCore\Service\SiteConfigsServiceInterface; use BaserCore\Service\TwoFactorAuthenticationsService; use BaserCore\TestSuite\BcTestCase; +use Cake\Core\Configure; use Cake\ORM\TableRegistry; use Cake\TestSuite\EmailTrait; use CakephpFixtureFactories\Scenario\ScenarioAwareTrait; @@ -123,9 +124,15 @@ public function testSend() */ public function testVerify($expected, $saveData, $verifyData) { - $this->TwoFactorAuthentications->save($this->TwoFactorAuthentications->newEntity($saveData)); - $result = $this->TwoFactorAuthenticationsService->verify($verifyData['user_id'], $verifyData['code']); - $this->assertEquals($expected, $result); + $allowTime = Configure::read('BcApp.twoFactorAuthenticationCodeAllowTime'); + Configure::write('BcApp.twoFactorAuthenticationCodeAllowTime', 10); + try { + $this->TwoFactorAuthentications->save($this->TwoFactorAuthentications->newEntity($saveData)); + $result = $this->TwoFactorAuthenticationsService->verify($verifyData['user_id'], $verifyData['code']); + $this->assertEquals($expected, $result); + } finally { + Configure::write('BcApp.twoFactorAuthenticationCodeAllowTime', $allowTime); + } } public static function getTestVerifyProvider() diff --git a/plugins/bc-custom-content/plugins/BcCcPref/src/View/Helper/BcCcPrefHelper.php b/plugins/bc-custom-content/plugins/BcCcPref/src/View/Helper/BcCcPrefHelper.php index c8397534e6..e2284260fc 100644 --- a/plugins/bc-custom-content/plugins/BcCcPref/src/View/Helper/BcCcPrefHelper.php +++ b/plugins/bc-custom-content/plugins/BcCcPref/src/View/Helper/BcCcPrefHelper.php @@ -67,10 +67,10 @@ public function control(CustomLink $link, array $options = []): string * @param CustomLink $link * @return string */ - public function preview(CustomLink $link) + public function preview(CustomLink $link): string { $options = [ - ':value' => 'entity.default_value' + 'v-model' => 'entity.default_value' ]; return $this->control($link, $options); } diff --git a/plugins/bc-custom-content/tests/TestCase/View/Helper/BcCcPrefHelperTest.php b/plugins/bc-custom-content/tests/TestCase/View/Helper/BcCcPrefHelperTest.php new file mode 100644 index 0000000000..59a1547d7e --- /dev/null +++ b/plugins/bc-custom-content/tests/TestCase/View/Helper/BcCcPrefHelperTest.php @@ -0,0 +1,55 @@ + + * + * @copyright Copyright (c) Catchup, Inc. + * @link https://catchup.co.jp + * @license MIT LICENSE + */ + +namespace BcCustomContent\Test\TestCase\View\Helper; + +use BaserCore\TestSuite\BcTestCase; +use BaserCore\View\BcFrontAppView; +use BcCcPref\View\Helper\BcCcPrefHelper; +use BcCustomContent\Test\Factory\CustomLinkFactory; + +/** + * BcCcPrefHelper Test Case + * @property BcCcPrefHelper $BcCcPrefHelper + */ +class BcCcPrefHelperTest extends BcTestCase +{ + + /** + * setUp + */ + public function setUp(): void + { + parent::setUp(); + $this->BcCcPrefHelper = new BcCcPrefHelper(new BcFrontAppView($this->getRequest())); + } + + /** + * tearDown + */ + public function tearDown(): void + { + parent::tearDown(); + unset($this->BcCcPrefHelper); + } + + /** + * Test preview + */ + public function testPreview() + { + $customLink = CustomLinkFactory::make(['name' => 'pref'])->getEntity(); + $result = $this->BcCcPrefHelper->preview($customLink); + + $this->assertStringContainsString('v-model="entity.default_value"', $result); + $this->assertStringNotContainsString(':value="entity.default_value"', $result); + } + +}