Skip to content

Commit

Permalink
Renamed class InputRegistry to WidgetRegistry.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Feb 24, 2014
1 parent a60d499 commit a081ea4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions src/View/Helper/FormHelper.php
Expand Up @@ -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;

Expand Down Expand Up @@ -113,7 +113,7 @@ class FormHelper extends Helper {
/**
* Registry for input widgets.
*
* @var \Cake\View\Widget\InputRegistry
* @var \Cake\View\Widget\WidgetRegistry
*/
protected $_registry;

Expand Down Expand Up @@ -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;
}
Expand Down
Expand Up @@ -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.
Expand Down
Expand Up @@ -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
Expand All @@ -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);
}
Expand All @@ -53,15 +53,15 @@ 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'],
]);
$this->assertNull($result);
$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',
]);
Expand All @@ -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()
]);
Expand All @@ -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'],
]);
Expand All @@ -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'],
]);
Expand All @@ -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');
}
Expand All @@ -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'],
Expand All @@ -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');
}
Expand All @@ -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');
Expand Down

0 comments on commit a081ea4

Please sign in to comment.