Changeset 48937 for trunk/tests/phpunit/tests/post/meta.php
- Timestamp:
- 09/02/2020 12:35:36 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/meta.php
r47122 r48937 53 53 54 54 // Check it exists. 55 $this->assert Equals( 'value', get_post_meta( self::$post_id, 'unique', true ) );56 $this->assert Equals( array( 'value' ), get_post_meta( self::$post_id, 'unique', false ) );55 $this->assertSame( 'value', get_post_meta( self::$post_id, 'unique', true ) ); 56 $this->assertSame( array( 'value' ), get_post_meta( self::$post_id, 'unique', false ) ); 57 57 58 58 // Fail to delete the wrong value. … … 63 63 64 64 // Check it is deleted. 65 $this->assert Equals( '', get_post_meta( self::$post_id, 'unique', true ) );66 $this->assert Equals( array(), get_post_meta( self::$post_id, 'unique', false ) );65 $this->assertSame( '', get_post_meta( self::$post_id, 'unique', true ) ); 66 $this->assertSame( array(), get_post_meta( self::$post_id, 'unique', false ) ); 67 67 68 68 } … … 74 74 75 75 // Check they exist. 76 $this->assert Equals( 'value', get_post_meta( self::$post_id, 'nonunique', true ) );77 $this->assert Equals( array( 'value', 'another value' ), get_post_meta( self::$post_id, 'nonunique', false ) );76 $this->assertSame( 'value', get_post_meta( self::$post_id, 'nonunique', true ) ); 77 $this->assertSame( array( 'value', 'another value' ), get_post_meta( self::$post_id, 'nonunique', false ) ); 78 78 79 79 // Fail to delete the wrong value. … … 84 84 85 85 // Check the remainder exists. 86 $this->assert Equals( 'another value', get_post_meta( self::$post_id, 'nonunique', true ) );87 $this->assert Equals( array( 'another value' ), get_post_meta( self::$post_id, 'nonunique', false ) );86 $this->assertSame( 'another value', get_post_meta( self::$post_id, 'nonunique', true ) ); 87 $this->assertSame( array( 'another value' ), get_post_meta( self::$post_id, 'nonunique', false ) ); 88 88 89 89 // Add a third one. … … 99 99 $actual = get_post_meta( self::$post_id, 'nonunique', false ); 100 100 sort( $actual ); 101 $this->assert Equals( $expected, $actual );101 $this->assertSame( $expected, $actual ); 102 102 103 103 // Delete the lot. … … 114 114 115 115 // Check they exist. 116 $this->assert Equals( 'value', get_post_meta( self::$post_id, 'unique_update', true ) );117 $this->assert Equals( array( 'value' ), get_post_meta( self::$post_id, 'unique_update', false ) );118 $this->assert Equals( 'value', get_post_meta( self::$post_id, 'nonunique_update', true ) );119 $this->assert Equals( array( 'value', 'another value' ), get_post_meta( self::$post_id, 'nonunique_update', false ) );116 $this->assertSame( 'value', get_post_meta( self::$post_id, 'unique_update', true ) ); 117 $this->assertSame( array( 'value' ), get_post_meta( self::$post_id, 'unique_update', false ) ); 118 $this->assertSame( 'value', get_post_meta( self::$post_id, 'nonunique_update', true ) ); 119 $this->assertSame( array( 'value', 'another value' ), get_post_meta( self::$post_id, 'nonunique_update', false ) ); 120 120 121 121 // Update them. … … 125 125 126 126 // Check they updated. 127 $this->assert Equals( 'new', get_post_meta( self::$post_id, 'unique_update', true ) );128 $this->assert Equals( array( 'new' ), get_post_meta( self::$post_id, 'unique_update', false ) );129 $this->assert Equals( 'new', get_post_meta( self::$post_id, 'nonunique_update', true ) );130 $this->assert Equals( array( 'new', 'another new' ), get_post_meta( self::$post_id, 'nonunique_update', false ) );127 $this->assertSame( 'new', get_post_meta( self::$post_id, 'unique_update', true ) ); 128 $this->assertSame( array( 'new' ), get_post_meta( self::$post_id, 'unique_update', false ) ); 129 $this->assertSame( 'new', get_post_meta( self::$post_id, 'nonunique_update', true ) ); 130 $this->assertSame( array( 'new', 'another new' ), get_post_meta( self::$post_id, 'nonunique_update', false ) ); 131 131 132 132 } … … 138 138 139 139 // Check they exist. 140 $this->assert Equals( 'value', get_post_meta( self::$post_id, 'unique_delete', true ) );141 $this->assert Equals( 'value', get_post_meta( self::$post_id_2, 'unique_delete', true ) );140 $this->assertSame( 'value', get_post_meta( self::$post_id, 'unique_delete', true ) ); 141 $this->assertSame( 'value', get_post_meta( self::$post_id_2, 'unique_delete', true ) ); 142 142 143 143 // Delete one of them. … … 145 145 146 146 // Check the other still exists. 147 $this->assert Equals( 'value', get_post_meta( self::$post_id_2, 'unique_delete', true ) );147 $this->assertSame( 'value', get_post_meta( self::$post_id_2, 'unique_delete', true ) ); 148 148 149 149 } … … 155 155 156 156 // Check they exist. 157 $this->assert Equals( 'value', get_post_meta( self::$post_id, 'unique_delete_by_key', true ) );158 $this->assert Equals( 'value', get_post_meta( self::$post_id_2, 'unique_delete_by_key', true ) );157 $this->assertSame( 'value', get_post_meta( self::$post_id, 'unique_delete_by_key', true ) ); 158 $this->assertSame( 'value', get_post_meta( self::$post_id_2, 'unique_delete_by_key', true ) ); 159 159 160 160 // Delete one of them. … … 162 162 163 163 // Check the other still exists. 164 $this->assert Equals( '', get_post_meta( self::$post_id_2, 'unique_delete_by_key', true ) );165 $this->assert Equals( '', get_post_meta( self::$post_id_2, 'unique_delete_by_key', true ) );164 $this->assertSame( '', get_post_meta( self::$post_id_2, 'unique_delete_by_key', true ) ); 165 $this->assertSame( '', get_post_meta( self::$post_id_2, 'unique_delete_by_key', true ) ); 166 166 } 167 167 … … 205 205 206 206 // Check they exist. 207 $this->assert Equals( 'value', get_post_meta( self::$post_id, 'unique_update', true ) );208 $this->assert Equals( array( 'value' ), get_post_meta( self::$post_id, 'unique_update', false ) );209 $this->assert Equals( 'value', get_post_meta( self::$post_id, 'nonunique_update', true ) );210 $this->assert Equals( array( 'value', 'another value' ), get_post_meta( self::$post_id, 'nonunique_update', false ) );207 $this->assertSame( 'value', get_post_meta( self::$post_id, 'unique_update', true ) ); 208 $this->assertSame( array( 'value' ), get_post_meta( self::$post_id, 'unique_update', false ) ); 209 $this->assertSame( 'value', get_post_meta( self::$post_id, 'nonunique_update', true ) ); 210 $this->assertSame( array( 'value', 'another value' ), get_post_meta( self::$post_id, 'nonunique_update', false ) ); 211 211 212 212 // Update them. … … 216 216 217 217 // Check they updated. 218 $this->assert Equals( 'new', get_post_meta( self::$post_id, 'unique_update', true ) );219 $this->assert Equals( array( 'new' ), get_post_meta( self::$post_id, 'unique_update', false ) );220 $this->assert Equals( 'new', get_post_meta( self::$post_id, 'nonunique_update', true ) );221 $this->assert Equals( array( 'new', 'another new' ), get_post_meta( self::$post_id, 'nonunique_update', false ) );218 $this->assertSame( 'new', get_post_meta( self::$post_id, 'unique_update', true ) ); 219 $this->assertSame( array( 'new' ), get_post_meta( self::$post_id, 'unique_update', false ) ); 220 $this->assertSame( 'new', get_post_meta( self::$post_id, 'nonunique_update', true ) ); 221 $this->assertSame( array( 'new', 'another new' ), get_post_meta( self::$post_id, 'nonunique_update', false ) ); 222 222 223 223 // Slashed update. … … 225 225 $this->assertTrue( update_meta( $mid1, 'unique_update', addslashes( $data ) ) ); 226 226 $meta = get_metadata_by_mid( 'post', $mid1 ); 227 $this->assert Equals( $data, $meta->meta_value );227 $this->assertSame( $data, $meta->meta_value ); 228 228 } 229 229 … … 264 264 $GLOBALS['wp_meta_keys'] = array(); 265 265 266 $this->assert Equals( 'post', $this->last_register_meta_call['object_type'] );267 $this->assert Equals( $meta_key, $this->last_register_meta_call['meta_key'] );268 $this->assert Equals( $args, $this->last_register_meta_call['args'] );266 $this->assertSame( 'post', $this->last_register_meta_call['object_type'] ); 267 $this->assertSame( $meta_key, $this->last_register_meta_call['meta_key'] ); 268 $this->assertSame( $args, $this->last_register_meta_call['args'] ); 269 269 } 270 270
Note: See TracChangeset
for help on using the changeset viewer.