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 /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@..
Decoded Output download
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mime\Tests\Header;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Header\MailboxHeader;
class MailboxHeaderTest extends TestCase
{
public function testConstructor()
{
$header = new MailboxHeader('Sender', $address = new Address('[email protected]'));
$this->assertEquals($address, $header->getAddress());
$this->assertEquals($address, $header->getBody());
}
public function testAddress()
{
$header = new MailboxHeader('Sender', new Address('[email protected]'));
$header->setBody($address = new Address('[email protected]'));
$this->assertEquals($address, $header->getAddress());
$this->assertEquals($address, $header->getBody());
$header->setAddress($address = new Address('[email protected]'));
$this->assertEquals($address, $header->getAddress());
$this->assertEquals($address, $header->getBody());
}
public function testgetBodyAsString()
{
$header = new MailboxHeader('Sender', new Address('[email protected]'));
$this->assertEquals('[email protected]', $header->getBodyAsString());
$header->setAddress(new Address('[email protected]'));
$this->assertEquals('[email protected]', $header->getBodyAsString());
$header = new MailboxHeader('Sender', new Address('[email protected]', 'Fabien Potencier'));
$this->assertEquals('Fabien Potencier <[email protected]>', $header->getBodyAsString());
$header = new MailboxHeader('Sender', new Address('[email protected]', 'Fabien Potencier, "from Symfony"'));
$this->assertEquals('"Fabien Potencier, \"from Symfony\"" <[email protected]>', $header->getBodyAsString());
$header = new MailboxHeader('From', new Address('[email protected]', 'Fabien Potencier, \escaped\'));
$this->assertEquals('"Fabien Potencier, \\escaped\\" <[email protected]>', $header->getBodyAsString());
$name = 'P'.pack('C', 0x8F).'tencier';
$header = new MailboxHeader('Sender', new Address('[email protected]', 'Fabien '.$name));
$header->setCharset('iso-8859-1');
$this->assertEquals('Fabien =?'.$header->getCharset().'?Q?P=8Ftencier?= <[email protected]>', $header->getBodyAsString());
}
public function testUtf8CharsInLocalPart()
{
$header = new MailboxHeader('Sender', new Address('[email protected]'));
$this->assertSame('[email protected]', $header->getBodyAsString());
}
public function testToString()
{
$header = new MailboxHeader('Sender', new Address('[email protected]'));
$this->assertEquals('Sender: [email protected]', $header->toString());
$header = new MailboxHeader('Sender', new Address('[email protected]', 'Fabien Potencier'));
$this->assertEquals('Sender: Fabien Potencier <[email protected]>', $header->toString());
}
}
?>
Did this file decode correctly?
Original Code
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mime\Tests\Header;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Header\MailboxHeader;
class MailboxHeaderTest extends TestCase
{
public function testConstructor()
{
$header = new MailboxHeader('Sender', $address = new Address('[email protected]'));
$this->assertEquals($address, $header->getAddress());
$this->assertEquals($address, $header->getBody());
}
public function testAddress()
{
$header = new MailboxHeader('Sender', new Address('[email protected]'));
$header->setBody($address = new Address('[email protected]'));
$this->assertEquals($address, $header->getAddress());
$this->assertEquals($address, $header->getBody());
$header->setAddress($address = new Address('[email protected]'));
$this->assertEquals($address, $header->getAddress());
$this->assertEquals($address, $header->getBody());
}
public function testgetBodyAsString()
{
$header = new MailboxHeader('Sender', new Address('[email protected]'));
$this->assertEquals('[email protected]', $header->getBodyAsString());
$header->setAddress(new Address('[email protected]'));
$this->assertEquals('[email protected]', $header->getBodyAsString());
$header = new MailboxHeader('Sender', new Address('[email protected]', 'Fabien Potencier'));
$this->assertEquals('Fabien Potencier <[email protected]>', $header->getBodyAsString());
$header = new MailboxHeader('Sender', new Address('[email protected]', 'Fabien Potencier, "from Symfony"'));
$this->assertEquals('"Fabien Potencier, \"from Symfony\"" <[email protected]>', $header->getBodyAsString());
$header = new MailboxHeader('From', new Address('[email protected]', 'Fabien Potencier, \\escaped\\'));
$this->assertEquals('"Fabien Potencier, \\\\escaped\\\\" <[email protected]>', $header->getBodyAsString());
$name = 'P'.pack('C', 0x8F).'tencier';
$header = new MailboxHeader('Sender', new Address('[email protected]', 'Fabien '.$name));
$header->setCharset('iso-8859-1');
$this->assertEquals('Fabien =?'.$header->getCharset().'?Q?P=8Ftencier?= <[email protected]>', $header->getBodyAsString());
}
public function testUtf8CharsInLocalPart()
{
$header = new MailboxHeader('Sender', new Address('[email protected]'));
$this->assertSame('[email protected]', $header->getBodyAsString());
}
public function testToString()
{
$header = new MailboxHeader('Sender', new Address('[email protected]'));
$this->assertEquals('Sender: [email protected]', $header->toString());
$header = new MailboxHeader('Sender', new Address('[email protected]', 'Fabien Potencier'));
$this->assertEquals('Sender: Fabien Potencier <[email protected]>', $header->toString());
}
}
Function Calls
None |
Stats
MD5 | 8a58a112dba7fbe55c3f2162068bb0f9 |
Eval Count | 0 |
Decode Time | 89 ms |