Make WordPress Core


Ignore:
Timestamp:
12/10/2017 12:30:32 AM (7 years ago)
Author:
johnbillion
Message:

Build/Test tools: Switch to PHPUnit's expectOutputString() method instead of manually using output buffers for output assertions.

Props birgire
Fixes #42098

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/taxonomy.php

    r42343 r42382  
    6767        $post_id = self::factory()->post->create();
    6868
    69         ob_start();
     69        $this->expectOutputString( sprintf(
     70            'Categories: <a href="%s">Uncategorized</a>.',
     71            get_category_link( 1 )
     72        ) );
    7073        the_taxonomies( array( 'post' => $post_id ) );
    71         $output = ob_get_clean();
    72 
    73         $link     = get_category_link( 1 );
    74         $expected = 'Categories: <a href="' . $link . '">Uncategorized</a>.';
    75         $this->assertEquals( $expected, $output );
    7674    }
    7775
Note: See TracChangeset for help on using the changeset viewer.