Skip to content

Commit

Permalink
Merge pull request #4007 from thangnnmd/unitTest_CustomEntriesService…
Browse files Browse the repository at this point in the history
…_getNew

CustomEntriesService::getNew ユニットテスト
  • Loading branch information
HungDV2022 authored Nov 12, 2024
2 parents 1a43666 + 2cb0bc4 commit e5f6dab
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class CustomEntriesService implements CustomEntriesServiceInterface
* Constructor
* @checked
* @noTodo
* @unitTest
*/
public function __construct()
{
Expand All @@ -91,6 +92,7 @@ public function __construct()
* @return EntityInterface
* @checked
* @noTodo
* @unitTest
*/
public function getNew(int $tableId)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,26 @@ public function test_construct()
*/
public function test_getNew()
{
$this->markTestIncomplete('このテストは未実装です。');
$this->loadFixtureScenario(InitAppScenario::class);
$this->loginAdmin($this->getRequest());
$customTable = $this->getService(CustomTablesServiceInterface::class);
//カスタムテーブルとカスタムエントリテーブルを生成
$customTable->create([
'id' => 1,
'name' => 'recruit_categories',
'title' => '求人情報',
'type' => '1',
'display_field' => 'title',
'has_child' => 0
]);
//正常系実行
$rs = $this->CustomEntriesService->getNew(1);

$this->assertEquals(1, $rs->custom_table_id);
$this->assertEquals(1, $rs->creator_id);
$this->assertEquals(0, $rs->status);

$this->CustomEntriesService->dropTable(1);
}

/**
Expand Down

0 comments on commit e5f6dab

Please sign in to comment.