Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (7 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/oembed/template.php

    r40526 r42343  
    66class Tests_Embed_Template extends WP_UnitTestCase {
    77    function test_oembed_output_post() {
    8         $user = self::factory()->user->create_and_get( array(
    9             'display_name' => 'John Doe',
    10         ) );
    11 
    12         $post_id = self::factory()->post->create( array(
    13             'post_author'  => $user->ID,
    14             'post_title'   => 'Hello World',
    15             'post_content' => 'Foo Bar',
    16             'post_excerpt' => 'Bar Baz',
    17         ) );
     8        $user = self::factory()->user->create_and_get(
     9            array(
     10                'display_name' => 'John Doe',
     11            )
     12        );
     13
     14        $post_id = self::factory()->post->create(
     15            array(
     16                'post_author'  => $user->ID,
     17                'post_title'   => 'Hello World',
     18                'post_content' => 'Foo Bar',
     19                'post_excerpt' => 'Bar Baz',
     20            )
     21        );
    1822        $this->go_to( get_post_embed_url( $post_id ) );
    1923
     
    3135
    3236    function test_oembed_output_post_with_thumbnail() {
    33         $post_id       = self::factory()->post->create( array(
    34             'post_title'   => 'Hello World',
    35             'post_content' => 'Foo Bar',
    36             'post_excerpt' => 'Bar Baz',
    37         ) );
     37        $post_id       = self::factory()->post->create(
     38            array(
     39                'post_title'   => 'Hello World',
     40                'post_content' => 'Foo Bar',
     41                'post_excerpt' => 'Bar Baz',
     42            )
     43        );
    3844        $file          = DIR_TESTDATA . '/images/canola.jpg';
    39         $attachment_id = self::factory()->attachment->create_object( $file, $post_id, array(
    40             'post_mime_type' => 'image/jpeg',
    41         ) );
     45        $attachment_id = self::factory()->attachment->create_object(
     46            $file, $post_id, array(
     47                'post_mime_type' => 'image/jpeg',
     48            )
     49        );
    4250        set_post_thumbnail( $post_id, $attachment_id );
    4351
     
    7583        $post          = self::factory()->post->create_and_get();
    7684        $file          = DIR_TESTDATA . '/images/canola.jpg';
    77         $attachment_id = self::factory()->attachment->create_object( $file, $post->ID, array(
    78             'post_mime_type' => 'image/jpeg',
    79             'post_title'     => 'Hello World',
    80             'post_content'   => 'Foo Bar',
    81             'post_excerpt'   => 'Bar Baz',
    82         ) );
     85        $attachment_id = self::factory()->attachment->create_object(
     86            $file, $post->ID, array(
     87                'post_mime_type' => 'image/jpeg',
     88                'post_title'     => 'Hello World',
     89                'post_content'   => 'Foo Bar',
     90                'post_excerpt'   => 'Bar Baz',
     91            )
     92        );
    8393
    8494        $this->go_to( get_post_embed_url( $attachment_id ) );
     
    98108
    99109    function test_oembed_output_draft_post() {
    100         $post_id = self::factory()->post->create( array(
    101             'post_title'   => 'Hello World',
    102             'post_content' => 'Foo Bar',
    103             'post_excerpt' => 'Bar Baz',
    104             'post_status'  => 'draft',
    105         ) );
     110        $post_id = self::factory()->post->create(
     111            array(
     112                'post_title'   => 'Hello World',
     113                'post_content' => 'Foo Bar',
     114                'post_excerpt' => 'Bar Baz',
     115                'post_status'  => 'draft',
     116            )
     117        );
    106118
    107119        $this->go_to( get_post_embed_url( $post_id ) );
     
    119131
    120132    function test_oembed_output_scheduled_post() {
    121         $post_id = self::factory()->post->create( array(
    122             'post_title'   => 'Hello World',
    123             'post_content' => 'Foo Bar',
    124             'post_excerpt' => 'Bar Baz',
    125             'post_status'  => 'future',
    126             'post_date'    => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' ) ),
    127         ) );
     133        $post_id = self::factory()->post->create(
     134            array(
     135                'post_title'   => 'Hello World',
     136                'post_content' => 'Foo Bar',
     137                'post_excerpt' => 'Bar Baz',
     138                'post_status'  => 'future',
     139                'post_date'    => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' ) ),
     140            )
     141        );
    128142
    129143        $this->go_to( get_post_embed_url( $post_id ) );
     
    141155
    142156    function test_oembed_output_private_post() {
    143         $post_id = self::factory()->post->create( array(
    144             'post_title'   => 'Hello World',
    145             'post_content' => 'Foo Bar',
    146             'post_excerpt' => 'Bar Baz',
    147             'post_status'  => 'private',
    148         ) );
     157        $post_id = self::factory()->post->create(
     158            array(
     159                'post_title'   => 'Hello World',
     160                'post_content' => 'Foo Bar',
     161                'post_excerpt' => 'Bar Baz',
     162                'post_status'  => 'private',
     163            )
     164        );
    149165
    150166        $this->go_to( get_post_embed_url( $post_id ) );
     
    165181        wp_set_current_user( $user_id );
    166182
    167         $post_id = self::factory()->post->create( array(
    168             'post_title'   => 'Hello World',
    169             'post_content' => 'Foo Bar',
    170             'post_excerpt' => 'Bar Baz',
    171             'post_status'  => 'private',
    172             'post_author'  => $user_id,
    173         ) );
     183        $post_id = self::factory()->post->create(
     184            array(
     185                'post_title'   => 'Hello World',
     186                'post_content' => 'Foo Bar',
     187                'post_excerpt' => 'Bar Baz',
     188                'post_status'  => 'private',
     189                'post_author'  => $user_id,
     190            )
     191        );
    174192
    175193        $this->go_to( get_post_embed_url( $post_id ) );
     
    194212
    195213    function test_wp_embed_excerpt_more() {
    196         $post_id = self::factory()->post->create( array(
    197             'post_title'   => 'Foo Bar',
    198             'post_content' => 'Bar Baz',
    199         ) );
     214        $post_id = self::factory()->post->create(
     215            array(
     216                'post_title'   => 'Foo Bar',
     217                'post_content' => 'Bar Baz',
     218            )
     219        );
    200220
    201221        $this->assertEquals( '', wp_embed_excerpt_more( '' ) );
     
    224244        $post_id       = self::factory()->post->create();
    225245        $file          = DIR_TESTDATA . '/images/canola.jpg';
    226         $attachment_id = self::factory()->attachment->create_object( $file, $post_id, array(
    227             'post_mime_type' => 'image/jpeg',
    228         ) );
     246        $attachment_id = self::factory()->attachment->create_object(
     247            $file, $post_id, array(
     248                'post_mime_type' => 'image/jpeg',
     249            )
     250        );
    229251        $this->go_to( get_post_embed_url( $attachment_id ) );
    230252        $this->assertTrue( is_embed() );
     
    243265    function test_get_post_embed_html() {
    244266        $post_id = self::factory()->post->create();
    245         $title = esc_attr(
     267        $title   = esc_attr(
    246268            sprintf(
    247269                __( '“%1$s” — %2$s' ),
Note: See TracChangeset for help on using the changeset viewer.