wiki.techinc.nl/tests/phpunit/includes/api/generateRandomImages.php
Antoine Musso 0fd05285d7 pass codesniffer on tests/
Fix almost all occurences of the following sniffs:

Generic.CodeAnalysis.UselessOverridingMethod.Found
Generic.Formatting.NoSpaceAfterCast.SpaceFound
Generic.Functions.FunctionCallArgumentSpacing.SpaceBeforeComma
Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine
Generic.PHP.LowerCaseConstant.Found
PSR2.Classes.PropertyDeclaration.ScopeMissing
PSR2.Files.EndFileNewline.TooMany
PSR2.Methods.MethodDeclaration.StaticBeforeVisibility

Change-Id: I96aacef5bafe5a2bca659744fba1380999cfc37d
2013-01-28 12:14:26 +01:00

49 lines
1.1 KiB
PHP

<?php
/**
* Bootstrapping for test image file generation
*
* @file
*/
// Evaluate the include path relative to this file
$IP = dirname( dirname( dirname( dirname( __DIR__ ) ) ) );
// Start up MediaWiki in command-line mode
require_once( "$IP/maintenance/Maintenance.php" );
require( __DIR__ . "/RandomImageGenerator.php" );
class GenerateRandomImages extends Maintenance {
public function getDbType() {
return Maintenance::DB_NONE;
}
public function execute() {
$getOptSpec = array(
'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 );