Skip to content
Browse files

Add unit test for negative step to JFormFieldIntegerTest.php.

  • Loading branch information...
1 parent c328bdc commit d8c451c497d8e38e32393e343e7d247d2082906e @aaronschmitz committed Mar 25, 2012
Showing with 20 additions and 0 deletions.
  1. +20 −0 tests/suites/unit/joomla/form/fields/JFormFieldIntegerTest.php
View
20 tests/suites/unit/joomla/form/fields/JFormFieldIntegerTest.php
@@ -128,5 +128,25 @@ public function testGetOptions()
),
'Line:'.__LINE__.' The field should not contain any options.'
);
+
+ $this->assertThat(
+ $form->load('<form><field name="integer" type="integer" first="-5" last="-7" step="-1"/></form>'),
+ $this->isTrue(),
+ 'Line:'.__LINE__.' XML string should load successfully.'
+ );
+
+ $field = new JFormFieldInteger($form);
+
+ $this->assertThat(
+ $field->setup($form->getXml()->field, 'value'),
+ $this->isTrue(),
+ 'Line:'.__LINE__.' The setup method should return true.'
+ );
+
+ $this->assertThat(
+ $field->input,
+ $this->StringContains('<option value="-7">-7</option>'),
+ 'Line:'.__LINE__.' The field should contain -5 through -7 as options.'
+ );
}
}

0 comments on commit d8c451c

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