7 use MediaWikiCoversValidator;
18 $raw = [
'd' => 4,
'c' => 3,
'b' => 2,
'a' => 1 ];
19 $cache = MapCacheLRU::newFromArray( $raw, 3 );
30 [
'a' => 1,
'b' => 2,
'c' => 3 ],
40 [
'b' => 2,
'c' => 3 ],
50 $cache = MapCacheLRU::newFromArray( [
'd' => 4,
'c' => 3,
'b' => 2,
'a' => 1 ], 4 );
53 [
'c' => 3,
'b' => 2,
'a' => 1 ],
63 $cache = MapCacheLRU::newFromArray( [
'd' => 4,
'c' => 3,
'b' => 2,
'a' => 1 ], 10 );
67 [
'd' => 4,
'c' => 3,
'b' => 2,
'a' => 1 ],
78 $raw = [
'a' => 1,
'b' => 2,
'c' => 3 ];
79 $cache = MapCacheLRU::newFromArray( $raw, 3 );
83 [
'a' => 1,
'b' => 2,
'c' => 3 ],
89 [
'a' => 1,
'b' => 2,
'c' => 3 ],
95 [
'b' => 2,
'c' => 3,
'a' => 1 ],
101 [
'b' => 2,
'c' => 3,
'a' => 1 ],
107 [
'c' => 3,
'a' => 1,
'b' => 22 ],
113 [
'a' => 1,
'b' => 22,
'd' => 4 ],
117 $cache->set(
'e', 5, 0.33 );
119 [
'e' => 5,
'b' => 22,
'd' => 4 ],
123 $cache->set(
'f', 6, 0.66 );
125 [
'b' => 22,
'f' => 6,
'd' => 4 ],
129 $cache->set(
'g', 7, 0.90 );
131 [
'f' => 6,
'g' => 7,
'd' => 4 ],
135 $cache->set(
'g', 7, 1.0 );
137 [
'f' => 6,
'd' => 4,
'g' => 7 ],
148 $raw = [
'a' => 1,
'b' => 2,
'c' => 3 ];
149 $cache = MapCacheLRU::newFromArray( $raw, 3 );
152 $cache->setMockTime( $now );
154 $cache->set(
'd',
'xxx' );
175 $raw = [
'a' => 1,
'b' => 2,
'c' => 3 ];
176 $cache = MapCacheLRU::newFromArray( $raw, 3 );
179 $cache->setMockTime( $now );
181 $cache->setField(
'PMs',
'Tony Blair',
'Labour' );
182 $cache->setField(
'PMs',
'Margaret Thatcher',
'Tory' );
198 [
'Tony Blair' =>
'Labour',
'Margaret Thatcher' =>
'Tory' ],
203 'Edwina Currie' => 1983,
204 'Neil Kinnock' => 1970
208 'Edwina Currie' => 1983,
209 'Neil Kinnock' => 1970
227 $cache = MapCacheLRU::newFromArray( [], 3 );
231 $this->fail(
"No exception" );
232 }
catch ( UnexpectedValueException
$e ) {
233 $this->
assertRegExp(
'/must be string or integer/', $e->getMessage() );
237 $this->fail(
"No exception" );
238 }
catch ( UnexpectedValueException
$e ) {
239 $this->
assertRegExp(
'/must be string or integer/', $e->getMessage() );
243 $this->fail(
"No exception" );
244 }
catch ( UnexpectedValueException
$e ) {
245 $this->
assertRegExp(
'/must be string or integer/', $e->getMessage() );
249 $cache->hasField(
'x', 3.4 );
250 $this->fail(
"No exception" );
251 }
catch ( UnexpectedValueException
$e ) {
252 $this->
assertRegExp(
'/must be string or integer/', $e->getMessage() );
255 $cache->getField(
'x',
false );
256 $this->fail(
"No exception" );
257 }
catch ( UnexpectedValueException
$e ) {
258 $this->
assertRegExp(
'/must be string or integer/', $e->getMessage() );
261 $cache->setField(
'x', 3.4,
'x' );
262 $this->fail(
"No exception" );
263 }
catch ( UnexpectedValueException
$e ) {
264 $this->
assertRegExp(
'/must be string or integer/', $e->getMessage() );
unserialize( $serialized)
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
testExpiry()
MapCacheLRU::has() MapCacheLRU::get() MapCacheLRU::set()
testFields()
MapCacheLRU::hasField() MapCacheLRU::getField() MapCacheLRU::setField()
testLRU()
MapCacheLRU::has() MapCacheLRU::get() MapCacheLRU::set()
testInvalidKeys()
MapCacheLRU::has() MapCacheLRU::get() MapCacheLRU::set() MapCacheLRU::hasField() MapCacheLRU::getFiel...
testSerialize()
MapCacheLRU::serialize() MapCacheLRU::unserialize()
testArrayConversion()
MapCacheLRU::newFromArray() MapCacheLRU::toArray() MapCacheLRU::getAllKeys() MapCacheLRU::clear() Map...
returning false will NOT prevent logging $e