wiki.techinc.nl/tests/phpunit/includes/api/generateRandomImages.php
Kunal Mehta 6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00

46 lines
1,013 B
PHP

<?php
/**
* Bootstrapping for test image file generation
*
* @file
*/
// Start up MediaWiki in command-line mode
require_once __DIR__ . "/../../../../maintenance/Maintenance.php";
require __DIR__ . "/RandomImageGenerator.php";
class GenerateRandomImages extends Maintenance {
public function getDbType() {
return Maintenance::DB_NONE;
}
public function execute() {
$getOptSpec = [
'dictionaryFile::',
'minWidth::',
'maxWidth::',
'minHeight::',
'maxHeight::',
'shapesToDraw::',
'shape::',
'number::',
'format::'
];
$options = getopt( null, $getOptSpec );
$format = isset( $options['format'] ) ? $options['format'] : 'jpg';
unset( $options['format'] );
$number = isset( $options['number'] ) ? intval( $options['number'] ) : 10;
unset( $options['number'] );
$randomImageGenerator = new RandomImageGenerator( $options );
$randomImageGenerator->writeImages( $number, $format );
}
}
$maintClass = 'GenerateRandomImages';
require RUN_MAINTENANCE_IF_MAIN;