1
1
<?php
2
2
3
- use \Gumlet \ImageResize ;
4
- use \Gumlet \ImageResizeException ;
3
+
4
+ use AJUR \Toolkit \ImageResize ;
5
+ use AJUR \Toolkit \ImageResizeException ;
5
6
use \PHPUnit \Framework \TestCase ;
6
7
7
8
class ImageResizeTest extends TestCase
@@ -28,7 +29,7 @@ public function testLoadGif()
28
29
$ resize = new ImageResize ($ image );
29
30
30
31
$ this ->assertEquals (IMAGETYPE_GIF , $ resize ->source_type );
31
- $ this ->assertInstanceOf ('\Gumlet \ImageResize ' , $ resize );
32
+ $ this ->assertInstanceOf ('\AJUR\Toolkit \ImageResize ' , $ resize );
32
33
}
33
34
34
35
public function testLoadJpg ()
@@ -37,7 +38,7 @@ public function testLoadJpg()
37
38
$ resize = new ImageResize ($ image );
38
39
39
40
$ this ->assertEquals (IMAGETYPE_JPEG , $ resize ->source_type );
40
- $ this ->assertInstanceOf ('\Gumlet \ImageResize ' , $ resize );
41
+ $ this ->assertInstanceOf ('\AJUR\Toolkit \ImageResize ' , $ resize );
41
42
}
42
43
43
44
public function testLoadIgnoreXmpExifJpg ()
@@ -46,7 +47,7 @@ public function testLoadIgnoreXmpExifJpg()
46
47
$ resize = new ImageResize ($ image );
47
48
48
49
$ this ->assertEquals (IMAGETYPE_JPEG , $ resize ->source_type );
49
- $ this ->assertInstanceOf ('\Gumlet \ImageResize ' , $ resize );
50
+ $ this ->assertInstanceOf ('\AJUR\Toolkit \ImageResize ' , $ resize );
50
51
}
51
52
52
53
public function testLoadPng ()
@@ -55,7 +56,7 @@ public function testLoadPng()
55
56
$ resize = new ImageResize ($ image );
56
57
57
58
$ this ->assertEquals (IMAGETYPE_PNG , $ resize ->source_type );
58
- $ this ->assertInstanceOf ('\Gumlet \ImageResize ' , $ resize );
59
+ $ this ->assertInstanceOf ('\AJUR\Toolkit \ImageResize ' , $ resize );
59
60
}
60
61
61
62
public function testLoadWebp ()
@@ -64,23 +65,23 @@ public function testLoadWebp()
64
65
$ resize = new ImageResize ($ image );
65
66
66
67
$ this ->assertEquals (IMAGETYPE_WEBP , $ resize ->source_type );
67
- $ this ->assertInstanceOf ('\Gumlet \ImageResize ' , $ resize );
68
+ $ this ->assertInstanceOf ('\AJUR\Toolkit \ImageResize ' , $ resize );
68
69
}
69
70
70
71
public function testLoadString ()
71
72
{
72
73
$ resize = ImageResize::createFromString (base64_decode ($ this ->image_string ));
73
74
74
75
$ this ->assertEquals (IMAGETYPE_GIF , $ resize ->source_type );
75
- $ this ->assertInstanceOf ('\Gumlet \ImageResize ' , $ resize );
76
+ $ this ->assertInstanceOf ('\AJUR\Toolkit \ImageResize ' , $ resize );
76
77
}
77
78
78
79
public function testLoadRfc2397 ()
79
80
{
80
81
$ resize = new ImageResize ($ this ->data_url );
81
82
82
83
$ this ->assertEquals (IMAGETYPE_GIF , $ resize ->source_type );
83
- $ this ->assertInstanceOf ('\Gumlet \ImageResize ' , $ resize );
84
+ $ this ->assertInstanceOf ('\AJUR\Toolkit \ImageResize ' , $ resize );
84
85
}
85
86
86
87
public function testAddFilter ()
@@ -89,7 +90,7 @@ public function testAddFilter()
89
90
$ resize = new ImageResize ($ image );
90
91
$ filename = $ this ->getTempFile ();
91
92
92
- $ this ->assertInstanceOf ('\Gumlet \ImageResize ' , $ resize ->addFilter ('imagefilter ' ));
93
+ $ this ->assertInstanceOf ('\AJUR\Toolkit \ImageResize ' , $ resize ->addFilter ('imagefilter ' ));
93
94
}
94
95
95
96
public function testApplyFilter ()
@@ -99,7 +100,7 @@ public function testApplyFilter()
99
100
$ resize ->addFilter ('imagefilter ' );
100
101
$ filename = $ this ->getTempFile ();
101
102
102
- $ this ->assertInstanceOf ('\Gumlet \ImageResize ' , $ resize ->save ($ filename ));
103
+ $ this ->assertInstanceOf ('\AJUR\Toolkit \ImageResize ' , $ resize ->save ($ filename ));
103
104
}
104
105
105
106
/**
@@ -109,29 +110,29 @@ public function testApplyFilter()
109
110
public function testLoadNoFile ()
110
111
{
111
112
$ this ->expectExceptionMessage ("No filename given " );
112
- $ this ->expectException (\ Gumlet \ ImageResizeException::class);
113
+ $ this ->expectException (ImageResizeException::class);
113
114
new ImageResize (null );
114
115
}
115
116
116
117
public function testLoadUnsupportedFile ()
117
118
{
118
- $ this ->expectExceptionMessage ("Gumlet \ImageResize ERROR: Could not read file " );
119
- $ this ->expectException (\ Gumlet \ ImageResizeException::class);
119
+ $ this ->expectExceptionMessage ("AJUR\Toolkit \ImageResize ERROR: Could not read file " );
120
+ $ this ->expectException (ImageResizeException::class);
120
121
new ImageResize (__FILE__ );
121
122
}
122
123
123
124
public function testLoadUnsupportedFileString ()
124
125
{
125
126
$ this ->expectExceptionMessage ("image_data must not be empty " );
126
- $ this ->expectException (\ Gumlet \ ImageResizeException::class);
127
+ $ this ->expectException (ImageResizeException::class);
127
128
ImageResize::createFromString ('' );
128
129
}
129
130
130
131
/*public function testLoadUnsupportedImage()
131
132
{
132
133
// хер его знает почему не работает тест...
133
- // $this->expectExceptionMessage("Gumlet \ImageResize ERROR: Unsupported image type");
134
- // $this->expectException(\Gumlet \ImageResizeException::class);
134
+ $this->expectExceptionMessage("AJUR\Toolkit \ImageResize ERROR: Unsupported image type");
135
+ $this->expectException(\AJUR\Toolkit \ImageResizeException::class);
135
136
$filename = $this->getTempFile();
136
137
137
138
$image = fopen($filename, 'w');
@@ -143,8 +144,8 @@ public function testLoadUnsupportedFileString()
143
144
144
145
/*public function testInvalidString()
145
146
{
146
- $this->expectExceptionMessage("Gumlet \ImageResize ERROR: Unsupported image type");
147
- $this->expectException(\Gumlet \ImageResizeException::class);
147
+ $this->expectExceptionMessage("AJUR\Toolkit \ImageResize ERROR: Unsupported image type");
148
+ $this->expectException(\AJUR\Toolkit \ImageResizeException::class);
148
149
ImageResize::createFromString(base64_decode($this->unsupported_image));
149
150
}*/
150
151
@@ -317,23 +318,23 @@ public function testCropPosition()
317
318
318
319
$ resize ->crop (50 , 50 , false , $ resize ::CROPRIGHT );
319
320
320
- $ reflection_class = new ReflectionClass ('\Gumlet \ImageResize ' );
321
+ $ reflection_class = new ReflectionClass ('\AJUR\Toolkit \ImageResize ' );
321
322
$ source_x = $ reflection_class ->getProperty ('source_x ' );
322
323
$ source_x ->setAccessible (true );
323
324
324
325
$ this ->assertEquals (100 , $ source_x ->getValue ($ resize ));
325
326
326
327
$ resize ->crop (50 , 50 , false , $ resize ::CROPCENTRE );
327
328
328
- $ reflection_class = new ReflectionClass ('\Gumlet \ImageResize ' );
329
+ $ reflection_class = new ReflectionClass ('\AJUR\Toolkit \ImageResize ' );
329
330
$ source_x = $ reflection_class ->getProperty ('source_x ' );
330
331
$ source_x ->setAccessible (true );
331
332
332
333
$ this ->assertEquals (50 , $ source_x ->getValue ($ resize ));
333
334
334
335
$ resize ->crop (50 , 50 , false , $ resize ::CROPTOPCENTER );
335
336
336
- $ reflection_class = new ReflectionClass ('\Gumlet \ImageResize ' );
337
+ $ reflection_class = new ReflectionClass ('\AJUR\Toolkit \ImageResize ' );
337
338
$ source_x = $ reflection_class ->getProperty ('source_x ' );
338
339
$ source_x ->setAccessible (true );
339
340
0 commit comments