public function testWritesAreCached() { // delete should mark cache as known to be empty $this->obj1->deleteMetadata($this->name); $this->assertTrue($this->cache->isKnown($this->guid1, $this->name)); $this->assertNull($this->cache->load($this->guid1, $this->name)); // without name, delete should invalidate the entire entity $this->cache->save($this->guid1, $this->name, $this->value); elgg_delete_metadata(array('guid' => $this->guid1)); $this->assertFalse($this->cache->isKnown($this->guid1, $this->name)); // test set $this->obj1->setMetadata($this->name, $this->value); $this->assertIdentical($this->cache->load($this->guid1, $this->name), $this->value); // test set multiple $this->obj1->setMetadata($this->name, 1, 'integer', true); $this->assertIdentical($this->cache->load($this->guid1, $this->name), array($this->value, 1)); // writes when access is ignore should invalidate $tmp_ignore = elgg_set_ignore_access(true); $this->obj1->setMetadata($this->name, $this->value); $this->assertFalse($this->cache->isKnown($this->guid1, $this->name)); elgg_set_ignore_access($tmp_ignore); }