Changeset 50284
- Timestamp:
- 02/10/2021 01:24:24 PM (4 years ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/auth.php
r50065 r50284 469 469 'Application passwords should be allowed for API authentication' 470 470 ); 471 $this->assert Equals( $item['uuid'], rest_get_authenticated_app_password() );471 $this->assertSame( $item['uuid'], rest_get_authenticated_app_password() ); 472 472 } 473 473 -
trunk/tests/phpunit/tests/functions.php
r49551 r50284 282 282 $this->assertSame( null, $callback_value ); 283 283 } else { 284 $this->assert Equals( $value->count(), unserialize( $serialized )->count() );284 $this->assertSame( $value->count(), unserialize( $serialized )->count() ); 285 285 } 286 286 } -
trunk/tests/phpunit/tests/https-detection.php
r50075 r50284 66 66 add_filter( 'pre_http_request', array( $this, 'mock_success_with_sslverify' ), 10, 2 ); 67 67 wp_update_https_detection_errors(); 68 $this->assert Equals( array(), get_option( 'https_detection_errors' ) );68 $this->assertSame( array(), get_option( 'https_detection_errors' ) ); 69 69 70 70 // If initial request fails and request without SSL verification succeeds, … … 73 73 add_filter( 'pre_http_request', array( $this, 'mock_success_without_sslverify' ), 10, 2 ); 74 74 wp_update_https_detection_errors(); 75 $this->assert Equals(75 $this->assertSame( 76 76 array( 'ssl_verification_failed' => array( 'Bad SSL certificate.' ) ), 77 77 get_option( 'https_detection_errors' ) … … 83 83 add_filter( 'pre_http_request', array( $this, 'mock_error_without_sslverify' ), 10, 2 ); 84 84 wp_update_https_detection_errors(); 85 $this->assert Equals(85 $this->assertSame( 86 86 array( 'bad_ssl_certificate' => array( 'Bad SSL certificate.' ) ), 87 87 get_option( 'https_detection_errors' ) … … 92 92 add_filter( 'pre_http_request', array( $this, 'mock_not_found' ), 10, 2 ); 93 93 wp_update_https_detection_errors(); 94 $this->assert Equals(94 $this->assertSame( 95 95 array( 'bad_response_code' => array( 'Not Found' ) ), 96 96 get_option( 'https_detection_errors' ) … … 101 101 add_filter( 'pre_http_request', array( $this, 'mock_bad_source' ), 10, 2 ); 102 102 wp_update_https_detection_errors(); 103 $this->assert Equals(103 $this->assertSame( 104 104 array( 'bad_response_source' => array( 'It looks like the response did not come from this site.' ) ), 105 105 get_option( 'https_detection_errors' ) … … 107 107 108 108 // Check that the requests are made to the correct URL. 109 $this->assert Equals( 'https://example.com/', $this->last_request_url );109 $this->assertSame( 'https://example.com/', $this->last_request_url ); 110 110 } 111 111 … … 122 122 ); 123 123 wp_update_https_detection_errors(); 124 $this->assert Equals( array(), get_option( 'https_detection_errors' ) );124 $this->assertSame( array(), get_option( 'https_detection_errors' ) ); 125 125 126 126 // Override to enforce an error being detected. … … 135 135 ); 136 136 wp_update_https_detection_errors(); 137 $this->assert Equals(137 $this->assertSame( 138 138 array( 'ssl_verification_failed' => array( 'Bad SSL certificate.' ) ), 139 139 get_option( 'https_detection_errors' ) … … 146 146 public function test_wp_schedule_https_detection() { 147 147 wp_schedule_https_detection(); 148 $this->assert Equals( 'twicedaily', wp_get_schedule( 'wp_https_detection' ) );148 $this->assertSame( 'twicedaily', wp_get_schedule( 'wp_https_detection' ) ); 149 149 } 150 150 … … 158 158 'args' => array( 'sslverify' => true ), 159 159 ); 160 $this->assert Equals( $request, wp_cron_conditionally_prevent_sslverify( $request ) );160 $this->assertSame( $request, wp_cron_conditionally_prevent_sslverify( $request ) ); 161 161 162 162 // If URL is using HTTPS, set 'sslverify' to false. … … 167 167 $expected = $request; 168 168 $expected['args']['sslverify'] = false; 169 $this->assert Equals( $expected, wp_cron_conditionally_prevent_sslverify( $request ) );169 $this->assertSame( $expected, wp_cron_conditionally_prevent_sslverify( $request ) ); 170 170 } 171 171 -
trunk/tests/phpunit/tests/https-migration.php
r50131 r50284 62 62 // Replaces URLs, including its encoded variant. 63 63 add_filter( 'wp_should_replace_insecure_home_url', '__return_true' ); 64 $this->assert Equals( $https_content, wp_replace_insecure_home_url( $http_content ) );64 $this->assertSame( $https_content, wp_replace_insecure_home_url( $http_content ) ); 65 65 66 66 // Does not replace anything if determined as unnecessary. 67 67 add_filter( 'wp_should_replace_insecure_home_url', '__return_false' ); 68 $this->assert Equals( $http_content, wp_replace_insecure_home_url( $http_content ) );68 $this->assertSame( $http_content, wp_replace_insecure_home_url( $http_content ) ); 69 69 } 70 70 … … 87 87 // Update URLs to HTTPS (successfully). 88 88 $this->assertTrue( wp_update_urls_to_https() ); 89 $this->assert Equals( $https_url, get_option( 'home' ) );90 $this->assert Equals( $https_url, get_option( 'siteurl' ) );89 $this->assertSame( $https_url, get_option( 'home' ) ); 90 $this->assertSame( $https_url, get_option( 'siteurl' ) ); 91 91 92 92 // Switch options back to use HTTP URLs, but now add filter to … … 99 99 // option. Therefore the change is expected to be reverted. 100 100 $this->assertFalse( wp_update_urls_to_https() ); 101 $this->assert Equals( $http_url, get_option( 'home' ) );102 $this->assert Equals( $http_url, get_option( 'siteurl' ) );101 $this->assertSame( $http_url, get_option( 'home' ) ); 102 $this->assertSame( $http_url, get_option( 'siteurl' ) ); 103 103 } 104 104 … … 110 110 update_option( 'fresh_site', '0' ); 111 111 wp_update_https_migration_required( 'http://example.org', 'https://example.org' ); 112 $this->assert Equals( '1',get_option( 'https_migration_required' ) );112 $this->assertTrue( get_option( 'https_migration_required' ) ); 113 113 114 114 // Changing another part than the scheme should delete/reset the flag because changing those parts (e.g. the … … 120 120 update_option( 'fresh_site', '1' ); 121 121 wp_update_https_migration_required( 'http://example.org', 'https://example.org' ); 122 $this->assert Equals( '',get_option( 'https_migration_required' ) );122 $this->assertFalse( get_option( 'https_migration_required' ) ); 123 123 124 124 // Changing (back) from HTTPS to HTTP should delete/reset the flag. -
trunk/tests/phpunit/tests/post.php
r50012 r50284 1412 1412 $post = get_post( $post_id ); 1413 1413 $this->assertEqualsWithDelta( strtotime( gmdate( 'Y-m-d H:i:s' ) ), strtotime( $post->post_date ), 2, 'The dates should be equal' ); 1414 $this->assert Equals( '0000-00-00 00:00:00', $post->post_date_gmt );1414 $this->assertSame( '0000-00-00 00:00:00', $post->post_date_gmt ); 1415 1415 1416 1416 $post_id = self::factory()->post->create( … … 1422 1422 $post = get_post( $post_id ); 1423 1423 $this->assertEqualsWithDelta( strtotime( gmdate( 'Y-m-d H:i:s' ) ), strtotime( $post->post_date ), 2, 'The dates should be equal' ); 1424 $this->assert Equals( '0000-00-00 00:00:00', $post->post_date_gmt );1424 $this->assertSame( '0000-00-00 00:00:00', $post->post_date_gmt ); 1425 1425 1426 1426 // Empty post_date_gmt without floating status … … 1451 1451 ); 1452 1452 $post = get_post( $post_id ); 1453 $this->assert Equals( get_date_from_gmt( $post_date_gmt ), $post->post_date );1454 $this->assert Equals( $post_date_gmt, $post->post_date_gmt );1453 $this->assertSame( get_date_from_gmt( $post_date_gmt ), $post->post_date ); 1454 $this->assertSame( $post_date_gmt, $post->post_date_gmt ); 1455 1455 1456 1456 // Invalid post_date_gmt … … 1461 1461 ); 1462 1462 $post = get_post( $post_id ); 1463 $this->assert Equals( '1970-01-01 00:00:00', $post->post_date );1464 $this->assert Equals( '0000-00-00 00:00:00', $post->post_date_gmt );1463 $this->assertSame( '1970-01-01 00:00:00', $post->post_date ); 1464 $this->assertSame( '0000-00-00 00:00:00', $post->post_date_gmt ); 1465 1465 } 1466 1466 … … 1481 1481 ); 1482 1482 $post = get_post( $post_id ); 1483 $this->assert Equals( $post_date, $post->post_date );1484 $this->assert Equals( '0000-00-00 00:00:00', $post->post_date_gmt );1483 $this->assertSame( $post_date, $post->post_date ); 1484 $this->assertSame( '0000-00-00 00:00:00', $post->post_date_gmt ); 1485 1485 1486 1486 $post_id = self::factory()->post->create( … … 1492 1492 ); 1493 1493 $post = get_post( $post_id ); 1494 $this->assert Equals( $post_date, $post->post_date );1495 $this->assert Equals( '0000-00-00 00:00:00', $post->post_date_gmt );1494 $this->assertSame( $post_date, $post->post_date ); 1495 $this->assertSame( '0000-00-00 00:00:00', $post->post_date_gmt ); 1496 1496 1497 1497 // Empty post_date_gmt without floating status … … 1503 1503 ); 1504 1504 $post = get_post( $post_id ); 1505 $this->assert Equals( $post_date, $post->post_date );1506 $this->assert Equals( get_gmt_from_date( $post_date ), $post->post_date_gmt );1505 $this->assertSame( $post_date, $post->post_date ); 1506 $this->assertSame( get_gmt_from_date( $post_date ), $post->post_date_gmt ); 1507 1507 1508 1508 $post_id = self::factory()->post->create( … … 1514 1514 ); 1515 1515 $post = get_post( $post_id ); 1516 $this->assert Equals( $post_date, $post->post_date );1517 $this->assert Equals( get_gmt_from_date( $post_date ), $post->post_date_gmt );1516 $this->assertSame( $post_date, $post->post_date ); 1517 $this->assertSame( get_gmt_from_date( $post_date ), $post->post_date_gmt ); 1518 1518 1519 1519 // Valid post_date_gmt … … 1525 1525 ); 1526 1526 $post = get_post( $post_id ); 1527 $this->assert Equals( $post_date, $post->post_date );1528 $this->assert Equals( $post_date_gmt, $post->post_date_gmt );1527 $this->assertSame( $post_date, $post->post_date ); 1528 $this->assertSame( $post_date_gmt, $post->post_date_gmt ); 1529 1529 1530 1530 // Invalid post_date_gmt … … 1536 1536 ); 1537 1537 $post = get_post( $post_id ); 1538 $this->assert Equals( $post_date, $post->post_date );1539 $this->assert Equals( '0000-00-00 00:00:00', $post->post_date_gmt );1538 $this->assertSame( $post_date, $post->post_date ); 1539 $this->assertSame( '0000-00-00 00:00:00', $post->post_date_gmt ); 1540 1540 } 1541 1541 … … 1555 1555 ) 1556 1556 ); 1557 $this->assert Equals( 0, $post_id );1557 $this->assertSame( 0, $post_id ); 1558 1558 1559 1559 $post_id = self::factory()->post->create( … … 1564 1564 ) 1565 1565 ); 1566 $this->assert Equals( 0, $post_id );1566 $this->assertSame( 0, $post_id ); 1567 1567 1568 1568 // Empty post_date_gmt without floating status … … 1573 1573 ) 1574 1574 ); 1575 $this->assert Equals( 0, $post_id );1575 $this->assertSame( 0, $post_id ); 1576 1576 1577 1577 $post_id = self::factory()->post->create( … … 1582 1582 ) 1583 1583 ); 1584 $this->assert Equals( 0, $post_id );1584 $this->assertSame( 0, $post_id ); 1585 1585 1586 1586 // Valid post_date_gmt … … 1591 1591 ) 1592 1592 ); 1593 $this->assert Equals( 0, $post_id );1593 $this->assertSame( 0, $post_id ); 1594 1594 1595 1595 // Invalid post_date_gmt … … 1600 1600 ) 1601 1601 ); 1602 $this->assert Equals( 0, $post_id );1602 $this->assertSame( 0, $post_id ); 1603 1603 } 1604 1604 … … 1615 1615 1616 1616 $resolved_post_date = wp_resolve_post_date( '', $post_date_gmt ); 1617 $this->assert Equals( get_date_from_gmt( $post_date_gmt ), $resolved_post_date );1617 $this->assertSame( get_date_from_gmt( $post_date_gmt ), $resolved_post_date ); 1618 1618 1619 1619 $resolved_post_date = wp_resolve_post_date( '', $invalid_date ); 1620 $this->assert Equals( '1970-01-01 00:00:00', $resolved_post_date );1620 $this->assertSame( '1970-01-01 00:00:00', $resolved_post_date ); 1621 1621 1622 1622 $resolved_post_date = wp_resolve_post_date( $post_date ); 1623 $this->assert Equals( $post_date, $resolved_post_date );1623 $this->assertSame( $post_date, $resolved_post_date ); 1624 1624 1625 1625 $resolved_post_date = wp_resolve_post_date( $post_date, $post_date_gmt ); 1626 $this->assert Equals( $post_date, $resolved_post_date );1626 $this->assertSame( $post_date, $resolved_post_date ); 1627 1627 1628 1628 $resolved_post_date = wp_resolve_post_date( $post_date, $invalid_date ); 1629 $this->assert Equals( $post_date, $resolved_post_date );1629 $this->assertSame( $post_date, $resolved_post_date ); 1630 1630 1631 1631 $resolved_post_date = wp_resolve_post_date( $invalid_date ); -
trunk/tests/phpunit/tests/post/nav-menu.php
r50014 r50284 1038 1038 ); 1039 1039 $post = get_post( $menu_item_id ); 1040 $this->assert Equals( get_date_from_gmt( $post_date_gmt ), $post->post_date );1040 $this->assertSame( get_date_from_gmt( $post_date_gmt ), $post->post_date ); 1041 1041 1042 1042 $menu_item_id = wp_update_nav_menu_item( … … 1052 1052 ); 1053 1053 $post = get_post( $menu_item_id ); 1054 $this->assert Equals( '1970-01-01 00:00:00', $post->post_date );1054 $this->assertSame( '1970-01-01 00:00:00', $post->post_date ); 1055 1055 1056 1056 $menu_item_id = wp_update_nav_menu_item( … … 1066 1066 ); 1067 1067 $post = get_post( $menu_item_id ); 1068 $this->assert Equals( $post_date, $post->post_date );1068 $this->assertSame( $post_date, $post->post_date ); 1069 1069 1070 1070 $menu_item_id = wp_update_nav_menu_item( … … 1081 1081 ); 1082 1082 $post = get_post( $menu_item_id ); 1083 $this->assert Equals( $post_date, $post->post_date );1083 $this->assertSame( $post_date, $post->post_date ); 1084 1084 1085 1085 $menu_item_id = wp_update_nav_menu_item( … … 1096 1096 ); 1097 1097 $post = get_post( $menu_item_id ); 1098 $this->assert Equals( $post_date, $post->post_date );1098 $this->assertSame( $post_date, $post->post_date ); 1099 1099 1100 1100 $menu_item_id = wp_update_nav_menu_item( -
trunk/tests/phpunit/tests/rest-api/rest-application-passwords-controller.php
r50114 r50284 892 892 $this->assertNotWPError( $response->as_error() ); 893 893 894 $this->assert Equals( $password['uuid'], $response->get_data()['uuid'] );894 $this->assertSame( $password['uuid'], $response->get_data()['uuid'] ); 895 895 } 896 896 … … 902 902 $response = rest_do_request( '/wp/v2/users/' . self::$admin . '/application-passwords/introspect' ); 903 903 904 $this->assert Equals( $password['uuid'], $response->get_data()['uuid'] );904 $this->assertSame( $password['uuid'], $response->get_data()['uuid'] ); 905 905 } 906 906 -
trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php
r50157 r50284 1200 1200 1201 1201 $this->assertCount( 1, $data ); 1202 $this->assert Equals( $post_ids[0], $data[0]['id'] );1202 $this->assertSame( $post_ids[0], $data[0]['id'] ); 1203 1203 } 1204 1204 -
trunk/tests/phpunit/tests/rest-api/rest-request.php
r50150 r50284 495 495 $this->assertArrayHasKey( 'params', $data ); 496 496 $this->assertArrayHasKey( 'failparam', $data['params'] ); 497 $this->assert Equals( 'Invalid. Super Invalid. Broken.', $data['params']['failparam'] );497 $this->assertSame( 'Invalid. Super Invalid. Broken.', $data['params']['failparam'] ); 498 498 } 499 499 … … 525 525 $this->assertArrayHasKey( 'details', $data ); 526 526 $this->assertArrayHasKey( 'failparam', $data['details'] ); 527 $this->assert Equals(527 $this->assertSame( 528 528 array( 529 529 'code' => 'invalid', … … 758 758 $this->assertArrayHasKey( 'params', $data ); 759 759 $this->assertArrayHasKey( 'failparam', $data['params'] ); 760 $this->assert Equals( 'Invalid. Super Invalid. Broken.', $data['params']['failparam'] );760 $this->assertSame( 'Invalid. Super Invalid. Broken.', $data['params']['failparam'] ); 761 761 } 762 762 … … 788 788 $this->assertArrayHasKey( 'details', $data ); 789 789 $this->assertArrayHasKey( 'failparam', $data['details'] ); 790 $this->assert Equals(790 $this->assertSame( 791 791 array( 792 792 'code' => 'invalid', -
trunk/tests/phpunit/tests/rest-api/rest-server.php
r50150 r50284 466 466 $response = rest_convert_error_to_response( $error ); 467 467 $this->assertSame( 400, $response->get_status() ); 468 $this->assert Equals( 'more_data', $response->get_data()['data'] );469 $this->assert Equals( array( array( 'status' => 400 ) ), $response->get_data()['additional_data'] );468 $this->assertSame( 'more_data', $response->get_data()['data'] ); 469 $this->assertSame( array( array( 'status' => 400 ) ), $response->get_data()['additional_data'] ); 470 470 } 471 471 -
trunk/tests/phpunit/tests/rest-api/rest-themes-controller.php
r49925 r50284 200 200 $response = rest_get_server()->dispatch( $request ); 201 201 202 $this->assert Equals( 200, $response->get_status() );202 $this->assertSame( 200, $response->get_status() ); 203 203 $data = $response->get_data(); 204 204 … … 238 238 $response = rest_get_server()->dispatch( $request ); 239 239 240 $this->assert Equals( 200, $response->get_status() );240 $this->assertSame( 200, $response->get_status() ); 241 241 $data = $response->get_data(); 242 242 … … 298 298 $this->assertErrorResponse( $error_code, $response, 403 ); 299 299 } else { 300 $this->assert Equals( 200, $response->get_status() );300 $this->assertSame( 200, $response->get_status() ); 301 301 } 302 302 } … … 1216 1216 $response = rest_get_server()->dispatch( $request ); 1217 1217 1218 $this->assert Equals( 200, $response->get_status() );1218 $this->assertSame( 200, $response->get_status() ); 1219 1219 $data = $response->get_data(); 1220 1220 $links = $response->get_links(); … … 1279 1279 $response = rest_get_server()->dispatch( $request ); 1280 1280 1281 $this->assert Equals( 200, $response->get_status() );1281 $this->assertSame( 200, $response->get_status() ); 1282 1282 } 1283 1283 -
trunk/tests/phpunit/tests/robots.php
r50078 r50284 30 30 add_filter( 'wp_robots', array( $this, 'add_noindex_directive' ) ); 31 31 $output = get_echo( 'wp_robots' ); 32 $this->assert Equals( "<meta name='robots' content='noindex' />\n", $output );32 $this->assertSame( "<meta name='robots' content='noindex' />\n", $output ); 33 33 34 34 // Do not render robots meta tag when there are only false-y directives.
Note: See TracChangeset
for help on using the changeset viewer.