From a081ea4fce50b9d26b34ebbbf885ce83cec954d4 Mon Sep 17 00:00:00 2001 From: ADmad Date: Mon, 24 Feb 2014 22:55:45 +0530 Subject: [PATCH] Renamed class InputRegistry to WidgetRegistry. --- src/View/Helper/FormHelper.php | 12 ++++----- .../{InputRegistry.php => WidgetRegistry.php} | 2 +- ...egistryTest.php => WidgetRegistryTest.php} | 26 +++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-) rename src/View/Widget/{InputRegistry.php => WidgetRegistry.php} (99%) rename tests/TestCase/View/Widget/{InputRegistryTest.php => WidgetRegistryTest.php} (86%) diff --git a/src/View/Helper/FormHelper.php b/src/View/Helper/FormHelper.php index 2fa8d546c6e..3121207d4fd 100755 --- a/src/View/Helper/FormHelper.php +++ b/src/View/Helper/FormHelper.php @@ -29,7 +29,7 @@ use Cake\View\Helper\StringTemplateTrait; use Cake\View\StringTemplate; use Cake\View\View; -use Cake\View\Widget\InputRegistry; +use Cake\View\Widget\WidgetRegistry; use DateTime; use Traversable; @@ -113,7 +113,7 @@ class FormHelper extends Helper { /** * Registry for input widgets. * - * @var \Cake\View\Widget\InputRegistry + * @var \Cake\View\Widget\WidgetRegistry */ protected $_registry; @@ -180,14 +180,14 @@ public function __construct(View $View, $settings = array()) { /** * Set the input registry the helper will use. * - * @param \Cake\View\Widget\InputRegistry $instance The registry instance to set. + * @param \Cake\View\Widget\WidgetRegistry $instance The registry instance to set. * @param array $widgets An array of widgets - * @return \Cake\View\Widget\InputRegistry + * @return \Cake\View\Widget\WidgetRegistry */ - public function inputRegistry(InputRegistry $instance = null, $widgets = []) { + public function inputRegistry(WidgetRegistry $instance = null, $widgets = []) { if ($instance === null) { if ($this->_registry === null) { - $this->_registry = new InputRegistry($this->_templater, $widgets); + $this->_registry = new WidgetRegistry($this->_templater, $widgets); } return $this->_registry; } diff --git a/src/View/Widget/InputRegistry.php b/src/View/Widget/WidgetRegistry.php similarity index 99% rename from src/View/Widget/InputRegistry.php rename to src/View/Widget/WidgetRegistry.php index bfc29ee1f59..69db7cfc914 100644 --- a/src/View/Widget/InputRegistry.php +++ b/src/View/Widget/WidgetRegistry.php @@ -32,7 +32,7 @@ * Each widget should expect a StringTemplate instance as their first * argument. All other dependencies will be included after. */ -class InputRegistry { +class WidgetRegistry { /** * Array of widgets + widget configuration. diff --git a/tests/TestCase/View/Widget/InputRegistryTest.php b/tests/TestCase/View/Widget/WidgetRegistryTest.php similarity index 86% rename from tests/TestCase/View/Widget/InputRegistryTest.php rename to tests/TestCase/View/Widget/WidgetRegistryTest.php index 8eca8859298..3b82ad35369 100644 --- a/tests/TestCase/View/Widget/InputRegistryTest.php +++ b/tests/TestCase/View/Widget/WidgetRegistryTest.php @@ -16,12 +16,12 @@ use Cake\TestSuite\TestCase; use Cake\View\StringTemplate; -use Cake\View\Widget\InputRegistry; +use Cake\View\Widget\WidgetRegistry; /** - * InputRegistry test case + * WidgetRegistry test case */ -class InputRegistryTestCase extends TestCase { +class WidgetRegistryTestCase extends TestCase { /** * setup method @@ -42,7 +42,7 @@ public function testAddInConstructor() { $widgets = [ 'text' => ['Cake\View\Widget\Basic'], ]; - $inputs = new InputRegistry($this->templates, $widgets); + $inputs = new WidgetRegistry($this->templates, $widgets); $result = $inputs->get('text'); $this->assertInstanceOf('Cake\View\Widget\Basic', $result); } @@ -53,7 +53,7 @@ public function testAddInConstructor() { * @return void */ public function testAdd() { - $inputs = new InputRegistry($this->templates); + $inputs = new WidgetRegistry($this->templates); $result = $inputs->add([ 'text' => ['Cake\View\Widget\Basic'], ]); @@ -61,7 +61,7 @@ public function testAdd() { $result = $inputs->get('text'); $this->assertInstanceOf('Cake\View\Widget\WidgetInterface', $result); - $inputs = new InputRegistry($this->templates); + $inputs = new WidgetRegistry($this->templates); $result = $inputs->add([ 'hidden' => 'Cake\View\Widget\Basic', ]); @@ -78,7 +78,7 @@ public function testAdd() { * @return void */ public function testAddInvalidType() { - $inputs = new InputRegistry($this->templates); + $inputs = new WidgetRegistry($this->templates); $inputs->add([ 'text' => new \StdClass() ]); @@ -91,7 +91,7 @@ public function testAddInvalidType() { * @return void */ public function testGet() { - $inputs = new InputRegistry($this->templates); + $inputs = new WidgetRegistry($this->templates); $inputs->add([ 'text' => ['Cake\View\Widget\Basic'], ]); @@ -106,7 +106,7 @@ public function testGet() { * @return void */ public function testGetFallback() { - $inputs = new InputRegistry($this->templates); + $inputs = new WidgetRegistry($this->templates); $inputs->add([ '_default' => ['Cake\View\Widget\Basic'], ]); @@ -125,7 +125,7 @@ public function testGetFallback() { * @return void */ public function testGetNoFallbackError() { - $inputs = new InputRegistry($this->templates); + $inputs = new WidgetRegistry($this->templates); $inputs->clear(); $inputs->get('foo'); } @@ -136,7 +136,7 @@ public function testGetNoFallbackError() { * @return void */ public function testGetResolveDependency() { - $inputs = new InputRegistry($this->templates); + $inputs = new WidgetRegistry($this->templates); $inputs->clear(); $inputs->add([ 'label' => ['Cake\View\Widget\Label'], @@ -154,7 +154,7 @@ public function testGetResolveDependency() { * @return void */ public function testGetResolveDependencyMissingClass() { - $inputs = new InputRegistry($this->templates); + $inputs = new WidgetRegistry($this->templates); $inputs->add(['test' => ['TestApp\View\Derp']]); $inputs->get('test'); } @@ -167,7 +167,7 @@ public function testGetResolveDependencyMissingClass() { * @return void */ public function testGetResolveDependencyMissingDependency() { - $inputs = new InputRegistry($this->templates); + $inputs = new WidgetRegistry($this->templates); $inputs->clear(); $inputs->add(['multicheckbox' => ['Cake\View\Widget\MultiCheckbox', 'label']]); $inputs->get('multicheckbox');