Make WordPress Core

Changeset 48974


Ignore:
Timestamp:
09/13/2020 03:19:40 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Tests: Correct assertion in Tests_DB::test_prepare_incorrect_arg_count().

On failure, wpdb::prepare() returns either an empty string or null, not false.

The test only passed accidentally due to assertEquals() not performing a strict type check.

Follow-up to [41662].

See #38266.

File:
1 edited

Legend:

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

    r48973 r48974  
    428428        // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged,WordPress.DB.PreparedSQL
    429429        $prepared = @$wpdb->prepare( $query, ...$args );
    430         $this->assertEquals( $expected, $prepared );
     430        $this->assertSame( $expected, $prepared );
    431431    }
    432432
     
    443443                "SELECT * FROM $wpdb->users WHERE id = %%%d AND user_login = %s",
    444444                array( 1 ),
    445                 false,
     445                '',
    446446            ),
    447447            array(
Note: See TracChangeset for help on using the changeset viewer.