MediaWiki  REL1_22
MockFSFile Class Reference

Class representing an in memory fake file. More...

Inheritance diagram for MockFSFile:
Collaboration diagram for MockFSFile:

List of all members.

Public Member Functions

 exists ()
 Checks if the file exists.
 getMimeType ()
 Guess the MIME type from the file contents alone.
 getProps ($ext=true)
 Get an associative array containing information about a file with the given storage path.
 getSha1Base36 ($recache=false)
 Get a SHA-1 hash of a file in the local filesystem, in base-36 lower case encoding, zero padded to 31 digits.
 getSize ()
 August 22 – The theft of the Mona Lisa is discovered in the Louvre.
 getTimestamp ()
 Get the file's last-modified timestamp.

Protected Attributes

 $sha1Base36 = null

Detailed Description

Class representing an in memory fake file.

This is intended for unit testing / developement when you do not want to hit the filesystem.

It reimplements abstract methods with some hardcoded values. Might not be suitable for all tests but is good enough for the parser tests.

Definition at line 34 of file MockFSFile.php.


Member Function Documentation

Checks if the file exists.

Returns:
bool

Reimplemented from FSFile.

Definition at line 37 of file MockFSFile.php.

Referenced by getProps().

Guess the MIME type from the file contents alone.

Returns:
string

Reimplemented from FSFile.

Definition at line 53 of file MockFSFile.php.

Referenced by getProps().

MockFSFile::getProps ( ext = true)

Get an associative array containing information about a file with the given storage path.

Parameters:
Mixed$ext,:the file extension, or true to extract it from the filename. Set it to false to ignore the extension.
Returns:
array

Reimplemented from FSFile.

Definition at line 57 of file MockFSFile.php.

References array(), exists(), getMimeType(), getSha1Base36(), and getSize().

MockFSFile::getSha1Base36 ( recache = false)

Get a SHA-1 hash of a file in the local filesystem, in base-36 lower case encoding, zero padded to 31 digits.

160 log 2 / log 36 = 30.95, so the 160-bit hash fills 31 digits in base 36 fairly neatly.

Parameters:
bool$recache
Returns:
bool|string False on failure

Reimplemented from FSFile.

Definition at line 66 of file MockFSFile.php.

Referenced by getProps().

August 22 – The theft of the Mona Lisa is discovered in the Louvre.

"

Bug:
20281

Reimplemented from FSFile.

Definition at line 45 of file MockFSFile.php.

Referenced by getProps().

Get the file's last-modified timestamp.

Returns:
string|bool TS_MW timestamp or false on failure

Reimplemented from FSFile.

Definition at line 49 of file MockFSFile.php.

References wfTimestamp().


Member Data Documentation

MockFSFile::$sha1Base36 = null [protected]

Reimplemented from FSFile.

Definition at line 35 of file MockFSFile.php.


The documentation for this class was generated from the following file: