$this->assertEquals($originalValue, $return_2);
}
+ public function getCleanKeyExamples() {
+ $es = [];
+ $es[] = ['hello_world and other.planets', 'hello_world and other.planets']; // allowed chars
+ $es[] = ['hello/world+-#@{}', 'hello-2fworld-2b-2d-23-40-7b-7d']; // escaped chars
+ $es[] = ['123456789 123456789 123456789 123456789 123456789 123456789 123', '123456789 123456789 123456789 123456789 123456789 123456789 123']; // long but allowed
+ $es[] = ['123456789 123456789 123456789 123456789 123456789 123456789 1234', '-2a008e182a4dcd1a78f405f30119e5f2']; // too long, md5 fallback
+ $es[] = ['123456789 /23456789 +23456789 -23456789 123456789 123456789', '-1b6baab5961431ed443ab321f5dfa0fb']; // too long, md5 fallback
+ return $es;
+ }
+
+ /**
+ * @param $inputKey
+ * @param $expectKey
+ * @dataProvider getCleanKeyExamples
+ */
+ public function testCleanKeys($inputKey, $expectKey) {
+ $actualKey = CRM_Core_BAO_Cache::cleanKey($inputKey);
+ $this->assertEquals($expectKey, $actualKey);
+ }
+
}