MediaWiki  REL1_20
ProcessCacheLRUTest Class Reference

Test for ProcessCacheLRU class. More...

Inheritance diagram for ProcessCacheLRUTest:
Collaboration diagram for ProcessCacheLRUTest:

List of all members.

Public Member Functions

 assertCacheEmpty ($cache, $msg= 'Cache should be empty')
 Helper to verify emptiness of a cache object.
 fillCache (&$cache, $numEntries)
 Helper to fill a cache object passed by reference.
 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.
 provideCacheFilling ()
 Provider for testFillingCache.
 provideInvalidConstructorArg ()
 Value which are forbidden by the constructor.
 testAddAndGetAKey ()
 testBumpExistingKeyToTop ()
 testConstructorGivenInvalidValue ($maxSize)
 provideInvalidConstructorArg MWException
 testDeleteOldKey ()
 testFillingCache ($cacheMaxEntries, $entryToFill, $msg= '')
 This test that we properly overflow when filling a cache with a sequence of always different cache-keys.
 testPhpUnitArrayEquality ()
 Highlight diff between assertEquals and assertNotSame.
 testRecentlyAccessedKeyStickIn ()
 testReplaceExistingKeyInAFullCacheShouldBumpToTop ()
 This first create a full cache then update the value for the 2nd filled entry.
 testReplaceExistingKeyShouldBumpEntryToTop ()
 Create a cache with only one remaining entry then update the first inserted entry.

Detailed Description

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.


Member Function Documentation

ProcessCacheLRUTest::assertCacheEmpty ( cache,
msg = 'Cache should be empty' 
)

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.

Referenced by testAddAndGetAKey(), and testDeleteOldKey().

ProcessCacheLRUTest::fillCache ( &$  cache,
numEntries 
)
ProcessCacheLRUTest::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.

Definition at line 36 of file ProcessCacheLRUTest.php.

Referenced by testFillingCache().

Provider for testFillingCache.

Definition at line 134 of file ProcessCacheLRUTest.php.

Value which are forbidden by the constructor.

Definition at line 79 of file ProcessCacheLRUTest.php.

provideInvalidConstructorArg MWException

Definition at line 72 of file ProcessCacheLRUTest.php.

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.

provideCacheFilling

Parameters:
$cacheMaxEntriesMaximum entry the created cache will hold
$entryToFillNumber of entries to insert in the created cache.

Definition at line 119 of file ProcessCacheLRUTest.php.

References fillCache(), and getExpectedCache().

Highlight diff between assertEquals and assertNotSame.

Definition at line 61 of file ProcessCacheLRUTest.php.

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).

Definition at line 187 of file ProcessCacheLRUTest.php.

References fillCache().

Create a cache with only one remaining entry then update the first inserted entry.

Should bump it to the top.

Definition at line 149 of file ProcessCacheLRUTest.php.

References fillCache().


The documentation for this class was generated from the following file: