Browse Source

Renamed class InputRegistry to WidgetRegistry.

ADmad 12 years ago
parent
commit
a081ea4fce

+ 6 - 6
src/View/Helper/FormHelper.php

@@ -29,7 +29,7 @@ use Cake\View\Helper;
 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 @@ class FormHelper extends Helper {
 /**
  * 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;
 		}

+ 1 - 1
src/View/Widget/InputRegistry.php

@@ -32,7 +32,7 @@ use \ReflectionClass;
  * 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.

+ 13 - 13
tests/TestCase/View/Widget/InputRegistryTest.php

@@ -16,12 +16,12 @@ namespace Cake\Test\TestCase\View\Widget;
 
 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 @@ class InputRegistryTestCase extends TestCase {
 		$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 @@ class InputRegistryTestCase extends TestCase {
  * @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 @@ class InputRegistryTestCase extends TestCase {
 		$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 @@ class InputRegistryTestCase extends TestCase {
  * @return void
  */
 	public function testAddInvalidType() {
-		$inputs = new InputRegistry($this->templates);
+		$inputs = new WidgetRegistry($this->templates);
 		$inputs->add([
 			'text' => new \StdClass()
 		]);
@@ -91,7 +91,7 @@ class InputRegistryTestCase extends TestCase {
  * @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 @@ class InputRegistryTestCase extends TestCase {
  * @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 @@ class InputRegistryTestCase extends TestCase {
  * @return void
  */
 	public function testGetNoFallbackError() {
-		$inputs = new InputRegistry($this->templates);
+		$inputs = new WidgetRegistry($this->templates);
 		$inputs->clear();
 		$inputs->get('foo');
 	}
@@ -136,7 +136,7 @@ class InputRegistryTestCase extends TestCase {
  * @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 @@ class InputRegistryTestCase extends TestCase {
  * @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 @@ class InputRegistryTestCase extends TestCase {
  * @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');