Changeset 48937 for trunk/tests/phpunit/tests/compat.php
- Timestamp:
- 09/02/2020 12:35:36 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/compat.php
r47198 r48937 37 37 */ 38 38 function test_mb_strlen( $string, $expected_character_length ) { 39 $this->assert Equals( $expected_character_length, _mb_strlen( $string, 'UTF-8' ) );39 $this->assertSame( $expected_character_length, _mb_strlen( $string, 'UTF-8' ) ); 40 40 } 41 41 … … 45 45 function test_mb_strlen_via_regex( $string, $expected_character_length ) { 46 46 _wp_can_use_pcre_u( false ); 47 $this->assert Equals( $expected_character_length, _mb_strlen( $string, 'UTF-8' ) );47 $this->assertSame( $expected_character_length, _mb_strlen( $string, 'UTF-8' ) ); 48 48 _wp_can_use_pcre_u( 'reset' ); 49 49 } … … 53 53 */ 54 54 function test_8bit_mb_strlen( $string, $expected_character_length, $expected_byte_length ) { 55 $this->assert Equals( $expected_byte_length, _mb_strlen( $string, '8bit' ) );55 $this->assertSame( $expected_byte_length, _mb_strlen( $string, '8bit' ) ); 56 56 } 57 57 … … 60 60 */ 61 61 function test_mb_substr( $string, $start, $length, $expected_character_substring ) { 62 $this->assert Equals( $expected_character_substring, _mb_substr( $string, $start, $length, 'UTF-8' ) );62 $this->assertSame( $expected_character_substring, _mb_substr( $string, $start, $length, 'UTF-8' ) ); 63 63 } 64 64 … … 68 68 function test_mb_substr_via_regex( $string, $start, $length, $expected_character_substring ) { 69 69 _wp_can_use_pcre_u( false ); 70 $this->assert Equals( $expected_character_substring, _mb_substr( $string, $start, $length, 'UTF-8' ) );70 $this->assertSame( $expected_character_substring, _mb_substr( $string, $start, $length, 'UTF-8' ) ); 71 71 _wp_can_use_pcre_u( 'reset' ); 72 72 } … … 76 76 */ 77 77 function test_8bit_mb_substr( $string, $start, $length, $expected_character_substring, $expected_byte_substring ) { 78 $this->assert Equals( $expected_byte_substring, _mb_substr( $string, $start, $length, '8bit' ) );78 $this->assertSame( $expected_byte_substring, _mb_substr( $string, $start, $length, '8bit' ) ); 79 79 } 80 80 … … 84 84 $string_mb = base64_decode( '5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=' ); 85 85 86 $this->assert Equals( 'DEF', _mb_substr( $string_ascii, 3 ) );87 $this->assert Equals( 'DEF', _mb_substr( $string_ascii, 3, 5, 'ISO-8859-1' ) );86 $this->assertSame( 'DEF', _mb_substr( $string_ascii, 3 ) ); 87 $this->assertSame( 'DEF', _mb_substr( $string_ascii, 3, 5, 'ISO-8859-1' ) ); 88 88 89 89 // Specific latin-1 as that is the default the core PHP test operates under. 90 $this->assert Equals( 'peacrOiqng==', base64_encode( _mb_substr( $string_mb, 2, 7, 'latin-1' ) ) );91 $this->assert Equals( '6Kqe44OG44Kt44K544OI44Gn44GZ', base64_encode( _mb_substr( $string_mb, 2, 7, 'utf-8' ) ) );90 $this->assertSame( 'peacrOiqng==', base64_encode( _mb_substr( $string_mb, 2, 7, 'latin-1' ) ) ); 91 $this->assertSame( '6Kqe44OG44Kt44K544OI44Gn44GZ', base64_encode( _mb_substr( $string_mb, 2, 7, 'utf-8' ) ) ); 92 92 93 93 /* https://github.com/php/php-src/blob/php-5.6.8/ext/mbstring/tests/mb_substr_variation1.phpt */ … … 159 159 $iterator = 0; 160 160 foreach ( $inputs as $input ) { 161 $this->assert Equals( $outputs[ $iterator ], _mb_substr( $input, $start, $length ) );161 $this->assertSame( $outputs[ $iterator ], _mb_substr( $input, $start, $length ) ); 162 162 $iterator++; 163 163 } … … 166 166 167 167 function test_hash_hmac_simple() { 168 $this->assert Equals( '140d1cb79fa12e2a31f32d35ad0a2723', _hash_hmac( 'md5', 'simple', 'key' ) );169 $this->assert Equals( '993003b95758e0ac2eba451a4c5877eb1bb7b92a', _hash_hmac( 'sha1', 'simple', 'key' ) );168 $this->assertSame( '140d1cb79fa12e2a31f32d35ad0a2723', _hash_hmac( 'md5', 'simple', 'key' ) ); 169 $this->assertSame( '993003b95758e0ac2eba451a4c5877eb1bb7b92a', _hash_hmac( 'sha1', 'simple', 'key' ) ); 170 170 } 171 171 172 172 function test_hash_hmac_padding() { 173 $this->assert Equals( '3c1399103807cf12ec38228614416a8c', _hash_hmac( 'md5', 'simple', '65 character key 65 character key 65 character key 65 character k' ) );174 $this->assert Equals( '4428826d20003e309d6c2a6515891370daf184ea', _hash_hmac( 'sha1', 'simple', '65 character key 65 character key 65 character key 65 character k' ) );173 $this->assertSame( '3c1399103807cf12ec38228614416a8c', _hash_hmac( 'md5', 'simple', '65 character key 65 character key 65 character key 65 character k' ) ); 174 $this->assertSame( '4428826d20003e309d6c2a6515891370daf184ea', _hash_hmac( 'sha1', 'simple', '65 character key 65 character key 65 character key 65 character k' ) ); 175 175 } 176 176 177 177 function test_hash_hmac_output() { 178 $this->assert Equals( array( 1 => '140d1cb79fa12e2a31f32d35ad0a2723' ), unpack( 'H32', _hash_hmac( 'md5', 'simple', 'key', true ) ) );179 $this->assert Equals( array( 1 => '993003b95758e0ac2eba451a4c5877eb1bb7b92a' ), unpack( 'H40', _hash_hmac( 'sha1', 'simple', 'key', true ) ) );178 $this->assertSame( array( 1 => '140d1cb79fa12e2a31f32d35ad0a2723' ), unpack( 'H32', _hash_hmac( 'md5', 'simple', 'key', true ) ) ); 179 $this->assertSame( array( 1 => '993003b95758e0ac2eba451a4c5877eb1bb7b92a' ), unpack( 'H40', _hash_hmac( 'sha1', 'simple', 'key', true ) ) ); 180 180 } 181 181 … … 187 187 $json = new Services_JSON(); 188 188 // Super basic test to verify Services_JSON is intact and working. 189 $this->assert Equals( '["foo"]', $json->encodeUnsafe( array( 'foo' ) ) );190 $this->assert Equals( array( 'foo' ), $json->decode( '["foo"]' ) );189 $this->assertSame( '["foo"]', $json->encodeUnsafe( array( 'foo' ) ) ); 190 $this->assertSame( array( 'foo' ), $json->decode( '["foo"]' ) ); 191 191 } 192 192
Note: See TracChangeset
for help on using the changeset viewer.