WordPress.org

Make WordPress Core

Changeset 1222 in tests


Ignore:
Timestamp:
02/28/13 16:48:20 (2 years ago)
Author:
nacin
Message:

Tests for wp_protect_special_option(), and for delete_option() trimming the option and checking for emptiness like other functions. see #23289.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/option/option.php

    r904 r1222  
    7272        $this->assertTrue( delete_option( $key ) ); 
    7373    } 
     74 
     75    /** 
     76     * @ticket 23289 
     77     */ 
     78    function test_bad_option_names() { 
     79        foreach ( array( '', '0', ' ', 0, false, null ) as $empty ) { 
     80            $this->assertFalse( get_option( $empty ) ); 
     81            $this->assertFalse( add_option( $empty, '' ) ); 
     82            $this->assertFalse( update_option( $empty, '' ) ); 
     83            $this->assertFalse( delete_option( $empty ) ); 
     84        } 
     85    } 
     86 
     87    /** 
     88     * @ticket 23289 
     89     * @expectedException WPDieException 
     90     */ 
     91    function test_special_option_name_alloption() { 
     92        delete_option( 'alloptions' ); 
     93    } 
     94 
     95    /** 
     96     * @ticket 23289 
     97     * @expectedException WPDieException 
     98     */ 
     99    function test_special_option_name_notoptions() { 
     100        delete_option( 'notoptions' ); 
     101    } 
    74102} 
Note: See TracChangeset for help on using the changeset viewer.