Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (8 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/ajax/MediaEdit.php

    r39173 r42343  
    3131
    3232        $filename = DIR_TESTDATA . '/images/canola.jpg';
    33         $contents = file_get_contents($filename);
     33        $contents = file_get_contents( $filename );
    3434
    35         $upload = wp_upload_bits(basename($filename), null, $contents);
    36         $id = $this->_make_attachment($upload);
     35        $upload = wp_upload_bits( basename( $filename ), null, $contents );
     36        $id     = $this->_make_attachment( $upload );
    3737
    38         $_REQUEST['action'] = 'image-editor';
     38        $_REQUEST['action']  = 'image-editor';
    3939        $_REQUEST['context'] = 'edit-attachment';
    40         $_REQUEST['postid'] = $id;
    41         $_REQUEST['target'] = 'thumbnail';
    42         $_REQUEST['do'] = 'save';
     40        $_REQUEST['postid']  = $id;
     41        $_REQUEST['target']  = 'thumbnail';
     42        $_REQUEST['do']      = 'save';
    4343        $_REQUEST['history'] = '[{"c":{"x":5,"y":8,"w":289,"h":322}}]';
    4444
    45         $media_meta = wp_get_attachment_metadata($id);
    46         $this->assertArrayHasKey('sizes', $media_meta, 'attachment should have size data');
    47         $this->assertArrayHasKey('medium', $media_meta['sizes'], 'attachment should have data for medium size');
    48         $ret = wp_save_image($id);
     45        $media_meta = wp_get_attachment_metadata( $id );
     46        $this->assertArrayHasKey( 'sizes', $media_meta, 'attachment should have size data' );
     47        $this->assertArrayHasKey( 'medium', $media_meta['sizes'], 'attachment should have data for medium size' );
     48        $ret = wp_save_image( $id );
    4949
    50         $media_meta = wp_get_attachment_metadata($id);
    51         $this->assertArrayHasKey('sizes', $media_meta, 'cropped attachment should have size data');
    52         $this->assertArrayHasKey('medium', $media_meta['sizes'], 'cropped attachment should have data for medium size');
     50        $media_meta = wp_get_attachment_metadata( $id );
     51        $this->assertArrayHasKey( 'sizes', $media_meta, 'cropped attachment should have size data' );
     52        $this->assertArrayHasKey( 'medium', $media_meta['sizes'], 'cropped attachment should have data for medium size' );
    5353    }
    5454
     
    6565
    6666        $upload = wp_upload_bits( basename( $filename ), null, $contents );
    67         $id = $this->_make_attachment( $upload );
     67        $id     = $this->_make_attachment( $upload );
    6868
    69         $_REQUEST['action'] = 'image-editor';
     69        $_REQUEST['action']  = 'image-editor';
    7070        $_REQUEST['context'] = 'edit-attachment';
    71         $_REQUEST['postid'] = $id;
    72         $_REQUEST['target'] = 'all';
    73         $_REQUEST['do'] = 'save';
     71        $_REQUEST['postid']  = $id;
     72        $_REQUEST['target']  = 'all';
     73        $_REQUEST['do']      = 'save';
    7474        $_REQUEST['history'] = '[{"c":{"x":5,"y":8,"w":289,"h":322}}]';
    7575
     
    7777
    7878        $media_meta = wp_get_attachment_metadata( $id );
    79         $sizes1 = $media_meta['sizes'];
     79        $sizes1     = $media_meta['sizes'];
    8080
    8181        $_REQUEST['history'] = '[{"c":{"x":5,"y":8,"w":189,"h":322}}]';
     
    8484
    8585        $media_meta = wp_get_attachment_metadata( $id );
    86         $sizes2 = $media_meta['sizes'];
     86        $sizes2     = $media_meta['sizes'];
    8787
    8888        $file_path = dirname( get_attached_file( $id ) );
Note: See TracChangeset for help on using the changeset viewer.