mirror of
				https://github.com/brmlab/brmsklad.git
				synced 2025-10-31 16:23:59 +01:00 
			
		
		
		
	Backup of current cakephp version
This commit is contained in:
		
							parent
							
								
									b8f82da6f8
								
							
						
					
					
						commit
						5a580df460
					
				
					 925 changed files with 238041 additions and 1 deletions
				
			
		
							
								
								
									
										77
									
								
								lib/Cake/Test/Case/Network/Email/DebugTransportTest.php
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								lib/Cake/Test/Case/Network/Email/DebugTransportTest.php
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,77 @@ | |||
| <?php | ||||
| /** | ||||
|  * DebugTransportTest file | ||||
|  * | ||||
|  * PHP 5 | ||||
|  * | ||||
|  * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> | ||||
|  * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) | ||||
|  * | ||||
|  * Licensed under The MIT License | ||||
|  * Redistributions of files must retain the above copyright notice | ||||
|  * | ||||
|  * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) | ||||
|  * @link          http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests | ||||
|  * @package       Cake.Test.Case.Network.Email | ||||
|  * @since         CakePHP(tm) v 2.0.0 | ||||
|  * @license       MIT License (http://www.opensource.org/licenses/mit-license.php) | ||||
|  */ | ||||
| App::uses('CakeEmail', 'Network/Email'); | ||||
| App::uses('AbstractTransport', 'Network/Email'); | ||||
| App::uses('DebugTransport', 'Network/Email'); | ||||
| 
 | ||||
| /** | ||||
|  * Test case | ||||
|  * | ||||
|  */ | ||||
| class DebugTransportTest extends CakeTestCase { | ||||
| 
 | ||||
| /** | ||||
|  * Setup | ||||
|  * | ||||
|  * @return void | ||||
|  */ | ||||
| 	public function setUp() { | ||||
| 		$this->DebugTransport = new DebugTransport(); | ||||
| 	} | ||||
| 
 | ||||
| /** | ||||
|  * testSend method | ||||
|  * | ||||
|  * @return void | ||||
|  */ | ||||
| 	public function testSend() { | ||||
| 		$this->getMock('CakeEmail', array('message'), array(), 'DebugCakeEmail'); | ||||
| 		$email = new DebugCakeEmail(); | ||||
| 		$email->from('noreply@cakephp.org', 'CakePHP Test'); | ||||
| 		$email->to('cake@cakephp.org', 'CakePHP'); | ||||
| 		$email->cc(array('mark@cakephp.org' => 'Mark Story', 'juan@cakephp.org' => 'Juan Basso')); | ||||
| 		$email->bcc('phpnut@cakephp.org'); | ||||
| 		$email->messageID('<4d9946cf-0a44-4907-88fe-1d0ccbdd56cb@localhost>'); | ||||
| 		$email->subject('Testing Message'); | ||||
| 		$date = date(DATE_RFC2822); | ||||
| 		$email->setHeaders(array('X-Mailer' => DebugCakeEmail::EMAIL_CLIENT, 'Date' => $date)); | ||||
| 		$email->expects($this->any())->method('message')->will($this->returnValue(array('First Line', 'Second Line', '.Third Line', ''))); | ||||
| 
 | ||||
| 		$headers = "From: CakePHP Test <noreply@cakephp.org>\r\n"; | ||||
| 		$headers .= "To: CakePHP <cake@cakephp.org>\r\n"; | ||||
| 		$headers .= "Cc: Mark Story <mark@cakephp.org>, Juan Basso <juan@cakephp.org>\r\n"; | ||||
| 		$headers .= "X-Mailer: CakePHP Email\r\n"; | ||||
| 		$headers .= "Date: " . $date . "\r\n"; | ||||
| 		$headers .= "Message-ID: <4d9946cf-0a44-4907-88fe-1d0ccbdd56cb@localhost>\r\n"; | ||||
| 		$headers .= "Subject: Testing Message\r\n"; | ||||
| 		$headers .= "MIME-Version: 1.0\r\n"; | ||||
| 		$headers .= "Content-Type: text/plain; charset=UTF-8\r\n"; | ||||
| 		$headers .= "Content-Transfer-Encoding: 8bit"; | ||||
| 
 | ||||
| 		$data = "First Line\r\n"; | ||||
| 		$data .= "Second Line\r\n"; | ||||
| 		$data .= ".Third Line\r\n"; // Not use 'RFC5321 4.5.2.Transparency' in DebugTransport.
 | ||||
| 
 | ||||
| 		$result = $this->DebugTransport->send($email); | ||||
| 
 | ||||
| 		$this->assertEquals($headers, $result['headers']); | ||||
| 		$this->assertEquals($data, $result['message']); | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Brm Ko
						Brm Ko