Skip to content

Commit

Permalink
unitTest_InstallationsAdminService_witeDbSettingToSession
Browse files Browse the repository at this point in the history
  • Loading branch information
thangnnmd authored Oct 10, 2024
1 parent 2c416e3 commit 735bf12
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public function getDefaultValuesStep4(ServerRequest $request): array
* @return void
* @checked
* @noTodo
* @unitTest
*/
public function writeDbSettingToSession(ServerRequest $request, array $data): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,103 @@ public static function getDefaultValuesStep4DataProvider()

/**
* test writeDbSettingToSession
* @param array $data
* @param array $expected
* @dataProvider writeDbSettingToSessionDataProvider
*/
public function test_writeDbSettingToSession()
public function test_writeDbSettingToSession($data, $expected)
{
$this->markTestIncomplete('このテストは、まだ実装されていません。');
$session = new Session();
$request = new ServerRequest(['session' => $session]);

$this->Installations->writeDbSettingToSession($request, $data);

$result = $session->read();
$this->assertEquals($expected, $result);
}

public static function writeDbSettingToSessionDataProvider()
{
return [
[
[
'dbType' => 'mysql',
'dbHost' => 'localhost',
'dbPort' => '3306',
'dbUsername' => 'root',
'dbPassword' => 'password',
'dbPrefix' => 'bc_',
'dbName' => 'test_database_mysql',
'dbDataPattern' => 'BcSample.default',
],
[
'Installation' => [
'dbType' => 'mysql',
'dbHost' => 'localhost',
'dbPort' => '3306',
'dbUsername' => 'root',
'dbPassword' => 'password',
'dbPrefix' => 'bc_',
'dbName' => 'test_database_mysql',
'dbSchema' => '',
'dbEncoding' => 'utf8mb4',
'dbDataPattern' => 'BcSample.default',
]
]
],
[
[
'dbType' => 'postgres',
'dbHost' => 'localhost',
'dbPort' => '5432',
'dbUsername' => 'root',
'dbPassword' => 'password',
'dbPrefix' => 'bc_',
'dbName' => 'test_database',
'dbDataPattern' => 'BcSample.default',
],
[
'Installation' => [
'dbType' => 'postgres',
'dbHost' => 'localhost',
'dbPort' => '5432',
'dbUsername' => 'root',
'dbPassword' => 'password',
'dbPrefix' => 'bc_',
'dbName' => 'test_database',
'dbSchema' => 'public',
'dbEncoding' => 'utf8',
'dbDataPattern' => 'BcSample.default'
]
]
],
[
[
'dbType' => 'sqlite',
'dbHost' => '',
'dbPort' => '',
'dbUsername' => '',
'dbPassword' => '',
'dbPrefix' => '',
'dbName' => 'test_database_sqlite',
'dbDataPattern' => 'BcSample.default',
],
[
'Installation' => [
'dbType' => 'sqlite',
'dbHost' => '',
'dbPort' => '',
'dbUsername' => '',
'dbPassword' => '',
'dbPrefix' => '',
'dbName' => 'test_database_sqlite',
'dbSchema' => '',
'dbEncoding' => 'utf8',
'dbDataPattern' => 'BcSample.default',
]
]
],
];
}

/**
Expand Down

0 comments on commit 735bf12

Please sign in to comment.