Skip to content

Commit

Permalink
Merge pull request #3944 from HungDV2022/unittest_InstallationsAdminS…
Browse files Browse the repository at this point in the history
…ervice_login

InstallationsAdminService::login() のユニットテスト
  • Loading branch information
HungDV2022 authored Oct 28, 2024
2 parents 5f0fa5a + e95e1c1 commit 62c1313
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ public function connectDb(ServerRequest $request): \Cake\Datasource\ConnectionIn
* @return void
* @checked
* @noTodo
* @unitTest
*/
public function login(ServerRequest $request, Response $response): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use BcInstaller\Service\Admin\InstallationsAdminService;
use BcInstaller\Service\Admin\InstallationsAdminServiceInterface;
use Cake\Core\Configure;
use Cake\Http\Response;
use Cake\Http\ServerRequest;
use Cake\Http\Session;
use Cake\ORM\Exception\PersistenceFailedException;
Expand Down Expand Up @@ -538,7 +539,15 @@ public function test_connectDb()
*/
public function test_login()
{
$this->markTestIncomplete('このテストは、まだ実装されていません。');
//準備
$this->loadFixtureScenario(InitAppScenario::class);
$request = $this->getRequest('/baser/admin/baser-core/users/index');
$request->getSession()->write('Installation.id', 1);
$response = new Response();
//テストを実行
$this->Installations->login($request, $response);
//ログインできるか確認
$this->assertEquals(1, $request->getSession()->read('AuthAdmin')->id);
}

/**
Expand Down

0 comments on commit 62c1313

Please sign in to comment.