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/meta/slashes.php

    r49004 r49005  
    1010        protected static $post_id;
    1111        protected static $comment_id;
     12        protected static $user_id;
    1213
    1314        public static function wpSetUpBeforeClass( $factory ) {
    … …  
    1516                self::$post_id    = $factory->post->create();
    1617                self::$comment_id = $factory->comment->create( array( 'comment_post_ID' => self::$post_id ) );
     18                self::$user_id    = $factory->user->create();
    1719        }
    1820
    … …  
    3537         */
    3638        function test_edit_post() {
    37                 $post_id = self::factory()->post->create();
     39                $post_id = self::$post_id;
    3840
    3941                if ( function_exists( 'wp_add_post_meta' ) ) {
    … …  
    112114         */
    113115        function test_add_post_meta() {
    114                 $post_id = self::factory()->post->create();
     116                $post_id = self::$post_id;
    115117
    116118                add_post_meta( $post_id, 'slash_test_1', addslashes( $this->slash_1 ) );
    … …  
    127129         */
    128130        function test_update_post_meta() {
    129                 $post_id = self::factory()->post->create();
     131                $post_id = self::$post_id;
    130132
    131133                update_post_meta( $post_id, 'slash_test_1', addslashes( $this->slash_1 ) );
    … …  
    192194         */
    193195        function test_add_user_meta() {
    194                 $user_id = self::factory()->user->create();
     196                $user_id = self::$user_id;
    195197
    196198                add_user_meta( $user_id, 'slash_test_1', $this->slash_1 );
    … …  
    215217         */
    216218        function test_update_user_meta() {
    217                 $user_id = self::factory()->user->create();
     219                $user_id = self::$user_id;
    218220
    219221                add_user_meta( $user_id, 'slash_test_1', 'foo' );
Note: See TracChangeset for help on using the changeset viewer.