Move ResultWrapper subclasses to Rdbms
[mediawiki.git] / tests / phpunit / includes / api / generateRandomImages.php
blobd49971470d36d5ca04e7e82a214e59b96c9c5f66
1 <?php
2 /**
3 * Bootstrapping for test image file generation
5 * @file
6 */
8 // Start up MediaWiki in command-line mode
9 require_once __DIR__ . "/../../../../maintenance/Maintenance.php";
10 require __DIR__ . "/RandomImageGenerator.php";
12 class GenerateRandomImages extends Maintenance {
14 public function getDbType() {
15 return Maintenance::DB_NONE;
18 public function execute() {
20 $getOptSpec = [
21 'dictionaryFile::',
22 'minWidth::',
23 'maxWidth::',
24 'minHeight::',
25 'maxHeight::',
26 'shapesToDraw::',
27 'shape::',
29 'number::',
30 'format::'
32 $options = getopt( null, $getOptSpec );
34 $format = isset( $options['format'] ) ? $options['format'] : 'jpg';
35 unset( $options['format'] );
37 $number = isset( $options['number'] ) ? intval( $options['number'] ) : 10;
38 unset( $options['number'] );
40 $randomImageGenerator = new RandomImageGenerator( $options );
41 $randomImageGenerator->writeImages( $number, $format );
45 $maintClass = 'GenerateRandomImages';
46 require RUN_MAINTENANCE_IF_MAIN;