Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92650203
PhabricatorTestStorageEngine.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Nov 22, 09:37
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Nov 24, 09:37 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22477789
Attached To
rPH Phabricator
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
]);
}
}
Event Timeline
Log In to Comment