Make WordPress Core


Ignore:
Timestamp:
09/19/2020 11:11:00 AM (6 years ago)
Author:
SergeyBiryukov
Message:

Tests: Speed up slashed data tests by reusing some more shared fixtures.

Follow-up to [35249], [49003].

See #51344.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/comment/slashes.php

    r49004 r49005  
    88class Tests_Comment_Slashes extends WP_UnitTestCase {
    99        protected static $author_id;
     10        protected static $post_id;
    1011
    1112        public static function wpSetUpBeforeClass( $factory ) {
    1213                // We need an admin user to bypass comment flood protection.
    1314                self::$author_id = $factory->user->create( array( 'role' => 'administrator' ) );
     15                self::$post_id   = $factory->post->create();
    1416        }
    1517
    … …  
    3436         */
    3537        function test_wp_new_comment() {
    36                 $post_id = self::factory()->post->create();
     38                $post_id = self::$post_id;
    3739
    3840                // Not testing comment_author_email or comment_author_url
    … …  
    7375         */
    7476        function test_edit_comment() {
    75                 $post_id    = self::factory()->post->create();
     77                $post_id    = self::$post_id;
    7678                $comment_id = self::factory()->comment->create(
    7779                        array(
    … …  
    119121         */
    120122        function test_wp_insert_comment() {
    121                 $post_id = self::factory()->post->create();
     123                $post_id = self::$post_id;
    122124
    123125                $comment_id = wp_insert_comment(
    … …  
    150152         */
    151153        function test_wp_update_comment() {
    152                 $post_id    = self::factory()->post->create();
     154                $post_id    = self::$post_id;
    153155                $comment_id = self::factory()->comment->create(
    154156                        array(
Note: See TracChangeset for help on using the changeset viewer.