public function testForcePHPArrayFlag() { ArrayFactory::setForcePHPArray(false); $this->assertInstanceOf('\\Limcache\\storage\\JudyArray', ArrayFactory::createArray(ArrayFactory::STRING_TO_MIXED)); ArrayFactory::setForcePHPArray(true); $this->assertInstanceOf('\\Limcache\\storage\\PHPArray', ArrayFactory::createArray(ArrayFactory::STRING_TO_MIXED)); }
/** * @dataProvider forcePHPArrayProvider */ public function testEvictionOnRead($forcePHPArray) { ArrayFactory::setForcePHPArray($forcePHPArray); $strategy = new MRU(3); $cache = new Cache($strategy); $cache['key1'] = 1; $cache['key2'] = 2; $cache['key3'] = 3; $cache['key1']; // read key1 $cache['key4'] = 4; $this->assertFalse(isset($cache['key1'])); $this->assertTrue(isset($cache['key2'])); $this->assertTrue(isset($cache['key3'])); $this->assertTrue(isset($cache['key4'])); }