Created
September 15, 2015 16:25
-
-
Save tareko/596875f14e50996e5d91 to your computer and use it in GitHub Desktop.
Failure to mock
This file contains hidden or 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
$email = new CakeEmail('default'); | |
$success = $email->template('tradeRequestOriginator') | |
->emailFormat('text') | |
->to($user['email']) | |
->subject('[Kitab] Shift trade request by you') | |
->viewVars(array( | |
'user' => $user, | |
'shift' => $shift, | |
'tradeId' => $tradeId, | |
'token' => $token)) | |
->send(); |
This file contains hidden or 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
public function testsendOriginator() { | |
$this->_TradeRequest = new TradeRequest(); | |
App::uses('CakeEmail', 'Network/Email'); | |
$CakeEmail = $this->getMock('CakeEmail' , array('send')); | |
$CakeEmail->expects($this->any()) | |
->method('send') | |
->will($this->returnValue(true)); | |
$email = new CakeEmail('default'); | |
debug($CakeEmail | |
->emailFormat('text') | |
->to('[email protected]') | |
->subject('[Kitab] Shift trade request by you') | |
->send()); | |
$user = array( | |
'email' => '[email protected]', | |
'name' => 'Test user', | |
); | |
$shift = array( | |
'date' => '2015-01-24', | |
'ShiftsType' => 1); | |
$result = $this->_TradeRequest->sendOriginator(5, $user, $shift, 'email'); | |
debug($result); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment