Skip to content

Commit 722061c

Browse files
authored
added further tests to check current behavior of RawData/FilterHelper.php (#351)
1 parent c9c2bed commit 722061c

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

tests/Integration/RawData/FilterHelperTest.php

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,34 @@ public function setUp()
4545
$this->fixture = new FilterHelper();
4646
}
4747

48+
/*
49+
* Tests for filter ASCII85Decode
50+
*/
51+
52+
public function testDecodeFilterASCII85Decode()
53+
{
54+
$compressed = '6Z6g\Eb0<5ARlp)FE2)5B)'; // = Compressed string
55+
$result = $this->fixture->decodeFilter('ASCII85Decode', $compressed);
56+
57+
$this->assertEquals('Compressed string', $result);
58+
}
59+
60+
/*
61+
* Tests for filter ASCIIHexDecode
62+
*/
63+
64+
public function testDecodeFilterASCIIHexDecode()
65+
{
66+
$compressed = '43 6f 6d 70 72 65 73 73 65 64 20 73 74 72 69 6e 67'; // = Compressed string
67+
$result = $this->fixture->decodeFilter('ASCIIHexDecode', $compressed);
68+
69+
$this->assertEquals('Compressed string', $result);
70+
}
71+
72+
/*
73+
* Tests for filter FlateDecode
74+
*/
75+
4876
public function testDecodeFilterFlateDecode()
4977
{
5078
$compressed = gzcompress('Compress me', 9);
@@ -74,4 +102,72 @@ public function testDecodeFilterFlateDecodeUncompressedString()
74102

75103
$this->fixture->decodeFilter('FlateDecode', 'something');
76104
}
105+
106+
/**
107+
* How does function behave if an uncompressed string was given.
108+
*/
109+
public function testDecodeFilterUnknownFilter()
110+
{
111+
$result = $this->fixture->decodeFilter('a string '.rand(), 'something');
112+
$this->assertEquals('something', $result);
113+
}
114+
115+
/*
116+
* Test for filters not being implemented yet.
117+
*/
118+
119+
/**
120+
* CCITTFaxDecode
121+
*/
122+
public function testDecodeFilterCCITTFaxDecode()
123+
{
124+
$this->expectException(Exception::class);
125+
$this->expectExceptionMessage('Decode CCITTFaxDecode not implemented yet.');
126+
127+
$this->fixture->decodeFilter('CCITTFaxDecode', '');
128+
}
129+
130+
/**
131+
* Crypt
132+
*/
133+
public function testDecodeFilterCrypt()
134+
{
135+
$this->expectException(Exception::class);
136+
$this->expectExceptionMessage('Decode Crypt not implemented yet.');
137+
138+
$this->fixture->decodeFilter('Crypt', '');
139+
}
140+
141+
/**
142+
* DCTDecode
143+
*/
144+
public function testDecodeFilterDCTDecode()
145+
{
146+
$this->expectException(Exception::class);
147+
$this->expectExceptionMessage('Decode DCTDecode not implemented yet.');
148+
149+
$this->fixture->decodeFilter('DCTDecode', '');
150+
}
151+
152+
/**
153+
* JBIG2Decode
154+
*/
155+
public function testDecodeFilterJBIG2Decode()
156+
{
157+
$this->expectException(Exception::class);
158+
$this->expectExceptionMessage('Decode JBIG2Decode not implemented yet.');
159+
160+
$this->fixture->decodeFilter('JBIG2Decode', '');
161+
}
162+
163+
/**
164+
* JPXDecode
165+
*/
166+
public function testDecodeFilterJPXDecode()
167+
{
168+
$this->expectException(Exception::class);
169+
$this->expectExceptionMessage('Decode JPXDecode not implemented yet.');
170+
171+
$this->fixture->decodeFilter('JPXDecode', '');
172+
}
77173
}

0 commit comments

Comments
 (0)