From 48514c7850afe23a1df49d62620a1a947c32b9f9 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Mon, 2 May 2016 17:08:43 +0200 Subject: [PATCH] On SMv2 only canonicalized aliases make sense --- .../FormElementManagerV2Polyfill.php | 4 +--- test/FormElementManagerTest.php | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/FormElementManager/FormElementManagerV2Polyfill.php b/src/FormElementManager/FormElementManagerV2Polyfill.php index 585e8466..727ef5ed 100644 --- a/src/FormElementManager/FormElementManagerV2Polyfill.php +++ b/src/FormElementManager/FormElementManagerV2Polyfill.php @@ -54,9 +54,7 @@ class FormElementManagerV2Polyfill extends AbstractPluginManager 'image' => Element\Image::class, 'month' => Element\Month::class, 'monthselect' => Element\MonthSelect::class, - 'MonthSelect' => Element\MonthSelect::class, - 'multiCheckbox' => Element\MultiCheckbox::class, - 'multiCheckBox' => Element\MultiCheckbox::class, + 'multicheckbox' => Element\MultiCheckbox::class, 'number' => Element\Number::class, 'password' => Element\Password::class, 'radio' => Element\Radio::class, diff --git a/test/FormElementManagerTest.php b/test/FormElementManagerTest.php index ae2c3f36..306c5a18 100644 --- a/test/FormElementManagerTest.php +++ b/test/FormElementManagerTest.php @@ -221,4 +221,21 @@ public function testAddingInvokableCreatesAliasAndMapsClassToElementFactory() $this->assertEquals(ElementFactory::class, $factories['zendtestformtestassetelementwithfilter']); } } + + public function testAllAliasesShouldBeCanonicalized() + { + if (method_exists($this->manager, 'configure')) { + $this->markTestSkipped('Check canonicalized makes sense only on v2'); + } + + $r = new ReflectionProperty($this->manager, 'aliases'); + $r->setAccessible(true); + $aliases = $r->getValue($this->manager); + + foreach ($aliases as $name => $alias) { + $this->manager->get($name . ' '); + $this->manager->get(strtoupper($name)); + $this->manager->get($name); + } + } }