Skip to content

Commit

Permalink
InstallationsAdminService::connectDb() のユニットテスト
Browse files Browse the repository at this point in the history
  • Loading branch information
TPGF00003 committed Oct 25, 2024
1 parent a38d874 commit c9a5f6a
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 @@ -301,6 +301,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 @@ -489,7 +489,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 c9a5f6a

Please sign in to comment.