ソースを参照

Making another Form::input() test pass

Jose Lorenzo Rodriguez 12 年 前
コミット
d891182881
1 ファイル変更12 行追加36 行削除
  1. 12 36
      tests/TestCase/View/Helper/FormHelperTest.php

+ 12 - 36
tests/TestCase/View/Helper/FormHelperTest.php

@@ -2765,7 +2765,6 @@ class FormHelperTest extends TestCase {
  * @return void
  */
 	public function testInputSelectType() {
-		$this->markTestIncomplete('A test here is throwing fatal error, fix later');
 		$result = $this->Form->input('email', array(
 			'options' => array('è' => 'Firést', 'é' => 'Secoènd'), 'empty' => true)
 		);
@@ -2816,10 +2815,10 @@ class FormHelperTest extends TestCase {
 		$result = $this->Form->input('Model.user_id', array('empty' => true));
 		$expected = array(
 			'div' => array('class' => 'input select'),
-			'label' => array('for' => 'ModelUserId'),
+			'label' => array('for' => 'model-user-id'),
 			'User',
 			'/label',
-			'select' => array('name' => 'Model[user_id]', 'id' => 'ModelUserId'),
+			'select' => array('name' => 'Model[user_id]', 'id' => 'model-user-id'),
 			array('option' => array('value' => '')),
 			'/option',
 			array('option' => array('value' => 'value', 'selected' => 'selected')),
@@ -2838,10 +2837,10 @@ class FormHelperTest extends TestCase {
 		$result = $this->Form->input('Thing.user_id', array('empty' => 'Some Empty'));
 		$expected = array(
 			'div' => array('class' => 'input select'),
-			'label' => array('for' => 'ThingUserId'),
+			'label' => array('for' => 'thing-user-id'),
 			'User',
 			'/label',
-			'select' => array('name' => 'Thing[user_id]', 'id' => 'ThingUserId'),
+			'select' => array('name' => 'Thing[user_id]', 'id' => 'thing-user-id'),
 			array('option' => array('value' => '')),
 			'Some Empty',
 			'/option',
@@ -2861,10 +2860,10 @@ class FormHelperTest extends TestCase {
 		$result = $this->Form->input('Thing.user_id', array('empty' => 'Some Empty'));
 		$expected = array(
 			'div' => array('class' => 'input select'),
-			'label' => array('for' => 'ThingUserId'),
+			'label' => array('for' => 'thing-user-id'),
 			'User',
 			'/label',
-			'select' => array('name' => 'Thing[user_id]', 'id' => 'ThingUserId'),
+			'select' => array('name' => 'Thing[user_id]', 'id' => 'thing-user-id'),
 			array('option' => array('value' => '')),
 			'Some Empty',
 			'/option',
@@ -2879,29 +2878,6 @@ class FormHelperTest extends TestCase {
 		);
 		$this->assertTags($result, $expected);
 
-		$this->View->viewVars['users'] = array('value' => 'good', 'other' => 'bad');
-		$this->Form->request->data = array('User' => array('User' => array('value')));
-		$result = $this->Form->input('User.User', array('empty' => true));
-		$expected = array(
-			'div' => array('class' => 'input select'),
-			'label' => array('for' => 'UserUser'),
-			'User',
-			'/label',
-			'input' => array('type' => 'hidden', 'name' => 'User[User]', 'value' => '', 'id' => 'UserUser_'),
-			'select' => array('name' => 'User[User][]', 'id' => 'UserUser', 'multiple' => 'multiple'),
-			array('option' => array('value' => '')),
-			'/option',
-			array('option' => array('value' => 'value', 'selected' => 'selected')),
-			'good',
-			'/option',
-			array('option' => array('value' => 'other')),
-			'bad',
-			'/option',
-			'/select',
-			'/div'
-		);
-		$this->assertTags($result, $expected);
-
 		$this->Form->data = array();
 		$result = $this->Form->input('Publisher.id', array(
 				'label'		=> 'Publisher',
@@ -2911,19 +2887,19 @@ class FormHelperTest extends TestCase {
 		));
 		$expected = array(
 			array('div' => array('class' => 'input select')),
-				array('label' => array('for' => 'PublisherId')),
+				array('label' => array('for' => 'publisher-id')),
 				'Publisher',
 				'/label',
-				'input' => array('type' => 'hidden', 'name' => 'Publisher[id]', 'value' => '', 'id' => 'PublisherId'),
+				'input' => array('type' => 'hidden', 'name' => 'Publisher[id]', 'value' => ''),
 				array('div' => array('class' => 'checkbox')),
-				array('input' => array('type' => 'checkbox', 'name' => 'Publisher[id][]', 'value' => 'Value 1', 'id' => 'PublisherIdValue1')),
-				array('label' => array('for' => 'PublisherIdValue1')),
+				array('input' => array('type' => 'checkbox', 'name' => 'Publisher[id][]', 'value' => 'Value 1', 'id' => 'publisher-id-value-1')),
+				array('label' => array('for' => 'publisher-id-value-1')),
 				'Label 1',
 				'/label',
 				'/div',
 				array('div' => array('class' => 'checkbox')),
-				array('input' => array('type' => 'checkbox', 'name' => 'Publisher[id][]', 'value' => 'Value 2', 'id' => 'PublisherIdValue2')),
-				array('label' => array('for' => 'PublisherIdValue2')),
+				array('input' => array('type' => 'checkbox', 'name' => 'Publisher[id][]', 'value' => 'Value 2', 'id' => 'publisher-id-value-2')),
+				array('label' => array('for' => 'publisher-id-value-2')),
 				'Label 2',
 				'/label',
 				'/div',