Something went wrong. Try again.
@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
Something went wrong. Try again.
1.1 kB · 41 lines
PHP
123456789101112131415161718192021222324252627282930313233343536373839404142<?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)); }
}