Make WordPress Core


Ignore:
Timestamp:
07/10/2009 09:22:52 PM (15 years ago)
Author:
westi
Message:

Add more testcases for checked and selected. Props Denis-de-Bernardy.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_admin_includes_template.php

    r231 r232  
    11<?php
    22class WPTestCheckedSelected extends WPTestCase {
    3    
    4     function test_numbers() {
     3    function test_equal() {
     4        $this->assertEquals(' selected=\'selected\'', selected('foo','foo',false));
     5        $this->assertEquals(' checked=\'checked\'', checked('foo','foo',false));
     6       
     7        $this->assertEquals(' selected=\'selected\'', selected('1',1,false));
     8        $this->assertEquals(' checked=\'checked\'', checked('1',1,false));
     9       
     10        $this->assertEquals(' selected=\'selected\'', selected('1',true,false));
     11        $this->assertEquals(' checked=\'checked\'', checked('1',true,false));
     12       
     13        $this->assertEquals(' selected=\'selected\'', selected(1,1,false));
     14        $this->assertEquals(' checked=\'checked\'', checked(1,1,false));
     15       
     16        $this->assertEquals(' selected=\'selected\'', selected(1,true,false));
     17        $this->assertEquals(' checked=\'checked\'', checked(1,true,false));
     18       
     19        $this->assertEquals(' selected=\'selected\'', selected(true,true,false));
     20        $this->assertEquals(' checked=\'checked\'', checked(true,true,false));
     21       
     22        $this->assertEquals(' selected=\'selected\'', selected('0',0,false));
     23        $this->assertEquals(' checked=\'checked\'', checked('0',0,false));
     24       
    525        $this->assertEquals(' selected=\'selected\'', selected(0,0,false));
    626        $this->assertEquals(' checked=\'checked\'', checked(0,0,false));
    7     }
    8    
    9     function test_booleans() {
    10         $this->assertEquals(' selected=\'selected\'', selected(true,true,false));
    11         $this->assertEquals(' checked=\'checked\'', checked(true,true,false));
    12     }
    13    
    14     function test_strings() {
    15         $this->assertEquals(' selected=\'selected\'', selected('one','one',false));
    16         $this->assertEquals(' checked=\'checked\'', checked('one','one',false));
     27       
     28        $this->assertEquals(' selected=\'selected\'', selected('',false,false));
     29        $this->assertEquals(' checked=\'checked\'', checked('',false,false));
     30       
     31        $this->assertEquals(' selected=\'selected\'', selected(false,false,false));
     32        $this->assertEquals(' checked=\'checked\'', checked(false,false,false));
    1733    }
    1834   
    1935    function test_notequal() {
     36        $this->assertEquals('', selected('0','',false));
     37        $this->assertEquals('', checked('0','',false));
     38       
    2039        $this->assertEquals('', selected(0,'',false));
    2140        $this->assertEquals('', checked(0,'',false));
     41       
     42        $this->assertEquals('', selected(0,false,false));
     43        $this->assertEquals('', checked(0,false,false));
    2244    }
    2345}
Note: See TracChangeset for help on using the changeset viewer.