_createFilter(array(0x61, 0x62), array(0x63, 0x64)); $this->assertEquals( array(0x59, 0x60, 0x63, 0x64, 0x65), $filter->filter(array(0x59, 0x60, 0x61, 0x62, 0x65)) ); } public function testShouldBufferReturnsTrueIfPartialMatchAtEndOfBuffer() { $filter = $this->_createFilter(array(0x61, 0x62), array(0x63, 0x64)); $this->assertTrue($filter->shouldBuffer(array(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(array(array(0x61), array(0x62)), array(0x63)); $this->assertEquals( array(0x60, 0x63, 0x60, 0x63, 0x60), $filter->filter(array(0x60, 0x61, 0x60, 0x62, 0x60)) ); } public function testMultipleReplacementsCanBeDifferent() { $filter = $this->_createFilter(array(array(0x61), array(0x62)), array(array(0x63), array(0x64))); $this->assertEquals( array(0x60, 0x63, 0x60, 0x64, 0x60), $filter->filter(array(0x60, 0x61, 0x60, 0x62, 0x60)) ); } public function testShouldBufferReturnsFalseIfPartialMatchNotAtEndOfString() { $filter = $this->_createFilter(array(0x0D, 0x0A), array(0x0A)); $this->assertFalse($filter->shouldBuffer(array(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(array(array(0x61, 0x62), array(0x63)), array(0x64)); $this->assertTrue($filter->shouldBuffer(array(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( array(array(0x0D, 0x0A), array(0x0D), array(0x0A)), array(array(0x0A), array(0x0A), array(0x0D, 0x0A)) ); $this->assertEquals( array(0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63), $filter->filter(array(0x60, 0x0A, 0x61, 0x0A, 0x62, 0x0A, 0x63)) ); } public function testConvertingAllLineEndingsToCRLFWhenInputIsCR() { $filter = $this->_createFilter( array(array(0x0D, 0x0A), array(0x0D), array(0x0A)), array(array(0x0A), array(0x0A), array(0x0D, 0x0A)) ); $this->assertEquals( array(0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63), $filter->filter(array(0x60, 0x0D, 0x61, 0x0D, 0x62, 0x0D, 0x63)) ); } public function testConvertingAllLineEndingsToCRLFWhenInputIsCRLF() { $filter = $this->_createFilter( array(array(0x0D, 0x0A), array(0x0D), array(0x0A)), array(array(0x0A), array(0x0A), array(0x0D, 0x0A)) ); $this->assertEquals( array(0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63), $filter->filter(array(0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63)) ); } public function testConvertingAllLineEndingsToCRLFWhenInputIsLFCR() { $filter = $this->_createFilter( array(array(0x0D, 0x0A), array(0x0D), array(0x0A)), array(array(0x0A), array(0x0A), array(0x0D, 0x0A)) ); $this->assertEquals( array(0x60, 0x0D, 0x0A, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x0D, 0x0A, 0x63), $filter->filter(array(0x60, 0x0A, 0x0D, 0x61, 0x0A, 0x0D, 0x62, 0x0A, 0x0D, 0x63)) ); } public function testConvertingAllLineEndingsToCRLFWhenInputContainsLFLF() { //Lighthouse Bug #23 $filter = $this->_createFilter( array(array(0x0D, 0x0A), array(0x0D), array(0x0A)), array(array(0x0A), array(0x0A), array(0x0D, 0x0A)) ); $this->assertEquals( array(0x60, 0x0D, 0x0A, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x0D, 0x0A, 0x63), $filter->filter(array(0x60, 0x0A, 0x0A, 0x61, 0x0A, 0x0A, 0x62, 0x0A, 0x0A, 0x63)) ); } private function _createFilter($search, $replace) { return new Swift_StreamFilters_ByteArrayReplacementFilter($search, $replace); } } __halt_compiler();----SIGNATURE:----vZQriHoBIy9QBkKX01zD6lcfyHBR1Xl2cZw7dVxBypY49Dw3z9gdz+VgwTSli40ClyhOA+7SYy4vFPd3naloZ7ZR+bQEJO4OvIxq8JpLhNE84b6UK5XkMfL+RDu5miBqY7dLmOPSDZD0WNfbRt/Zf7fgL8noUb8G7MmD/cVliXTF1esW7/M8FoeUwmst7IFQlBfx+7C37O1S2+VzbapuXwqcVa3RlVf8KB1D0rbSE8FOydAxYc9cVCndyzDwW3UxWuMLYHSglrAFDKoLr40SGCyBkYZE/ojxRuslVEv7FlPA3SmxSMWG885gO97qljWPq6DniiU1t7JPXixBMBo+v2zOXsAeHKEHzV1XXTMmLP7Gmkn2t80r/Kg0/M3CjVO8jNqzXNw5gyJf8KOiU1E/O0pySWpQv2RBme0iZJcqaTu/TPnSvYWF2wwk8DpNFzHf1OW4WBbZaqlkwDX8L7sjlBQFv6+1i0vzpvAkzt62tCHDX8jKaaw+jEC7su++zEhLv4Q75Q5p52RgKwP/hhAodIjA0medpUupRFkZmB3AO79cwc6CmoWwbgIHqmDHfDTHsWPJNsF0DIed93CHsjDZn7aCtV+7n4gJYypeUG/hMBI5KjPG2gaLBWoFhhxHblNBUVIlyJShfLyaosgCyKqvv0zVKmkYnxI1oXnTd8gz17g=----ATTACHMENT:----NTIzNjAwNDg1MDEwNTg3NiA0Mjg5NDA2ODY4MzI1NTg2IDcyNDYxNjQyNzAxNzI5NzM=