@@ -14,9 +14,9 @@ class ImageResizeTest extends PHPUnit_Framework_TestCase
14
14
);
15
15
16
16
private $ unsupported_image = 'Qk08AAAAAAAAADYAAAAoAAAAAQAAAAEAAAABABAAAAAAAAYAAAASCwAAEgsAAAAAAAAAAAAA/38AAAAA ' ;
17
- private $ image_string = 'R0lGODlhDwAPAKECAAAAzMzM /////wAAACwAAAAADwAPAAACIISPeQHsrZ5ModrLlN48CXF8m2iQ3YmmKqVlRtW4MLwWACH+H09wdGltaXplZCBieSBVbGVhZCBTbWFydFNhdmVyIQAAOw == ' ;
17
+ private $ image_string = 'R0lGODlhAQABAIAAAAQCBP ///yH5BAEAAAEALAAAAAABAAEAAAICRAEAOw == ' ;
18
18
19
- public function testLoadString (){
19
+ public function testLoadString () {
20
20
$ resize = ImageResize::createFromString (base64_decode ($ this ->image_string ));
21
21
22
22
$ this ->assertEquals (IMAGETYPE_GIF , $ resize ->source_type );
@@ -49,10 +49,10 @@ public function testLoadPng() {
49
49
50
50
/**
51
51
* @expectedException Exception
52
- * @expectedExceptionMessage Could not load image from string
52
+ * @expectedExceptionMessage Unsupported image type
53
53
*/
54
- public function testInvalidString (){
55
- ImageResize::createFromString ($ this ->unsupported_image );
54
+ public function testInvalidString () {
55
+ ImageResize::createFromString (base64_decode ( $ this ->unsupported_image ) );
56
56
}
57
57
58
58
/**
@@ -71,6 +71,14 @@ public function testLoadUnsupportedFile() {
71
71
new ImageResize (__FILE__ );
72
72
}
73
73
74
+ /**
75
+ * @expectedException Exception
76
+ * @expectedExceptionMessage Could not load
77
+ */
78
+ public function testLoadUnsupportedFileString () {
79
+ ImageResize::createFromString ('' );
80
+ }
81
+
74
82
/**
75
83
* @expectedException Exception
76
84
* @expectedExceptionMessage Unsupported image type
@@ -216,16 +224,16 @@ public function testSaveChmod() {
216
224
$ this ->assertEquals (600 , substr (decoct (fileperms ($ filename )), 3 ));
217
225
}
218
226
219
- public function testGetImageAsString (){
227
+ public function testGetImageAsString () {
220
228
$ resize = ImageResize::createFromString (base64_decode ($ this ->image_string ));
221
229
$ image = $ resize ->getImageAsString ();
222
- $ this ->assertEquals (79 , strlen ($ image ));
230
+ $ this ->assertEquals (43 , strlen ($ image ));
223
231
}
224
232
225
- public function testToString (){
233
+ public function testToString () {
226
234
$ resize = ImageResize::createFromString (base64_decode ($ this ->image_string ));
227
235
$ image = (string )$ resize ;
228
- $ this ->assertEquals (79 , strlen ($ image ));
236
+ $ this ->assertEquals (43 , strlen ($ image ));
229
237
}
230
238
231
239
public function testOutputGif () {
0 commit comments