Skip to content

Commit

Permalink
ユニットテスト
Browse files Browse the repository at this point in the history
  • Loading branch information
TPGF00003 committed Nov 8, 2024
1 parent 6a30468 commit fc91d28
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions plugins/bc-mail/tests/TestCase/Controller/MailControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use BaserCore\Test\Factory\ContentFactory;
use BaserCore\Test\Factory\SiteFactory;
use BaserCore\Test\Scenario\InitAppScenario;
use BaserCore\TestSuite\BcTestCase;
use BaserCore\Utility\BcContainerTrait;
use BcMail\Test\Factory\MailContentFactory;
Expand Down Expand Up @@ -116,18 +117,34 @@ public function testSubmit()
}

/**
* [private] 確認画面から戻る
* [PUBIC] メール送信完了
*/
public function test_back()
public function test_thanks()
{
$this->markTestIncomplete('このテストは、まだ実装されていません。');
$this->loadFixtureScenario(InitAppScenario::class);
ContentFactory::make(['id' => 1, 'plugin' => 'BcMail', 'type' => 'MailContent', 'entity_id' => 1, 'url' => '/contact/', 'site_id' => 1, 'lft' => 1, 'rght' => 2])->persist();
MailContentFactory::make(['id' => 1, 'form_template' => 'default', 'mail_template' => 'mail_default'])->persist();

$this->session(['BcMail.MailContent' => MailContentFactory::get(1)]);
//正常テスト
$this->get('/contact/thanks');

$this->assertResponseOk();
$vars = $this->_controller->viewBuilder()->getVars();
$this->assertNotNull($vars['mailContent']);
}

/**
* 認証用のキャプチャ画像を表示する
*/
public function testCaptcha()
{
$this->markTestIncomplete('このテストは、まだ実装されていません。');
$this->loadFixtureScenario(InitAppScenario::class);
ContentFactory::make(['id' => 1, 'plugin' => 'BcMail', 'type' => 'MailContent', 'entity_id' => 1, 'url' => '/contact/', 'site_id' => 1, 'lft' => 1, 'rght' => 2])->persist();
MailContentFactory::make(['id' => 1, 'form_template' => 'default', 'mail_template' => 'mail_default'])->persist();

//正常テスト
$this->get('/contact/captcha/abc');
$this->assertResponseOk();
}
}

0 comments on commit fc91d28

Please sign in to comment.