Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php declare(strict_types=1); /** * DebugTransportTest file * * CakePHP(tm) : Rapid D..
Decoded Output download
<?php
declare(strict_types=1);
/**
* DebugTransportTest file
*
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link https://cakephp.org CakePHP(tm) Project
* @since 2.0.0
* @license https://opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Test\TestCase\Mailer\Transport;
use Cake\Mailer\Message;
use Cake\Mailer\Transport\DebugTransport;
use Cake\TestSuite\TestCase;
/**
* Test case
*/
class DebugTransportTest extends TestCase
{
/**
* @var \Cake\Mailer\Transport\DebugTransport
*/
protected $DebugTransport;
/**
* Setup
*/
public function setUp(): void
{
parent::setUp();
$this->DebugTransport = new DebugTransport();
}
/**
* testSend method
*/
public function testSend(): void
{
$message = new Message();
$message->setFrom('[email protected]', 'CakePHP Test');
$message->setTo('[email protected]', 'CakePHP');
$message->setCc(['[email protected]' => 'Mark Story', '[email protected]' => 'Juan Basso']);
$message->setBcc('[email protected]');
$message->setMessageId('<4d9946cf-0a44-4907-88fe-1d0ccbdd56cb@localhost>');
$message->setSubject('Testing Message');
$date = date(DATE_RFC2822);
$message->setHeaders(['Date' => $date, 'o:tag' => ['foo', 'bar']]);
$message->setBody(['text' => "First Line
Second Line
.Third Line
"]);
$headers = "From: CakePHP Test <[email protected]>
";
$headers .= "To: CakePHP <[email protected]>
";
$headers .= "Cc: Mark Story <[email protected]>, Juan Basso <[email protected]>
";
$headers .= 'Date: ' . $date . "
";
$headers .= 'o:tag: foo' . "
";
$headers .= 'o:tag: bar' . "
";
$headers .= "Message-ID: <4d9946cf-0a44-4907-88fe-1d0ccbdd56cb@localhost>
";
$headers .= "Subject: Testing Message
";
$headers .= "MIME-Version: 1.0
";
$headers .= "Content-Type: text/plain; charset=UTF-8
";
$headers .= 'Content-Transfer-Encoding: 8bit';
$data = "First Line
";
$data .= "Second Line
";
$data .= ".Third Line
"; // Not use 'RFC5321 4.5.2.Transparency' in DebugTransport.
$result = $this->DebugTransport->send($message);
$this->assertSame($headers, $result['headers']);
$this->assertSame($data, $result['message']);
}
}
?>
Did this file decode correctly?
Original Code
<?php
declare(strict_types=1);
/**
* DebugTransportTest file
*
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link https://cakephp.org CakePHP(tm) Project
* @since 2.0.0
* @license https://opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Test\TestCase\Mailer\Transport;
use Cake\Mailer\Message;
use Cake\Mailer\Transport\DebugTransport;
use Cake\TestSuite\TestCase;
/**
* Test case
*/
class DebugTransportTest extends TestCase
{
/**
* @var \Cake\Mailer\Transport\DebugTransport
*/
protected $DebugTransport;
/**
* Setup
*/
public function setUp(): void
{
parent::setUp();
$this->DebugTransport = new DebugTransport();
}
/**
* testSend method
*/
public function testSend(): void
{
$message = new Message();
$message->setFrom('[email protected]', 'CakePHP Test');
$message->setTo('[email protected]', 'CakePHP');
$message->setCc(['[email protected]' => 'Mark Story', '[email protected]' => 'Juan Basso']);
$message->setBcc('[email protected]');
$message->setMessageId('<4d9946cf-0a44-4907-88fe-1d0ccbdd56cb@localhost>');
$message->setSubject('Testing Message');
$date = date(DATE_RFC2822);
$message->setHeaders(['Date' => $date, 'o:tag' => ['foo', 'bar']]);
$message->setBody(['text' => "First Line\nSecond Line\n.Third Line\n"]);
$headers = "From: CakePHP Test <[email protected]>\r\n";
$headers .= "To: CakePHP <[email protected]>\r\n";
$headers .= "Cc: Mark Story <[email protected]>, Juan Basso <[email protected]>\r\n";
$headers .= 'Date: ' . $date . "\r\n";
$headers .= 'o:tag: foo' . "\r\n";
$headers .= 'o:tag: bar' . "\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\r\n"; // Not use 'RFC5321 4.5.2.Transparency' in DebugTransport.
$result = $this->DebugTransport->send($message);
$this->assertSame($headers, $result['headers']);
$this->assertSame($data, $result['message']);
}
}
Function Calls
None |
Stats
MD5 | 155e7d3f2d580b04ee4608df92907812 |
Eval Count | 0 |
Decode Time | 73 ms |