Skip to content
Permalink
Browse files

Move test from FormHelper into SelectBox widget test.

Closes #3931 as I am unable to reproduce the original issue.
  • Loading branch information...
markstory committed Jul 13, 2014
1 parent 6189cc1 commit 6b796b77dc52b65f5fcc6afa1a8686f653e40fa2
Showing with 25 additions and 7 deletions.
  1. +0 −7 tests/TestCase/View/Helper/FormHelperTest.php
  2. +25 −0 tests/TestCase/View/Widget/SelectBoxTest.php
@@ -2573,13 +2573,6 @@ public function testInputSelectType() {
);
$this->assertTags($result, $expected);
$this->View->viewVars['users'] = null;
$result = $this->Form->input('Thing.user_id', array(
'options' => array('value' => 'good', 'other' => 'bad'),
'empty' => 'Some Empty'
));
$this->assertTags($result, $expected);
$this->Form->data = array();
$result = $this->Form->input('Publisher.id', array(
'label' => 'Publisher',
@@ -14,6 +14,7 @@
*/
namespace Cake\Test\TestCase\View\Widget;
use Cake\Collection\Collection;
use Cake\TestSuite\TestCase;
use Cake\View\StringTemplate;
use Cake\View\Widget\SelectBox;
@@ -106,6 +107,30 @@ public function testRenderSimpleIterator() {
$this->assertTags($result, $expected);
}
/**
* test simple iterator rendering with empty option
*
* @return void
*/
public function testRenderSimpleIteratorWithEmpty() {
$select = new SelectBox($this->templates);
$options = new Collection(['a' => 'Albatross', 'b' => 'Budgie']);
$data = [
'name' => 'Birds[name]',
'options' => $options,
'empty' => 'Pick one'
];
$result = $select->render($data, $this->context);
$expected = [
'select' => ['name' => 'Birds[name]'],
['option' => ['value' => '']], 'Pick one', '/option',
['option' => ['value' => 'a']], 'Albatross', '/option',
['option' => ['value' => 'b']], 'Budgie', '/option',
'/select'
];
$this->assertTags($result, $expected);
}
/**
* test complex option rendering
*

0 comments on commit 6b796b7

Please sign in to comment.
You can’t perform that action at this time.