Some MediaHandler subclasses were setting custom properties on the File object in order to cache file-associated state. So: * Add File::getHandlerState() and File::setHandlerState(). * Put them in an interface, which will be used in a subsequent commit in MediaHandler::getSizeAndMetadata(). * Use them in DjvuHandler. * Provide a trivial implementation of the interface, for use in testing and in the subsequent commit. Change-Id: Ic365384ff13f7898c1203da38c4405abf03d7563
15 lines
394 B
PHP
15 lines
394 B
PHP
<?php
|
|
|
|
/**
|
|
* @covers TrivialMediaHandlerState
|
|
*/
|
|
class TrivialMediaHandlerStateTest extends MediaWikiUnitTestCase {
|
|
public function testSetHandlerState() {
|
|
$obj = new stdClass;
|
|
$state = new TrivialMediaHandlerState;
|
|
$this->assertNull( $state->getHandlerState( 'test' ) );
|
|
$state->setHandlerState( 'test', $obj );
|
|
$this->assertSame( $obj, $state->getHandlerState( 'test' ) );
|
|
}
|
|
|
|
}
|