}
public function testElementBasics() {
- global $wgWellFormedXml;
-
$this->assertEquals(
'<img>',
Html::element( 'img', null, '' ),
'Close tag for empty element (array, string)'
);
- $wgWellFormedXml = true;
+ $this->setMwGlobals( 'wgWellFormedXml', true );
$this->assertEquals(
'<img />',
}
public function testExpandAttributesForBooleans() {
- global $wgHtml5, $wgWellFormedXml;
-
$this->assertEquals(
'',
Html::expandAttributes( array( 'selected' => false ) ),
'Boolean attributes have no value when value is true (passed as numerical array)'
);
- $wgWellFormedXml = true;
+ $this->setMwGlobals( 'wgWellFormedXml', true );
$this->assertEquals(
' selected=""',
'Boolean attributes have empty string value when value is true (wgWellFormedXml)'
);
- $wgHtml5 = false;
+ $this->setMwGlobals( 'wgHtml5', false );
$this->assertEquals(
' selected="selected"',
* Please note it output a string prefixed with a space!
*/
public function testExpandAttributesVariousExpansions() {
- global $wgWellFormedXml;
-
### NOT EMPTY ####
$this->assertEquals(
' empty_string=""',
'Number 0 value needs no quotes'
);
- $wgWellFormedXml = true;
+ $this->setMwGlobals( 'wgWellFormedXml', true );
$this->assertEquals(
' empty_string=""',
* List of input element types values introduced by HTML5
* Full list at http://www.w3.org/TR/html-markup/input.html
*/
- function provideHtml5InputTypes() {
+ public static function provideHtml5InputTypes() {
$types = array(
'datetime',
'datetime-local',
class JobQueueTest extends MediaWikiTestCase {
protected $key;
protected $queueRand, $queueRandTTL, $queueFifo, $queueFifoTTL;
- protected $old = array();
function __construct( $name = null, array $data = array(), $dataName = '' ) {
parent::__construct( $name, $data, $dataName );
}
protected function setUp() {
- global $wgMemc, $wgJobTypeConf;
+ global $wgJobTypeConf;
parent::setUp();
- $this->old['wgMemc'] = $wgMemc;
- $wgMemc = new HashBagOStuff();
+
+ $this->setMwGlobals( 'wgMemc', new HashBagOStuff() );
+
if ( $this->getCliArg( 'use-jobqueue=' ) ) {
$name = $this->getCliArg( 'use-jobqueue=' );
if ( !isset( $wgJobTypeConf[$name] ) ) {
}
protected function tearDown() {
- global $wgMemc;
parent::tearDown();
foreach ( array(
'queueRand', 'queueRandTTL', 'queueTimestamp', 'queueTimestampTTL',
}
$this->$q = null;
}
- $wgMemc = $this->old['wgMemc'];
}
/**
$this->assertEquals( 0, $queue->getAcquiredCount(), "No jobs active ($desc)" );
}
- function provider_queueLists() {
+ public static function provider_queueLists() {
return array(
array( 'queueRand', false, 'Random queue without ack()' ),
array( 'queueRandTTL', true, 'Random queue with ack()' ),
);
}
- function provider_fifoQueueLists() {
+ public static function provider_fifoQueueLists() {
return array(
array( 'queueFifo', false, 'Ordered queue without ack()' ),
array( 'queueFifoTTL', true, 'Ordered queue with ack()' )
if ( !wfDl( 'exif' ) ) {
$this->markTestSkipped( "This test needs the exif extension." );
}
- global $wgShowEXIF;
- $this->show = $wgShowEXIF;
- $wgShowEXIF = true;
- global $wgEnableAutoRotation;
- $this->oldAuto = $wgEnableAutoRotation;
- $wgEnableAutoRotation = true;
- }
-
- protected function tearDown() {
- global $wgShowEXIF, $wgEnableAutoRotation;
- $wgShowEXIF = $this->show;
- $wgEnableAutoRotation = $this->oldAuto;
-
- parent::tearDown();
+ $this->setMwGlobals( array(
+ 'wgShowEXIF' => true,
+ 'wgEnableAutoRotation' => true,
+ ) );
}
/**
* @dataProvider provideFilesNoAutoRotate
*/
function testMetadataNoAutoRotate( $name, $type, $info ) {
- global $wgEnableAutoRotation;
- $wgEnableAutoRotation = false;
+ $this->setMwGlobals( 'wgEnableAutoRotation', false );
$file = $this->dataFile( $name, $type );
$this->assertEquals( $info['width'], $file->getWidth(), "$name: width check" );
$this->assertEquals( $info['height'], $file->getHeight(), "$name: height check" );
-
- $wgEnableAutoRotation = true;
}
/**
* @dataProvider provideFilesNoAutoRotate
*/
function testRotationRenderingNoAutoRotate( $name, $type, $info, $thumbs ) {
- global $wgEnableAutoRotation;
- $wgEnableAutoRotation = false;
+ $this->setMwGlobals( 'wgEnableAutoRotation', false );
foreach ( $thumbs as $size => $out ) {
if ( preg_match( '/^(\d+)px$/', $size, $matches ) ) {
$this->assertEquals( $out[1], $gis[1], "$name: thumb actual height check for $size" );
}
}
- $wgEnableAutoRotation = true;
}
public static function provideFilesNoAutoRotate() {
$this->assertEquals( $expected, $result );
}
- function provideBitmapExtractPreRotationDimensions() {
+ public static function provideBitmapExtractPreRotationDimensions() {
return array(
array(
0,