Merge "Follow-up I0b781c11 (2a55449): use User::getAutomaticGroups()."
[lhc/web/wiklou.git] / tests / phpunit / includes / api / generateRandomImages.php
1 <?php
2 /**
3 * Bootstrapping for test image file generation
4 *
5 * @file
6 */
7
8 // Evaluate the include path relative to this file
9 $IP = dirname( dirname( dirname( dirname( __DIR__ ) ) ) );
10
11 // Start up MediaWiki in command-line mode
12 require_once( "$IP/maintenance/Maintenance.php" );
13 require( __DIR__ . "/RandomImageGenerator.php" );
14
15 class GenerateRandomImages extends Maintenance {
16
17 public function getDbType() {
18 return Maintenance::DB_NONE;
19 }
20
21 public function execute() {
22
23 $getOptSpec = array(
24 'dictionaryFile::',
25 'minWidth::',
26 'maxWidth::',
27 'minHeight::',
28 'maxHeight::',
29 'shapesToDraw::',
30 'shape::',
31
32 'number::',
33 'format::'
34 );
35 $options = getopt( null, $getOptSpec );
36
37 $format = isset( $options['format'] ) ? $options['format'] : 'jpg';
38 unset( $options['format'] );
39
40 $number = isset( $options['number'] ) ? intval( $options['number'] ) : 10;
41 unset( $options['number'] );
42
43 $randomImageGenerator = new RandomImageGenerator( $options );
44 $randomImageGenerator->writeImages( $number, $format );
45 }
46 }
47
48 $maintClass = 'GenerateRandomImages';
49 require( RUN_MAINTENANCE_IF_MAIN );
50
51