Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F95806090
PhabricatorCachesTestCase.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
Thu, Dec 19, 10:58
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Dec 21, 10:58 (2 d)
Engine
blob
Format
Raw Data
Handle
23060871
Attached To
rPH Phabricator
PhabricatorCachesTestCase.php
View Options
<?php
final
class
PhabricatorCachesTestCase
extends
PhabricatorTestCase
{
public
function
testRequestCache
()
{
$cache
=
PhabricatorCaches
::
getRequestCache
();
$test_key
=
'unit.'
.
Filesystem
::
readRandomCharacters
(
8
);
$default_value
=
pht
(
'Default'
);
$new_value
=
pht
(
'New Value'
);
$this
->
assertEqual
(
$default_value
,
$cache
->
getKey
(
$test_key
,
$default_value
));
// Set a key, verify it persists.
$cache
=
PhabricatorCaches
::
getRequestCache
();
$cache
->
setKey
(
$test_key
,
$new_value
);
$this
->
assertEqual
(
$new_value
,
$cache
->
getKey
(
$test_key
,
$default_value
));
// Refetch the cache, verify it's really a cache.
$cache
=
PhabricatorCaches
::
getRequestCache
();
$this
->
assertEqual
(
$new_value
,
$cache
->
getKey
(
$test_key
,
$default_value
));
// Destroy the cache.
PhabricatorCaches
::
destroyRequestCache
();
// Now, the value should be missing again.
$cache
=
PhabricatorCaches
::
getRequestCache
();
$this
->
assertEqual
(
$default_value
,
$cache
->
getKey
(
$test_key
,
$default_value
));
}
}
Event Timeline
Log In to Comment