MediaWiki
1.30.0
|
Test for ProcessCacheLRU class. More...
Static Public Member Functions | |
static | provideCacheFilling () |
Provider for testFillingCache. More... | |
static | provideInvalidConstructorArg () |
Value which are forbidden by the constructor. More... | |
Protected Member Functions | |
assertCacheEmpty ( $cache, $msg='Cache should be empty') | |
Helper to verify emptiness of a cache object. More... | |
fillCache (&$cache, $numEntries) | |
Helper to fill a cache object passed by reference. More... | |
getExpectedCache ( $cacheMaxEntries, $entryToFill) | |
Generates an array of what would be expected in cache for a given cache size and a number of entries filled in sequentially. More... | |
Test for ProcessCacheLRU class.
Note that it uses the ProcessCacheLRUTestable class which extends some properties and methods visibility. That class is defined at the end of the file containing this class.
Cache
Definition at line 12 of file ProcessCacheLRUTest.php.
|
protected |
Helper to verify emptiness of a cache object.
Compare against an array so we get the cache content difference.
Definition at line 18 of file ProcessCacheLRUTest.php.
References $cache.
Referenced by testAddAndGetAKey(), and testDeleteOldKey().
|
protected |
Helper to fill a cache object passed by reference.
Definition at line 25 of file ProcessCacheLRUTest.php.
References $cache.
Referenced by testBumpExistingKeyToTop(), testFillingCache(), testReplaceExistingKeyInAFullCacheShouldBumpToTop(), and testReplaceExistingKeyShouldBumpEntryToTop().
|
protected |
Generates an array of what would be expected in cache for a given cache size and a number of entries filled in sequentially.
Definition at line 36 of file ProcessCacheLRUTest.php.
Referenced by testFillingCache().
|
static |
Provider for testFillingCache.
Definition at line 147 of file ProcessCacheLRUTest.php.
|
static |
Value which are forbidden by the constructor.
Definition at line 83 of file ProcessCacheLRUTest.php.
ProcessCacheLRUTest::testAddAndGetAKey | ( | ) |
ProcessCacheLRU::get ProcessCacheLRU::set ProcessCacheLRU::has.
Definition at line 99 of file ProcessCacheLRUTest.php.
References assertCacheEmpty().
ProcessCacheLRUTest::testBumpExistingKeyToTop | ( | ) |
Definition at line 235 of file ProcessCacheLRUTest.php.
References $cache, and fillCache().
ProcessCacheLRUTest::testConstructorGivenInvalidValue | ( | $maxSize | ) |
provideInvalidConstructorArg Wikimedia\Assert\ParameterAssertionException ProcessCacheLRU::__construct
Definition at line 76 of file ProcessCacheLRUTest.php.
ProcessCacheLRUTest::testDeleteOldKey | ( | ) |
ProcessCacheLRU::set ProcessCacheLRU::get.
Definition at line 114 of file ProcessCacheLRUTest.php.
References assertCacheEmpty().
ProcessCacheLRUTest::testFillingCache | ( | $cacheMaxEntries, | |
$entryToFill, | |||
$msg = '' |
|||
) |
This test that we properly overflow when filling a cache with a sequence of always different cache-keys.
Meant to verify we correclty delete the older key.
ProcessCacheLRU::set provideCacheFilling
int | $cacheMaxEntries | Maximum entry the created cache will hold |
int | $entryToFill | Number of entries to insert in the created cache. |
Definition at line 133 of file ProcessCacheLRUTest.php.
References $cache, fillCache(), and getExpectedCache().
ProcessCacheLRUTest::testPhpUnitArrayEquality | ( | ) |
Highlight diff between assertEquals and assertNotSame.
Definition at line 62 of file ProcessCacheLRUTest.php.
ProcessCacheLRUTest::testRecentlyAccessedKeyStickIn | ( | ) |
ProcessCacheLRU::get ProcessCacheLRU::set ProcessCacheLRU::has.
Definition at line 189 of file ProcessCacheLRUTest.php.
References $cache.
ProcessCacheLRUTest::testReplaceExistingKeyInAFullCacheShouldBumpToTop | ( | ) |
This first create a full cache then update the value for the 2nd filled entry.
Given a cache having 1,2,3 as key, updating 2 should bump 2 to the top of the queue with the new value: 1,3,2* (* = updated).
ProcessCacheLRU::set ProcessCacheLRU::get
Definition at line 211 of file ProcessCacheLRUTest.php.
References $cache, and fillCache().
ProcessCacheLRUTest::testReplaceExistingKeyShouldBumpEntryToTop | ( | ) |
Create a cache with only one remaining entry then update the first inserted entry.
Should bump it to the top.
Definition at line 165 of file ProcessCacheLRUTest.php.
References $cache, and fillCache().