-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
404 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
plugins/baser-core/tests/TestCase/Controller/Api/Admin/JwksControllerTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
/** | ||
* baserCMS : Based Website Development Project <https://basercms.net> | ||
* Copyright (c) NPO baser foundation <https://baserfoundation.org/> | ||
* | ||
* @copyright Copyright (c) NPO baser foundation | ||
* @link https://basercms.net baserCMS Project | ||
* @since 5.0.0 | ||
* @license https://basercms.net/license/index.html MIT License | ||
*/ | ||
|
||
namespace BaserCore\Test\TestCase\Controller\Api\Admin; | ||
|
||
use BaserCore\Controller\Api\Admin\JwksController; | ||
use BaserCore\TestSuite\BcTestCase; | ||
use BaserCore\Utility\BcContainerTrait; | ||
use Cake\TestSuite\IntegrationTestTrait; | ||
|
||
/** | ||
* JwksControllerTest Test Case | ||
*/ | ||
class JwksControllerTest extends BcTestCase | ||
{ | ||
|
||
/** | ||
* Trait | ||
*/ | ||
use IntegrationTestTrait; | ||
use BcContainerTrait; | ||
|
||
/** | ||
* set up | ||
*/ | ||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
} | ||
|
||
/** | ||
* test initialize | ||
* | ||
* @return void | ||
*/ | ||
public function testInitialize() | ||
{ | ||
$controller = new JwksController($this->getRequest()); | ||
$this->assertEquals(['index'], $controller->Authentication->getUnauthenticatedActions()); | ||
} | ||
|
||
/** | ||
* test index | ||
*/ | ||
public function testIndex() | ||
{ | ||
$this->get('/baser/api/admin/baser-core/jwks/index.json'); | ||
//ステータスを確認 | ||
$this->assertResponseCode(200); | ||
//戻り値確認 | ||
$vars = $this->_controller->viewBuilder()->getVars(); | ||
$this->assertArrayHasKey('kid', $vars['keys']['keys'][0]); | ||
$this->assertArrayHasKey('kty', $vars['keys']['keys'][0]); | ||
$this->assertArrayHasKey('alg', $vars['keys']['keys'][0]); | ||
$this->assertArrayHasKey('use', $vars['keys']['keys'][0]); | ||
$this->assertArrayHasKey('e', $vars['keys']['keys'][0]); | ||
$this->assertArrayHasKey('n', $vars['keys']['keys'][0]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,11 +88,16 @@ public function testEdit() | |
{ | ||
$this->enableSecurityToken(); | ||
$this->enableCsrfToken(); | ||
$data = [ | ||
'email' => '[email protected]' | ||
]; | ||
$data = ['email' => '[email protected]']; | ||
$this->post('/baser/api/admin/baser-core/site_configs/edit/1.json?token=' . $this->accessToken, $data); | ||
$this->assertResponseSuccess(); | ||
|
||
//エラーを発生した場合、 | ||
$this->post('/baser/api/admin/baser-core/site_configs/edit/1.json?token=' . $this->accessToken, ['email' => '']); | ||
$this->assertResponseCode(400); | ||
$result = json_decode((string)$this->_response->getBody()); | ||
$this->assertEquals('入力エラーです。内容を修正してください。', $result->message); | ||
$this->assertEquals('管理者メールアドレスを入力してください。', $result->errors->email->_empty); | ||
} | ||
|
||
/** | ||
|
32 changes: 32 additions & 0 deletions
32
plugins/baser-core/tests/TestCase/Controller/MaintenanceControllerTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace BaserCore\Test\TestCase\Controller; | ||
|
||
use BaserCore\Controller\MaintenanceController; | ||
use BaserCore\TestSuite\BcTestCase; | ||
|
||
class MaintenanceControllerTest extends BcTestCase | ||
{ | ||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
$this->MaintenanceController = new MaintenanceController($this->getRequest()); | ||
} | ||
|
||
public function tearDown(): void | ||
{ | ||
parent::tearDown(); | ||
} | ||
|
||
/** | ||
* test index | ||
*/ | ||
public function testIndex() | ||
{ | ||
$this->get('/maintenance'); | ||
$this->assertResponseOk(); | ||
|
||
$vars = $this->_controller->viewBuilder()->getVars(); | ||
$this->assertEquals('メンテナンス中', $vars['title']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.