Skip to content

Commit

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

InstallationsAdminService::connectDb() のユニットテスト
  • Loading branch information
HungDV2022 authored Oct 28, 2024
2 parents 2a264da + c9a5f6a commit 4cbb228
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ public function initFiles(ServerRequest $request): void
* @return \Cake\Datasource\ConnectionInterface
* @checked
* @noTodo
* @unitTest
*/
public function connectDb(ServerRequest $request): \Cake\Datasource\ConnectionInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,28 @@ public function test_initFiles()
*/
public function test_connectDb()
{
$this->markTestIncomplete('このテストは、まだ実装されていません。');
//準備
$session = new Session();
$request = new ServerRequest(['session' => $session]);
$session->write('Installation', [
"datasource" => "MySQL",
"dbSchema" => "test_basercms",
'dbType' => 'mysql',
'dbName' => 'test_db',
'dbHost' => 'bc-db',
'dbPrefix' => '',
'dbPort' => '3306',
'dbEncoding' => 'utf-8',
'dbDataPattern' => 'BcThemeSample.default',
"dbUsername" => "root",
"dbPassword" => "root",
]);
//準備
$rs = $this->Installations->connectDb($request);

// 接続できていること
$this->assertNotEmpty($rs);
$this->assertTrue($rs->getDriver()->isConnected());
}

/**
Expand Down

0 comments on commit 4cbb228

Please sign in to comment.