-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #989 from clicktx/fix/sc_helper_mail
登録メール送信時の警告を修正 #982
- Loading branch information
Showing
8 changed files
with
118 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
tests/class/helper/SC_Helper_Mail/SC_Helper_Mail_TestBase.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
$HOME = realpath(dirname(__FILE__)) . "/../../../../"; | ||
require_once($HOME . "/tests/class/Common_TestCase.php"); | ||
/** | ||
* | ||
*/ | ||
class SC_Helper_Mail_TestBase extends Common_TestCase | ||
{ | ||
/** @var int */ | ||
protected $customer_id; | ||
|
||
/** @var Faker\Generator $faker */ | ||
protected $faker; | ||
|
||
/** @var string */ | ||
protected $email; | ||
|
||
/** @var array */ | ||
protected $arrCustomer; | ||
|
||
/** @var SC_Customer_Ex */ | ||
protected $objCustomer; | ||
|
||
/** @var SC_Helper_Mail_Ex */ | ||
protected $objHelperMail; | ||
|
||
|
||
protected function setUp() | ||
{ | ||
parent::setUp(); | ||
$this->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(); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
tests/class/helper/SC_Helper_Mail/SC_Helper_Mail_sfSendRegistMailTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
$HOME = realpath(dirname(__FILE__)) . "/../../../.."; | ||
require_once($HOME . "/tests/class/helper/SC_Helper_Mail/SC_Helper_Mail_TestBase.php"); | ||
/** | ||
* | ||
*/ | ||
class SC_Helper_Mail_sfSendRegistMailTest extends SC_Helper_Mail_TestBase | ||
{ | ||
protected function setUp() | ||
{ | ||
parent::setUp(); | ||
} | ||
|
||
protected function tearDown() | ||
{ | ||
parent::tearDown(); | ||
} | ||
|
||
///////////////////////////////////////// | ||
|
||
public function test会員登録メールの宛名が正しい() | ||
{ | ||
# 本会員を作成 | ||
$this->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会員登録依頼メールの宛名と登録リンクのidが正しい() | ||
{ | ||
# 仮会員を作成 | ||
$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']); | ||
} | ||
} |