Make WordPress Core

Changeset 63401


Ignore:
Timestamp:
08/30/2026 10:42:49 PM (2 weeks ago)
Author:
SergeyBiryukov
Message:

Tests: Use assertIsNotArray() for array type assertions.

Tests_Theme::test_get_theme() wraps a native type check in a boolean assertion. PHPUnit has a dedicated assertion for this, which states the intent directly and reports a more useful message when it fails. The comment above it is reworded for clarity.

Developed in https://github.com/WordPress/wordpress-develop/pull/13305.

Follow-up to r62761, r63311.

Props Soean, mukesh27, SergeyBiryukov.
See #65819.

File:
1 edited

Legend:

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

    r62761 r63401  
    9595                foreach ( array_keys( $themes ) as $name ) {
    9696                        $theme = get_theme( $name );
    97                         // WP_Theme implements ArrayAccess. Even ArrayObject returns false for is_array().
    98                         $this->assertFalse( is_array( $theme ) );
     97                        // WP_Theme implements ArrayAccess, but that does not make it an array:
     98                        // is_array() returns false for ArrayObject.
     99                        $this->assertIsNotArray( $theme );
    99100                        $this->assertInstanceOf( 'WP_Theme', $theme );
    100101                        $this->assertSame( $theme, $themes[ $name ] );
Note: See TracChangeset for help on using the changeset viewer.