Skip to content

Commit

Permalink
テストの修正
Browse files Browse the repository at this point in the history
  • Loading branch information
chihiro-adachi committed Apr 15, 2024
1 parent 4c7a40e commit 15d027f
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions tests/Eccube/Tests/Web/Admin/Setting/Shop/MailControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public function testEdit()
$MailTemplate = $this->createMail();
$form = [
'_token' => 'dummy',
'name' => $MailTemplate->getName(),
'template' => $MailTemplate->getId(),
'mail_subject' => 'Test Subject',
'tpl_data' => 'Test TPL Data',
Expand All @@ -106,6 +107,7 @@ public function testEditHtml()
$MailTemplate = $this->createMail();
$form = [
'_token' => 'dummy',
'name' => $MailTemplate->getName(),
'template' => $MailTemplate->getId(),
'mail_subject' => 'Test Subject',
'tpl_data' => 'Test TPL Data',
Expand Down Expand Up @@ -133,18 +135,16 @@ public function testEditFail()
'template' => $mid,
'mail_subject' => 'Test Subject',
];
$this->client->request(
$crawler = $this->client->request(
'POST',
$this->generateUrl('admin_setting_shop_mail_edit', ['id' => $mid]),
['mail' => $form]
);

$redirectUrl = $this->generateUrl('admin_setting_shop_mail');
$this->assertTrue($this->client->getResponse()->isRedirect($redirectUrl));
$this->assertTrue($this->client->getResponse()->isSuccessful());

$crawler = $this->client->followRedirect();
$this->actual = $crawler->filter('div.alert')->text();
$this->expected = trans('admin.common.save_error');
$this->actual = $crawler->filter('span.form-error-message')->text();
$this->expected = '選択した値は無効です。';
$this->verify();
}

Expand All @@ -158,13 +158,15 @@ public function testCreateFail()
'template' => null,
'mail_subject' => null,
];
$this->client->request(
$crawler = $this->client->request(
'POST',
$this->generateUrl('admin_setting_shop_mail'),
['mail' => $form]
);

$redirectUrl = $this->generateUrl('admin_setting_shop_mail');
$this->assertTrue($this->client->getResponse()->isRedirect($redirectUrl));
$this->assertTrue($this->client->getResponse()->isSuccessful());
$this->actual = $crawler->filter('span.form-error-message')->text();
$this->expected = '入力されていません。';
$this->verify();
}
}

0 comments on commit 15d027f

Please sign in to comment.