Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F569660
PhabricatorTestStorageEngine.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorTestStorageEngine.php
View Options
<?php
/**
* Test storage engine. Does not actually store files. Used for unit tests.
*/
final
class
PhabricatorTestStorageEngine
extends
PhabricatorFileStorageEngine
{
private
static
$storage
=
array
();
private
static
$nextHandle
=
1
;
public
function
getEngineIdentifier
()
{
return
'unit-test'
;
}
public
function
getEnginePriority
()
{
return
1000
;
}
public
function
isTestEngine
()
{
return
true
;
}
public
function
canWriteFiles
()
{
return
true
;
}
public
function
hasFilesizeLimit
()
{
return
false
;
}
public
function
writeFile
(
$data
,
array
$params
)
{
AphrontWriteGuard
::
willWrite
();
self
::
$storage
[
self
::
$nextHandle
]
=
$data
;
return
(
string
)
self
::
$nextHandle
++;
}
public
function
readFile
(
$handle
)
{
if
(
isset
(
self
::
$storage
[
$handle
]))
{
return
self
::
$storage
[
$handle
];
}
throw
new
Exception
(
pht
(
"No such file with handle '%s'!"
,
$handle
));
}
public
function
deleteFile
(
$handle
)
{
AphrontWriteGuard
::
willWrite
();
unset
(
self
::
$storage
[
$handle
]);
}
public
function
tamperWithFile
(
$handle
,
$data
)
{
self
::
$storage
[
$handle
]
=
$data
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, May 13, 2:53 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
120060
Default Alt Text
PhabricatorTestStorageEngine.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment