Go to the documentation of this file.
19 $this->assertAttributeEquals(
array(),
'cache',
$cache, $msg );
27 for ( $i = 1; $i <= $numEntries; $i++ ) {
28 $cache->set(
"cache-key-$i",
"prop-$i",
"value-$i" );
39 if ( $entryToFill === 0 ) {
42 } elseif ( $entryToFill <= $cacheMaxEntries ) {
43 # Cache is not fully filled
47 $firstKey = 1 + $entryToFill - $cacheMaxEntries;
50 $lastKey = $entryToFill;
52 for ( $i = $firstKey; $i <= $lastKey; $i++ ) {
53 $expected[
"cache-key-$i"] =
array(
"prop-$i" =>
"value-$i" );
63 $one =
array(
'A' => 1,
'B' => 2 );
64 $two =
array(
'B' => 2,
'A' => 1 );
65 $this->assertEquals( $one, $two );
66 $this->assertNotSame( $one, $two );
84 array(
new stdClass() ),
96 $oneCache->set(
'cache-key',
'prop1',
'value1' );
97 $this->assertEquals( 1, $oneCache->getEntriesCount() );
98 $this->assertTrue( $oneCache->has(
'cache-key',
'prop1' ) );
99 $this->assertEquals(
'value1', $oneCache->get(
'cache-key',
'prop1' ) );
106 $oneCache->set(
'cache-key',
'prop1',
'value1' );
107 $oneCache->set(
'cache-key',
'prop1',
'value2' );
108 $this->assertEquals(
'value2', $oneCache->get(
'cache-key',
'prop1' ) );
127 "Filling a $cacheMaxEntries entries cache with $entryToFill entries"
139 array( 1, 2 ), # overflow
140 array( 5, 33 ), # overflow
156 $cache->set(
"cache-key-1",
"prop-1",
"new-value-for-1" );
160 'cache-key-2' =>
array(
'prop-2' =>
'value-2' ),
161 'cache-key-1' =>
array(
'prop-1' =>
'new-value-for-1' ),
169 $cache->set(
'first',
'prop1',
'value1' );
170 $cache->set(
'second',
'prop2',
'value2' );
173 $cache->get(
'first',
'prop1' );
175 $cache->set(
'third',
'prop3',
'value3' );
177 $this->assertFalse(
$cache->has(
'second',
'prop2' ) );
193 $cache->set(
"cache-key-2",
"prop-2",
"new-value-for-2" );
196 'cache-key-1' =>
array(
'prop-1' =>
'value-1' ),
197 'cache-key-3' =>
array(
'prop-3' =>
'value-3' ),
198 'cache-key-2' =>
array(
'prop-2' =>
'new-value-for-2' ),
202 $this->assertEquals(
'new-value-for-2',
203 $cache->get(
'cache-key-2',
'prop-2' )
212 $cache->set(
"cache-key-1",
"prop-1",
"new value for 1" );
215 'cache-key-2' =>
array(
'prop-2' =>
'value-2' ),
216 'cache-key-3' =>
array(
'prop-3' =>
'value-3' ),
217 'cache-key-1' =>
array(
'prop-1' =>
'new value for 1' ),
235 return count( $this->
cache );
testConstructorGivenInvalidValue( $maxSize)
@dataProvider provideInvalidConstructorArg @expectedException UnexpectedValueException
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
static provideCacheFilling()
Provider for testFillingCache.
fillCache(&$cache, $numEntries)
Helper to fill a cache object passed by reference.
you have access to all of the normal MediaWiki so you can get a DB use the cache
testFillingCache( $cacheMaxEntries, $entryToFill, $msg='')
This test that we properly overflow when filling a cache with a sequence of always different cache-ke...
Test for ProcessCacheLRU class.
testPhpUnitArrayEquality()
Highlight diff between assertEquals and assertNotSame.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
assertCacheEmpty( $cache, $msg='Cache should be empty')
Helper to verify emptiness of a cache object.
Overrides some ProcessCacheLRU methods and properties accessibility.
testReplaceExistingKeyShouldBumpEntryToTop()
Create a cache with only one remaining entry then update the first inserted entry.
static provideInvalidConstructorArg()
Value which are forbidden by the constructor.
testReplaceExistingKeyInAFullCacheShouldBumpToTop()
This first create a full cache then update the value for the 2nd filled entry.
testRecentlyAccessedKeyStickIn()
Handles per process caching of items.
testBumpExistingKeyToTop()
getExpectedCache( $cacheMaxEntries, $entryToFill)
Generates an array of what would be expected in cache for a given cache size and a number of entries ...