public function testKeyNormalization() { $collection = new Collection(['X' => 'a', 'y' => 'b', 'Z' => 'C']); $collection->addNormalizer(function (&$value, &$key) { $key = strtoupper($key); $value = strtolower($value); }); // @todo allow key normalization for previously stored entries too! $collection['d'] = 'TEST'; $this->assertEquals(['X' => 'a', 'Y' => 'b', 'Z' => 'c', 'D' => 'test'], $collection->getInternalValue()); }
public function testKeyNormalization() { $collection = new Collection(['X' => 'a', 'y' => 'b', 'Z' => 'C']); $collection->addKeyNormalizer(function (&$key) { $key = strtoupper($key); }); $collection['d'] = 'test'; $this->assertEquals(['X' => 'a', 'Y' => 'b', 'Z' => 'C', 'D' => 'test'], $collection->getInternalValue()); }