Permalink
Browse files

Removed duplicate assertion comments in DropdownFieldTest

  • Loading branch information...
1 parent 666a20f commit da4534bda88d887ce23a1fff9b76a0bf9952173c @chillu chillu committed Oct 30, 2012
Showing with 1 addition and 21 deletions.
  1. +1 −21 tests/forms/DropdownFieldTest.php
@@ -83,66 +83,46 @@ public function testZeroArraySourceNotOverwrittenByEmptyString() {
public function testNumberOfSelectOptionsAvailable() {
/* Create a field with a blank value */
$field = $this->createDropdownField('(Any)');
-
- /* 3 options are available */
$this->assertEquals(count($this->findOptionElements($field->Field())), 3, '3 options are available');
-
- /* There is one selected option, since a dropdown can only possibly have one! */
$selectedOptions = $this->findSelectedOptionElements($field->Field());
$this->assertEquals(count($selectedOptions), 1,
'We only have 1 selected option, since a dropdown can only possibly have one!');
/* Create a field without a blank value */
$field = $this->createDropdownField();
-
- /* 2 options are available */
$this->assertEquals(count($this->findOptionElements($field->Field())), 2, '2 options are available');
-
- /* There are no selected options */
$selectedOptions = $this->findSelectedOptionElements($field->Field());
$this->assertEquals(count($selectedOptions), 0, 'There are no selected options');
}
public function testIntegerZeroValueSeelctedOptionBehaviour() {
$field = $this->createDropdownField('(Any)', 0);
$selectedOptions = $this->findSelectedOptionElements($field->Field());
-
- /* The selected option is "No" */
$this->assertEquals((string) $selectedOptions[0], 'No', 'The selected option is "No"');
}
public function testBlankStringValueSelectedOptionBehaviour() {
$field = $this->createDropdownField('(Any)');
$selectedOptions = $this->findSelectedOptionElements($field->Field());
-
- /* The selected option is "(Any)" */
$this->assertEquals((string) $selectedOptions[0], '(Any)', 'The selected option is "(Any)"');
}
public function testNullValueSelectedOptionBehaviour() {
$field = $this->createDropdownField('(Any)', null);
$selectedOptions = $this->findSelectedOptionElements($field->Field());
-
- /* The selected option is "(Any)" */
$this->assertEquals((string) $selectedOptions[0], '(Any)', 'The selected option is "(Any)"');
}
public function testStringValueSelectedOptionBehaviour() {
$field = $this->createDropdownField('(Any)', '1');
$selectedOptions = $this->findSelectedOptionElements($field->Field());
-
- /* The selected option is "Yes" */
$this->assertEquals((string) $selectedOptions[0], 'Yes', 'The selected option is "Yes"');
-
$field->setSource(array(
'Cats' => 'Cats and Kittens',
'Dogs' => 'Dogs and Puppies'
));
$field->setValue('Cats');
-
$selectedOptions = $this->findSelectedOptionElements($field->Field());
-
- /* The selected option is "Cats and Kittens" */
$this->assertEquals((string) $selectedOptions[0], 'Cats and Kittens',
'The selected option is "Cats and Kittens"');
}
@@ -164,7 +144,7 @@ public function createDropdownField($emptyString = null, $value = '') {
);
$field = new DropdownField('Field', null, $source, $value);
- if($emptyString) $field->setEmptyString($emptyString);
+ if($emptyString !== null) $field->setEmptyString($emptyString);
return $field;
}

0 comments on commit da4534b

Please sign in to comment.