diff --git a/tests/class/helper/SC_Helper_Mail/SC_Helper_Mail_TestBase.php b/tests/class/helper/SC_Helper_Mail/SC_Helper_Mail_TestBase.php new file mode 100644 index 0000000000..b366d124e5 --- /dev/null +++ b/tests/class/helper/SC_Helper_Mail/SC_Helper_Mail_TestBase.php @@ -0,0 +1,50 @@ +checkMailCatcherStatus(); + $this->objHelperMail = new SC_Helper_Mail_Ex(); + + $this->faker = Faker\Factory::create('ja_JP'); + } + + protected function tearDown() + { + parent::tearDown(); + } + + protected function setUpCustomer($properties = []) + { + $this->email = $this->faker->safeEmail; + $this->customer_id = $this->objGenerator->createCustomer($this->email, $properties); + $this->arrCustomer = $this->objQuery->getRow('*', 'dtb_customer', 'customer_id = ?', [$this->customer_id]); + $this->objCustomer = new SC_Customer_Ex(); + } +} diff --git a/tests/class/helper/SC_Helper_Mail/SC_Helper_Mail_sfSendRegistMailTest.php b/tests/class/helper/SC_Helper_Mail/SC_Helper_Mail_sfSendRegistMailTest.php new file mode 100644 index 0000000000..48076b6760 --- /dev/null +++ b/tests/class/helper/SC_Helper_Mail/SC_Helper_Mail_sfSendRegistMailTest.php @@ -0,0 +1,46 @@ +setUpCustomer(); + + $this->resetEmails(); + $this->objHelperMail->sfSendRegistMail($this->arrCustomer['secret_key']); + + $message = $this->getLastMailCatcherMessage(); + $this->assertContains($this->arrCustomer['name01'] . $this->arrCustomer['name02'] . ' 様', $message['source']); + } + + public function test会員登録依頼メールの宛名が正しい() + { + # 仮会員を作成 + $this->setUpCustomer(['status' => 1]); + + $this->resetEmails(); + $this->objHelperMail->sfSendRegistMail($this->arrCustomer['secret_key'], '', false, true); + + $message = $this->getLastMailCatcherMessage(); + $this->assertContains($this->arrCustomer['name01'] . ' ' . $this->arrCustomer['name02'] . ' 様', $message['source']); + $this->assertContains('&id=' . $this->arrCustomer['secret_key'], $message['source']); + } +}