From 0dd9bffab0e12811b313c89591449db797835757 Mon Sep 17 00:00:00 2001 From: ADmad Date: Sun, 2 Nov 2014 07:13:57 +0530 Subject: [PATCH] Add "Widget" suffix to widget classes. --- .../Widget/{Basic.php => BasicWidget.php} | 2 +- .../Widget/{Button.php => ButtonWidget.php} | 2 +- .../{Checkbox.php => CheckboxWidget.php} | 2 +- .../{DateTime.php => DateTimeWidget.php} | 8 +-- src/View/Widget/{File.php => FileWidget.php} | 2 +- .../Widget/{Label.php => LabelWidget.php} | 2 +- ...tiCheckbox.php => MultiCheckboxWidget.php} | 2 +- ...estingLabel.php => NestingLabelWidget.php} | 4 +- .../Widget/{Radio.php => RadioWidget.php} | 2 +- .../{SelectBox.php => SelectBoxWidget.php} | 2 +- .../{Textarea.php => TextareaWidget.php} | 2 +- src/View/Widget/WidgetRegistry.php | 24 ++++----- .../{BasicTest.php => BasicWidgetTest.php} | 12 ++--- .../{ButtonTest.php => ButtonWidgetTest.php} | 12 ++--- ...heckboxTest.php => CheckboxWidgetTest.php} | 14 ++--- ...ateTimeTest.php => DateTimeWidgetTest.php} | 10 ++-- .../{FileTest.php => FileWidgetTest.php} | 8 +-- .../{LabelTest.php => LabelWidgetTest.php} | 10 ++-- ...oxTest.php => MultiCheckboxWidgetTest.php} | 26 ++++----- .../{RadioTest.php => RadioWidgetTest.php} | 54 +++++++++---------- ...ectBoxTest.php => SelectBoxWidgetTest.php} | 42 +++++++-------- ...extareaTest.php => TextareaWidgetTest.php} | 8 +-- .../View/Widget/WidgetRegistryTest.php | 34 ++++++------ .../Plugin/TestPlugin/config/test_widgets.php | 2 +- tests/test_app/config/test_widgets.php | 2 +- 25 files changed, 144 insertions(+), 144 deletions(-) rename src/View/Widget/{Basic.php => BasicWidget.php} (97%) rename src/View/Widget/{Button.php => ButtonWidget.php} (97%) rename src/View/Widget/{Checkbox.php => CheckboxWidget.php} (98%) rename src/View/Widget/{DateTime.php => DateTimeWidget.php} (98%) rename src/View/Widget/{File.php => FileWidget.php} (97%) rename src/View/Widget/{Label.php => LabelWidget.php} (97%) rename src/View/Widget/{MultiCheckbox.php => MultiCheckboxWidget.php} (99%) rename src/View/Widget/{NestingLabel.php => NestingLabelWidget.php} (91%) rename src/View/Widget/{Radio.php => RadioWidget.php} (99%) rename src/View/Widget/{SelectBox.php => SelectBoxWidget.php} (99%) rename src/View/Widget/{Textarea.php => TextareaWidget.php} (97%) rename tests/TestCase/View/Widget/{BasicTest.php => BasicWidgetTest.php} (90%) rename tests/TestCase/View/Widget/{ButtonTest.php => ButtonWidgetTest.php} (90%) rename tests/TestCase/View/Widget/{CheckboxTest.php => CheckboxWidgetTest.php} (92%) rename tests/TestCase/View/Widget/{DateTimeTest.php => DateTimeWidgetTest.php} (99%) rename tests/TestCase/View/Widget/{FileTest.php => FileWidgetTest.php} (91%) rename tests/TestCase/View/Widget/{LabelTest.php => LabelWidgetTest.php} (90%) rename tests/TestCase/View/Widget/{MultiCheckboxTest.php => MultiCheckboxWidgetTest.php} (90%) rename tests/TestCase/View/Widget/{RadioTest.php => RadioWidgetTest.php} (91%) rename tests/TestCase/View/Widget/{SelectBoxTest.php => SelectBoxWidgetTest.php} (93%) rename tests/TestCase/View/Widget/{TextareaTest.php => TextareaWidgetTest.php} (91%) diff --git a/src/View/Widget/Basic.php b/src/View/Widget/BasicWidget.php similarity index 97% rename from src/View/Widget/Basic.php rename to src/View/Widget/BasicWidget.php index 74cc4d509ce..4aa57f78d03 100644 --- a/src/View/Widget/Basic.php +++ b/src/View/Widget/BasicWidget.php @@ -24,7 +24,7 @@ * input elements like hidden, text, email, tel and other * types. */ -class Basic implements WidgetInterface { +class BasicWidget implements WidgetInterface { /** * StringTemplate instance. diff --git a/src/View/Widget/Button.php b/src/View/Widget/ButtonWidget.php similarity index 97% rename from src/View/Widget/Button.php rename to src/View/Widget/ButtonWidget.php index f4a22e42a21..e1c3b79c8a5 100644 --- a/src/View/Widget/Button.php +++ b/src/View/Widget/ButtonWidget.php @@ -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. diff --git a/src/View/Widget/Checkbox.php b/src/View/Widget/CheckboxWidget.php similarity index 98% rename from src/View/Widget/Checkbox.php rename to src/View/Widget/CheckboxWidget.php index ff6a20348ed..397b67c5e06 100644 --- a/src/View/Widget/Checkbox.php +++ b/src/View/Widget/CheckboxWidget.php @@ -20,7 +20,7 @@ /** * Input widget for creating checkbox widgets. */ -class Checkbox implements WidgetInterface { +class CheckboxWidget implements WidgetInterface { /** * Template instance. diff --git a/src/View/Widget/DateTime.php b/src/View/Widget/DateTimeWidget.php similarity index 98% rename from src/View/Widget/DateTime.php rename to src/View/Widget/DateTimeWidget.php index d93f5e0ef20..93d0807ea47 100644 --- a/src/View/Widget/DateTime.php +++ b/src/View/Widget/DateTimeWidget.php @@ -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; /** @@ -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. @@ -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; } diff --git a/src/View/Widget/File.php b/src/View/Widget/FileWidget.php similarity index 97% rename from src/View/Widget/File.php rename to src/View/Widget/FileWidget.php index 961bba47b08..a7d92aecd30 100644 --- a/src/View/Widget/File.php +++ b/src/View/Widget/FileWidget.php @@ -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 diff --git a/src/View/Widget/Label.php b/src/View/Widget/LabelWidget.php similarity index 97% rename from src/View/Widget/Label.php rename to src/View/Widget/LabelWidget.php index 4b5d2d7b813..7c88e4dfb3f 100644 --- a/src/View/Widget/Label.php +++ b/src/View/Widget/LabelWidget.php @@ -23,7 +23,7 @@ * Generally this element is used by other widgets, * and FormHelper itself. */ -class Label implements WidgetInterface { +class LabelWidget implements WidgetInterface { /** * Templates diff --git a/src/View/Widget/MultiCheckbox.php b/src/View/Widget/MultiCheckboxWidget.php similarity index 99% rename from src/View/Widget/MultiCheckbox.php rename to src/View/Widget/MultiCheckboxWidget.php index d31a06f4586..43ad4c2c086 100644 --- a/src/View/Widget/MultiCheckbox.php +++ b/src/View/Widget/MultiCheckboxWidget.php @@ -22,7 +22,7 @@ * Input widget class for generating multiple checkboxes. * */ -class MultiCheckbox implements WidgetInterface { +class MultiCheckboxWidget implements WidgetInterface { use IdGeneratorTrait; diff --git a/src/View/Widget/NestingLabel.php b/src/View/Widget/NestingLabelWidget.php similarity index 91% rename from src/View/Widget/NestingLabel.php rename to src/View/Widget/NestingLabelWidget.php index 36c1376a47d..bc3b4e654e9 100644 --- a/src/View/Widget/NestingLabel.php +++ b/src/View/Widget/NestingLabelWidget.php @@ -14,7 +14,7 @@ */ namespace Cake\View\Widget; -use Cake\View\Widget\Label; +use Cake\View\Widget\LabelWidget; /** * Form 'widget' for creating labels that contain their input. @@ -22,7 +22,7 @@ * Generally this element is used by other widgets, * and FormHelper itself. */ -class NestingLabel extends Label { +class NestingLabelWidget extends LabelWidget { /** * The template to use. diff --git a/src/View/Widget/Radio.php b/src/View/Widget/RadioWidget.php similarity index 99% rename from src/View/Widget/Radio.php rename to src/View/Widget/RadioWidget.php index 712717cd85f..741051b5e95 100644 --- a/src/View/Widget/Radio.php +++ b/src/View/Widget/RadioWidget.php @@ -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; diff --git a/src/View/Widget/SelectBox.php b/src/View/Widget/SelectBoxWidget.php similarity index 99% rename from src/View/Widget/SelectBox.php rename to src/View/Widget/SelectBoxWidget.php index f9e38bfcdea..65890617898 100644 --- a/src/View/Widget/SelectBox.php +++ b/src/View/Widget/SelectBoxWidget.php @@ -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. diff --git a/src/View/Widget/Textarea.php b/src/View/Widget/TextareaWidget.php similarity index 97% rename from src/View/Widget/Textarea.php rename to src/View/Widget/TextareaWidget.php index 3f2e90a156e..e166b6ed6cc 100644 --- a/src/View/Widget/Textarea.php +++ b/src/View/Widget/TextareaWidget.php @@ -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 diff --git a/src/View/Widget/WidgetRegistry.php b/src/View/Widget/WidgetRegistry.php index 13a4ce40432..039b6fa9369 100644 --- a/src/View/Widget/WidgetRegistry.php +++ b/src/View/Widget/WidgetRegistry.php @@ -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'], ]; /** @@ -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)); } diff --git a/tests/TestCase/View/Widget/BasicTest.php b/tests/TestCase/View/Widget/BasicWidgetTest.php similarity index 90% rename from tests/TestCase/View/Widget/BasicTest.php rename to tests/TestCase/View/Widget/BasicWidgetTest.php index 78d9e08026f..c4c78508c4a 100644 --- a/tests/TestCase/View/Widget/BasicTest.php +++ b/tests/TestCase/View/Widget/BasicWidgetTest.php @@ -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(); @@ -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'] @@ -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', @@ -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', @@ -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', diff --git a/tests/TestCase/View/Widget/ButtonTest.php b/tests/TestCase/View/Widget/ButtonWidgetTest.php similarity index 90% rename from tests/TestCase/View/Widget/ButtonTest.php rename to tests/TestCase/View/Widget/ButtonWidgetTest.php index 48766d5a215..18dbc84f2ba 100644 --- a/tests/TestCase/View/Widget/ButtonTest.php +++ b/tests/TestCase/View/Widget/ButtonWidgetTest.php @@ -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(); @@ -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'], @@ -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', @@ -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 ' ]; @@ -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', diff --git a/tests/TestCase/View/Widget/CheckboxTest.php b/tests/TestCase/View/Widget/CheckboxWidgetTest.php similarity index 92% rename from tests/TestCase/View/Widget/CheckboxTest.php rename to tests/TestCase/View/Widget/CheckboxWidgetTest.php index c388d4cf480..140117dfb27 100644 --- a/tests/TestCase/View/Widget/CheckboxTest.php +++ b/tests/TestCase/View/Widget/CheckboxWidgetTest.php @@ -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. @@ -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]', ]; @@ -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, @@ -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, @@ -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, @@ -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, diff --git a/tests/TestCase/View/Widget/DateTimeTest.php b/tests/TestCase/View/Widget/DateTimeWidgetTest.php similarity index 99% rename from tests/TestCase/View/Widget/DateTimeTest.php rename to tests/TestCase/View/Widget/DateTimeWidgetTest.php index ca2aeb6cde3..1ef5435e334 100644 --- a/tests/TestCase/View/Widget/DateTimeTest.php +++ b/tests/TestCase/View/Widget/DateTimeWidgetTest.php @@ -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 @@ -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); } /** diff --git a/tests/TestCase/View/Widget/FileTest.php b/tests/TestCase/View/Widget/FileWidgetTest.php similarity index 91% rename from tests/TestCase/View/Widget/FileTest.php rename to tests/TestCase/View/Widget/FileWidgetTest.php index 051cf9d3c55..3fe9cdb8401 100644 --- a/tests/TestCase/View/Widget/FileTest.php +++ b/tests/TestCase/View/Widget/FileWidgetTest.php @@ -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 @@ -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'], @@ -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 = [ diff --git a/tests/TestCase/View/Widget/LabelTest.php b/tests/TestCase/View/Widget/LabelWidgetTest.php similarity index 90% rename from tests/TestCase/View/Widget/LabelTest.php rename to tests/TestCase/View/Widget/LabelWidgetTest.php index 6d02860cac6..779481fc1e7 100644 --- a/tests/TestCase/View/Widget/LabelTest.php +++ b/tests/TestCase/View/Widget/LabelWidgetTest.php @@ -16,12 +16,12 @@ use Cake\TestSuite\TestCase; use Cake\View\StringTemplate; -use Cake\View\Widget\Label; +use Cake\View\Widget\LabelWidget; /** * Label test case. */ -class LabelTest extends TestCase { +class LabelWidgetTest extends TestCase { /** * setup method. @@ -43,7 +43,7 @@ public function setUp() { * @return void */ public function testRender() { - $label = new Label($this->templates); + $label = new LabelWidget($this->templates); $data = [ 'text' => 'My text', ]; @@ -62,7 +62,7 @@ public function testRender() { * @return void */ public function testRenderEscape() { - $label = new Label($this->templates); + $label = new LabelWidget($this->templates); $data = [ 'text' => 'My > text', 'for' => 'Some > value', @@ -83,7 +83,7 @@ public function testRenderEscape() { * @return void */ public function testRenderAttributes() { - $label = new Label($this->templates); + $label = new LabelWidget($this->templates); $data = [ 'text' => 'My > text', 'for' => 'some-id', diff --git a/tests/TestCase/View/Widget/MultiCheckboxTest.php b/tests/TestCase/View/Widget/MultiCheckboxWidgetTest.php similarity index 90% rename from tests/TestCase/View/Widget/MultiCheckboxTest.php rename to tests/TestCase/View/Widget/MultiCheckboxWidgetTest.php index 1708db606b4..b88d55e4252 100644 --- a/tests/TestCase/View/Widget/MultiCheckboxTest.php +++ b/tests/TestCase/View/Widget/MultiCheckboxWidgetTest.php @@ -16,13 +16,13 @@ use Cake\TestSuite\TestCase; use Cake\View\StringTemplate; -use Cake\View\Widget\Label; -use Cake\View\Widget\MultiCheckbox; +use Cake\View\Widget\LabelWidget; +use Cake\View\Widget\MultiCheckboxWidget; /** * MultiCheckbox test case. */ -class MultiCheckboxTest extends TestCase { +class MultiCheckboxWidgetTest extends TestCase { /** * setup method. @@ -46,8 +46,8 @@ public function setUp() { * @return void */ public function testRenderSimple() { - $label = new Label($this->templates); - $input = new MultiCheckbox($this->templates, $label); + $label = new LabelWidget($this->templates); + $input = new MultiCheckboxWidget($this->templates, $label); $data = [ 'name' => 'Tags[id]', 'options' => [ @@ -89,8 +89,8 @@ public function testRenderSimple() { * @return void */ public function testRenderComplex() { - $label = new Label($this->templates); - $input = new MultiCheckbox($this->templates, $label); + $label = new LabelWidget($this->templates); + $input = new MultiCheckboxWidget($this->templates, $label); $data = [ 'name' => 'Tags[id]', 'options' => [ @@ -134,8 +134,8 @@ public function testRenderComplex() { * @return void */ public function testRenderEscaping() { - $label = new Label($this->templates); - $input = new MultiCheckbox($this->templates, $label); + $label = new LabelWidget($this->templates); + $input = new MultiCheckboxWidget($this->templates, $label); $data = [ 'name' => 'Tags[id]', 'options' => [ @@ -165,8 +165,8 @@ public function testRenderEscaping() { * @return void */ public function testRenderSelected() { - $label = new Label($this->templates); - $input = new MultiCheckbox($this->templates, $label); + $label = new LabelWidget($this->templates); + $input = new MultiCheckboxWidget($this->templates, $label); $data = [ 'name' => 'Tags[id]', 'options' => [ @@ -219,8 +219,8 @@ public function testRenderSelected() { * @return void */ public function testRenderDisabled() { - $label = new Label($this->templates); - $input = new MultiCheckbox($this->templates, $label); + $label = new LabelWidget($this->templates); + $input = new MultiCheckboxWidget($this->templates, $label); $data = [ 'name' => 'Tags[id]', 'options' => [ diff --git a/tests/TestCase/View/Widget/RadioTest.php b/tests/TestCase/View/Widget/RadioWidgetTest.php similarity index 91% rename from tests/TestCase/View/Widget/RadioTest.php rename to tests/TestCase/View/Widget/RadioWidgetTest.php index 73038856fcd..a49ad536e41 100644 --- a/tests/TestCase/View/Widget/RadioTest.php +++ b/tests/TestCase/View/Widget/RadioWidgetTest.php @@ -17,13 +17,13 @@ use Cake\Collection\Collection; use Cake\TestSuite\TestCase; use Cake\View\StringTemplate; -use Cake\View\Widget\NestingLabel; -use Cake\View\Widget\Radio; +use Cake\View\Widget\NestingLabelWidget; +use Cake\View\Widget\RadioWidget; /** * Radio test case */ -class RadioTest extends TestCase { +class RadioWidgetTest extends TestCase { /** * setup method. @@ -51,8 +51,8 @@ public function testRenderSimpleNotNested() { 'nestingLabel' => '{{text}}', 'radioWrapper' => '{{input}}{{label}}' ]); - $label = new NestingLabel($this->templates); - $radio = new Radio($this->templates, $label); + $label = new NestingLabelWidget($this->templates); + $radio = new RadioWidget($this->templates, $label); $data = [ 'name' => 'Crayons[color]', 'label' => null, @@ -110,8 +110,8 @@ public function testRenderSimpleNotNested() { * @return void */ public function testRenderSimple() { - $label = new NestingLabel($this->templates); - $radio = new Radio($this->templates, $label); + $label = new NestingLabelWidget($this->templates); + $radio = new RadioWidget($this->templates, $label); $data = [ 'name' => 'Crayons[color]', 'label' => null, @@ -154,8 +154,8 @@ public function testRenderSimple() { * @return void */ public function testRenderComplex() { - $label = new NestingLabel($this->templates); - $radio = new Radio($this->templates, $label); + $label = new NestingLabelWidget($this->templates); + $radio = new RadioWidget($this->templates, $label); $data = [ 'name' => 'Crayons[color]', 'options' => [ @@ -194,8 +194,8 @@ public function testRenderComplex() { * @return void */ public function testRenderIdSuffixGeneration() { - $label = new NestingLabel($this->templates); - $radio = new Radio($this->templates, $label); + $label = new NestingLabelWidget($this->templates); + $radio = new RadioWidget($this->templates, $label); $data = [ 'name' => 'Thing[value]', 'options' => ['a>b' => 'First', 'a 'Second'] @@ -230,8 +230,8 @@ public function testRenderIdSuffixGeneration() { * @return void */ public function testRenderBooleanishValues() { - $label = new NestingLabel($this->templates); - $radio = new Radio($this->templates, $label); + $label = new NestingLabelWidget($this->templates); + $radio = new RadioWidget($this->templates, $label); $data = [ 'name' => 'Model[field]', 'options' => ['1' => 'Yes', '0' => 'No'], @@ -305,8 +305,8 @@ public function testRenderBooleanishValues() { * @return void */ public function testRenderRequiredAndFormAttribute() { - $label = new NestingLabel($this->templates); - $radio = new Radio($this->templates, $label); + $label = new NestingLabelWidget($this->templates); + $radio = new RadioWidget($this->templates, $label); $data = [ 'name' => 'published', 'options' => ['option A', 'option B'], @@ -335,8 +335,8 @@ public function testRenderRequiredAndFormAttribute() { * @return void */ public function testRenderEmptyOption() { - $label = new NestingLabel($this->templates); - $radio = new Radio($this->templates, $label); + $label = new NestingLabelWidget($this->templates); + $radio = new RadioWidget($this->templates, $label); $data = [ 'name' => 'Crayons[color]', 'options' => ['r' => 'Red'], @@ -400,8 +400,8 @@ public function testRenderInputInsideLabel() { 'label' => '{{input}}{{text}}', 'radioWrapper' => '{{label}}', ]); - $label = new NestingLabel($this->templates); - $radio = new Radio($this->templates, $label); + $label = new NestingLabelWidget($this->templates); + $radio = new RadioWidget($this->templates, $label); $data = [ 'name' => 'Crayons[color]', 'options' => ['r' => 'Red'], @@ -427,8 +427,8 @@ public function testRenderInputInsideLabel() { * @return void */ public function testRenderSelected() { - $label = new NestingLabel($this->templates); - $radio = new Radio($this->templates, $label); + $label = new NestingLabelWidget($this->templates); + $radio = new RadioWidget($this->templates, $label); $data = [ 'name' => 'Versions[ver]', 'val' => '1', @@ -478,8 +478,8 @@ public function testRenderSelected() { * @return void */ public function testRenderDisabled() { - $label = new NestingLabel($this->templates); - $radio = new Radio($this->templates, $label); + $label = new NestingLabelWidget($this->templates); + $radio = new RadioWidget($this->templates, $label); $data = [ 'name' => 'Versions[ver]', 'options' => [ @@ -550,8 +550,8 @@ public function testRenderDisabled() { * @return void */ public function testRenderLabelOptions() { - $label = new NestingLabel($this->templates); - $radio = new Radio($this->templates, $label); + $label = new NestingLabelWidget($this->templates); + $radio = new RadioWidget($this->templates, $label); $data = [ 'name' => 'Versions[ver]', 'options' => [ @@ -623,8 +623,8 @@ public function testRenderContainerTemplate() { $this->templates->add([ 'radioWrapper' => '
{{input}}{{label}}
' ]); - $label = new NestingLabel($this->templates); - $radio = new Radio($this->templates, $label); + $label = new NestingLabelWidget($this->templates); + $radio = new RadioWidget($this->templates, $label); $data = [ 'name' => 'Versions[ver]', 'options' => [ diff --git a/tests/TestCase/View/Widget/SelectBoxTest.php b/tests/TestCase/View/Widget/SelectBoxWidgetTest.php similarity index 93% rename from tests/TestCase/View/Widget/SelectBoxTest.php rename to tests/TestCase/View/Widget/SelectBoxWidgetTest.php index 6c95dc36811..098af926571 100644 --- a/tests/TestCase/View/Widget/SelectBoxTest.php +++ b/tests/TestCase/View/Widget/SelectBoxWidgetTest.php @@ -17,12 +17,12 @@ use Cake\Collection\Collection; use Cake\TestSuite\TestCase; use Cake\View\StringTemplate; -use Cake\View\Widget\SelectBox; +use Cake\View\Widget\SelectBoxWidget; /** * SelectBox test case */ -class SelectBoxTest extends TestCase { +class SelectBoxWidgetTest extends TestCase { /** * setup method. @@ -47,7 +47,7 @@ public function setUp() { * @return void */ public function testRenderNoOptions() { - $select = new SelectBox($this->templates); + $select = new SelectBoxWidget($this->templates); $data = [ 'id' => 'BirdName', 'name' => 'Birds[name]', @@ -67,7 +67,7 @@ public function testRenderNoOptions() { * @return void */ public function testRenderSimple() { - $select = new SelectBox($this->templates); + $select = new SelectBoxWidget($this->templates); $data = [ 'id' => 'BirdName', 'name' => 'Birds[name]', @@ -89,7 +89,7 @@ public function testRenderSimple() { * @return void */ public function testRenderSimpleIterator() { - $select = new SelectBox($this->templates); + $select = new SelectBoxWidget($this->templates); $options = new \ArrayObject(['a' => 'Albatross', 'b' => 'Budgie']); $data = [ 'name' => 'Birds[name]', @@ -113,7 +113,7 @@ public function testRenderSimpleIterator() { * @return void */ public function testRenderSimpleIteratorWithEmpty() { - $select = new SelectBox($this->templates); + $select = new SelectBoxWidget($this->templates); $options = new Collection(['a' => 'Albatross', 'b' => 'Budgie']); $data = [ 'name' => 'Birds[name]', @@ -137,7 +137,7 @@ public function testRenderSimpleIteratorWithEmpty() { * @return void */ public function testRenderComplex() { - $select = new SelectBox($this->templates); + $select = new SelectBoxWidget($this->templates); $data = [ 'id' => 'BirdName', 'name' => 'Birds[name]', @@ -166,7 +166,7 @@ public function testRenderComplex() { * @return void */ public function testRenderSelected() { - $select = new SelectBox($this->templates); + $select = new SelectBoxWidget($this->templates); $data = [ 'id' => 'BirdName', 'name' => 'Birds[name]', @@ -208,7 +208,7 @@ public function testRenderSelected() { * @return void */ public function testRenderMultipleSelect() { - $select = new SelectBox($this->templates); + $select = new SelectBoxWidget($this->templates); $data = [ 'id' => 'BirdName', 'name' => 'Birds[name]', @@ -235,7 +235,7 @@ public function testRenderMultipleSelect() { * @return void */ public function testRenderMultipleSelected() { - $select = new SelectBox($this->templates); + $select = new SelectBoxWidget($this->templates); $data = [ 'multiple' => true, 'id' => 'BirdName', @@ -270,7 +270,7 @@ public function testRenderMultipleSelected() { * @return void */ public function testRenderOptionGroups() { - $select = new SelectBox($this->templates); + $select = new SelectBoxWidget($this->templates); $data = [ 'name' => 'Birds[name]', 'options' => [ @@ -316,7 +316,7 @@ public function testRenderOptionGroups() { * @return void */ public function testRenderOptionGroupsEscape() { - $select = new SelectBox($this->templates); + $select = new SelectBoxWidget($this->templates); $data = [ 'name' => 'Birds[name]', 'options' => [ @@ -361,7 +361,7 @@ public function testRenderOptionGroupsEscape() { * @return void */ public function testRenderOptionGroupsWithAttributes() { - $select = new SelectBox($this->templates); + $select = new SelectBoxWidget($this->templates); $data = [ 'name' => 'Birds[name]', 'options' => [ @@ -399,7 +399,7 @@ public function testRenderOptionGroupsWithAttributes() { * @return void */ public function testRenderOptionGroupsTraversable() { - $select = new SelectBox($this->templates); + $select = new SelectBoxWidget($this->templates); $mammals = new \ArrayObject(['beaver' => 'Beaver', 'elk' => 'Elk']); $data = [ 'name' => 'Birds[name]', @@ -443,7 +443,7 @@ public function testRenderOptionGroupsTraversable() { * @return void */ public function testRenderOptionGroupsSelectedAndDisabled() { - $select = new SelectBox($this->templates); + $select = new SelectBoxWidget($this->templates); $data = [ 'name' => 'Birds[name]', 'val' => ['1', '2', 'burp'], @@ -484,7 +484,7 @@ public function testRenderOptionGroupsSelectedAndDisabled() { * @return void */ public function testRenderDisabled() { - $select = new SelectBox($this->templates); + $select = new SelectBoxWidget($this->templates); $data = [ 'disabled' => true, 'name' => 'Birds[name]', @@ -503,7 +503,7 @@ public function testRenderDisabled() { ]; $this->assertHtml($expected, $result); - $select = new SelectBox($this->templates); + $select = new SelectBoxWidget($this->templates); $data = [ 'disabled' => [1], 'name' => 'numbers', @@ -527,7 +527,7 @@ public function testRenderDisabled() { * @return void */ public function testRenderDisabledMultiple() { - $select = new SelectBox($this->templates); + $select = new SelectBoxWidget($this->templates); $data = [ 'disabled' => ['a', 'c'], 'val' => 'a', @@ -563,7 +563,7 @@ public function testRenderDisabledMultiple() { * @return void */ public function testRenderEmptyOption() { - $select = new SelectBox($this->templates); + $select = new SelectBoxWidget($this->templates); $data = [ 'id' => 'BirdName', 'name' => 'Birds[name]', @@ -614,7 +614,7 @@ public function testRenderEmptyOption() { * @return void */ public function testRenderEscapingOption() { - $select = new SelectBox($this->templates); + $select = new SelectBoxWidget($this->templates); $data = [ 'name' => 'Birds[name]', 'options' => [ @@ -667,7 +667,7 @@ public function testRenderEscapingOption() { * @return void */ public function testRenderNullOptions() { - $select = new SelectBox($this->templates); + $select = new SelectBoxWidget($this->templates); $data = [ 'id' => 'BirdName', 'name' => 'Birds[name]', diff --git a/tests/TestCase/View/Widget/TextareaTest.php b/tests/TestCase/View/Widget/TextareaWidgetTest.php similarity index 91% rename from tests/TestCase/View/Widget/TextareaTest.php rename to tests/TestCase/View/Widget/TextareaWidgetTest.php index 50fbf911299..71a033f4627 100644 --- a/tests/TestCase/View/Widget/TextareaTest.php +++ b/tests/TestCase/View/Widget/TextareaWidgetTest.php @@ -16,12 +16,12 @@ use Cake\TestSuite\TestCase; use Cake\View\StringTemplate; -use Cake\View\Widget\Textarea; +use Cake\View\Widget\TextareaWidget; /** * Textarea input test. */ -class TextareaTest extends TestCase { +class TextareaWidgetTest extends TestCase { /** * setup @@ -43,7 +43,7 @@ public function setUp() { * @return void */ public function testRenderSimple() { - $input = new Textarea($this->templates); + $input = new TextareaWidget($this->templates); $result = $input->render(['name' => 'comment'], $this->context); $expected = [ 'textarea' => ['name' => 'comment'], @@ -58,7 +58,7 @@ public function testRenderSimple() { * @return void */ public function testRenderWithValue() { - $input = new Textarea($this->templates); + $input = new TextareaWidget($this->templates); $data = ['name' => 'comment', 'data-foo' => '', 'val' => 'some ']; $result = $input->render($data, $this->context); $expected = [ diff --git a/tests/TestCase/View/Widget/WidgetRegistryTest.php b/tests/TestCase/View/Widget/WidgetRegistryTest.php index 97cc7557f14..06831d9cfbe 100644 --- a/tests/TestCase/View/Widget/WidgetRegistryTest.php +++ b/tests/TestCase/View/Widget/WidgetRegistryTest.php @@ -43,15 +43,15 @@ public function setUp() { */ public function testAddInConstructor() { $widgets = [ - 'text' => ['Cake\View\Widget\Basic'], + 'text' => ['Cake\View\Widget\BasicWidget'], 'label' => ['Label'], ]; $inputs = new WidgetRegistry($this->templates, $this->view, $widgets); $result = $inputs->get('text'); - $this->assertInstanceOf('Cake\View\Widget\Basic', $result); + $this->assertInstanceOf('Cake\View\Widget\BasicWidget', $result); $result = $inputs->get('label'); - $this->assertInstanceOf('Cake\View\Widget\Label', $result); + $this->assertInstanceOf('Cake\View\Widget\LabelWidget', $result); } /** @@ -73,7 +73,7 @@ public function testGetViewInstance() { */ public function testLoadInConstructor() { $inputs = new WidgetRegistry($this->templates, $this->view, 'test_widgets'); - $this->assertInstanceOf('Cake\View\Widget\Label', $inputs->get('text')); + $this->assertInstanceOf('Cake\View\Widget\LabelWidget', $inputs->get('text')); } /** @@ -84,7 +84,7 @@ public function testLoadInConstructor() { public function testLoadPluginInConstuctor() { Plugin::load('TestPlugin'); $inputs = new WidgetRegistry($this->templates, $this->view, 'TestPlugin.test_widgets'); - $this->assertInstanceOf('Cake\View\Widget\Label', $inputs->get('text')); + $this->assertInstanceOf('Cake\View\Widget\LabelWidget', $inputs->get('text')); } /** @@ -95,7 +95,7 @@ public function testLoadPluginInConstuctor() { public function testAdd() { $inputs = new WidgetRegistry($this->templates, $this->view); $result = $inputs->add([ - 'text' => ['Cake\View\Widget\Basic'], + 'text' => ['Cake\View\Widget\BasicWidget'], ]); $this->assertNull($result); $result = $inputs->get('text'); @@ -103,7 +103,7 @@ public function testAdd() { $inputs = new WidgetRegistry($this->templates, $this->view); $result = $inputs->add([ - 'hidden' => 'Cake\View\Widget\Basic', + 'hidden' => 'Cake\View\Widget\BasicWidget', ]); $this->assertNull($result); $result = $inputs->get('hidden'); @@ -133,10 +133,10 @@ public function testAddInvalidType() { public function testGet() { $inputs = new WidgetRegistry($this->templates, $this->view); $inputs->add([ - 'text' => ['Cake\View\Widget\Basic'], + 'text' => ['Cake\View\Widget\BasicWidget'], ]); $result = $inputs->get('text'); - $this->assertInstanceOf('Cake\View\Widget\Basic', $result); + $this->assertInstanceOf('Cake\View\Widget\BasicWidget', $result); $this->assertSame($result, $inputs->get('text')); } @@ -148,10 +148,10 @@ public function testGet() { public function testGetFallback() { $inputs = new WidgetRegistry($this->templates, $this->view); $inputs->add([ - '_default' => ['Cake\View\Widget\Basic'], + '_default' => ['Cake\View\Widget\BasicWidget'], ]); $result = $inputs->get('text'); - $this->assertInstanceOf('Cake\View\Widget\Basic', $result); + $this->assertInstanceOf('Cake\View\Widget\BasicWidget', $result); $result2 = $inputs->get('hidden'); $this->assertSame($result, $result2); @@ -179,23 +179,23 @@ public function testGetResolveDependency() { $inputs = new WidgetRegistry($this->templates, $this->view); $inputs->clear(); $inputs->add([ - 'label' => ['Cake\View\Widget\Label'], - 'multicheckbox' => ['Cake\View\Widget\MultiCheckbox', 'label'] + 'label' => ['Cake\View\Widget\LabelWidget'], + 'multicheckbox' => ['Cake\View\Widget\MultiCheckboxWidget', 'label'] ]); $result = $inputs->get('multicheckbox'); - $this->assertInstanceOf('Cake\View\Widget\MultiCheckbox', $result); + $this->assertInstanceOf('Cake\View\Widget\MultiCheckboxWidget', $result); } /** * Test getting resolve dependency missing class * * @expectedException RuntimeException - * @expectedExceptionMessage Unable to locate widget class "TestApp\View\Derp" + * @expectedExceptionMessage Unable to locate widget class "TestApp\View\DerpWidget" * @return void */ public function testGetResolveDependencyMissingClass() { $inputs = new WidgetRegistry($this->templates, $this->view); - $inputs->add(['test' => ['TestApp\View\Derp']]); + $inputs->add(['test' => ['TestApp\View\DerpWidget']]); $inputs->get('test'); } @@ -209,7 +209,7 @@ public function testGetResolveDependencyMissingClass() { public function testGetResolveDependencyMissingDependency() { $inputs = new WidgetRegistry($this->templates, $this->view); $inputs->clear(); - $inputs->add(['multicheckbox' => ['Cake\View\Widget\MultiCheckbox', 'label']]); + $inputs->add(['multicheckbox' => ['Cake\View\Widget\MultiCheckboxWidget', 'label']]); $inputs->get('multicheckbox'); } diff --git a/tests/test_app/Plugin/TestPlugin/config/test_widgets.php b/tests/test_app/Plugin/TestPlugin/config/test_widgets.php index f7784c7606e..d41b6d0fdf2 100644 --- a/tests/test_app/Plugin/TestPlugin/config/test_widgets.php +++ b/tests/test_app/Plugin/TestPlugin/config/test_widgets.php @@ -3,5 +3,5 @@ * Widgets list for testing. */ $config = [ - 'text' => ['Cake\View\Widget\Label'], + 'text' => ['Cake\View\Widget\LabelWidget'], ]; diff --git a/tests/test_app/config/test_widgets.php b/tests/test_app/config/test_widgets.php index f7784c7606e..d41b6d0fdf2 100644 --- a/tests/test_app/config/test_widgets.php +++ b/tests/test_app/config/test_widgets.php @@ -3,5 +3,5 @@ * Widgets list for testing. */ $config = [ - 'text' => ['Cake\View\Widget\Label'], + 'text' => ['Cake\View\Widget\LabelWidget'], ];