Skip to content

Commit

Permalink
Add "Widget" suffix to widget classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Nov 2, 2014
1 parent 4d9a607 commit 0dd9bff
Show file tree
Hide file tree
Showing 25 changed files with 144 additions and 144 deletions.
Expand Up @@ -24,7 +24,7 @@
* input elements like hidden, text, email, tel and other
* types.
*/
class Basic implements WidgetInterface {
class BasicWidget implements WidgetInterface {

/**
* StringTemplate instance.
Expand Down
Expand Up @@ -24,7 +24,7 @@
* If you need to make basic submit inputs with type=submit,
* use the Basic input widget.
*/
class Button implements WidgetInterface {
class ButtonWidget implements WidgetInterface {

/**
* StringTemplate instance.
Expand Down
Expand Up @@ -20,7 +20,7 @@
/**
* Input widget for creating checkbox widgets.
*/
class Checkbox implements WidgetInterface {
class CheckboxWidget implements WidgetInterface {

/**
* Template instance.
Expand Down
Expand Up @@ -16,7 +16,7 @@

use Cake\View\Form\ContextInterface;
use Cake\View\StringTemplate;
use Cake\View\Widget\SelectBox;
use Cake\View\Widget\SelectBoxWidget;
use Cake\View\Widget\WidgetInterface;

/**
Expand All @@ -25,7 +25,7 @@
* This class is intended as an internal implementation detail
* of Cake\View\Helper\FormHelper and is not intended for direct use.
*/
class DateTime implements WidgetInterface {
class DateTimeWidget implements WidgetInterface {

/**
* Select box widget.
Expand Down Expand Up @@ -60,9 +60,9 @@ class DateTime implements WidgetInterface {
* Constructor
*
* @param \Cake\View\StringTemplate $templates Templates list.
* @param \Cake\View\Widget\SelectBox $selectBox Selectbox widget instance.
* @param \Cake\View\Widget\SelectBoxWidget $selectBox Selectbox widget instance.
*/
public function __construct(StringTemplate $templates, SelectBox $selectBox) {
public function __construct(StringTemplate $templates, SelectBoxWidget $selectBox) {
$this->_select = $selectBox;
$this->_templates = $templates;
}
Expand Down
Expand Up @@ -23,7 +23,7 @@
* This class is intended as an internal implementation detail
* of Cake\View\Helper\FormHelper and is not intended for direct use.
*/
class File implements WidgetInterface {
class FileWidget implements WidgetInterface {

/**
* Constructor
Expand Down
Expand Up @@ -23,7 +23,7 @@
* Generally this element is used by other widgets,
* and FormHelper itself.
*/
class Label implements WidgetInterface {
class LabelWidget implements WidgetInterface {

/**
* Templates
Expand Down
Expand Up @@ -22,7 +22,7 @@
* Input widget class for generating multiple checkboxes.
*
*/
class MultiCheckbox implements WidgetInterface {
class MultiCheckboxWidget implements WidgetInterface {

use IdGeneratorTrait;

Expand Down
Expand Up @@ -14,15 +14,15 @@
*/
namespace Cake\View\Widget;

use Cake\View\Widget\Label;
use Cake\View\Widget\LabelWidget;

/**
* Form 'widget' for creating labels that contain their input.
*
* Generally this element is used by other widgets,
* and FormHelper itself.
*/
class NestingLabel extends Label {
class NestingLabelWidget extends LabelWidget {

/**
* The template to use.
Expand Down
Expand Up @@ -25,7 +25,7 @@
* This class is intended as an internal implementation detail
* of Cake\View\Helper\FormHelper and is not intended for direct use.
*/
class Radio implements WidgetInterface {
class RadioWidget implements WidgetInterface {

use IdGeneratorTrait;

Expand Down
Expand Up @@ -24,7 +24,7 @@
* This class is intended as an internal implementation detail
* of Cake\View\Helper\FormHelper and is not intended for direct use.
*/
class SelectBox implements WidgetInterface {
class SelectBoxWidget implements WidgetInterface {

/**
* Template instance.
Expand Down
Expand Up @@ -23,7 +23,7 @@
* This class is intended as an internal implementation detail
* of Cake\View\Helper\FormHelper and is not intended for direct use.
*/
class Textarea implements WidgetInterface {
class TextareaWidget implements WidgetInterface {

/**
* Constructor
Expand Down
24 changes: 12 additions & 12 deletions src/View/Widget/WidgetRegistry.php
Expand Up @@ -44,17 +44,17 @@ class WidgetRegistry {
* @var array
*/
protected $_widgets = [
'button' => ['Cake\View\Widget\Button'],
'checkbox' => ['Cake\View\Widget\Checkbox'],
'file' => ['Cake\View\Widget\File'],
'label' => ['Cake\View\Widget\Label'],
'nestingLabel' => ['Cake\View\Widget\NestingLabel'],
'multicheckbox' => ['Cake\View\Widget\MultiCheckbox', 'nestingLabel'],
'radio' => ['Cake\View\Widget\Radio', 'nestingLabel'],
'select' => ['Cake\View\Widget\SelectBox'],
'textarea' => ['Cake\View\Widget\Textarea'],
'datetime' => ['Cake\View\Widget\DateTime', 'select'],
'_default' => ['Cake\View\Widget\Basic'],
'button' => ['Cake\View\Widget\ButtonWidget'],
'checkbox' => ['Cake\View\Widget\CheckboxWidget'],
'file' => ['Cake\View\Widget\FileWidget'],
'label' => ['Cake\View\Widget\LabelWidget'],
'nestingLabel' => ['Cake\View\Widget\NestingLabelWidget'],
'multicheckbox' => ['Cake\View\Widget\MultiCheckboxWidget', 'nestingLabel'],
'radio' => ['Cake\View\Widget\RadioWidget', 'nestingLabel'],
'select' => ['Cake\View\Widget\SelectBoxWidget'],
'textarea' => ['Cake\View\Widget\TextareaWidget'],
'datetime' => ['Cake\View\Widget\DateTimeWidget', 'select'],
'_default' => ['Cake\View\Widget\BasicWidget'],
];

/**
Expand Down Expand Up @@ -179,7 +179,7 @@ protected function _resolveWidget($widget) {
}

$class = array_shift($widget);
$className = App::className($class, 'View/Widget');
$className = App::className($class, 'View/Widget', 'Widget');
if ($className === false || !class_exists($className)) {
throw new \RuntimeException(sprintf('Unable to locate widget class "%s"', $class));
}
Expand Down
Expand Up @@ -16,12 +16,12 @@

use Cake\TestSuite\TestCase;
use Cake\View\StringTemplate;
use Cake\View\Widget\Basic;
use Cake\View\Widget\BasicWidget;

/**
* Basic input test.
*/
class BasicTest extends TestCase {
class BasicWidgetTest extends TestCase {

public function setUp() {
parent::setUp();
Expand All @@ -38,7 +38,7 @@ public function setUp() {
* @return void
*/
public function testRenderSimple() {
$text = new Basic($this->templates);
$text = new BasicWidget($this->templates);
$result = $text->render(['name' => 'my_input'], $this->context);
$expected = [
'input' => ['type' => 'text', 'name' => 'my_input']
Expand All @@ -52,7 +52,7 @@ public function testRenderSimple() {
* @return void
*/
public function testRenderType() {
$text = new Basic($this->templates);
$text = new BasicWidget($this->templates);
$data = [
'name' => 'my_input',
'type' => 'email',
Expand All @@ -70,7 +70,7 @@ public function testRenderType() {
* @return void
*/
public function testRenderWithValue() {
$text = new Basic($this->templates);
$text = new BasicWidget($this->templates);
$data = [
'name' => 'my_input',
'type' => 'email',
Expand All @@ -93,7 +93,7 @@ public function testRenderWithValue() {
* @return void
*/
public function testRenderAttributes() {
$text = new Basic($this->templates);
$text = new BasicWidget($this->templates);
$data = [
'name' => 'my_input',
'type' => 'email',
Expand Down
Expand Up @@ -16,12 +16,12 @@

use Cake\TestSuite\TestCase;
use Cake\View\StringTemplate;
use Cake\View\Widget\Button;
use Cake\View\Widget\ButtonWidget;

/**
* Basic input test.
*/
class ButtonTest extends TestCase {
class ButtonWidgetTest extends TestCase {

public function setUp() {
parent::setUp();
Expand All @@ -38,7 +38,7 @@ public function setUp() {
* @return void
*/
public function testRenderSimple() {
$button = new Button($this->templates);
$button = new ButtonWidget($this->templates);
$result = $button->render(['name' => 'my_input'], $this->context);
$expected = [
'button' => ['type' => 'submit', 'name' => 'my_input'],
Expand All @@ -53,7 +53,7 @@ public function testRenderSimple() {
* @return void
*/
public function testRenderType() {
$button = new Button($this->templates);
$button = new ButtonWidget($this->templates);
$data = [
'name' => 'my_input',
'type' => 'button',
Expand All @@ -74,7 +74,7 @@ public function testRenderType() {
* @return void
*/
public function testRenderWithText() {
$button = new Button($this->templates);
$button = new ButtonWidget($this->templates);
$data = [
'text' => 'Some <value>'
];
Expand Down Expand Up @@ -102,7 +102,7 @@ public function testRenderWithText() {
* @return void
*/
public function testRenderAttributes() {
$button = new Button($this->templates);
$button = new ButtonWidget($this->templates);
$data = [
'name' => 'my_input',
'text' => 'Go',
Expand Down
Expand Up @@ -16,12 +16,12 @@

use Cake\TestSuite\TestCase;
use Cake\View\StringTemplate;
use Cake\View\Widget\Checkbox;
use Cake\View\Widget\CheckboxWidget;

/**
* Checkbox test case
*/
class CheckboxTest extends TestCase {
class CheckboxWidgetTest extends TestCase {

/**
* setup method.
Expand All @@ -43,7 +43,7 @@ public function setUp() {
* @return void
*/
public function testRenderSimple() {
$checkbox = new Checkbox($this->templates);
$checkbox = new CheckboxWidget($this->templates);
$data = [
'name' => 'Comment[spam]',
];
Expand Down Expand Up @@ -78,7 +78,7 @@ public function testRenderSimple() {
* @return void
*/
public function testRenderDisabled() {
$checkbox = new Checkbox($this->templates);
$checkbox = new CheckboxWidget($this->templates);
$data = [
'name' => 'Comment[spam]',
'disabled' => true,
Expand All @@ -101,7 +101,7 @@ public function testRenderDisabled() {
* @return void
*/
public function testRenderChecked() {
$checkbox = new Checkbox($this->templates);
$checkbox = new CheckboxWidget($this->templates);
$data = [
'name' => 'Comment[spam]',
'value' => 1,
Expand Down Expand Up @@ -167,7 +167,7 @@ public static function checkedProvider() {
* @return void
*/
public function testRenderCheckedValue($checked) {
$checkbox = new Checkbox($this->templates);
$checkbox = new CheckboxWidget($this->templates);
$data = [
'name' => 'Comment[spam]',
'value' => 1,
Expand Down Expand Up @@ -207,7 +207,7 @@ public static function uncheckedProvider() {
* @return void
*/
public function testRenderUnCheckedValue($checked) {
$checkbox = new Checkbox($this->templates);
$checkbox = new CheckboxWidget($this->templates);
$data = [
'name' => 'Comment[spam]',
'value' => 1,
Expand Down
Expand Up @@ -16,13 +16,13 @@

use Cake\TestSuite\TestCase;
use Cake\View\StringTemplate;
use Cake\View\Widget\DateTime;
use Cake\View\Widget\SelectBox;
use Cake\View\Widget\DateTimeWidget;
use Cake\View\Widget\SelectBoxWidget;

/**
* DateTime input test case
*/
class DateTimeTest extends TestCase {
class DateTimeWidgetTest extends TestCase {

/**
* @setUp
Expand All @@ -39,8 +39,8 @@ public function setUp() {
];
$this->templates = new StringTemplate($templates);
$this->context = $this->getMock('Cake\View\Form\ContextInterface');
$this->selectBox = new SelectBox($this->templates);
$this->DateTime = new DateTime($this->templates, $this->selectBox);
$this->selectBox = new SelectBoxWidget($this->templates);
$this->DateTime = new DateTimeWidget($this->templates, $this->selectBox);
}

/**
Expand Down
Expand Up @@ -16,12 +16,12 @@

use Cake\TestSuite\TestCase;
use Cake\View\StringTemplate;
use Cake\View\Widget\File;
use Cake\View\Widget\FileWidget;

/**
* File input test.
*/
class FileTest extends TestCase {
class FileWidgetTest extends TestCase {

/**
* setup
Expand All @@ -43,7 +43,7 @@ public function setUp() {
* @return void
*/
public function testRenderSimple() {
$input = new File($this->templates);
$input = new FileWidget($this->templates);
$result = $input->render(['name' => 'image'], $this->context);
$expected = [
'input' => ['type' => 'file', 'name' => 'image'],
Expand All @@ -57,7 +57,7 @@ public function testRenderSimple() {
* @return void
*/
public function testRenderAttributes() {
$input = new File($this->templates);
$input = new FileWidget($this->templates);
$data = ['name' => 'image', 'required' => true, 'val' => 'nope'];
$result = $input->render($data, $this->context);
$expected = [
Expand Down

0 comments on commit 0dd9bff

Please sign in to comment.