Changeset 54142 for trunk/tests/phpunit/tests/dependencies/scripts.php
- Timestamp:
- 09/13/2022 03:56:28 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/dependencies/scripts.php
r53360 r54142 1429 1429 * @param mixed $l10n_data Localization data passed to wp_localize_script(). 1430 1430 * @param string $expected Expected transformation of localization data. 1431 * @param string $warning Optional. Whether a PHP native warning/error is expected. Default false. 1432 */ 1433 public function test_wp_localize_script_data_formats( $l10n_data, $expected, $warning = false ) { 1434 if ( $warning ) { 1435 if ( PHP_VERSION_ID < 80000 ) { 1436 $this->expectWarning(); 1437 } else { 1438 $this->expectError(); 1439 } 1440 } 1441 1431 */ 1432 public function test_wp_localize_script_data_formats( $l10n_data, $expected ) { 1442 1433 if ( ! is_array( $l10n_data ) ) { 1443 1434 $this->setExpectedIncorrectUsage( 'WP_Scripts::localize' ); … … 1461 1452 * @type mixed $l10n_data Localization data passed to wp_localize_script(). 1462 1453 * @type string $expected Expected transformation of localization data. 1463 * @type string $warning Optional. Whether a PHP native warning/error is expected.1464 1454 * } 1465 1455 */ … … 1472 1462 array( array( 'foo' => 6.6 ), '{"foo":"6.6"}' ), 1473 1463 array( array( 'foo' => 6 ), '{"foo":"6"}' ), 1464 array( array(), '[]' ), 1474 1465 1475 1466 // Unofficially supported format. … … 1477 1468 1478 1469 // Unsupported formats. 1479 array( 1.5, '1.5' , true),1480 array( 1, '1' , true),1470 array( 1.5, '1.5' ), 1471 array( 1, '1' ), 1481 1472 array( false, '[""]' ), 1473 array( null, 'null' ), 1482 1474 ); 1483 1475 }
Note: See TracChangeset
for help on using the changeset viewer.