Index: trunk/phase3/tests/phpunit/includes/api/RandomImageGenerator.php |
— | — | @@ -91,14 +91,6 @@ |
92 | 92 | if ( !isset( $this->dictionaryFile ) ) { |
93 | 93 | throw new Exception( "RandomImageGenerator: dictionary file not found or not specified properly" ); |
94 | 94 | } |
95 | | - |
96 | | - if ( !class_exists( 'Imagick' ) ) { |
97 | | - throw new Exception( 'No Imagick extension' ); |
98 | | - } |
99 | | - global $wgExiv2Command; |
100 | | - if ( !$wgExiv2Command || !is_executable( $wgExiv2Command ) ) { |
101 | | - throw new Exception( 'exiv2 not executable or $wgExiv2Command not set' ); |
102 | | - } |
103 | 95 | } |
104 | 96 | |
105 | 97 | /** |
— | — | @@ -129,7 +121,8 @@ |
130 | 122 | return 'writeSvg'; |
131 | 123 | } else { |
132 | 124 | // figure out how to write images |
133 | | - if ( class_exists( 'Imagick' ) ) { |
| 125 | + global $wgExiv2Command; |
| 126 | + if ( class_exists( 'Imagick' ) && $wgExiv2Command && is_executable( $wgExiv2Command ) ) { |
134 | 127 | return 'writeImageWithApi'; |
135 | 128 | } elseif ( $wgUseImageMagick && $wgImageMagickConvertCommand && is_executable( $wgImageMagickConvertCommand ) ) { |
136 | 129 | return 'writeImageWithCommandLine'; |
— | — | @@ -304,9 +297,7 @@ |
305 | 298 | if ( $retval !== 0 ) { |
306 | 299 | print "Error with $cmd: $retval, $err\n"; |
307 | 300 | } |
308 | | - } |
309 | | - |
310 | | - |
| 301 | + } |
311 | 302 | } |
312 | 303 | |
313 | 304 | /** |
Index: trunk/phase3/tests/phpunit/includes/api/ApiUploadTest.php |
— | — | @@ -107,12 +107,12 @@ |
108 | 108 | |
109 | 109 | try { |
110 | 110 | $randomImageGenerator = new RandomImageGenerator(); |
| 111 | + $filePaths = $randomImageGenerator->writeImages( 1, $extension, wfTempDir() ); |
111 | 112 | } |
112 | 113 | catch ( Exception $e ) { |
113 | 114 | $this->markTestIncomplete( $e->getMessage() ); |
114 | 115 | } |
115 | 116 | |
116 | | - $filePaths = $randomImageGenerator->writeImages( 1, $extension, wfTempDir() ); |
117 | 117 | $filePath = $filePaths[0]; |
118 | 118 | $fileSize = filesize( $filePath ); |
119 | 119 | $fileName = basename( $filePath ); |
— | — | @@ -204,12 +204,12 @@ |
205 | 205 | |
206 | 206 | try { |
207 | 207 | $randomImageGenerator = new RandomImageGenerator(); |
| 208 | + $filePaths = $randomImageGenerator->writeImages( 2, $extension, wfTempDir() ); |
208 | 209 | } |
209 | 210 | catch ( Exception $e ) { |
210 | 211 | $this->markTestIncomplete( $e->getMessage() ); |
211 | 212 | } |
212 | 213 | |
213 | | - $filePaths = $randomImageGenerator->writeImages( 2, $extension, wfTempDir() ); |
214 | 214 | // we'll reuse this filename |
215 | 215 | $fileName = basename( $filePaths[0] ); |
216 | 216 | |
— | — | @@ -278,11 +278,12 @@ |
279 | 279 | |
280 | 280 | try { |
281 | 281 | $randomImageGenerator = new RandomImageGenerator(); |
| 282 | + $filePaths = $randomImageGenerator->writeImages( 1, $extension, wfTempDir() ); |
282 | 283 | } |
283 | 284 | catch ( Exception $e ) { |
284 | 285 | $this->markTestIncomplete( $e->getMessage() ); |
285 | 286 | } |
286 | | - $filePaths = $randomImageGenerator->writeImages( 1, $extension, wfTempDir() ); |
| 287 | + |
287 | 288 | $fileNames[0] = basename( $filePaths[0] ); |
288 | 289 | $fileNames[1] = "SameContentAs" . $fileNames[0]; |
289 | 290 | |
— | — | @@ -361,12 +362,12 @@ |
362 | 363 | |
363 | 364 | try { |
364 | 365 | $randomImageGenerator = new RandomImageGenerator(); |
| 366 | + $filePaths = $randomImageGenerator->writeImages( 1, $extension, wfTempDir() ); |
365 | 367 | } |
366 | 368 | catch ( Exception $e ) { |
367 | 369 | $this->markTestIncomplete( $e->getMessage() ); |
368 | 370 | } |
369 | 371 | |
370 | | - $filePaths = $randomImageGenerator->writeImages( 1, $extension, wfTempDir() ); |
371 | 372 | $filePath = $filePaths[0]; |
372 | 373 | $fileSize = filesize( $filePath ); |
373 | 374 | $fileName = basename( $filePath ); |