And allow extensions to add their own media handlers. I'm not too happy with the introduction of another global, but didn't like the alternatives either: * Add some hook to MockMediaHandlerFactory that would allow extensions to add their own stuff in. * Use another hook (like ParserTestTables or ParserTestGlobals) and then override the service with a new instance - seemed too hacky The good thing about this is that it lets us kill off a class. I'm other to other suggestions in case I missed something. Bug: T169258 Depends-On: I5875621c58597426ad5242bf3d07714555c439b5 Change-Id: I1c2e903fb235395a8de8e0f7bf65ce07739d2930
38 lines
682 B
PHP
38 lines
682 B
PHP
<?php
|
|
|
|
/**
|
|
* @group Media
|
|
*/
|
|
class FakeDimensionFile extends File {
|
|
public $mustRender = false;
|
|
public $mime;
|
|
public $dimensions;
|
|
|
|
public function __construct( $dimensions, $mime = 'unknown/unknown' ) {
|
|
parent::__construct( Title::makeTitle( NS_FILE, 'Test' ),
|
|
new NullRepo( null ) );
|
|
|
|
$this->dimensions = $dimensions;
|
|
$this->mime = $mime;
|
|
}
|
|
|
|
public function getWidth( $page = 1 ) {
|
|
return $this->dimensions[0];
|
|
}
|
|
|
|
public function getHeight( $page = 1 ) {
|
|
return $this->dimensions[1];
|
|
}
|
|
|
|
public function mustRender() {
|
|
return $this->mustRender;
|
|
}
|
|
|
|
public function getPath() {
|
|
return '';
|
|
}
|
|
|
|
public function getMimeType() {
|
|
return $this->mime;
|
|
}
|
|
}
|