wiki.techinc.nl/tests/phpunit/includes/api/generateRandomImages.php
Ammar Abdulhamid 61ff46196e Use class keyword for classname resolution
Change-Id: I149abf837c6bd79f05648b1acbfaf45dc900125e
2020-03-27 09:33:01 +01:00

44 lines
965 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 = [
'minWidth::',
'maxWidth::',
'minHeight::',
'maxHeight::',
'shapesToDraw::',
'shape::',
'number::',
'format::'
];
$options = getopt( null, $getOptSpec );
$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::class;
require RUN_MAINTENANCE_IF_MAIN;