Make WordPress Core

Changeset 54791


Ignore:
Timestamp:
11/10/2022 01:05:57 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Tests: Correct the test for get_blogaddress_by_id() with a non-existing ID.

Due to auto-increment, when running various test groups or classes separately, in this case running all of the tests under phpunit/tests/multisite/ by including the --filter Tests_Multisite parameter, it is entirely possible for the blog ID 42 to actually exist, making the test's assumption incorrect.

By using PHP_INT_MAX instead, we can avoid a collision with a fixture of another test.

Follow-up to [31157].

See #56793.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/multisite/site.php

    r54760 r54791  
    688688
    689689        /**
    690          * Tests returning the appropriate response for a invalid id given.
     690         * Tests returning an empty string for a non-existing ID.
    691691         */
    692692        public function test_get_blogaddress_by_id_with_invalid_id() {
    693             $blogaddress = get_blogaddress_by_id( 42 );
     693            $blogaddress = get_blogaddress_by_id( PHP_INT_MAX );
    694694            $this->assertSame( '', $blogaddress );
    695695        }
Note: See TracChangeset for help on using the changeset viewer.