Make WordPress Core

Changeset 1148 in tests


Ignore:
Timestamp:
11/21/2012 03:01:28 PM (13 years ago)
Author:
ryan
Message:

Pinking shears and eol-style

Location:
trunk
Files:
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/mock-image-editor.php

    • Property svn:eol-style set to native
  • trunk/tests/admin/includesFile.php

    • Property svn:eol-style set to native
  • trunk/tests/admin/includesPost.php

    • Property svn:eol-style set to native
  • trunk/tests/admin/includesScreen.php

    r1073 r1148  
    8181            $this->assertFalse( $current_screen->in_admin( 'user' ) );
    8282            $this->assertFalse( $current_screen->in_admin( 'garbage' ) );
    83            
     83
    8484            // With convert_to_screen(), the same ID should return the exact $current_screen.
    8585            $this->assertSame( $current_screen, convert_to_screen( $screen->id ), $hook_name );
  • trunk/tests/adminbar.php

    • Property svn:eol-style set to native
  • trunk/tests/ajax/Response.php

    r975 r1148  
    6262     * Note:  headers_list doesn't work properly in CLI mode, fall back on
    6363     * xdebug_get_headers if it's available
    64      * Needs a separate process to get around the headers/output from the 
     64     * Needs a separate process to get around the headers/output from the
    6565     * bootstrapper
    6666     * @ticket 19448
     
    9090     */
    9191    public function test_response_charset_in_xml() {
    92        
     92
    9393        // Generate an ajax response
    9494        ob_start();
  • trunk/tests/attachment/slashes.php

    r1071 r1148  
    1212        $this->old_current_user = get_current_user_id();
    1313        wp_set_current_user( $this->author_id );
    14        
     14
    1515        // it is important to test with both even and odd numbered slashes as
    1616        // kses does a strip-then-add slashes in some of it's function calls
  • trunk/tests/canonical/permalinkFormats.php

    r1113 r1148  
    6262        foreach ( $tests as $permalink_format => $expected ) {
    6363            update_option( 'permalink_structure', $permalink_format );
    64            
     64
    6565            // Get the rewrite rules
    6666            $rules = $wp_rewrite->generate_rewrite_rules( get_option( 'permalink_structure' ), EP_PERMALINK, false, false, false, false );
    67            
     67
    6868            // Filter out only the post rewrite rule
    6969            foreach ( $rules as $regex => $url ) {
  • trunk/tests/comment.php

    • Property svn:eol-style set to native
  • trunk/tests/comment/slashes.php

    r1041 r1148  
    1313        $this->old_current_user = get_current_user_id();
    1414        wp_set_current_user( $this->author_id );
    15        
     15
    1616        // it is important to test with both even and odd numbered slashes as
    1717        // kses does a strip-then-add slashes in some of it's function calls
     
    3737        $post_id = $this->factory->post->create();
    3838
    39         // not testing comment_author_email or comment_author_url 
     39        // not testing comment_author_email or comment_author_url
    4040        // as slashes are not permitted in that data
    4141        $data = array(
     
    7474        ));
    7575
    76         // not testing comment_author_email or comment_author_url 
     76        // not testing comment_author_email or comment_author_url
    7777        // as slashes are not permitted in that data
    7878        $_POST = array();
     
    8181        $_POST['content'] = $this->slash_7;
    8282        $_POST = add_magic_quotes( $_POST );
    83        
     83
    8484        edit_comment();
    8585        $comment = get_comment( $comment_id );
     
    9393        $_POST['content'] = $this->slash_4;
    9494        $_POST = add_magic_quotes( $_POST );
    95        
     95
    9696        edit_comment();
    9797        $comment = get_comment( $comment_id );
     
    107107    function test_wp_insert_comment() {
    108108        $post_id = $this->factory->post->create();
    109        
     109
    110110        $comment_id = wp_insert_comment(array(
    111111            'comment_post_ID' => $post_id,
     
    138138            'comment_post_ID' => $post_id
    139139        ));
    140        
     140
    141141        wp_update_comment(array(
    142142            'comment_ID' => $comment_id,
  • trunk/tests/functions/deprecated.php

    r1061 r1148  
    2828     */
    2929    protected $_deprecated_files = array();
    30    
     30
    3131    /**
    3232     * Set up the test fixture
     
    105105        );
    106106    }
    107    
     107
    108108    /**
    109109     * Check if something was deprecated
     
    133133        return false;
    134134    }
    135    
     135
    136136    /**
    137137     * Test that wp_save_image_file has a deprecated argument when passed a GD resource
     
    150150        // Check if the arg was deprecated
    151151        $check = $this->was_deprecated( 'argument', 'wp_save_image_file' );
    152         $this->assertNotEmpty( $check );       
     152        $this->assertNotEmpty( $check );
    153153    }
    154    
     154
    155155    /**
    156156     * Test that wp_save_image_file doesn't have a deprecated argument when passed a WP_Image_Editor
  • trunk/tests/image/base.php

    r1124 r1148  
    1616        add_filter( 'image_editor_class', array( $this, 'setEngine') );
    1717    }
    18    
     18
    1919    /**
    2020     * Undo the image editor override
     
    3030    public function setEngine() {
    3131        return $this->editor_engine;
    32     }   
     32    }
    3333}
  • trunk/tests/image/functions.php

    r1126 r1148  
    1414     */
    1515    protected function get_mime_type( $filename ) {
    16         $mime_type = ''; 
    17         if ( extension_loaded( 'fileinfo' ) ) { 
     16        $mime_type = '';
     17        if ( extension_loaded( 'fileinfo' ) ) {
    1818            $finfo = new finfo();
    1919            $mime_type = $finfo->file( $filename, FILEINFO_MIME );
    20         } elseif ( function_exists('mime_content_type') ) { 
     20        } elseif ( function_exists('mime_content_type') ) {
    2121            $mime_type = mime_content_type( $filename );
    2222        }
     
    2626        return $mime_type;
    2727    }
    28    
     28
    2929    function test_is_image_positive() {
    3030        // these are all image files recognized by php
     
    9393            $this->assertFalse( file_is_displayable_image( DIR_TESTDATA.'/images/'.$file ), "file_is_valid_image($file) should return false" );
    9494        }
    95     }   
    96    
     95    }
     96
    9797    /**
    9898     * Test save image file and mime_types
     
    108108            'image/png'
    109109        );
    110        
     110
    111111        // Test each image editor engine
    112112        $classes = array('WP_Image_Editor_GD', 'WP_Image_Editor_Imagick');
    113113        foreach ( $classes as $class ) {
    114            
     114
    115115            // If the image editor isn't available, skip it
    116116            if ( ! call_user_func( array( $class, 'test' ) ) ) {
     
    122122            // Call wp_save_image_file
    123123            $img = WP_Image_Editor::get_instance( DIR_TESTDATA . '/images/canola.jpg' );
    124            
     124
    125125            // Save a file as each mime type, assert it works
    126126            foreach ( $mime_types as $mime_type ) {
    127                 $file = wp_tempnam();               
     127                $file = wp_tempnam();
    128128                $ret = wp_save_image_file( $file, $img, $mime_type, 1 );
    129129                $this->assertNotEmpty( $ret );
    130130                $this->assertNotInstanceOf( 'WP_Error', $ret );
    131131                $this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) );
    132                
     132
    133133                // Clean up
    134134                @unlink( $file );
     
    140140        }
    141141    }
    142    
     142
    143143    /**
    144144     * Test that a passed mime type overrides the extension in the filename
     
    163163            $file = wp_tempnam( 'tmp.jpg' );
    164164            $ret = $img->save( $file, $mime_type );
    165            
     165
    166166            // Make assertions
    167167            $this->assertNotEmpty( $ret );
    168168            $this->assertNotInstanceOf( 'WP_Error', $ret );
    169169            $this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) );
    170            
     170
    171171            // Clean up
    172172            @unlink( $file );
     
    202202            $filter = create_function( '', "return '$class';" );
    203203            add_filter( 'image_editor_class', $filter );
    204            
     204
    205205            // Save the image as each file extension, check the mime type
    206206            $img = WP_Image_Editor::get_instance( DIR_TESTDATA . '/images/canola.jpg' );
  • trunk/tests/image/resize.php

    r1123 r1148  
    127127        $this->assertEquals( 'error_loading_image', $image->get_error_code() );
    128128    }
    129    
     129
    130130    /**
    131131     * Try resizing a php file (bad image)
  • trunk/tests/image/resize_gd.php

    r1123 r1148  
    1010    /**
    1111     * Use the GD image editor engine
    12      * @var string 
     12     * @var string
    1313     */
    1414    public $editor_engine = 'WP_Image_Editor_GD';
  • trunk/tests/image/resize_imagick.php

    r1123 r1148  
    1010    /**
    1111     * Use the Imagick image editor engine
    12      * @var string 
     12     * @var string
    1313     */
    1414    public $editor_engine = 'WP_Image_Editor_Imagick';
  • trunk/tests/includes/factory.php

    • Property svn:eol-style set to native
  • trunk/tests/iterators.php

    • Property svn:eol-style set to native
  • trunk/tests/l10n.php

    • Property svn:eol-style set to native
  • trunk/tests/link.php

    • Property svn:eol-style set to native
    r1140 r1148  
    2222        $_SERVER['REQUEST_URI'] = '/woohoo';
    2323        $paged = get_pagenum_link( 2 );
    24        
     24
    2525        remove_filter( 'home_url', array( $this, '_get_pagenum_link_cb' ) );
    2626        $this->assertEquals( $paged, home_url( '/WooHoo/page/2/' ) );
  • trunk/tests/option/slashes.php

    r1071 r1148  
    3535        $this->assertEquals( $this->slash_4, get_option( 'slash_test_4' ) );
    3636    }
    37    
     37
    3838    /**
    3939     * Tests the model function that expects un-slashed data
     
    4242    function test_update_option() {
    4343        add_option( 'slash_test_5', 'foo' );
    44        
     44
    4545        update_option( 'slash_test_5', $this->slash_1 );
    4646        $this->assertEquals( $this->slash_1, get_option( 'slash_test_5' ) );
  • trunk/tests/post/formats.php

    r1143 r1148  
    5555        $format = get_post_format( $post_id );
    5656        $this->assertEquals( 'aside', $format );
    57        
     57
    5858        $result = set_post_format( $post_id, 'standard' );
    5959        $this->assertNotInstanceOf( 'WP_Error', $result );
  • trunk/tests/post/query.php

    r1138 r1148  
    224224            'operator' => 'IN'
    225225        )
    226         )   
     226        )
    227227    ) );
    228228
     
    242242    $post_id5 = $this->factory->post->create();
    243243    add_post_meta( $post_id5, 'time', 1000 );
    244    
     244
    245245    $args = array(
    246246        'meta_key' => 'time',
     
    258258    $posts = wp_list_pluck( $query->posts, 'ID' );
    259259    $this->assertEqualSets( array( $post_id2, $post_id3 ), $posts );
    260    
     260
    261261    $args = array(
    262262        'meta_key' => 'time',
     
    429429                    'terms' => array( $cat_a ),
    430430                )
    431             )   
     431            )
    432432        ) );
    433433
     
    442442                    'include_children' => false
    443443                )
    444             )   
     444            )
    445445        ) );
    446446
     
    454454                    'terms' => array( $cat_b ),
    455455                )
    456             )   
     456            )
    457457        ) );
    458458
     
    467467                    'include_children' => false
    468468                )
    469             )   
     469            )
    470470        ) );
    471471
     
    479479                    'terms' => array( $cat_c ),
    480480                )
    481             )   
     481            )
    482482        ) );
    483483
     
    492492                    'include_children' => false
    493493                )
    494             )   
     494            )
    495495        ) );
    496496
  • trunk/tests/post/slashes.php

    r1041 r1148  
    1212        $this->old_current_user = get_current_user_id();
    1313        wp_set_current_user( $this->author_id );
    14        
     14
    1515        // it is important to test with both even and odd numbered slashes as
    1616        // kses does a strip-then-add slashes in some of it's function calls
     
    103103    function test_wp_update_post() {
    104104        $id = $this->factory->post->create();
    105    
     105
    106106        wp_update_post(array(
    107107            'ID' => $id,
  • trunk/tests/term/slashes.php

    r1071 r1148  
    3939        );
    4040        $_POST = add_magic_quotes( $_POST );
    41        
     41
    4242        // Make the request
    4343        try {
     
    4646            unset( $e );
    4747        }
    48        
     48
    4949        $term = get_term_by( 'slug', 'string-with-1-slash', 'category' );
    5050        $this->assertEquals( $this->slash_1, $term->name );
     
    5757        );
    5858        $_POST = add_magic_quotes( $_POST );
    59        
     59
    6060        // Make the request
    6161        try {
     
    6464            unset( $e );
    6565        }
    66        
     66
    6767        $term = get_term_by( 'slug', 'string-with-3-slashes', 'category' );
    6868        $this->assertEquals( $this->slash_3, $term->name );
     
    7575        );
    7676        $_POST = add_magic_quotes( $_POST );
    77        
     77
    7878        // Make the request
    7979        try {
     
    8282            unset( $e );
    8383        }
    84        
     84
    8585        $term = get_term_by( 'slug', 'string-with-2-slashes', 'category' );
    8686        $this->assertEquals( $this->slash_2, $term->name );
    8787
    8888    }
    89    
     89
    9090    /**
    9191     * Tests the controller function that expects slashed data
     
    9999        foreach ( $taxonomies as $taxonomy ) {
    100100            $_POST = $_GET = $_REQUEST = array();
    101            
     101
    102102            $_POST = array(
    103103                '_wpnonce_add-tag' => wp_create_nonce( 'add-tag' ),
     
    108108            );
    109109            $_POST = add_magic_quotes( $_POST );
    110            
     110
    111111            // Make the request
    112112            try {
     
    115115                unset( $e );
    116116            }
    117            
     117
    118118            $term = get_term_by( 'slug', 'controller_slash_test_1_'.$taxonomy, $taxonomy );
    119119            $this->assertEquals( $this->slash_1, $term->name );
     
    128128            );
    129129            $_POST = add_magic_quotes( $_POST );
    130            
     130
    131131            // Make the request
    132132            try {
     
    135135                unset( $e );
    136136            }
    137            
     137
    138138            $term = get_term_by( 'slug', 'controller_slash_test_2_'.$taxonomy, $taxonomy );
    139139            $this->assertEquals( $this->slash_3, $term->name );
     
    148148            );
    149149            $_POST = add_magic_quotes( $_POST );
    150            
     150
    151151            // Make the request
    152152            try {
     
    155155                unset( $e );
    156156            }
    157            
     157
    158158            $term = get_term_by( 'slug', 'controller_slash_test_3_'.$taxonomy, $taxonomy );
    159159            $this->assertEquals( $this->slash_2, $term->name );
     
    161161        }
    162162    }
    163    
     163
    164164    /**
    165165     * Tests the model function that expects un-slashed data
     
    183183            $this->assertEquals( $this->slash_1, $term->name );
    184184            $this->assertEquals( $this->slash_3, $term->description );
    185    
     185
    186186            $insert = wp_insert_term(
    187187                $this->slash_3,
     
    195195            $this->assertEquals( $this->slash_3, $term->name );
    196196            $this->assertEquals( $this->slash_5, $term->description );
    197    
     197
    198198            $insert = wp_insert_term(
    199199                $this->slash_2,
     
    223223                'taxonomy' => $taxonomy
    224224            ));
    225    
     225
    226226            $update = wp_update_term(
    227227                $id,
     
    236236            $this->assertEquals( $this->slash_1, $term->name );
    237237            $this->assertEquals( $this->slash_3, $term->description );
    238    
     238
    239239            $update = wp_update_term(
    240240                $id,
     
    248248            $this->assertEquals( $this->slash_3, $term->name );
    249249            $this->assertEquals( $this->slash_5, $term->description );
    250    
     250
    251251            $update = wp_update_term(
    252252                $id,
  • trunk/tests/user/slashes.php

    r1071 r1148  
    1212        $this->old_current_user = get_current_user_id();
    1313        wp_set_current_user( $this->author_id );
    14        
     14
    1515        // it is important to test with both even and odd numbered slashes as
    1616        // kses does a strip-then-add slashes in some of it's function calls
Note: See TracChangeset for help on using the changeset viewer.