r93928 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93927‎ | r93928 | r93929 >
Date:22:33, 4 August 2011
Author:demon
Status:ok (Comments)
Tags:
Comment:
Fixes for r92251:
* Move Imagick check into getImageWriteMethod(), adjust exception catching. Previously this was bailing on the test if you have convert but not the PHP Imagick extension. Now all these tests are passing for me again.
* Rm unused member variable, whitespace, etc
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/api/ApiUploadTest.php (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/api/RandomImageGenerator.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/api/RandomImageGenerator.php
@@ -91,14 +91,6 @@
9292 if ( !isset( $this->dictionaryFile ) ) {
9393 throw new Exception( "RandomImageGenerator: dictionary file not found or not specified properly" );
9494 }
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 - }
10395 }
10496
10597 /**
@@ -129,7 +121,8 @@
130122 return 'writeSvg';
131123 } else {
132124 // figure out how to write images
133 - if ( class_exists( 'Imagick' ) ) {
 125+ global $wgExiv2Command;
 126+ if ( class_exists( 'Imagick' ) && $wgExiv2Command && is_executable( $wgExiv2Command ) ) {
134127 return 'writeImageWithApi';
135128 } elseif ( $wgUseImageMagick && $wgImageMagickConvertCommand && is_executable( $wgImageMagickConvertCommand ) ) {
136129 return 'writeImageWithCommandLine';
@@ -304,9 +297,7 @@
305298 if ( $retval !== 0 ) {
306299 print "Error with $cmd: $retval, $err\n";
307300 }
308 - }
309 -
310 -
 301+ }
311302 }
312303
313304 /**
Index: trunk/phase3/tests/phpunit/includes/api/ApiUploadTest.php
@@ -107,12 +107,12 @@
108108
109109 try {
110110 $randomImageGenerator = new RandomImageGenerator();
 111+ $filePaths = $randomImageGenerator->writeImages( 1, $extension, wfTempDir() );
111112 }
112113 catch ( Exception $e ) {
113114 $this->markTestIncomplete( $e->getMessage() );
114115 }
115116
116 - $filePaths = $randomImageGenerator->writeImages( 1, $extension, wfTempDir() );
117117 $filePath = $filePaths[0];
118118 $fileSize = filesize( $filePath );
119119 $fileName = basename( $filePath );
@@ -204,12 +204,12 @@
205205
206206 try {
207207 $randomImageGenerator = new RandomImageGenerator();
 208+ $filePaths = $randomImageGenerator->writeImages( 2, $extension, wfTempDir() );
208209 }
209210 catch ( Exception $e ) {
210211 $this->markTestIncomplete( $e->getMessage() );
211212 }
212213
213 - $filePaths = $randomImageGenerator->writeImages( 2, $extension, wfTempDir() );
214214 // we'll reuse this filename
215215 $fileName = basename( $filePaths[0] );
216216
@@ -278,11 +278,12 @@
279279
280280 try {
281281 $randomImageGenerator = new RandomImageGenerator();
 282+ $filePaths = $randomImageGenerator->writeImages( 1, $extension, wfTempDir() );
282283 }
283284 catch ( Exception $e ) {
284285 $this->markTestIncomplete( $e->getMessage() );
285286 }
286 - $filePaths = $randomImageGenerator->writeImages( 1, $extension, wfTempDir() );
 287+
287288 $fileNames[0] = basename( $filePaths[0] );
288289 $fileNames[1] = "SameContentAs" . $fileNames[0];
289290
@@ -361,12 +362,12 @@
362363
363364 try {
364365 $randomImageGenerator = new RandomImageGenerator();
 366+ $filePaths = $randomImageGenerator->writeImages( 1, $extension, wfTempDir() );
365367 }
366368 catch ( Exception $e ) {
367369 $this->markTestIncomplete( $e->getMessage() );
368370 }
369371
370 - $filePaths = $randomImageGenerator->writeImages( 1, $extension, wfTempDir() );
371372 $filePath = $filePaths[0];
372373 $fileSize = filesize( $filePath );
373374 $fileName = basename( $filePath );

Follow-up revisions

RevisionCommit summaryAuthorDate
r93930Followup r93928: forgot to remove thisdemon22:34, 4 August 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r92251Add words.txt for us Windows users. This is a random selection of 1000 words ...btongminh17:13, 15 July 2011

Comments

#Comment by Bryan (talk | contribs)   19:01, 26 August 2011

Thanks.

Status & tagging log