@@ 2898-2919 (lines=22) @@ | ||
2895 | * |
|
2896 | * @return void |
|
2897 | */ |
|
2898 | public function testInputMagicTypeDoesNotOverride() { |
|
2899 | $this->View->viewVars['users'] = array('value' => 'good', 'other' => 'bad'); |
|
2900 | $result = $this->Form->input('Model.user', array('type' => 'checkbox')); |
|
2901 | $expected = array( |
|
2902 | 'div' => array('class' => 'input checkbox'), |
|
2903 | array('input' => array( |
|
2904 | 'type' => 'hidden', |
|
2905 | 'name' => 'data[Model][user]', |
|
2906 | 'id' => 'ModelUser_', |
|
2907 | 'value' => 0, |
|
2908 | )), |
|
2909 | array('input' => array( |
|
2910 | 'name' => 'data[Model][user]', |
|
2911 | 'type' => 'checkbox', |
|
2912 | 'id' => 'ModelUser', |
|
2913 | 'value' => 1 |
|
2914 | )), |
|
2915 | 'label' => array('for' => 'ModelUser'), 'User', '/label', |
|
2916 | '/div' |
|
2917 | ); |
|
2918 | $this->assertTags($result, $expected); |
|
2919 | } |
|
2920 | ||
2921 | /** |
|
2922 | * Test that magic input() selects are created for type=number |
|
@@ 5891-5913 (lines=23) @@ | ||
5888 | * |
|
5889 | * @return void |
|
5890 | */ |
|
5891 | public function testCheckboxZeroValue() { |
|
5892 | $result = $this->Form->input('User.get_spam', array( |
|
5893 | 'type' => 'checkbox', |
|
5894 | 'value' => '0', |
|
5895 | 'hiddenField' => '1', |
|
5896 | )); |
|
5897 | $expected = array( |
|
5898 | 'div' => array('class' => 'input checkbox'), |
|
5899 | array('input' => array( |
|
5900 | 'type' => 'hidden', 'name' => 'data[User][get_spam]', |
|
5901 | 'value' => '1', 'id' => 'UserGetSpam_' |
|
5902 | )), |
|
5903 | array('input' => array( |
|
5904 | 'type' => 'checkbox', 'name' => 'data[User][get_spam]', |
|
5905 | 'value' => '0', 'id' => 'UserGetSpam' |
|
5906 | )), |
|
5907 | 'label' => array('for' => 'UserGetSpam'), |
|
5908 | 'Get Spam', |
|
5909 | '/label', |
|
5910 | '/div' |
|
5911 | ); |
|
5912 | $this->assertTags($result, $expected); |
|
5913 | } |
|
5914 | ||
5915 | /** |
|
5916 | * testDateTime method |