Skip to content

Commit

Permalink
Merge pull request #3942 from thangnnmd/unitTest_MailContentsControll…
Browse files Browse the repository at this point in the history
…er_index

MailContentsController::index
  • Loading branch information
HungDV2022 authored Oct 24, 2024
2 parents 31f5eaf + f8ecfd0 commit f889863
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class MailContentsController extends BcAdminApiController
*
* @checked
* @noTodo
* @unitTest
*/
public function index(MailContentsServiceInterface $service)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,26 @@ public function testCopy()
$this->assertEquals($result->message, 'メールフォームのコピー「メールコンテンツコピー」を追加しました。');
$this->assertNotNull($result->mailContent);
}

/**
* test index
*/
public function test_index()
{
//create data
$this->loadFixtureScenario(MailFieldsScenario::class);
$this->loadFixtureScenario(MailContentsScenario::class);

$this->get("/baser/api/admin/bc-mail/mail_contents/index.json?token=" . $this->accessToken);
$this->assertResponseOk();

$result = json_decode((string)$this->_response->getBody());
//List of mail contents
$this->assertCount(2, $result->mailContents);

//Query is set to limit = 1, only one result is returned
$this->get("/baser/api/admin/bc-mail/mail_contents/index.json?limit=1&token=" . $this->accessToken);
$result = json_decode((string)$this->_response->getBody());
$this->assertCount(1, $result->mailContents);
}
}

0 comments on commit f889863

Please sign in to comment.