Skip to content

Commit 4452e3a

Browse files
author
Mitch
committed
Whitespace, shorten image string
1 parent 8b7d376 commit 4452e3a

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

test/Test.php

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ class ImageResizeTest extends PHPUnit_Framework_TestCase
1414
);
1515

1616
private $unsupported_image = 'Qk08AAAAAAAAADYAAAAoAAAAAQAAAAEAAAABABAAAAAAAAYAAAASCwAAEgsAAAAAAAAAAAAA/38AAAAA';
17-
private $image_string = 'R0lGODlhDwAPAKECAAAAzMzM/////wAAACwAAAAADwAPAAACIISPeQHsrZ5ModrLlN48CXF8m2iQ3YmmKqVlRtW4MLwWACH+H09wdGltaXplZCBieSBVbGVhZCBTbWFydFNhdmVyIQAAOw==';
17+
private $image_string = 'R0lGODlhAQABAIAAAAQCBP///yH5BAEAAAEALAAAAAABAAEAAAICRAEAOw==';
1818

19-
public function testLoadString(){
19+
public function testLoadString() {
2020
$resize = ImageResize::createFromString(base64_decode($this->image_string));
2121

2222
$this->assertEquals(IMAGETYPE_GIF, $resize->source_type);
@@ -49,10 +49,10 @@ public function testLoadPng() {
4949

5050
/**
5151
* @expectedException Exception
52-
* @expectedExceptionMessage Could not load image from string
52+
* @expectedExceptionMessage Unsupported image type
5353
*/
54-
public function testInvalidString(){
55-
ImageResize::createFromString($this->unsupported_image);
54+
public function testInvalidString() {
55+
ImageResize::createFromString(base64_decode($this->unsupported_image));
5656
}
5757

5858
/**
@@ -71,6 +71,14 @@ public function testLoadUnsupportedFile() {
7171
new ImageResize(__FILE__);
7272
}
7373

74+
/**
75+
* @expectedException Exception
76+
* @expectedExceptionMessage Could not load
77+
*/
78+
public function testLoadUnsupportedFileString() {
79+
ImageResize::createFromString('');
80+
}
81+
7482
/**
7583
* @expectedException Exception
7684
* @expectedExceptionMessage Unsupported image type
@@ -216,16 +224,16 @@ public function testSaveChmod() {
216224
$this->assertEquals(600, substr(decoct(fileperms($filename)), 3));
217225
}
218226

219-
public function testGetImageAsString(){
227+
public function testGetImageAsString() {
220228
$resize = ImageResize::createFromString(base64_decode($this->image_string));
221229
$image = $resize->getImageAsString();
222-
$this->assertEquals(79, strlen($image));
230+
$this->assertEquals(43, strlen($image));
223231
}
224232

225-
public function testToString(){
233+
public function testToString() {
226234
$resize = ImageResize::createFromString(base64_decode($this->image_string));
227235
$image = (string)$resize;
228-
$this->assertEquals(79, strlen($image));
236+
$this->assertEquals(43, strlen($image));
229237
}
230238

231239
public function testOutputGif() {

0 commit comments

Comments
 (0)