function testUsed() { $hash = new HTMLPurifier_StringHash(array('key' => 'value', 'key2' => 'value2')); $this->assertIdentical($hash->getAccessed(), array()); $t = $hash->offsetGet('key'); $this->assertIdentical($hash->getAccessed(), array('key' => true)); $hash->resetAccessed(); $this->assertIdentical($hash->getAccessed(), array()); }
/** * Triggers errors for any unused keys passed in the hash; such keys * may indicate typos, missing values, etc. * @param HTMLPurifier_StringHash $hash Hash to check. */ protected function _findUnused($hash) { $accessed = $hash->getAccessed(); foreach ($hash as $k => $v) { if (!isset($accessed[$k])) { trigger_error("String hash key '{$k}' not used by builder", E_USER_NOTICE); } } }