Localisation updates from https://translatewiki.net.
[mediawiki.git] / tests / phpunit / includes / api / generateRandomImages.php
blob1b3d51d50f0dcbe9c1a00c8f6b3c1b0022e4df5f
1 <?php
3 namespace MediaWiki\Tests\Api;
5 use MediaWiki\Maintenance\Maintenance;
7 /**
8 * Bootstrapping for test image file generation
10 * @file
13 // Start up MediaWiki in command-line mode
14 require_once __DIR__ . "/../../../../maintenance/Maintenance.php";
15 require_once __DIR__ . "/RandomImageGenerator.php";
17 class GenerateRandomImages extends Maintenance {
19 public function getDbType() {
20 return Maintenance::DB_NONE;
23 public function execute() {
24 $getOptSpec = [
25 'minWidth::',
26 'maxWidth::',
27 'minHeight::',
28 'maxHeight::',
30 'number::',
31 'format::'
33 $options = getopt( '', $getOptSpec );
35 $format = $options['format'] ?? 'svg';
36 unset( $options['format'] );
38 $number = (int)( $options['number'] ?? 1 );
39 unset( $options['number'] );
41 $randomImageGenerator = new RandomImageGenerator( $options );
42 $randomImageGenerator->writeImages( $number, $format );
46 $maintClass = GenerateRandomImages::class;
47 require_once RUN_MAINTENANCE_IF_MAIN;