Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
/**
* BcCcPref : baserCMS Custom Content Prefecture List Plugin
* Copyright (c) Catchup, Inc. <https://catchup.co.jp>
*
* @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);
}

}
Loading