a = CRM_Utils_Cache::create([ 'name' => 'e2e array-dec test', 'type' => ['ArrayCache'], ]) ); } public function testDoubleLifeWithDelete() { $this->assertFalse($this->a->has('foo')); $this->assertEquals('dfl-1', $this->a->get('foo', 'dfl-1')); $this->cache->set('foo', 100); $this->assertTrue($this->a->has('foo')); $this->assertEquals(100, $this->a->get('foo', 'dfl-1')[1]); $this->cache->set('foo', 200); $this->assertTrue($this->a->has('foo')); $this->assertEquals(200, $this->a->get('foo', 'dfl-1')[1]); $this->cache->delete('foo'); $this->assertFalse($this->a->has('foo')); $this->assertEquals('dfl-1', $this->a->get('foo', 'dfl-1')); } public function testDoubleLifeWithClear() { $this->assertFalse($this->a->has('foo')); $this->assertEquals('dfl-1', $this->a->get('foo', 'dfl-1')); $this->cache->set('foo', 100); $this->assertTrue($this->a->has('foo')); $this->assertEquals(100, $this->a->get('foo', 'dfl-1')[1]); $this->cache->clear(); $this->assertFalse($this->a->has('foo')); $this->assertEquals('dfl-1', $this->a->get('foo', 'dfl-1')); } }