Skip to content

Commit

Permalink
CustomEntriesTableTest get/set table name (#2772)
Browse files Browse the repository at this point in the history
  • Loading branch information
nghiem-mb authored Oct 2, 2023
1 parent cec99d2 commit fc1feeb
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ public function setUp(int $tableId, array $postData = [])
* @param int $tableId
* @checked
* @noTodo
* @unitTest
*/
public function setUseTable(int $tableId)
{
Expand All @@ -179,6 +180,9 @@ public function setUseTable(int $tableId)
*
* @param int $tableId
* @return string
* @noTodo
* @checked
* @unitTest
*/
public function getTableName(int $tableId, string $name = ''): string
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,20 @@ public function test_setUp()
public function test_setUseTable()
{
//準備

//正常系実行

//異常系実行


$dataBaseService = $this->getService(BcDatabaseServiceInterface::class);
$customTable = $this->getService(CustomTablesServiceInterface::class);
$customTable->create([
'id' => 1,
'name' => 'recruit',
'title' => '求人情報',
'type' => '1',
'display_field' => 'title',
]);
$this->CustomEntriesTable->setUseTable(1);
$result = $this->CustomEntriesTable->getTable();
$this->assertEquals('custom_entry_1_recruit', $result);
//不要なテーブルを削除
$dataBaseService->dropTable('custom_entry_1_recruit');
}

/**
Expand All @@ -310,11 +318,23 @@ public function test_setUseTable()
public function test_getTableName()
{
//準備

//正常系実行

//異常系実行

$dataBaseService = $this->getService(BcDatabaseServiceInterface::class);
$customTable = $this->getService(CustomTablesServiceInterface::class);
$customTable->create([
'id' => 1,
'name' => 'recruit',
'title' => '求人情報',
'type' => '1',
'display_field' => 'title',
]);
//正常系実行: name パラメータなし
$result = $this->CustomEntriesTable->getTableName(1);
$this->assertEquals('custom_entry_1_recruit', $result);
//正常系実行: name パラメータあり
$result = $this->CustomEntriesTable->getTableName(1, 'Nghiem');
$this->assertEquals('custom_entry_1_Nghiem', $result);
//不要なテーブルを削除
$dataBaseService->dropTable('custom_entry_1_recruit');

}

Expand Down

0 comments on commit fc1feeb

Please sign in to comment.