Permalink
Browse files

make choices associative in testSelect()

  • Loading branch information...
1 parent 1a3e8c5 commit f74ab31fbc1c22b5897516b167b151a8bc5e6249 @scribu committed Feb 21, 2013
Showing with 8 additions and 6 deletions.
  1. +8 −6 tests/test-forms.php
View
@@ -170,9 +170,9 @@ function testCheckboxWithValues() {
function testSelect() {
$choices = array(
- '1/2',
- '1',
- '1 1/3',
+ 'green' => 'Green',
+ 'blue' => 'Blue',
+ 'white' => 'White'
);
$args = array(
@@ -190,12 +190,14 @@ function testSelect() {
$this->assertCount( count( $choices ), $options );
- foreach ( $options as $i => $option ) {
+ foreach ( $options as $option ) {
$el = FluentDOM( $option );
- $this->assertEquals( $choices[ $i ], $el->attr('value') );
+ list( $value, $title ) = each( $choices );
+
+ $this->assertEquals( $value, $el->attr('value') );
- $this->assertEquals( $choices[ $i ], $el->text() );
+ $this->assertEquals( $title, $el->text() );
$this->assertEmpty( $el->attr( 'selected' ) );
}

0 comments on commit f74ab31

Please sign in to comment.