Make WordPress Core

Changeset 62969


Ignore:
Timestamp:
08/02/2026 11:48:34 PM (7 days ago)
Author:
SergeyBiryukov
Message:

Tests: Use assertTrue()/assertFalse() instead of assertSame() with booleans.

Using the dedicated boolean assertions clarifies intent and produces more descriptive failure messages.

Follow-up to [51453].

Props Soean, mukesh27.
See #64894.

Location:
trunk/tests/phpunit/tests
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/blocks/wpBlockType.php

    r57987 r62969  
    529529                );
    530530
    531                 $this->assertSame( false, $callback_called, 'The callback should not be called before the variations are accessed.' );
     531                $this->assertFalse( $callback_called, 'The callback should not be called before the variations are accessed.' );
    532532                $block_type->variations; // access the variations.
    533                 $this->assertSame( true, $callback_called, 'The callback should be called when the variations are accessed.' );
     533                $this->assertTrue( $callback_called, 'The callback should be called when the variations are accessed.' );
    534534        }
    535535
     
    556556                // If the variations are defined after registration but before first access, the callback should not override it.
    557557                $this->assertSameSets( $test_variations, $block_type->get_variations(), 'Variations are same as variations set' );
    558                 $this->assertSame( false, $callback_called, 'The callback was never called.' );
     558                $this->assertFalse( $callback_called, 'The callback was never called.' );
    559559        }
    560560
     
    618618                $obtained_variations = $block_type->variations; // access the variations.
    619619
    620                 $this->assertSame( true, $callback_called, 'The callback should be called when the variations are accessed.' );
     620                $this->assertTrue( $callback_called, 'The callback should be called when the variations are accessed.' );
    621621                $this->assertSameSets( $obtained_variations, $expected_variations, 'The variations obtained from the callback should be filtered.' );
    622622        }
  • trunk/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-bind.php

    r62944 r62969  
    455455                $html    = '<div data-wp-bind--id="myPlugin::state.trueValue"></div>';
    456456                list($p) = $this->process_directives( $html );
    457                 $this->assertSame( true, $p->get_attribute( 'id' ) );
     457                $this->assertTrue( $p->get_attribute( 'id' ) );
    458458        }
    459459
     
    468468                $html    = '<div data-wp-bind--id="myPlugin::state.trueValue"></div>';
    469469                list($p) = $this->process_directives( $html );
    470                 $this->assertSame( true, $p->get_attribute( 'id' ) );
     470                $this->assertTrue( $p->get_attribute( 'id' ) );
    471471
    472472                $html    = '<div data-wp-bind--id---unique-id="myPlugin::state.trueValue"></div>';
  • trunk/tests/phpunit/tests/rest-api/rest-post-meta-fields.php

    r61424 r62969  
    23492349
    23502350                $data = $response->get_data();
    2351                 $this->assertSame( false, $data['meta']['authenticated'] );
     2351                $this->assertFalse( $data['meta']['authenticated'] );
    23522352        }
    23532353
  • trunk/tests/phpunit/tests/rest-api/wpRestMenusController.php

    r59718 r62969  
    317317                $this->assertSame( 'New Name', $data['name'] );
    318318                $this->assertSame( 'New Description', $data['description'] );
    319                 $this->assertSame( true, $data['auto_add'] );
     319                $this->assertTrue( $data['auto_add'] );
    320320                $this->assertSame( 'new-name', $data['slug'] );
    321321                $this->assertSame( 'just meta', $data['meta']['test_single_menu'] );
Note: See TracChangeset for help on using the changeset viewer.