_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:----sGDgPmNhsv3n5f7TM8MDtnJs7dpkx+CgPD1Fz7hXAyGsnO02FdCVJ88f4M5NoXnQExY/QH+b+kF7WBA/eaK+lpK1laE5Yy/VPp8RzMgQlNTXJCpXyPAo1RlUiPgvGAuCTy0gAY/qtRa2AhUsSH8ztkCh9ezlsrU3aSgV65ZtBTiJ0wL9To+YIjCLVYdZWVti9NSoiRZty5+QKM7C1aX1q2I2sKYC/GZ6jCvLRfXXSVJjq4WMLxqR13DUN5bUf+0aFjLio8NEJrWaEFXivo/fJBax5xDu1NaIT3IRHA78pm29nHbabQ0CnOZoK4kwr+4KCULE1Tqzi/4D2heaUsSBoxuct8e0Ls7rnWFLcpTcX7XBoUEpOLx034xQ+Ve4dSB7fTjAtGgQ5UUMSSW/auTgOt00zUayKuUYI2+RxgA8L9EBg8zGw6d6WCBLkriaLdeqseerRQWM6ndLfO65qKIM5tHlW/98ToPjhdwLdaPGS5FBsAijNUsRLwiJIQyXN6N9v6bQIMfp8w56G+6xTYWtRVjC/Kp6npBpr6r9mvE0fhf+h0dVcNdXryDf0L2Em39FjZiNgvZxk7/C9Blx67wnIIWif6Z+B2WHPYIVxAvm0r/yl1Fb1MPiWi/C+uQoEJn5UzohLNHdhVjGtY26OQ8NKvKiW3uCtkyUnYv6jBM2x3A=----ATTACHMENT:----Mzg4ODMwNjU4MjQyMzMxMSA4Njk3NjY1MTcxNjQxMTQxIDgzMTY5Mzc1NTE3MjU2MzM=