Make WordPress Core

Changeset 58594


Ignore:
Timestamp:
06/28/2024 03:45:08 PM (4 weeks ago)
Author:
SergeyBiryukov
Message:

Tests: Use assertSame() in WP_Interactivity_API tests.

This ensures that not only the return values match the expected results, but also that their type is the same.

Going forward, stricter type checking by using assertSame() should generally be preferred to assertEquals() where appropriate, to make the tests more reliable.

Follow-up to [57563], [57649], [57822], [57826], [57835], [58159], [58327].

See #61530.

Location:
trunk/tests/phpunit/tests/interactivity-api
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-class.php

    r58321 r58594  
    5959        $html    = '<div data-wp-class--some-class="myPlugin::state.true">Text</div>';
    6060        list($p) = $this->process_directives( $html );
    61         $this->assertEquals( 'some-class', $p->get_attribute( 'class' ) );
     61        $this->assertSame( 'some-class', $p->get_attribute( 'class' ) );
    6262    }
    6363
     
    7777            >Text</div>';
    7878        list($p) = $this->process_directives( $html );
    79         $this->assertEquals( 'some-class other-class', $p->get_attribute( 'class' ) );
     79        $this->assertSame( 'some-class other-class', $p->get_attribute( 'class' ) );
    8080    }
    8181
     
    9595            >Text</div>';
    9696        list($p) = $this->process_directives( $html );
    97         $this->assertEquals( 'some-class', $p->get_attribute( 'class' ) );
     97        $this->assertSame( 'some-class', $p->get_attribute( 'class' ) );
    9898
    9999        $html    = '
     
    104104            >Text</div>';
    105105        list($p) = $this->process_directives( $html );
    106         $this->assertEquals( 'some-class', $p->get_attribute( 'class' ) );
     106        $this->assertSame( 'some-class', $p->get_attribute( 'class' ) );
    107107    }
    108108
     
    117117        $html    = '<div class="other-class" data-wp-class--some-class="myPlugin::state.true">Text</div>';
    118118        list($p) = $this->process_directives( $html );
    119         $this->assertEquals( 'other-class some-class', $p->get_attribute( 'class' ) );
     119        $this->assertSame( 'other-class some-class', $p->get_attribute( 'class' ) );
    120120    }
    121121
     
    144144        $html    = '<div class="other-class" data-wp-class--some-class="myPlugin::state.false">Text</div>';
    145145        list($p) = $this->process_directives( $html );
    146         $this->assertEquals( 'other-class', $p->get_attribute( 'class' ) );
     146        $this->assertSame( 'other-class', $p->get_attribute( 'class' ) );
    147147    }
    148148
     
    158158        $html    = '<div class="some-class" data-wp-class--some-class="myPlugin::state.true">Text</div>';
    159159        list($p) = $this->process_directives( $html );
    160         $this->assertEquals( 'some-class', $p->get_attribute( 'class' ) );
     160        $this->assertSame( 'some-class', $p->get_attribute( 'class' ) );
    161161    }
    162162
     
    172172        $html    = '<div class="other-class some-class" data-wp-class--some-class="myPlugin::state.true">Text</div>';
    173173        list($p) = $this->process_directives( $html );
    174         $this->assertEquals( 'other-class some-class', $p->get_attribute( 'class' ) );
     174        $this->assertSame( 'other-class some-class', $p->get_attribute( 'class' ) );
    175175    }
    176176
     
    200200        $html    = '<div class="other-class some-class" data-wp-class--some-class="myPlugin::state.false">Text</div>';
    201201        list($p) = $this->process_directives( $html );
    202         $this->assertEquals( 'other-class', $p->get_attribute( 'class' ) );
     202        $this->assertSame( 'other-class', $p->get_attribute( 'class' ) );
    203203    }
    204204
     
    228228        $html    = '<div class="other-class" data-wp-class="myPlugin::state.true">Text</div>';
    229229        list($p) = $this->process_directives( $html );
    230         $this->assertEquals( 'other-class', $p->get_attribute( 'class' ) );
     230        $this->assertSame( 'other-class', $p->get_attribute( 'class' ) );
    231231    }
    232232
     
    243243        $html    = '<div class="other-class" data-wp-class--some-class="">Text</div>';
    244244        list($p) = $this->process_directives( $html );
    245         $this->assertEquals( 'other-class', $p->get_attribute( 'class' ) );
     245        $this->assertSame( 'other-class', $p->get_attribute( 'class' ) );
    246246    }
    247247
     
    258258        $html    = '<div class="other-class" data-wp-class--some-class>Text</div>';
    259259        list($p) = $this->process_directives( $html );
    260         $this->assertEquals( 'other-class', $p->get_attribute( 'class' ) );
     260        $this->assertSame( 'other-class', $p->get_attribute( 'class' ) );
    261261    }
    262262
     
    272272        $html    = '<div data-wp-class--some-class="myPlugin::state.true" data-wp-class--some-class="myPlugin::state.true">Text</div>';
    273273        list($p) = $this->process_directives( $html );
    274         $this->assertEquals( 'some-class', $p->get_attribute( 'class' ) );
     274        $this->assertSame( 'some-class', $p->get_attribute( 'class' ) );
    275275    }
    276276
     
    287287        $html    = '<div data-wp-class--some-class="myPlugin::state.text">Text</div>';
    288288        list($p) = $this->process_directives( $html );
    289         $this->assertEquals( 'some-class', $p->get_attribute( 'class' ) );
     289        $this->assertSame( 'some-class', $p->get_attribute( 'class' ) );
    290290
    291291        $this->interactivity->state( 'myPlugin', array( 'array' => array( 1, 2 ) ) );
    292292        $html    = '<div data-wp-class--some-class="myPlugin::state.array">Text</div>';
    293293        list($p) = $this->process_directives( $html );
    294         $this->assertEquals( 'some-class', $p->get_attribute( 'class' ) );
     294        $this->assertSame( 'some-class', $p->get_attribute( 'class' ) );
    295295
    296296        $this->interactivity->state( 'myPlugin', array( 'number' => 1 ) );
    297297        $html    = '<div data-wp-class--some-class="myPlugin::state.number">Text</div>';
    298298        list($p) = $this->process_directives( $html );
    299         $this->assertEquals( 'some-class', $p->get_attribute( 'class' ) );
     299        $this->assertSame( 'some-class', $p->get_attribute( 'class' ) );
    300300    }
    301301
  • trunk/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-context.php

    r58321 r58594  
    5757        ';
    5858        list($p) = $this->process_directives( $html );
    59         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
     59        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
    6060    }
    6161
     
    7979        ';
    8080        list($p) = $this->process_directives( $html );
    81         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
     81        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
    8282    }
    8383
     
    100100        ';
    101101        list($p) = $this->process_directives( $html );
    102         $this->assertEquals( 'some-id-1', $p->get_attribute( 'id' ) );
    103         $p->next_tag( array( 'class_name' => 'test' ) );
    104         $this->assertEquals( 'some-id-2', $p->get_attribute( 'id' ) );
     102        $this->assertSame( 'some-id-1', $p->get_attribute( 'id' ) );
     103        $p->next_tag( array( 'class_name' => 'test' ) );
     104        $this->assertSame( 'some-id-2', $p->get_attribute( 'id' ) );
    105105    }
    106106
     
    122122        ';
    123123        list($p) = $this->process_directives( $html );
    124         $this->assertEquals( 'some-id-2', $p->get_attribute( 'id' ) );
     124        $this->assertSame( 'some-id-2', $p->get_attribute( 'id' ) );
    125125    }
    126126
     
    143143        ';
    144144        list($p) = $this->process_directives( $html );
    145         $this->assertEquals( 'some-id-2', $p->get_attribute( 'id' ) );
    146         $p->next_tag( array( 'class_name' => 'test' ) );
    147         $this->assertEquals( 'some-id-1', $p->get_attribute( 'id' ) );
     145        $this->assertSame( 'some-id-2', $p->get_attribute( 'id' ) );
     146        $p->next_tag( array( 'class_name' => 'test' ) );
     147        $this->assertSame( 'some-id-1', $p->get_attribute( 'id' ) );
    148148    }
    149149
     
    166166        ';
    167167        list($p) = $this->process_directives( $html );
    168         $this->assertEquals( 'some-id-1', $p->get_attribute( 'id' ) );
    169         $p->next_tag( array( 'class_name' => 'test' ) );
    170         $this->assertEquals( 'some-id-2', $p->get_attribute( 'id' ) );
     168        $this->assertSame( 'some-id-1', $p->get_attribute( 'id' ) );
     169        $p->next_tag( array( 'class_name' => 'test' ) );
     170        $this->assertSame( 'some-id-2', $p->get_attribute( 'id' ) );
    171171    }
    172172
     
    207207        ';
    208208        list($p) = $this->process_directives( $html );
    209         $this->assertEquals( 'some-id-1', $p->get_attribute( 'id' ) );
    210         $p->next_tag( array( 'class_name' => 'test' ) );
    211         $this->assertEquals( 'some-id-1', $p->get_attribute( 'id' ) );
     209        $this->assertSame( 'some-id-1', $p->get_attribute( 'id' ) );
     210        $p->next_tag( array( 'class_name' => 'test' ) );
     211        $this->assertSame( 'some-id-1', $p->get_attribute( 'id' ) );
    212212    }
    213213
     
    248248        ';
    249249        list($p) = $this->process_directives( $html );
    250         $this->assertEquals( 'some-id-1', $p->get_attribute( 'id' ) );
    251         $p->next_tag( array( 'class_name' => 'test' ) );
    252         $this->assertEquals( 'some-id-1', $p->get_attribute( 'id' ) );
     250        $this->assertSame( 'some-id-1', $p->get_attribute( 'id' ) );
     251        $p->next_tag( array( 'class_name' => 'test' ) );
     252        $this->assertSame( 'some-id-1', $p->get_attribute( 'id' ) );
    253253    }
    254254
     
    289289        ';
    290290        list($p) = $this->process_directives( $html );
    291         $this->assertEquals( 'some-id-1', $p->get_attribute( 'id' ) );
    292         $p->next_tag( array( 'class_name' => 'test' ) );
    293         $this->assertEquals( 'some-id-1', $p->get_attribute( 'id' ) );
     291        $this->assertSame( 'some-id-1', $p->get_attribute( 'id' ) );
     292        $p->next_tag( array( 'class_name' => 'test' ) );
     293        $this->assertSame( 'some-id-1', $p->get_attribute( 'id' ) );
    294294    }
    295295
     
    308308        ';
    309309        list($p) = $this->process_directives( $html );
    310         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
     310        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
    311311    }
    312312
     
    347347        ';
    348348        list($p) = $this->process_directives( $html );
    349         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
     349        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
    350350    }
    351351
     
    369369        ';
    370370        list($p) = $this->process_directives( $html );
    371         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
     371        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
    372372    }
    373373
     
    390390        ';
    391391        list($p) = $this->process_directives( $html );
    392         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
     392        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
    393393    }
    394394
     
    417417        ';
    418418        list($p) = $this->process_directives( $html );
    419         $this->assertEquals( 'other-id', $p->get_attribute( 'id' ) );
    420         $p->next_tag( array( 'class_name' => 'test' ) );
    421         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
    422         $p->next_tag( array( 'class_name' => 'test' ) );
    423         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
     419        $this->assertSame( 'other-id', $p->get_attribute( 'id' ) );
     420        $p->next_tag( array( 'class_name' => 'test' ) );
     421        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
     422        $p->next_tag( array( 'class_name' => 'test' ) );
     423        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
    424424        $p->next_tag( array( 'class_name' => 'test' ) );
    425425        $this->assertNull( $p->get_attribute( 'id' ) );
     
    446446        ';
    447447        list($p) = $this->process_directives( $html );
    448         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
     448        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
    449449    }
    450450
     
    470470        ';
    471471        list($p) = $this->process_directives( $html );
    472         $this->assertEquals( 'some-id-1', $p->get_attribute( 'id' ) );
    473         $p->next_tag( array( 'class_name' => 'test' ) );
    474         $this->assertEquals( 'some-id-2', $p->get_attribute( 'id' ) );
     472        $this->assertSame( 'some-id-1', $p->get_attribute( 'id' ) );
     473        $p->next_tag( array( 'class_name' => 'test' ) );
     474        $this->assertSame( 'some-id-2', $p->get_attribute( 'id' ) );
    475475    }
    476476
     
    495495        ';
    496496        list($p) = $this->process_directives( $html );
    497         $this->assertEquals( 'some-id-2', $p->get_attribute( 'id' ) );
     497        $this->assertSame( 'some-id-2', $p->get_attribute( 'id' ) );
    498498    }
    499499
     
    519519        ';
    520520        list($p) = $this->process_directives( $html );
    521         $this->assertEquals( 'some-id-2', $p->get_attribute( 'id' ) );
    522         $p->next_tag( array( 'class_name' => 'test' ) );
    523         $this->assertEquals( 'some-id-1', $p->get_attribute( 'id' ) );
     521        $this->assertSame( 'some-id-2', $p->get_attribute( 'id' ) );
     522        $p->next_tag( array( 'class_name' => 'test' ) );
     523        $this->assertSame( 'some-id-1', $p->get_attribute( 'id' ) );
    524524    }
    525525}
  • trunk/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-each.php

    r58327 r58594  
    4343            </div>';
    4444        $new      = $this->interactivity->process_directives( $original );
    45         $this->assertEquals( $original, $new );
     45        $this->assertSame( $original, $new );
    4646    }
    4747
     
    6969            </template>';
    7070        $new      = $this->interactivity->process_directives( $original );
    71         $this->assertEquals( $original, $new );
     71        $this->assertSame( $original, $new );
    7272    }
    7373
     
    9393            '<div id="after-wp-each" data-wp-bind--id="myPlugin::state.after">Text</div>';
    9494        $new      = $this->interactivity->process_directives( $original );
    95         $this->assertEquals( $expected, $new );
     95        $this->assertSame( $expected, $new );
    9696    }
    9797
     
    117117            '<div id="after-wp-each" data-wp-bind--id="myPlugin::state.after">Text</div>';
    118118        $new      = $this->interactivity->process_directives( $original );
    119         $this->assertEquals( $expected, $new );
     119        $this->assertSame( $expected, $new );
    120120    }
    121121
     
    146146            '</div>';
    147147        $new      = $this->interactivity->process_directives( $original );
    148         $this->assertEquals( $expected, $new );
     148        $this->assertSame( $expected, $new );
    149149    }
    150150
     
    174174            '</div>';
    175175        $new      = $this->interactivity->process_directives( $original );
    176         $this->assertEquals( $expected, $new );
     176        $this->assertSame( $expected, $new );
    177177    }
    178178
     
    202202            '</div>';
    203203        $new      = $this->interactivity->process_directives( $original );
    204         $this->assertEquals( $expected, $new );
     204        $this->assertSame( $expected, $new );
    205205    }
    206206
     
    230230            '<div id="after-wp-each" data-wp-bind--id="myPlugin::state.after">Text</div>';
    231231        $new      = $this->interactivity->process_directives( $original );
    232         $this->assertEquals( $expected, $new );
     232        $this->assertSame( $expected, $new );
    233233    }
    234234
     
    258258            '<div id="after-wp-each" data-wp-bind--id="myPlugin::state.after">Text</div>';
    259259        $new      = $this->interactivity->process_directives( $original );
    260         $this->assertEquals( $expected, $new );
     260        $this->assertSame( $expected, $new );
    261261    }
    262262
     
    287287            '<div id="after-wp-each" data-wp-bind--id="myPlugin::state.after">Text</div>';
    288288        $new      = $this->interactivity->process_directives( $original );
    289         $this->assertEquals( $expected, $new );
     289        $this->assertSame( $expected, $new );
    290290    }
    291291
     
    319319            '<div id="after-wp-each" data-wp-bind--id="myPlugin::state.after">Text</div>';
    320320        $new      = $this->interactivity->process_directives( $original );
    321         $this->assertEquals( $expected, $new );
     321        $this->assertSame( $expected, $new );
    322322    }
    323323
     
    362362            '<div id="after-wp-each" data-wp-bind--id="myPlugin::state.after">Text</div>';
    363363        $new      = $this->interactivity->process_directives( $original );
    364         $this->assertEquals( $expected, $new );
     364        $this->assertSame( $expected, $new );
    365365    }
    366366
     
    386386            '<div id="after-wp-each" data-wp-bind--id="myPlugin::state.after">Text</div>';
    387387        $new      = $this->interactivity->process_directives( $original );
    388         $this->assertEquals( $expected, $new );
     388        $this->assertSame( $expected, $new );
    389389    }
    390390
     
    411411            '<div id="after-wp-each" data-wp-bind--id="myPlugin::state.after">Text</div>';
    412412        $new      = $this->interactivity->process_directives( $original );
    413         $this->assertEquals( $expected, $new );
     413        $this->assertSame( $expected, $new );
    414414    }
    415415
     
    427427            '</template>';
    428428        $new      = $this->interactivity->process_directives( $original );
    429         $this->assertEquals( $original, $new );
     429        $this->assertSame( $original, $new );
    430430
    431431        $original = '' .
     
    434434            '</template>';
    435435        $new      = $this->interactivity->process_directives( $original );
    436         $this->assertEquals( $original, $new );
     436        $this->assertSame( $original, $new );
    437437
    438438        // But it should work fine with spaces and linebreaks.
     
    445445        $p->next_tag( array( 'class_name' => 'test' ) );
    446446        $p->next_tag( array( 'class_name' => 'test' ) );
    447         $this->assertEquals( '1', $p->get_attribute( 'id' ) );
     447        $this->assertSame( '1', $p->get_attribute( 'id' ) );
    448448        $p->next_tag( array( 'class_name' => 'test' ) );
    449         $this->assertEquals( '2', $p->get_attribute( 'id' ) );
     449        $this->assertSame( '2', $p->get_attribute( 'id' ) );
    450450    }
    451451
     
    488488            '<div id="after-wp-each" data-wp-bind--id="myPlugin::state.after">Text</div>';
    489489        $new      = $this->interactivity->process_directives( $original );
    490         $this->assertEquals( $expected, $new );
     490        $this->assertSame( $expected, $new );
    491491    }
    492492
     
    534534            '<div id="after-wp-each" data-wp-bind--id="myPlugin::state.after">Text</div>';
    535535        $new      = $this->interactivity->process_directives( $original );
    536         $this->assertEquals( $expected, $new );
     536        $this->assertSame( $expected, $new );
    537537    }
    538538
     
    572572            '<div id="after-wp-each" data-wp-bind--id="myPlugin::state.after">Text</div>';
    573573        $new      = $this->interactivity->process_directives( $original );
    574         $this->assertEquals( $expected, $new );
     574        $this->assertSame( $expected, $new );
    575575    }
    576576
     
    591591            '<div data-wp-bind--id="myPlugin::state.after">Text</div>';
    592592        $new      = $this->interactivity->process_directives( $original );
    593         $this->assertEquals( $original, $new );
     593        $this->assertSame( $original, $new );
    594594    }
    595595
     
    615615            '<div data-wp-bind--id="myPlugin::state.after">Text</div>';
    616616        $new      = $this->interactivity->process_directives( $original );
    617         $this->assertEquals( $original, $new );
     617        $this->assertSame( $original, $new );
    618618    }
    619619
     
    640640        $this->interactivity->state( 'myPlugin', array( 'list' => null ) );
    641641        $new = $this->interactivity->process_directives( $original );
    642         $this->assertEquals( $expected, $new );
     642        $this->assertSame( $expected, $new );
    643643
    644644        $this->interactivity->state( 'myPlugin', array( 'list' => 'Text' ) );
    645645        $new = $this->interactivity->process_directives( $original );
    646         $this->assertEquals( $expected, $new );
     646        $this->assertSame( $expected, $new );
    647647
    648648        $this->interactivity->state( 'myPlugin', array( 'list' => 100 ) );
    649649        $new = $this->interactivity->process_directives( $original );
    650         $this->assertEquals( $expected, $new );
     650        $this->assertSame( $expected, $new );
    651651
    652652        $this->interactivity->state( 'myPlugin', array( 'list' => false ) );
    653653        $new = $this->interactivity->process_directives( $original );
    654         $this->assertEquals( $expected, $new );
     654        $this->assertSame( $expected, $new );
    655655
    656656        $this->interactivity->state( 'myPlugin', array( 'list' => true ) );
    657657        $new = $this->interactivity->process_directives( $original );
    658         $this->assertEquals( $expected, $new );
     658        $this->assertSame( $expected, $new );
    659659    }
    660660
     
    683683            '<div id="after-wp-each" data-wp-bind--id="myPlugin::state.after">Text</div>';
    684684        $new      = $this->interactivity->process_directives( $original );
    685         $this->assertEquals( $expected, $new );
     685        $this->assertSame( $expected, $new );
    686686    }
    687687}
  • trunk/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-interactive.php

    r57836 r58594  
    5959            ';
    6060        list($p) = $this->process_directives( $html );
    61         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
     61        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
    6262    }
    6363
     
    7777            ';
    7878        list($p) = $this->process_directives( $html );
    79         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
     79        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
    8080    }
    8181
     
    9898            ';
    9999        list($p) = $this->process_directives( $html );
    100         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
    101         $p->next_tag( array( 'class_name' => 'test' ) );
    102         $this->assertEquals( 'other-id', $p->get_attribute( 'id' ) );
     100        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
     101        $p->next_tag( array( 'class_name' => 'test' ) );
     102        $this->assertSame( 'other-id', $p->get_attribute( 'id' ) );
    103103    }
    104104
     
    122122            ';
    123123        list($p) = $this->process_directives( $html );
    124         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
    125         $p->next_tag( array( 'class_name' => 'test' ) );
    126         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
     124        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
     125        $p->next_tag( array( 'class_name' => 'test' ) );
     126        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
    127127    }
    128128
     
    145145            ';
    146146        list($p) = $this->process_directives( $html );
    147         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
    148         $p->next_tag( array( 'class_name' => 'test' ) );
    149         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
     147        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
     148        $p->next_tag( array( 'class_name' => 'test' ) );
     149        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
    150150    }
    151151
     
    168168        ';
    169169        list($p) = $this->process_directives( $html );
    170         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
    171         $p->next_tag( array( 'class_name' => 'test' ) );
    172         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
     170        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
     171        $p->next_tag( array( 'class_name' => 'test' ) );
     172        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
    173173    }
    174174
     
    191191            ';
    192192        list($p) = $this->process_directives( $html );
    193         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
    194         $p->next_tag( array( 'class_name' => 'test' ) );
    195         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
     193        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
     194        $p->next_tag( array( 'class_name' => 'test' ) );
     195        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
    196196    }
    197197
     
    210210            ';
    211211        list($p) = $this->process_directives( $html );
    212         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
     212        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
    213213    }
    214214
     
    228228            ';
    229229        list($p) = $this->process_directives( $html );
    230         $this->assertEquals( 'other-id', $p->get_attribute( 'id' ) );
     230        $this->assertSame( 'other-id', $p->get_attribute( 'id' ) );
    231231    }
    232232
     
    249249            ';
    250250        list($p) = $this->process_directives( $html );
    251         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
    252         $p->next_tag( array( 'class_name' => 'test' ) );
    253         $this->assertEquals( 'other-id', $p->get_attribute( 'id' ) );
     251        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
     252        $p->next_tag( array( 'class_name' => 'test' ) );
     253        $this->assertSame( 'other-id', $p->get_attribute( 'id' ) );
    254254
    255255        $html    = '
     
    262262            ';
    263263        list($p) = $this->process_directives( $html );
    264         $this->assertEquals( 'other-id', $p->get_attribute( 'id' ) );
    265         $p->next_tag( array( 'class_name' => 'test' ) );
    266         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
     264        $this->assertSame( 'other-id', $p->get_attribute( 'id' ) );
     265        $p->next_tag( array( 'class_name' => 'test' ) );
     266        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
    267267    }
    268268}
  • trunk/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-router-region.php

    r57836 r58594  
    8989        $new_html = $this->interactivity->process_directives( $html );
    9090        $footer   = $this->render_wp_footer();
    91         $this->assertEquals( $html, $new_html );
    92         $this->assertEquals( '', $footer );
    93         $this->assertEquals( '', get_echo( 'wp_print_styles' ) );
     91        $this->assertSame( $html, $new_html );
     92        $this->assertSame( '', $footer );
     93        $this->assertSame( '', get_echo( 'wp_print_styles' ) );
    9494    }
    9595
     
    109109        ';
    110110        $new_html = $this->interactivity->process_directives( $html );
    111         $this->assertEquals( $html, $new_html );
     111        $this->assertSame( $html, $new_html );
    112112
    113113        // Check that the style is loaded, but only once.
     
    116116        $p      = new WP_HTML_Tag_Processor( $styles );
    117117        $this->assertTrue( $p->next_tag( $query ) );
    118         $this->assertEquals( 'wp-interactivity-router-animations-inline-css', $p->get_attribute( 'id' ) );
     118        $this->assertSame( 'wp-interactivity-router-animations-inline-css', $p->get_attribute( 'id' ) );
    119119        $this->assertStringContainsString( '.wp-interactivity-router-loading-bar', $styles );
    120120        $this->assertFalse( $p->next_tag( $query ) );
  • trunk/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-style.php

    r58321 r58594  
    6262        // Adds property on empty style attribute.
    6363        $result = $this->merge_style_property( '', 'color', 'green' );
    64         $this->assertEquals( 'color:green;', $result );
     64        $this->assertSame( 'color:green;', $result );
    6565
    6666        // Changes style property when there is an existing property.
    6767        $result = $this->merge_style_property( 'color:red;', 'color', 'green' );
    68         $this->assertEquals( 'color:green;', $result );
     68        $this->assertSame( 'color:green;', $result );
    6969
    7070        // Adds a new property when the existing one does not match.
    7171        $result = $this->merge_style_property( 'color:red;', 'background', 'blue' );
    72         $this->assertEquals( 'color:red;background:blue;', $result );
     72        $this->assertSame( 'color:red;background:blue;', $result );
    7373
    7474        // Handles multiple existing properties.
    7575        $result = $this->merge_style_property( 'color:red;margin:5px;', 'color', 'green' );
    76         $this->assertEquals( 'margin:5px;color:green;', $result );
     76        $this->assertSame( 'margin:5px;color:green;', $result );
    7777
    7878        // Adds a new property when multiple existing properties do not match.
    7979        $result = $this->merge_style_property( 'color:red;margin:5px;', 'padding', '10px' );
    80         $this->assertEquals( 'color:red;margin:5px;padding:10px;', $result );
     80        $this->assertSame( 'color:red;margin:5px;padding:10px;', $result );
    8181
    8282        // Removes whitespaces in all properties.
    8383        $result = $this->merge_style_property( ' color : red; margin : 5px; ', 'padding', ' 10px ' );
    84         $this->assertEquals( 'color:red;margin:5px;padding:10px;', $result );
     84        $this->assertSame( 'color:red;margin:5px;padding:10px;', $result );
    8585
    8686        // Updates a property when it's not the first one in the value.
    8787        $result = $this->merge_style_property( 'color:red;margin:5px;', 'margin', '15px' );
    88         $this->assertEquals( 'color:red;margin:15px;', $result );
     88        $this->assertSame( 'color:red;margin:15px;', $result );
    8989
    9090        // Adds missing trailing semicolon.
    9191        $result = $this->merge_style_property( 'color:red;margin:5px', 'padding', '10px' );
    92         $this->assertEquals( 'color:red;margin:5px;padding:10px;', $result );
     92        $this->assertSame( 'color:red;margin:5px;padding:10px;', $result );
    9393
    9494        // Doesn't add double semicolons.
    9595        $result = $this->merge_style_property( 'color:red;margin:5px;', 'padding', '10px;' );
    96         $this->assertEquals( 'color:red;margin:5px;padding:10px;', $result );
     96        $this->assertSame( 'color:red;margin:5px;padding:10px;', $result );
    9797
    9898        // Handles empty properties in the input.
    9999        $result = $this->merge_style_property( 'color:red;;margin:5px;;', 'padding', '10px' );
    100         $this->assertEquals( 'color:red;margin:5px;padding:10px;', $result );
     100        $this->assertSame( 'color:red;margin:5px;padding:10px;', $result );
    101101
    102102        // Moves the modified property to the end.
    103103        $result = $this->merge_style_property( 'border-style: dashed; border: 3px solid red;', 'border-style', 'inset' );
    104         $this->assertEquals( 'border:3px solid red;border-style:inset;', $result );
     104        $this->assertSame( 'border:3px solid red;border-style:inset;', $result );
    105105    }
    106106
     
    116116        // Removes a property with an empty string.
    117117        $result = $this->merge_style_property( 'color:red;margin:5px;', 'color', '' );
    118         $this->assertEquals( 'margin:5px;', $result );
     118        $this->assertSame( 'margin:5px;', $result );
    119119
    120120        // Removes a property with null.
    121121        $result = $this->merge_style_property( 'color:red;margin:5px;', 'color', null );
    122         $this->assertEquals( 'margin:5px;', $result );
     122        $this->assertSame( 'margin:5px;', $result );
    123123
    124124        // Removes a property with false.
    125125        $result = $this->merge_style_property( 'color:red;margin:5px;', 'color', false );
    126         $this->assertEquals( 'margin:5px;', $result );
     126        $this->assertSame( 'margin:5px;', $result );
    127127
    128128        // Removes a property with 0.
    129129        $result = $this->merge_style_property( 'color:red;margin:5px;', 'color', 0 );
    130         $this->assertEquals( 'margin:5px;', $result );
     130        $this->assertSame( 'margin:5px;', $result );
    131131
    132132        // It doesn't add a new property with an empty string.
    133133        $result = $this->merge_style_property( 'color:red;', 'padding', '' );
    134         $this->assertEquals( 'color:red;', $result );
     134        $this->assertSame( 'color:red;', $result );
    135135
    136136        // It doesn't add a new property with null.
    137137        $result = $this->merge_style_property( 'color:red;', 'padding', null );
    138         $this->assertEquals( 'color:red;', $result );
     138        $this->assertSame( 'color:red;', $result );
    139139
    140140        // It doesn't add a new property with false.
    141141        $result = $this->merge_style_property( 'color:red;', 'padding', false );
    142         $this->assertEquals( 'color:red;', $result );
     142        $this->assertSame( 'color:red;', $result );
    143143
    144144        // It doesn't add a new property with 0.
    145145        $result = $this->merge_style_property( 'color:red;', 'padding', 0 );
    146         $this->assertEquals( 'color:red;', $result );
     146        $this->assertSame( 'color:red;', $result );
    147147    }
    148148
     
    171171        $html    = '<div data-wp-style--color="myPlugin::state.green">Text</div>';
    172172        list($p) = $this->process_directives( $html );
    173         $this->assertEquals( 'color:green;', $p->get_attribute( 'style' ) );
     173        $this->assertSame( 'color:green;', $p->get_attribute( 'style' ) );
    174174    }
    175175
     
    189189            >Text</div>';
    190190        list($p) = $this->process_directives( $html );
    191         $this->assertEquals( 'color:green;background:green;', $p->get_attribute( 'style' ) );
     191        $this->assertSame( 'color:green;background:green;', $p->get_attribute( 'style' ) );
    192192    }
    193193
     
    207207            >Text</div>';
    208208        list($p) = $this->process_directives( $html );
    209         $this->assertEquals( 'color:green;', $p->get_attribute( 'style' ) );
     209        $this->assertSame( 'color:green;', $p->get_attribute( 'style' ) );
    210210
    211211        $html    = '
     
    216216            >Text</div>';
    217217        list($p) = $this->process_directives( $html );
    218         $this->assertEquals( 'color:green;', $p->get_attribute( 'style' ) );
     218        $this->assertSame( 'color:green;', $p->get_attribute( 'style' ) );
    219219    }
    220220
     
    230230        $html    = '<div style="padding:10px;" data-wp-style--color="myPlugin::state.green">Text</div>';
    231231        list($p) = $this->process_directives( $html );
    232         $this->assertEquals( 'padding:10px;color:green;', $p->get_attribute( 'style' ) );
     232        $this->assertSame( 'padding:10px;color:green;', $p->get_attribute( 'style' ) );
    233233    }
    234234
     
    244244        $html    = '<div style="color:red;" data-wp-style--color="myPlugin::state.green">Text</div>';
    245245        list($p) = $this->process_directives( $html );
    246         $this->assertEquals( 'color:green;', $p->get_attribute( 'style' ) );
     246        $this->assertSame( 'color:green;', $p->get_attribute( 'style' ) );
    247247    }
    248248
     
    272272        $html    = '<div style="padding:10px;" data-wp-style--color="myPlugin::state.false">Text</div>';
    273273        list($p) = $this->process_directives( $html );
    274         $this->assertEquals( 'padding:10px;', $p->get_attribute( 'style' ) );
     274        $this->assertSame( 'padding:10px;', $p->get_attribute( 'style' ) );
    275275    }
    276276
     
    286286        $html    = '<div style="color:green;" data-wp-style--color="myPlugin::state.green">Text</div>';
    287287        list($p) = $this->process_directives( $html );
    288         $this->assertEquals( 'color:green;', $p->get_attribute( 'style' ) );
     288        $this->assertSame( 'color:green;', $p->get_attribute( 'style' ) );
    289289    }
    290290
     
    300300        $html    = '<div style="padding:10px;color:green;" data-wp-style--color="myPlugin::state.green">Text</div>';
    301301        list($p) = $this->process_directives( $html );
    302         $this->assertEquals( 'padding:10px;color:green;', $p->get_attribute( 'style' ) );
     302        $this->assertSame( 'padding:10px;color:green;', $p->get_attribute( 'style' ) );
    303303    }
    304304
     
    328328        $html    = '<div style="padding:10px;color:green;" data-wp-style--color="myPlugin::state.false">Text</div>';
    329329        list($p) = $this->process_directives( $html );
    330         $this->assertEquals( 'padding:10px;', $p->get_attribute( 'style' ) );
     330        $this->assertSame( 'padding:10px;', $p->get_attribute( 'style' ) );
    331331    }
    332332
     
    356356        $html    = '<div style="padding:10px;" data-wp-style="myPlugin::state.green">Text</div>';
    357357        list($p) = $this->process_directives( $html );
    358         $this->assertEquals( 'padding:10px;', $p->get_attribute( 'style' ) );
     358        $this->assertSame( 'padding:10px;', $p->get_attribute( 'style' ) );
    359359    }
    360360
     
    371371        $html    = '<div style="padding:10px" data-wp-style--color="">Text</div>';
    372372        list($p) = $this->process_directives( $html );
    373         $this->assertEquals( 'padding:10px;', $p->get_attribute( 'style' ) );
     373        $this->assertSame( 'padding:10px;', $p->get_attribute( 'style' ) );
    374374    }
    375375
     
    386386        $html    = '<div style="padding: 10px;" data-wp-style--color>Text</div>';
    387387        list($p) = $this->process_directives( $html );
    388         $this->assertEquals( 'padding:10px;', $p->get_attribute( 'style' ) );
     388        $this->assertSame( 'padding:10px;', $p->get_attribute( 'style' ) );
    389389    }
    390390
     
    400400        $html    = '<div data-wp-style--color="myPlugin::state.green" data-wp-style--color="myPlugin::state.green">Text</div>';
    401401        list($p) = $this->process_directives( $html );
    402         $this->assertEquals( 'color:green;', $p->get_attribute( 'style' ) );
     402        $this->assertSame( 'color:green;', $p->get_attribute( 'style' ) );
    403403    }
    404404
  • trunk/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-text.php

    r58327 r58594  
    4040        $html     = '<div data-wp-text="myPlugin::state.text">Text</div>';
    4141        $new_html = $this->interactivity->process_directives( $html );
    42         $this->assertEquals( '<div data-wp-text="myPlugin::state.text">Updated</div>', $new_html );
     42        $this->assertSame( '<div data-wp-text="myPlugin::state.text">Updated</div>', $new_html );
    4343    }
    4444
     
    5454        $html     = '<div data-wp-text="myPlugin::state.number">Text</div>';
    5555        $new_html = $this->interactivity->process_directives( $html );
    56         $this->assertEquals( '<div data-wp-text="myPlugin::state.number">100</div>', $new_html );
     56        $this->assertSame( '<div data-wp-text="myPlugin::state.number">100</div>', $new_html );
    5757    }
    5858
     
    7878        $html     = '<div data-wp-text="myPlugin::state.true">Text</div>';
    7979        $new_html = $this->interactivity->process_directives( $html );
    80         $this->assertEquals( '<div data-wp-text="myPlugin::state.true"></div>', $new_html );
     80        $this->assertSame( '<div data-wp-text="myPlugin::state.true"></div>', $new_html );
    8181
    8282        $html     = '<div data-wp-text="myPlugin::state.false">Text</div>';
    8383        $new_html = $this->interactivity->process_directives( $html );
    84         $this->assertEquals( '<div data-wp-text="myPlugin::state.false"></div>', $new_html );
     84        $this->assertSame( '<div data-wp-text="myPlugin::state.false"></div>', $new_html );
    8585
    8686        $html     = '<div data-wp-text="myPlugin::state.null">Text</div>';
    8787        $new_html = $this->interactivity->process_directives( $html );
    88         $this->assertEquals( '<div data-wp-text="myPlugin::state.null"></div>', $new_html );
     88        $this->assertSame( '<div data-wp-text="myPlugin::state.null"></div>', $new_html );
    8989
    9090        $html     = '<div data-wp-text="myPlugin::state.array">Text</div>';
    9191        $new_html = $this->interactivity->process_directives( $html );
    92         $this->assertEquals( '<div data-wp-text="myPlugin::state.array"></div>', $new_html );
     92        $this->assertSame( '<div data-wp-text="myPlugin::state.array"></div>', $new_html );
    9393
    9494        $html     = '<div data-wp-text="myPlugin::state.func">Text</div>';
    9595        $new_html = $this->interactivity->process_directives( $html );
    96         $this->assertEquals( '<div data-wp-text="myPlugin::state.func"></div>', $new_html );
     96        $this->assertSame( '<div data-wp-text="myPlugin::state.func"></div>', $new_html );
    9797    }
    9898
     
    108108        $html     = '<div data-wp-text="myPlugin::state.text"><div><div>Text</div><div>Another text</div></div></div>';
    109109        $new_html = $this->interactivity->process_directives( $html );
    110         $this->assertEquals( '<div data-wp-text="myPlugin::state.text">Updated</div>', $new_html );
     110        $this->assertSame( '<div data-wp-text="myPlugin::state.text">Updated</div>', $new_html );
    111111    }
    112112
     
    122122        $html     = '<div data-wp-text="myPlugin::state.text"><span>Text</div>';
    123123        $new_html = $this->interactivity->process_directives( $html );
    124         $this->assertEquals( '<div data-wp-text="myPlugin::state.text">Updated</div>', $new_html );
     124        $this->assertSame( '<div data-wp-text="myPlugin::state.text">Updated</div>', $new_html );
    125125    }
    126126
     
    138138        $html     = '<div data-wp-text="myPlugin::state.text">Text<div></div>';
    139139        $new_html = $this->interactivity->process_directives( $html );
    140         $this->assertEquals( '<div data-wp-text="myPlugin::state.text">Text<div></div>', $new_html );
     140        $this->assertSame( '<div data-wp-text="myPlugin::state.text">Text<div></div>', $new_html );
    141141    }
    142142
     
    153153        $html     = '<div data-wp-text="myPlugin::state.text">Text</div>';
    154154        $new_html = $this->interactivity->process_directives( $html );
    155         $this->assertEquals( '<div data-wp-text="myPlugin::state.text">&lt;span&gt;Updated&lt;/span&gt;</div>', $new_html );
     155        $this->assertSame( '<div data-wp-text="myPlugin::state.text">&lt;span&gt;Updated&lt;/span&gt;</div>', $new_html );
    156156    }
    157157}
  • trunk/tests/phpunit/tests/interactivity-api/wpInteractivityAPI.php

    r58327 r58594  
    7070     */
    7171    public function test_state_and_config_should_be_empty() {
    72         $this->assertEquals( array(), $this->interactivity->state( 'myPlugin' ) );
    73         $this->assertEquals( array(), $this->interactivity->config( 'myPlugin' ) );
     72        $this->assertSame( array(), $this->interactivity->state( 'myPlugin' ) );
     73        $this->assertSame( array(), $this->interactivity->config( 'myPlugin' ) );
    7474    }
    7575
     
    9090        );
    9191        $result = $this->interactivity->state( 'myPlugin', $state );
    92         $this->assertEquals( $state, $result );
     92        $this->assertSame( $state, $result );
    9393        $result = $this->interactivity->config( 'myPlugin', $state );
    94         $this->assertEquals( $state, $result );
     94        $this->assertSame( $state, $result );
    9595    }
    9696
     
    107107        $this->interactivity->state( 'myPlugin', array( 'b' => 2 ) );
    108108        $this->interactivity->state( 'otherPlugin', array( 'c' => 3 ) );
    109         $this->assertEquals(
     109        $this->assertSame(
    110110            array(
    111111                'a' => 1,
     
    114114            $this->interactivity->state( 'myPlugin' )
    115115        );
    116         $this->assertEquals(
     116        $this->assertSame(
    117117            array( 'c' => 3 ),
    118118            $this->interactivity->state( 'otherPlugin' )
     
    122122        $this->interactivity->config( 'myPlugin', array( 'b' => 2 ) );
    123123        $this->interactivity->config( 'otherPlugin', array( 'c' => 3 ) );
    124         $this->assertEquals(
     124        $this->assertSame(
    125125            array(
    126126                'a' => 1,
     
    129129            $this->interactivity->config( 'myPlugin' )
    130130        );
    131         $this->assertEquals(
     131        $this->assertSame(
    132132            array( 'c' => 3 ),
    133133            $this->interactivity->config( 'otherPlugin' )
     
    146146        $this->interactivity->state( 'myPlugin', array( 'a' => 1 ) );
    147147        $this->interactivity->state( 'myPlugin', array( 'a' => 2 ) );
    148         $this->assertEquals(
     148        $this->assertSame(
    149149            array( 'a' => 2 ),
    150150            $this->interactivity->state( 'myPlugin' )
     
    153153        $this->interactivity->config( 'myPlugin', array( 'a' => 1 ) );
    154154        $this->interactivity->config( 'myPlugin', array( 'a' => 2 ) );
    155         $this->assertEquals(
     155        $this->assertSame(
    156156            array( 'a' => 2 ),
    157157            $this->interactivity->config( 'myPlugin' )
     
    171171        $this->interactivity->state( 'myPlugin', array( 'a' => array( 1, 2 ) ) );
    172172        $this->interactivity->state( 'myPlugin', array( 'a' => array( 3, 4 ) ) );
    173         $this->assertEquals(
     173        $this->assertSame(
    174174            array( 'a' => array( 3, 4 ) ),
    175175            $this->interactivity->state( 'myPlugin' )
     
    178178        $this->interactivity->config( 'myPlugin', array( 'a' => array( 1, 2 ) ) );
    179179        $this->interactivity->config( 'myPlugin', array( 'a' => array( 3, 4 ) ) );
    180         $this->assertEquals(
     180        $this->assertSame(
    181181            array( 'a' => array( 3, 4 ) ),
    182182            $this->interactivity->config( 'myPlugin' )
     
    219219        );
    220220
    221         $this->assertEquals(
    222             array(
     221        $this->assertSame(
     222            array(
     223                'config' => $data,
    223224                'state'  => $data,
    224                 'config' => $data,
    225225            ),
    226226            $result
     
    252252        $this->interactivity->state( 'myPlugin', array( 'a' => 1 ) );
    253253        $result = $this->print_client_interactivity_data();
    254         $this->assertEquals( array( 'state' => array( 'myPlugin' => array( 'a' => 1 ) ) ), $result );
     254        $this->assertSame( array( 'state' => array( 'myPlugin' => array( 'a' => 1 ) ) ), $result );
    255255    }
    256256
     
    266266        $this->interactivity->config( 'myPlugin', array( 'a' => 1 ) );
    267267        $result = $this->print_client_interactivity_data();
    268         $this->assertEquals( array( 'config' => array( 'myPlugin' => array( 'a' => 1 ) ) ), $result );
     268        $this->assertSame( array( 'config' => array( 'myPlugin' => array( 'a' => 1 ) ) ), $result );
    269269    }
    270270
     
    287287SCRIPT_TAG;
    288288
    289         $this->assertSame( $expected, $printed_script );
     289        $this->assertSameIgnoreEOL( $expected, $printed_script );
    290290    }
    291291
     
    320320SCRIPT_TAG;
    321321
    322         $this->assertSame( $expected, $printed_script );
     322        $this->assertSameIgnoreEOL( $expected, $printed_script );
    323323    }
    324324
     
    341341SCRIPT_TAG;
    342342
    343         $this->assertSame( $expected, $printed_script );
     343        $this->assertSameIgnoreEOL( $expected, $printed_script );
    344344    }
    345345
     
    374374SCRIPT_TAG;
    375375
    376         $this->assertSame( $expected, $printed_script );
     376        $this->assertSameIgnoreEOL( $expected, $printed_script );
    377377    }
    378378
     
    411411{"config":{"myPlugin":{"chars":"&\\u003C\\u003E/"}},"state":{"myPlugin":{"ampersand":"&","less-than sign":"\\u003C","greater-than sign":"\\u003E","solidus":"/","line separator":"\u{2028}","paragraph separator":"\u{2029}","flag of england":"\u{1F3F4}\u{E0067}\u{E0062}\u{E0065}\u{E006E}\u{E0067}\u{E007F}","malicious script closer":"\\u003C/script\\u003E","entity-encoded malicious script closer":"&lt;/script&gt;"}}}
    412412JSON;
    413         $this->assertEquals( $expected, $interactivity_data_string[1] );
     413        $this->assertSame( $expected, $interactivity_data_string[1] );
    414414    }
    415415
     
    451451{"config":{"myPlugin":{"chars":"&\\u003C\\u003E/"}},"state":{"myPlugin":{"ampersand":"&","less-than sign":"\\u003C","greater-than sign":"\\u003E","solidus":"/","line separator":"\\u2028","paragraph separator":"\\u2029","flag of england":"\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40\\udc65\\udb40\\udc6e\\udb40\\udc67\\udb40\\udc7f","malicious script closer":"\\u003C/script\\u003E","entity-encoded malicious script closer":"&lt;/script&gt;"}}}
    452452JSON;
    453         $this->assertEquals( $expected, $interactivity_data_string[1] );
     453        $this->assertSame( $expected, $interactivity_data_string[1] );
    454454    }
    455455
     
    468468        $this->interactivity->state( 'otherPlugin', array( 'b' => 2 ) );
    469469
    470         $this->assertEquals(
     470        $this->assertSame(
    471471            array( 'a' => 1 ),
    472472            $this->interactivity->state()
     
    489489        $this->interactivity->state( 'otherPlugin', array( 'b' => 2 ) );
    490490
    491         $this->assertEquals(
     491        $this->assertSame(
    492492            array(),
    493493            $this->interactivity->state( null, array( 'newProp' => 'value' ) )
     
    509509        $this->interactivity->state( 'otherPlugin', array( 'b' => 2 ) );
    510510
    511         $this->assertEquals(
     511        $this->assertSame(
    512512            array(),
    513513            $this->interactivity->state( '' )
     
    525525     */
    526526    public function test_state_without_namespace_outside_directive_processing() {
    527         $this->assertEquals(
     527        $this->assertSame(
    528528            array(),
    529529            $this->interactivity->state()
     
    551551        );
    552552
    553         $this->assertEquals(
     553        $this->assertSame(
    554554            array( 'a' => 1 ),
    555555            $this->interactivity->get_context( 'myPlugin' )
    556556        );
    557         $this->assertEquals(
     557        $this->assertSame(
    558558            array( 'b' => 2 ),
    559559            $this->interactivity->get_context( 'otherPlugin' )
     
    581581        );
    582582
    583         $this->assertEquals(
     583        $this->assertSame(
    584584            array( 'a' => 1 ),
    585585            $this->interactivity->get_context()
     
    599599        $this->set_internal_context_stack();
    600600
    601         $this->assertEquals(
     601        $this->assertSame(
    602602            array(),
    603603            $this->interactivity->get_context( 'myPlugin' )
     
    624624        );
    625625
    626         $this->assertEquals(
     626        $this->assertSame(
    627627            array(),
    628628            $this->interactivity->get_context( 'otherPlugin' )
     
    649649        );
    650650
    651         $this->assertEquals(
     651        $this->assertSame(
    652652            array(),
    653653            $this->interactivity->get_context( '' )
     
    667667    public function test_get_context_outside_of_directive_processing() {
    668668        $context = $this->interactivity->get_context();
    669         $this->assertEquals( array(), $context );
     669        $this->assertSame( array(), $context );
    670670    }
    671671
     
    682682
    683683        $result = $extract_directive_value->invoke( $this->interactivity, 'state.foo', 'myPlugin' );
    684         $this->assertEquals( array( 'myPlugin', 'state.foo' ), $result );
     684        $this->assertSame( array( 'myPlugin', 'state.foo' ), $result );
    685685
    686686        $result = $extract_directive_value->invoke( $this->interactivity, 'otherPlugin::state.foo', 'myPlugin' );
    687         $this->assertEquals( array( 'otherPlugin', 'state.foo' ), $result );
     687        $this->assertSame( array( 'otherPlugin', 'state.foo' ), $result );
    688688
    689689        $result = $extract_directive_value->invoke( $this->interactivity, '{ "isOpen": false }', 'myPlugin' );
    690         $this->assertEquals( array( 'myPlugin', array( 'isOpen' => false ) ), $result );
     690        $this->assertSame( array( 'myPlugin', array( 'isOpen' => false ) ), $result );
    691691
    692692        $result = $extract_directive_value->invoke( $this->interactivity, 'otherPlugin::{ "isOpen": false }', 'myPlugin' );
    693         $this->assertEquals( array( 'otherPlugin', array( 'isOpen' => false ) ), $result );
     693        $this->assertSame( array( 'otherPlugin', array( 'isOpen' => false ) ), $result );
    694694
    695695        $result = $extract_directive_value->invoke( $this->interactivity, 'true', 'myPlugin' );
    696         $this->assertEquals( array( 'myPlugin', true ), $result );
     696        $this->assertSame( array( 'myPlugin', true ), $result );
    697697
    698698        $result = $extract_directive_value->invoke( $this->interactivity, 'false', 'myPlugin' );
    699         $this->assertEquals( array( 'myPlugin', false ), $result );
     699        $this->assertSame( array( 'myPlugin', false ), $result );
    700700
    701701        $result = $extract_directive_value->invoke( $this->interactivity, 'null', 'myPlugin' );
    702         $this->assertEquals( array( 'myPlugin', null ), $result );
     702        $this->assertSame( array( 'myPlugin', null ), $result );
    703703
    704704        $result = $extract_directive_value->invoke( $this->interactivity, '100', 'myPlugin' );
    705         $this->assertEquals( array( 'myPlugin', 100 ), $result );
     705        $this->assertSame( array( 'myPlugin', 100 ), $result );
    706706
    707707        $result = $extract_directive_value->invoke( $this->interactivity, '1.2', 'myPlugin' );
    708         $this->assertEquals( array( 'myPlugin', 1.2 ), $result );
     708        $this->assertSame( array( 'myPlugin', 1.2 ), $result );
    709709
    710710        $result = $extract_directive_value->invoke( $this->interactivity, '1.2.3', 'myPlugin' );
    711         $this->assertEquals( array( 'myPlugin', '1.2.3' ), $result );
     711        $this->assertSame( array( 'myPlugin', '1.2.3' ), $result );
    712712
    713713        $result = $extract_directive_value->invoke( $this->interactivity, 'otherPlugin::true', 'myPlugin' );
    714         $this->assertEquals( array( 'otherPlugin', true ), $result );
     714        $this->assertSame( array( 'otherPlugin', true ), $result );
    715715
    716716        $result = $extract_directive_value->invoke( $this->interactivity, 'otherPlugin::false', 'myPlugin' );
    717         $this->assertEquals( array( 'otherPlugin', false ), $result );
     717        $this->assertSame( array( 'otherPlugin', false ), $result );
    718718
    719719        $result = $extract_directive_value->invoke( $this->interactivity, 'otherPlugin::null', 'myPlugin' );
    720         $this->assertEquals( array( 'otherPlugin', null ), $result );
     720        $this->assertSame( array( 'otherPlugin', null ), $result );
    721721
    722722        $result = $extract_directive_value->invoke( $this->interactivity, 'otherPlugin::100', 'myPlugin' );
    723         $this->assertEquals( array( 'otherPlugin', 100 ), $result );
     723        $this->assertSame( array( 'otherPlugin', 100 ), $result );
    724724
    725725        $result = $extract_directive_value->invoke( $this->interactivity, 'otherPlugin::1.2', 'myPlugin' );
    726         $this->assertEquals( array( 'otherPlugin', 1.2 ), $result );
     726        $this->assertSame( array( 'otherPlugin', 1.2 ), $result );
    727727
    728728        $result = $extract_directive_value->invoke( $this->interactivity, 'otherPlugin::1.2.3', 'myPlugin' );
    729         $this->assertEquals( array( 'otherPlugin', '1.2.3' ), $result );
     729        $this->assertSame( array( 'otherPlugin', '1.2.3' ), $result );
    730730
    731731        $result = $extract_directive_value->invoke( $this->interactivity, 'otherPlugin::[{"o":4}, null, 3e6]', 'myPlugin' );
    732         $this->assertEquals( array( 'otherPlugin', array( array( 'o' => 4 ), null, 3000000.0 ) ), $result );
     732        $this->assertSame( array( 'otherPlugin', array( array( 'o' => 4 ), null, 3000000.0 ) ), $result );
    733733    }
    734734
     
    745745
    746746        $result = $extract_directive_value->invoke( $this->interactivity, '', 'myPlugin' );
    747         $this->assertEquals( array( 'myPlugin', null ), $result );
     747        $this->assertSame( array( 'myPlugin', null ), $result );
    748748
    749749        // This is a boolean attribute.
    750750        $result = $extract_directive_value->invoke( $this->interactivity, true, 'myPlugin' );
    751         $this->assertEquals( array( 'myPlugin', null ), $result );
     751        $this->assertSame( array( 'myPlugin', null ), $result );
    752752
    753753        $result = $extract_directive_value->invoke( $this->interactivity, false, 'myPlugin' );
    754         $this->assertEquals( array( 'myPlugin', null ), $result );
     754        $this->assertSame( array( 'myPlugin', null ), $result );
    755755
    756756        $result = $extract_directive_value->invoke( $this->interactivity, null, 'myPlugin' );
    757         $this->assertEquals( array( 'myPlugin', null ), $result );
     757        $this->assertSame( array( 'myPlugin', null ), $result );
    758758
    759759        // A string ending in `::` without any extra characters is not considered a
    760760        // namespace.
    761761        $result = $extract_directive_value->invoke( $this->interactivity, 'myPlugin::', 'myPlugin' );
    762         $this->assertEquals( array( 'myPlugin', 'myPlugin::' ), $result );
     762        $this->assertSame( array( 'myPlugin', 'myPlugin::' ), $result );
    763763
    764764        // A namespace with invalid characters is not considered a valid namespace.
    765765        $result = $extract_directive_value->invoke( $this->interactivity, '$myPlugin::state.foo', 'myPlugin' );
    766         $this->assertEquals( array( 'myPlugin', '$myPlugin::state.foo' ), $result );
     766        $this->assertSame( array( 'myPlugin', '$myPlugin::state.foo' ), $result );
    767767    }
    768768
     
    780780        // Invalid JSON due to missing quotes. Returns the original value.
    781781        $result = $extract_directive_value->invoke( $this->interactivity, '{ isOpen: false }', 'myPlugin' );
    782         $this->assertEquals( array( 'myPlugin', '{ isOpen: false }' ), $result );
     782        $this->assertSame( array( 'myPlugin', '{ isOpen: false }' ), $result );
    783783
    784784        // Null string. Returns null.
    785785        $result = $extract_directive_value->invoke( $this->interactivity, 'null', 'myPlugin' );
    786         $this->assertEquals( array( 'myPlugin', null ), $result );
     786        $this->assertSame( array( 'myPlugin', null ), $result );
    787787    }
    788788
     
    800800
    801801        $result = $extract_prefix_and_suffix->invoke( $this->interactivity, 'data-wp-interactive' );
    802         $this->assertEquals( array( 'data-wp-interactive' ), $result );
     802        $this->assertSame( array( 'data-wp-interactive' ), $result );
    803803
    804804        $result = $extract_prefix_and_suffix->invoke( $this->interactivity, 'data-wp-bind--src' );
    805         $this->assertEquals( array( 'data-wp-bind', 'src' ), $result );
     805        $this->assertSame( array( 'data-wp-bind', 'src' ), $result );
    806806
    807807        $result = $extract_prefix_and_suffix->invoke( $this->interactivity, 'data-wp-foo--and--bar' );
    808         $this->assertEquals( array( 'data-wp-foo', 'and--bar' ), $result );
     808        $this->assertSame( array( 'data-wp-foo', 'and--bar' ), $result );
    809809    }
    810810
     
    820820        $html           = '<div>Inner content here</div>';
    821821        $processed_html = $this->interactivity->process_directives( $html );
    822         $this->assertEquals( $html, $processed_html );
     822        $this->assertSame( $html, $processed_html );
    823823
    824824        $html           = '<div><span>Content</span><strong>More Content</strong></div>';
    825825        $processed_html = $this->interactivity->process_directives( $html );
    826         $this->assertEquals( $html, $processed_html );
     826        $this->assertSame( $html, $processed_html );
    827827    }
    828828
     
    841841        $p              = new WP_HTML_Tag_Processor( $processed_html );
    842842        $p->next_tag();
    843         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
     843        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
    844844    }
    845845
     
    854854        $html           = '<div data-wp-unknown="">Text</div>';
    855855        $processed_html = $this->interactivity->process_directives( $html );
    856         $this->assertEquals( $html, $processed_html );
     856        $this->assertSame( $html, $processed_html );
    857857    }
    858858
     
    877877        $p              = new WP_HTML_Tag_Processor( $processed_html );
    878878        $p->next_tag();
    879         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
    880         $this->assertEquals( 'some-class', $p->get_attribute( 'class' ) );
    881         $this->assertEquals( 'display:none;', $p->get_attribute( 'style' ) );
     879        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
     880        $this->assertSame( 'some-class', $p->get_attribute( 'class' ) );
     881        $this->assertSame( 'display:none;', $p->get_attribute( 'style' ) );
    882882        $this->assertStringContainsString( 'Updated', $p->get_updated_html() );
    883883        $this->assertStringNotContainsString( 'Text', $p->get_updated_html() );
     
    953953        $p              = new WP_HTML_Tag_Processor( $processed_html );
    954954        $p->next_tag( 'div' );
    955         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
     955        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
    956956    }
    957957
     
    10181018        $this->assertNull( $p->get_attribute( 'id' ) );
    10191019        $p->next_tag( 'div' );
    1020         $this->assertEquals( 'some-id', $p->get_attribute( 'id' ) );
     1020        $this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
    10211021    }
    10221022
     
    11221122
    11231123        $result = $this->evaluate( 'state.key' );
    1124         $this->assertEquals( 'myPlugin-state', $result );
     1124        $this->assertSame( 'myPlugin-state', $result );
    11251125
    11261126        $result = $this->evaluate( 'context.key' );
    1127         $this->assertEquals( 'myPlugin-context', $result );
     1127        $this->assertSame( 'myPlugin-context', $result );
    11281128
    11291129        $result = $this->evaluate( 'otherPlugin::state.key' );
    1130         $this->assertEquals( 'otherPlugin-state', $result );
     1130        $this->assertSame( 'otherPlugin-state', $result );
    11311131
    11321132        $result = $this->evaluate( 'otherPlugin::context.key' );
    1133         $this->assertEquals( 'otherPlugin-context', $result );
     1133        $this->assertSame( 'otherPlugin-context', $result );
    11341134
    11351135        $result = $this->evaluate( 'state.obj.prop' );
     
    12421242
    12431243        $result = $this->evaluate( 'state.nested.key' );
    1244         $this->assertEquals( 'myPlugin-state-nested', $result );
     1244        $this->assertSame( 'myPlugin-state-nested', $result );
    12451245
    12461246        $result = $this->evaluate( 'context.nested.key' );
    1247         $this->assertEquals( 'myPlugin-context-nested', $result );
     1247        $this->assertSame( 'myPlugin-context-nested', $result );
    12481248
    12491249        $result = $this->evaluate( 'otherPlugin::state.nested.key' );
    1250         $this->assertEquals( 'otherPlugin-state-nested', $result );
     1250        $this->assertSame( 'otherPlugin-state-nested', $result );
    12511251
    12521252        $result = $this->evaluate( 'otherPlugin::context.nested.key' );
    1253         $this->assertEquals( 'otherPlugin-context-nested', $result );
     1253        $this->assertSame( 'otherPlugin-context-nested', $result );
    12541254    }
    12551255
  • trunk/tests/phpunit/tests/interactivity-api/wpInteractivityAPIDirectivesProcessor.php

    r57987 r58594  
    2525        $p       = new WP_Interactivity_API_Directives_Processor( $content );
    2626        $p->next_tag();
    27         $this->assertEquals( 'Text', $p->get_content_between_balanced_template_tags() );
     27        $this->assertSame( 'Text', $p->get_content_between_balanced_template_tags() );
    2828
    2929        $content = '<template>Text</template><template>More text</template>';
    3030        $p       = new WP_Interactivity_API_Directives_Processor( $content );
    3131        $p->next_tag();
    32         $this->assertEquals( 'Text', $p->get_content_between_balanced_template_tags() );
    33         $p->next_tag();
    34         $this->assertEquals( 'More text', $p->get_content_between_balanced_template_tags() );
     32        $this->assertSame( 'Text', $p->get_content_between_balanced_template_tags() );
     33        $p->next_tag();
     34        $this->assertSame( 'More text', $p->get_content_between_balanced_template_tags() );
    3535    }
    3636
     
    4747        $p       = new WP_Interactivity_API_Directives_Processor( $content );
    4848        $p->next_tag();
    49         $this->assertEquals( '', $p->get_content_between_balanced_template_tags() );
     49        $this->assertSame( '', $p->get_content_between_balanced_template_tags() );
    5050    }
    5151
     
    8282        $p       = new WP_Interactivity_API_Directives_Processor( $content );
    8383        $p->next_tag();
    84         $this->assertEquals( '<span>Content</span><strong>More Content</strong>', $p->get_content_between_balanced_template_tags() );
     84        $this->assertSame( '<span>Content</span><strong>More Content</strong>', $p->get_content_between_balanced_template_tags() );
    8585
    8686        $content = '<template><template>Content</template><img src="example.jpg"></template>';
    8787        $p       = new WP_Interactivity_API_Directives_Processor( $content );
    8888        $p->next_tag();
    89         $this->assertEquals( '<template>Content</template><img src="example.jpg">', $p->get_content_between_balanced_template_tags() );
     89        $this->assertSame( '<template>Content</template><img src="example.jpg">', $p->get_content_between_balanced_template_tags() );
    9090    }
    9191
     
    132132        $p       = new WP_Interactivity_API_Directives_Processor( $content );
    133133        $p->next_tag();
    134         $this->assertEquals( 'Missing opening span</span>', $p->get_content_between_balanced_template_tags() );
     134        $this->assertSame( 'Missing opening span</span>', $p->get_content_between_balanced_template_tags() );
    135135    }
    136136
     
    164164        $p->next_tag();
    165165        $p->get_content_between_balanced_template_tags();
    166         $this->assertEquals( 'TEMPLATE', $p->get_tag() );
     166        $this->assertSame( 'TEMPLATE', $p->get_tag() );
    167167        $this->assertTrue( $p->is_tag_closer() );
    168168        $p->next_tag();
    169         $this->assertEquals( 'DIV', $p->get_tag() );
     169        $this->assertSame( 'DIV', $p->get_tag() );
    170170    }
    171171
     
    480480        $this->assertEquals( $content_1 . $content_2, $p );
    481481        $p->next_tag( array( 'tag_closers' => 'visit' ) );
    482         $this->assertEquals( 'content-2', $p->get_attribute( 'class' ) );
     482        $this->assertSame( 'content-2', $p->get_attribute( 'class' ) );
    483483        $p->next_tag( array( 'tag_closers' => 'visit' ) );
    484484        $result = $p->append_content_after_template_tag_closer( $content_3 );
     
    486486        $p->next_tag( array( 'tag_closers' => 'visit' ) );
    487487        $this->assertEquals( $content_1 . $content_2 . $content_3, $p );
    488         $this->assertEquals( 'content-3', $p->get_attribute( 'class' ) );
     488        $this->assertSame( 'content-3', $p->get_attribute( 'class' ) );
    489489    }
    490490
     
    510510        $this->assertEquals( $content_1 . $content_2 . $content_3, $p );
    511511        $p->next_tag( array( 'tag_closers' => 'visit' ) );
    512         $this->assertEquals( 'content-3', $p->get_attribute( 'class' ) );
     512        $this->assertSame( 'content-3', $p->get_attribute( 'class' ) );
    513513
    514514        $p = new WP_Interactivity_API_Directives_Processor( $content_1 . $content_3 );
     
    519519        $this->assertEquals( $content_1 . $content_4 . $content_3, $p );
    520520        $p->next_tag( array( 'tag_closers' => 'visit' ) );
    521         $this->assertEquals( 'content-4', $p->get_attribute( 'class' ) );
     521        $this->assertSame( 'content-4', $p->get_attribute( 'class' ) );
    522522    }
    523523
     
    559559        $this->assertEquals( $content_1 . $content_2, $p );
    560560        $p->next_tag( array( 'tag_closers' => 'visit' ) );
    561         $this->assertEquals( 'content-2', $p->get_attribute( 'class' ) );
     561        $this->assertSame( 'content-2', $p->get_attribute( 'class' ) );
    562562        // Rewinds to the first template.
    563563        $p->seek( 'first template' );
    564564        $p->release_bookmark( 'first template' );
    565         $this->assertEquals( 'content-1', $p->get_attribute( 'class' ) );
     565        $this->assertSame( 'content-1', $p->get_attribute( 'class' ) );
    566566        $p->next_tag( array( 'tag_closers' => 'visit' ) );
    567567        $result = $p->append_content_after_template_tag_closer( $content_3 );
    568568        $this->assertEquals( $content_1 . $content_3 . $content_2, $p );
    569569        $p->next_tag( array( 'tag_closers' => 'visit' ) );
    570         $this->assertEquals( 'content-3', $p->get_attribute( 'class' ) );
     570        $this->assertSame( 'content-3', $p->get_attribute( 'class' ) );
    571571    }
    572572
     
    616616        $this->assertEquals( $content_1 . $content_2, $p );
    617617        $p->next_tag();
    618         $this->assertEquals( 'content-2-template-1', $p->get_attribute( 'class' ) );
    619         $p->next_tag();
    620         $this->assertEquals( 'content-2-template-2', $p->get_attribute( 'class' ) );
     618        $this->assertSame( 'content-2-template-1', $p->get_attribute( 'class' ) );
     619        $p->next_tag();
     620        $this->assertSame( 'content-2-template-2', $p->get_attribute( 'class' ) );
    621621        $p->next_tag( array( 'tag_closers' => 'visit' ) );
    622622        $result = $p->append_content_after_template_tag_closer( $content_3 );
     
    641641        $this->assertFalse( $result );
    642642        $this->assertEquals( $content, $p );
    643         $this->assertEquals( 'TEMPLATE', $p->get_tag() ); // It didn't move.
     643        $this->assertSame( 'TEMPLATE', $p->get_tag() ); // It didn't move.
    644644        $this->assertTrue( $p->is_tag_closer() ); // It didn't move.
    645645    }
     
    695695        $p->next_tag();
    696696        $this->assertTrue( $p->next_balanced_tag_closer_tag() );
    697         $this->assertEquals( 'DIV', $p->get_tag() );
     697        $this->assertSame( 'DIV', $p->get_tag() );
    698698        $this->assertTrue( $p->is_tag_closer() );
    699699    }
     
    732732        $p->next_tag();
    733733        $this->assertTrue( $p->next_balanced_tag_closer_tag() );
    734         $this->assertEquals( 'DIV', $p->get_tag() );
     734        $this->assertSame( 'DIV', $p->get_tag() );
    735735        $this->assertTrue( $p->is_tag_closer() );
    736736
     
    739739        $p->next_tag();
    740740        $this->assertTrue( $p->next_balanced_tag_closer_tag() );
    741         $this->assertEquals( 'DIV', $p->get_tag() );
     741        $this->assertSame( 'DIV', $p->get_tag() );
    742742        $this->assertTrue( $p->is_tag_closer() );
    743743        $this->assertFalse( $p->next_tag() ); // No more content.
     
    794794        $this->assertTrue( $p->skip_to_tag_closer() );
    795795        $this->assertTrue( $p->is_tag_closer() );
    796         $this->assertEquals( 'DIV', $p->get_tag() );
     796        $this->assertSame( 'DIV', $p->get_tag() );
    797797    }
    798798
  • trunk/tests/phpunit/tests/interactivity-api/wpInteractivityAPIFunctions.php

    r58234 r58594  
    7777        $p               = new WP_HTML_Tag_Processor( $rendered_blocks );
    7878        $p->next_tag( array( 'class_name' => 'interactive/block-1' ) );
    79         $this->assertEquals( '1', $p->get_attribute( 'value' ) );
     79        $this->assertSame( '1', $p->get_attribute( 'value' ) );
    8080    }
    8181
     
    9898        $p               = new WP_HTML_Tag_Processor( $rendered_blocks );
    9999        $p->next_tag( array( 'class_name' => 'interactive/block-1' ) );
    100         $this->assertEquals( '1', $p->get_attribute( 'value' ) );
     100        $this->assertSame( '1', $p->get_attribute( 'value' ) );
    101101        $p->next_tag( array( 'class_name' => 'interactive/block-2' ) );
    102         $this->assertEquals( '2', $p->get_attribute( 'value' ) );
     102        $this->assertSame( '2', $p->get_attribute( 'value' ) );
    103103        $p->next_tag( array( 'class_name' => 'non-interactive/block-3' ) );
    104104        $this->assertNull( $p->get_attribute( 'value' ) );
    105105        $p->next_tag( array( 'class_name' => 'interactive/block-4' ) );
    106         $this->assertEquals( '4', $p->get_attribute( 'value' ) );
     106        $this->assertSame( '4', $p->get_attribute( 'value' ) );
    107107    }
    108108
     
    123123        $p               = new WP_HTML_Tag_Processor( $rendered_blocks );
    124124        $p->next_tag( array( 'class_name' => 'interactive/block-2' ) );
    125         $this->assertEquals( '2', $p->get_attribute( 'value' ) );
     125        $this->assertSame( '2', $p->get_attribute( 'value' ) );
    126126    }
    127127
     
    144144        $p               = new WP_HTML_Tag_Processor( $rendered_blocks );
    145145        $p->next_tag( array( 'class_name' => 'interactive/block-2' ) );
    146         $this->assertEquals( '2', $p->get_attribute( 'value' ) );
     146        $this->assertSame( '2', $p->get_attribute( 'value' ) );
    147147        $p->next_tag( array( 'class_name' => 'interactive/block-3' ) );
    148         $this->assertEquals( '3', $p->get_attribute( 'value' ) );
     148        $this->assertSame( '3', $p->get_attribute( 'value' ) );
    149149    }
    150150
     
    169169        $p               = new WP_HTML_Tag_Processor( $rendered_blocks );
    170170        $p->next_tag( array( 'class_name' => 'interactive/block-2' ) );
    171         $this->assertEquals( '2', $p->get_attribute( 'value' ) );
     171        $this->assertSame( '2', $p->get_attribute( 'value' ) );
    172172        $p->next_tag( array( 'class_name' => 'interactive/block-4' ) );
    173         $this->assertEquals( '4', $p->get_attribute( 'value' ) );
     173        $this->assertSame( '4', $p->get_attribute( 'value' ) );
    174174    }
    175175
     
    191191        $p               = new WP_HTML_Tag_Processor( $rendered_blocks );
    192192        $p->next_tag( array( 'class_name' => 'interactive/block-1' ) );
    193         $this->assertEquals( '1', $p->get_attribute( 'value' ) );
     193        $this->assertSame( '1', $p->get_attribute( 'value' ) );
    194194        $p->next_tag( array( 'class_name' => 'non-interactive/block-2' ) );
    195195        $this->assertNull( $p->get_attribute( 'value' ) );
     
    213213        $p               = new WP_HTML_Tag_Processor( $rendered_blocks );
    214214        $p->next_tag( array( 'class_name' => 'interactive/block-1' ) );
    215         $this->assertEquals( '1', $p->get_attribute( 'value' ) );
     215        $this->assertSame( '1', $p->get_attribute( 'value' ) );
    216216        $p->next_tag( array( 'class_name' => 'non-interactive/block-2' ) );
    217         $this->assertEquals( '1', $p->get_attribute( 'value' ) );
     217        $this->assertSame( '1', $p->get_attribute( 'value' ) );
    218218    }
    219219
     
    239239        $p               = new WP_HTML_Tag_Processor( $rendered_blocks );
    240240        $p->next_tag( array( 'class_name' => 'interactive/block-1' ) );
    241         $this->assertEquals( '1', $p->get_attribute( 'value' ) );
     241        $this->assertSame( '1', $p->get_attribute( 'value' ) );
    242242        $p->next_tag( array( 'class_name' => 'interactive/block-2' ) );
    243         $this->assertEquals( '2', $p->get_attribute( 'value' ) );
     243        $this->assertSame( '2', $p->get_attribute( 'value' ) );
    244244        $p->next_tag( array( 'class_name' => 'non-interactive/block-3' ) );
    245         $this->assertEquals( '2', $p->get_attribute( 'value' ) );
     245        $this->assertSame( '2', $p->get_attribute( 'value' ) );
    246246        $p->next_tag( array( 'class_name' => 'non-interactive/block-4' ) );
    247         $this->assertEquals( '1', $p->get_attribute( 'value' ) );
     247        $this->assertSame( '1', $p->get_attribute( 'value' ) );
    248248    }
    249249
     
    289289        $this->data_wp_test_processor_count = 0;
    290290        wp_interactivity_process_directives( $html );
    291         $this->assertEquals( 1, $this->data_wp_test_processor_count );
     291        $this->assertSame( 1, $this->data_wp_test_processor_count );
    292292
    293293        register_block_type(
     
    310310        do_blocks( $post_content );
    311311        unregister_block_type( 'test/custom-directive-block' );
    312         $this->assertEquals( 2, $this->data_wp_test_processor_count );
     312        $this->assertSame( 2, $this->data_wp_test_processor_count );
    313313        $directive_processors->setValue( null, $old_directive_processors );
    314314    }
     
    344344        remove_filter( 'render_block_data', 'test_render_block_data' );
    345345        unregister_block_type( 'test/custom-directive-block' );
    346         $this->assertEquals( 'test', $processor->get_attribute( 'value' ) );
     346        $this->assertSame( 'test', $processor->get_attribute( 'value' ) );
    347347    }
    348348
     
    356356     */
    357357    public function test_wp_interactivity_data_wp_context_with_different_arrays() {
    358         $this->assertEquals( 'data-wp-context=\'{}\'', wp_interactivity_data_wp_context( array() ) );
    359         $this->assertEquals(
     358        $this->assertSame( 'data-wp-context=\'{}\'', wp_interactivity_data_wp_context( array() ) );
     359        $this->assertSame(
    360360            'data-wp-context=\'{"a":1,"b":"2","c":true}\'',
    361361            wp_interactivity_data_wp_context(
     
    367367            )
    368368        );
    369         $this->assertEquals(
     369        $this->assertSame(
    370370            'data-wp-context=\'{"a":[1,2]}\'',
    371371            wp_interactivity_data_wp_context( array( 'a' => array( 1, 2 ) ) )
    372372        );
    373         $this->assertEquals(
     373        $this->assertSame(
    374374            'data-wp-context=\'[1,2]\'',
    375375            wp_interactivity_data_wp_context( array( 1, 2 ) )
     
    386386     */
    387387    public function test_wp_interactivity_data_wp_context_with_different_arrays_and_a_namespace() {
    388         $this->assertEquals( 'data-wp-context=\'myPlugin::{}\'', wp_interactivity_data_wp_context( array(), 'myPlugin' ) );
    389         $this->assertEquals(
     388        $this->assertSame( 'data-wp-context=\'myPlugin::{}\'', wp_interactivity_data_wp_context( array(), 'myPlugin' ) );
     389        $this->assertSame(
    390390            'data-wp-context=\'myPlugin::{"a":1,"b":"2","c":true}\'',
    391391            wp_interactivity_data_wp_context(
     
    398398            )
    399399        );
    400         $this->assertEquals(
     400        $this->assertSame(
    401401            'data-wp-context=\'myPlugin::{"a":[1,2]}\'',
    402402            wp_interactivity_data_wp_context( array( 'a' => array( 1, 2 ) ), 'myPlugin' )
    403403        );
    404         $this->assertEquals(
     404        $this->assertSame(
    405405            'data-wp-context=\'myPlugin::[1,2]\'',
    406406            wp_interactivity_data_wp_context( array( 1, 2 ), 'myPlugin' )
     
    419419     */
    420420    public function test_wp_interactivity_data_wp_context_with_json_flags() {
    421         $this->assertEquals( 'data-wp-context=\'{"tag":"\u003Cfoo\u003E"}\'', wp_interactivity_data_wp_context( array( 'tag' => '<foo>' ) ) );
    422         $this->assertEquals( 'data-wp-context=\'{"apos":"\u0027bar\u0027"}\'', wp_interactivity_data_wp_context( array( 'apos' => "'bar'" ) ) );
    423         $this->assertEquals( 'data-wp-context=\'{"quot":"\u0022baz\u0022"}\'', wp_interactivity_data_wp_context( array( 'quot' => '"baz"' ) ) );
    424         $this->assertEquals( 'data-wp-context=\'{"amp":"T\u0026T"}\'', wp_interactivity_data_wp_context( array( 'amp' => 'T&T' ) ) );
     421        $this->assertSame( 'data-wp-context=\'{"tag":"\u003Cfoo\u003E"}\'', wp_interactivity_data_wp_context( array( 'tag' => '<foo>' ) ) );
     422        $this->assertSame( 'data-wp-context=\'{"apos":"\u0027bar\u0027"}\'', wp_interactivity_data_wp_context( array( 'apos' => "'bar'" ) ) );
     423        $this->assertSame( 'data-wp-context=\'{"quot":"\u0022baz\u0022"}\'', wp_interactivity_data_wp_context( array( 'quot' => '"baz"' ) ) );
     424        $this->assertSame( 'data-wp-context=\'{"amp":"T\u0026T"}\'', wp_interactivity_data_wp_context( array( 'amp' => 'T&T' ) ) );
    425425    }
    426426
     
    449449        $processor->next_tag( array( 'class_name' => 'test' ) );
    450450        unregister_block_type( 'test/custom-directive-block' );
    451         $this->assertEquals( '1', $processor->get_attribute( 'src' ) );
     451        $this->assertSame( '1', $processor->get_attribute( 'src' ) );
    452452    }
    453453
     
    489489        $second_input_value = $processor->get_attribute( 'value' );
    490490        unregister_block_type( 'test/custom-directive-block' );
    491         $this->assertEquals( 'inner', $first_input_value );
    492         $this->assertEquals( 'outer', $second_input_value );
     491        $this->assertSame( 'inner', $first_input_value );
     492        $this->assertSame( 'outer', $second_input_value );
    493493    }
    494494
Note: See TracChangeset for help on using the changeset viewer.