wiki.techinc.nl/tests/phpunit/mocks/filerepo/MockLocalRepo.php
Aaron Schulz ff5abb66b4 Migrate callers to new MWFileProps::getPropsFromPath() method
* FSFile should not be responsible for handling this much logic.
* Make more MediaHandler classes aware of the fact that an object
  other than File might be passed in. Use the FSFile instead of a
  useless empty stdClass object.
* Also added more fields to FSFile::placeholderProps to make it
  more complete.

Change-Id: I9fe764b2a7261af507c6555e6a57273cf7d00d36
2016-09-22 00:33:46 +00:00

23 lines
493 B
PHP

<?php
/**
* Class simulating a local file repo.
*
* @ingroup FileRepo
* @since 1.28
*/
class MockLocalRepo extends LocalRepo {
function getLocalCopy( $virtualUrl ) {
return new MockFSFile( wfTempDir() . '/' . wfRandomString( 32 ) );
}
function getLocalReference( $virtualUrl ) {
return new MockFSFile( wfTempDir() . '/' . wfRandomString( 32 ) );
}
function getFileProps( $virtualUrl ) {
$fsFile = $this->getLocalReference( $virtualUrl );
return $fsFile->getProps();
}
}