Remove product literal strings in "pht()", part 5
[phabricator.git] / src / applications / files / engine / PhabricatorTestStorageEngine.php
blob952fba60759a1d9f862dbd6f1f424323d8d69141
1 <?php
3 /**
4 * Test storage engine. Does not actually store files. Used for unit tests.
5 */
6 final class PhabricatorTestStorageEngine
7 extends PhabricatorFileStorageEngine {
9 private static $storage = array();
10 private static $nextHandle = 1;
12 public function getEngineIdentifier() {
13 return 'unit-test';
16 public function getEnginePriority() {
17 return 1000;
20 public function isTestEngine() {
21 return true;
24 public function canWriteFiles() {
25 return true;
28 public function hasFilesizeLimit() {
29 return false;
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;