Skip to content
This repository
Browse code

move the test case to its own method

  • Loading branch information...
commit 044cf60b69563ce60e73c60cac7f1361a5b346e4 1 parent 5064601
Mark authored
53  lib/Cake/Test/Case/View/Helper/FormHelperTest.php
@@ -2615,6 +2615,36 @@ public function testInputOverridingMagicSelectType() {
2615 2615
 	}
2616 2616
 
2617 2617
 /**
  2618
+ * Test that magic input() selects are created for type=number
  2619
+ *
  2620
+ * @return void
  2621
+ */
  2622
+	public function testInputMagicSelectForTypeNumber() {
  2623
+		$this->View->viewVars['balances'] = array(0 => 'nothing', 1 => 'some', 100 => 'a lot');
  2624
+		$this->Form->request->data = array('ValidateUser' => array('balance' => 1));
  2625
+		$result = $this->Form->input('ValidateUser.balance');
  2626
+		$expected = array(
  2627
+			'div' => array('class' => 'input select'),
  2628
+			'label' => array('for' => 'ValidateUserBalance'),
  2629
+			'Balance',
  2630
+			'/label',
  2631
+			'select' => array('name' => 'data[ValidateUser][balance]', 'id' => 'ValidateUserBalance'),
  2632
+			array('option' => array('value' => '0')),
  2633
+			'nothing',
  2634
+			'/option',
  2635
+			array('option' => array('value' => '1', 'selected' => 'selected')),
  2636
+			'some',
  2637
+			'/option',
  2638
+			array('option' => array('value' => '100')),
  2639
+			'a lot',
  2640
+			'/option',
  2641
+			'/select',
  2642
+			'/div'
  2643
+		);
  2644
+		$this->assertTags($result, $expected);
  2645
+	}
  2646
+
  2647
+/**
2618 2648
  * Test that magic input() selects can easily be converted into radio types without error.
2619 2649
  *
2620 2650
  * @return void
@@ -2650,29 +2680,6 @@ public function testInputWithMatchingFieldAndModelName() {
2650 2680
 			'/div'
2651 2681
 		);
2652 2682
 		$this->assertTags($result, $expected);
2653  
-
2654  
-		$this->View->viewVars['balances'] = array(0 => 'nothing', 1 => 'some', 100 => 'a lot');
2655  
-		$this->Form->request->data = array('ValidateUser' => array('balance' => 1));
2656  
-		$result = $this->Form->input('ValidateUser.balance');
2657  
-		$expected = array(
2658  
-			'div' => array('class' => 'input select'),
2659  
-			'label' => array('for' => 'ValidateUserBalance'),
2660  
-			'Balance',
2661  
-			'/label',
2662  
-			'select' => array('name' => 'data[ValidateUser][balance]', 'id' => 'ValidateUserBalance'),
2663  
-			array('option' => array('value' => '0')),
2664  
-			'nothing',
2665  
-			'/option',
2666  
-			array('option' => array('value' => '1', 'selected' => 'selected')),
2667  
-			'some',
2668  
-			'/option',
2669  
-			array('option' => array('value' => '100')),
2670  
-			'a lot',
2671  
-			'/option',
2672  
-			'/select',
2673  
-			'/div'
2674  
-		);
2675  
-		$this->assertTags($result, $expected);
2676 2683
 	}
2677 2684
 
2678 2685
 /**

0 notes on commit 044cf60

Please sign in to comment.
Something went wrong with that request. Please try again.