Skip to content

Commit

Permalink
admin_ThemeFilesController::delete ユニットテスt (#2802)
Browse files Browse the repository at this point in the history
Co-authored-by: Đỗ Văn Hùng <[email protected]>
  • Loading branch information
HungDV2022 and dovanhung authored Oct 16, 2023
1 parent 85dbdba commit 720ec83
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ public function edit(ThemeFilesAdminServiceInterface $service)
* @return void
* @checked
* @noTodo
* @unitTest
*/
public function delete(ThemeFilesAdminServiceInterface $service)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,20 @@ public function test_edit()
*/
public function test_delete()
{
$this->markTestIncomplete('このテストは未実装です。');
$this->enableSecurityToken();
$this->enableCsrfToken();
$fullpath = BASER_PLUGINS . 'bc-column' . '/templates/layout/';
$file = new BcFile($fullpath . 'base_name_1.php');
$file->create();

//Postメソッドを検証場合
$this->post('/baser/admin/bc-theme-file/theme_files/delete/BcColumn/layout/base_name_1.php');
//戻る値を確認
$this->assertResponseCode(302);
$this->assertFlashMessage('ファイル base_name_1.php を削除しました。');
$this->assertRedirect('/baser/admin/bc-theme-file/theme_files/index/BcColumn/layout/');
//実際にファイルが削除されいてるか確認すること
$this->assertFalse(file_exists($fullpath . 'base_name_1.php'));
}

/**
Expand Down

0 comments on commit 720ec83

Please sign in to comment.