4 * Test storage engine. Does not actually store files. Used for unit tests.
6 final class PhabricatorTestStorageEngine
7 extends PhabricatorFileStorageEngine
{
9 private static $storage = array();
10 private static $nextHandle = 1;
12 public function getEngineIdentifier() {
16 public function getEnginePriority() {
20 public function isTestEngine() {
24 public function canWriteFiles() {
28 public function hasFilesizeLimit() {
32 public function writeFile($data, array $params) {
33 AphrontWriteGuard
::willWrite();
34 self
::$storage[self
::$nextHandle] = $data;
35 return (string)self
::$nextHandle++
;
38 public function readFile($handle) {
39 if (isset(self
::$storage[$handle])) {
40 return self
::$storage[$handle];
42 throw new Exception(pht("No such file with handle '%s'!", $handle));
45 public function deleteFile($handle) {
46 AphrontWriteGuard
::willWrite();
47 unset(self
::$storage[$handle]);
50 public function tamperWithFile($handle, $data) {
51 self
::$storage[$handle] = $data;