objectcache: Move unit tests for HashBagOStuff to its own suite
[lhc/web/wiklou.git] / tests / phpunit / includes / libs / objectcache / HashBagOStuffTest.php
1 <?php
2
3 /**
4 * @group BagOStuff
5 */
6 class HashBagOStuffTest extends PHPUnit_Framework_TestCase {
7
8 public function testEvictionOrder() {
9 $cache = new HashBagOStuff( array( 'maxKeys' => 10 ) );
10 for ( $i = 0; $i < 10; $i++ ) {
11 $cache->set( "key$i", 1 );
12 $this->assertEquals( 1, $cache->get( "key$i" ) );
13 }
14 for ( $i = 10; $i < 20; $i++ ) {
15 $cache->set( "key$i", 1 );
16 $this->assertEquals( 1, $cache->get( "key$i" ) );
17 $this->assertEquals( false, $cache->get( "key" . $i - 10 ) );
18 }
19 }
20 }