- Timestamp:
- 06/28/2024 03:45:08 PM (6 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/interactivity-api/wpInteractivityAPIFunctions.php
r58234 r58594 77 77 $p = new WP_HTML_Tag_Processor( $rendered_blocks ); 78 78 $p->next_tag( array( 'class_name' => 'interactive/block-1' ) ); 79 $this->assert Equals( '1', $p->get_attribute( 'value' ) );79 $this->assertSame( '1', $p->get_attribute( 'value' ) ); 80 80 } 81 81 … … 98 98 $p = new WP_HTML_Tag_Processor( $rendered_blocks ); 99 99 $p->next_tag( array( 'class_name' => 'interactive/block-1' ) ); 100 $this->assert Equals( '1', $p->get_attribute( 'value' ) );100 $this->assertSame( '1', $p->get_attribute( 'value' ) ); 101 101 $p->next_tag( array( 'class_name' => 'interactive/block-2' ) ); 102 $this->assert Equals( '2', $p->get_attribute( 'value' ) );102 $this->assertSame( '2', $p->get_attribute( 'value' ) ); 103 103 $p->next_tag( array( 'class_name' => 'non-interactive/block-3' ) ); 104 104 $this->assertNull( $p->get_attribute( 'value' ) ); 105 105 $p->next_tag( array( 'class_name' => 'interactive/block-4' ) ); 106 $this->assert Equals( '4', $p->get_attribute( 'value' ) );106 $this->assertSame( '4', $p->get_attribute( 'value' ) ); 107 107 } 108 108 … … 123 123 $p = new WP_HTML_Tag_Processor( $rendered_blocks ); 124 124 $p->next_tag( array( 'class_name' => 'interactive/block-2' ) ); 125 $this->assert Equals( '2', $p->get_attribute( 'value' ) );125 $this->assertSame( '2', $p->get_attribute( 'value' ) ); 126 126 } 127 127 … … 144 144 $p = new WP_HTML_Tag_Processor( $rendered_blocks ); 145 145 $p->next_tag( array( 'class_name' => 'interactive/block-2' ) ); 146 $this->assert Equals( '2', $p->get_attribute( 'value' ) );146 $this->assertSame( '2', $p->get_attribute( 'value' ) ); 147 147 $p->next_tag( array( 'class_name' => 'interactive/block-3' ) ); 148 $this->assert Equals( '3', $p->get_attribute( 'value' ) );148 $this->assertSame( '3', $p->get_attribute( 'value' ) ); 149 149 } 150 150 … … 169 169 $p = new WP_HTML_Tag_Processor( $rendered_blocks ); 170 170 $p->next_tag( array( 'class_name' => 'interactive/block-2' ) ); 171 $this->assert Equals( '2', $p->get_attribute( 'value' ) );171 $this->assertSame( '2', $p->get_attribute( 'value' ) ); 172 172 $p->next_tag( array( 'class_name' => 'interactive/block-4' ) ); 173 $this->assert Equals( '4', $p->get_attribute( 'value' ) );173 $this->assertSame( '4', $p->get_attribute( 'value' ) ); 174 174 } 175 175 … … 191 191 $p = new WP_HTML_Tag_Processor( $rendered_blocks ); 192 192 $p->next_tag( array( 'class_name' => 'interactive/block-1' ) ); 193 $this->assert Equals( '1', $p->get_attribute( 'value' ) );193 $this->assertSame( '1', $p->get_attribute( 'value' ) ); 194 194 $p->next_tag( array( 'class_name' => 'non-interactive/block-2' ) ); 195 195 $this->assertNull( $p->get_attribute( 'value' ) ); … … 213 213 $p = new WP_HTML_Tag_Processor( $rendered_blocks ); 214 214 $p->next_tag( array( 'class_name' => 'interactive/block-1' ) ); 215 $this->assert Equals( '1', $p->get_attribute( 'value' ) );215 $this->assertSame( '1', $p->get_attribute( 'value' ) ); 216 216 $p->next_tag( array( 'class_name' => 'non-interactive/block-2' ) ); 217 $this->assert Equals( '1', $p->get_attribute( 'value' ) );217 $this->assertSame( '1', $p->get_attribute( 'value' ) ); 218 218 } 219 219 … … 239 239 $p = new WP_HTML_Tag_Processor( $rendered_blocks ); 240 240 $p->next_tag( array( 'class_name' => 'interactive/block-1' ) ); 241 $this->assert Equals( '1', $p->get_attribute( 'value' ) );241 $this->assertSame( '1', $p->get_attribute( 'value' ) ); 242 242 $p->next_tag( array( 'class_name' => 'interactive/block-2' ) ); 243 $this->assert Equals( '2', $p->get_attribute( 'value' ) );243 $this->assertSame( '2', $p->get_attribute( 'value' ) ); 244 244 $p->next_tag( array( 'class_name' => 'non-interactive/block-3' ) ); 245 $this->assert Equals( '2', $p->get_attribute( 'value' ) );245 $this->assertSame( '2', $p->get_attribute( 'value' ) ); 246 246 $p->next_tag( array( 'class_name' => 'non-interactive/block-4' ) ); 247 $this->assert Equals( '1', $p->get_attribute( 'value' ) );247 $this->assertSame( '1', $p->get_attribute( 'value' ) ); 248 248 } 249 249 … … 289 289 $this->data_wp_test_processor_count = 0; 290 290 wp_interactivity_process_directives( $html ); 291 $this->assert Equals( 1, $this->data_wp_test_processor_count );291 $this->assertSame( 1, $this->data_wp_test_processor_count ); 292 292 293 293 register_block_type( … … 310 310 do_blocks( $post_content ); 311 311 unregister_block_type( 'test/custom-directive-block' ); 312 $this->assert Equals( 2, $this->data_wp_test_processor_count );312 $this->assertSame( 2, $this->data_wp_test_processor_count ); 313 313 $directive_processors->setValue( null, $old_directive_processors ); 314 314 } … … 344 344 remove_filter( 'render_block_data', 'test_render_block_data' ); 345 345 unregister_block_type( 'test/custom-directive-block' ); 346 $this->assert Equals( 'test', $processor->get_attribute( 'value' ) );346 $this->assertSame( 'test', $processor->get_attribute( 'value' ) ); 347 347 } 348 348 … … 356 356 */ 357 357 public function test_wp_interactivity_data_wp_context_with_different_arrays() { 358 $this->assert Equals( 'data-wp-context=\'{}\'', wp_interactivity_data_wp_context( array() ) );359 $this->assert Equals(358 $this->assertSame( 'data-wp-context=\'{}\'', wp_interactivity_data_wp_context( array() ) ); 359 $this->assertSame( 360 360 'data-wp-context=\'{"a":1,"b":"2","c":true}\'', 361 361 wp_interactivity_data_wp_context( … … 367 367 ) 368 368 ); 369 $this->assert Equals(369 $this->assertSame( 370 370 'data-wp-context=\'{"a":[1,2]}\'', 371 371 wp_interactivity_data_wp_context( array( 'a' => array( 1, 2 ) ) ) 372 372 ); 373 $this->assert Equals(373 $this->assertSame( 374 374 'data-wp-context=\'[1,2]\'', 375 375 wp_interactivity_data_wp_context( array( 1, 2 ) ) … … 386 386 */ 387 387 public function test_wp_interactivity_data_wp_context_with_different_arrays_and_a_namespace() { 388 $this->assert Equals( 'data-wp-context=\'myPlugin::{}\'', wp_interactivity_data_wp_context( array(), 'myPlugin' ) );389 $this->assert Equals(388 $this->assertSame( 'data-wp-context=\'myPlugin::{}\'', wp_interactivity_data_wp_context( array(), 'myPlugin' ) ); 389 $this->assertSame( 390 390 'data-wp-context=\'myPlugin::{"a":1,"b":"2","c":true}\'', 391 391 wp_interactivity_data_wp_context( … … 398 398 ) 399 399 ); 400 $this->assert Equals(400 $this->assertSame( 401 401 'data-wp-context=\'myPlugin::{"a":[1,2]}\'', 402 402 wp_interactivity_data_wp_context( array( 'a' => array( 1, 2 ) ), 'myPlugin' ) 403 403 ); 404 $this->assert Equals(404 $this->assertSame( 405 405 'data-wp-context=\'myPlugin::[1,2]\'', 406 406 wp_interactivity_data_wp_context( array( 1, 2 ), 'myPlugin' ) … … 419 419 */ 420 420 public function test_wp_interactivity_data_wp_context_with_json_flags() { 421 $this->assert Equals( 'data-wp-context=\'{"tag":"\u003Cfoo\u003E"}\'', wp_interactivity_data_wp_context( array( 'tag' => '<foo>' ) ) );422 $this->assert Equals( 'data-wp-context=\'{"apos":"\u0027bar\u0027"}\'', wp_interactivity_data_wp_context( array( 'apos' => "'bar'" ) ) );423 $this->assert Equals( 'data-wp-context=\'{"quot":"\u0022baz\u0022"}\'', wp_interactivity_data_wp_context( array( 'quot' => '"baz"' ) ) );424 $this->assert Equals( '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' ) ) ); 425 425 } 426 426 … … 449 449 $processor->next_tag( array( 'class_name' => 'test' ) ); 450 450 unregister_block_type( 'test/custom-directive-block' ); 451 $this->assert Equals( '1', $processor->get_attribute( 'src' ) );451 $this->assertSame( '1', $processor->get_attribute( 'src' ) ); 452 452 } 453 453 … … 489 489 $second_input_value = $processor->get_attribute( 'value' ); 490 490 unregister_block_type( 'test/custom-directive-block' ); 491 $this->assert Equals( 'inner', $first_input_value );492 $this->assert Equals( 'outer', $second_input_value );491 $this->assertSame( 'inner', $first_input_value ); 492 $this->assertSame( 'outer', $second_input_value ); 493 493 } 494 494
Note: See TracChangeset
for help on using the changeset viewer.