Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MailContentsController::edit() ユニットテスト #4084

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public function initialize(): void
* @param int ブログコンテンツID
* @checked
* @noTodo
* @unitTest
*/
public function edit(MailContentsAdminServiceInterface $service, int $id)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

namespace BcMail\Test\TestCase\Controller\Admin;

use BaserCore\Test\Factory\ContentFactory;
use BaserCore\Test\Scenario\InitAppScenario;
use BaserCore\TestSuite\BcTestCase;
use BaserCore\Utility\BcContainerTrait;
Expand Down Expand Up @@ -90,7 +89,23 @@ public function test_delete()
*/
public function testAdmin_edit()
{
$this->markTestIncomplete('このテストは、まだ実装されていません。');
$this->enableSecurityToken();
$this->enableCsrfToken();
//データーを生成
$mailContentServices = $this->getService(MailContentsServiceInterface::class);
//データを生成
$this->loadFixtureScenario(MailContentsScenario::class);
//Postデータを生成
$mailContent = $mailContentServices->get(1);
$mailContent->description = 'this is api edit';
//対象URLをコル
$this->post('/baser/admin/bc-mail/mail_contents/edit/1', $mailContent->toArray());
$this->assertResponseCode(302);
$this->assertFlashMessage('メールフォーム「お問い合わせ」を更新しました。');

//エラーを発生した場合
$this->post('/baser/admin/bc-mail/mail_contents/edit/222', $mailContent->toArray());
$this->assertResponseCode(404);
}

/**
Expand Down