@@ -22,15 +22,16 @@ public function test_all_meta_fields_should_be_added() {
2222 global $ wpdb ;
2323
2424 $ post_id = self ::factory ()->post ->create ();
25- $ meta = array (
25+ $ meta = array (
2626 'key1 ' => '1 ' ,
2727 'key2 ' => '2 ' ,
2828 'key3 ' => '3 ' ,
2929 );
30- $ latest_mid = (int ) $ wpdb ->get_var ( "SELECT MAX( meta_id ) FROM {$ wpdb ->postmeta }" );
30+
31+ $ latest_mid = (int ) $ wpdb ->get_var ( "SELECT MAX( meta_id ) FROM {$ wpdb ->postmeta }" );
3132 $ add_post_metadata_calls = did_filter ( 'add_post_metadata ' );
32- $ add_post_meta_calls = did_action ( 'add_post_meta ' );
33- $ added_post_meta_calls = did_action ( 'added_post_meta ' );
33+ $ add_post_meta_calls = did_action ( 'add_post_meta ' );
34+ $ added_post_meta_calls = did_action ( 'added_post_meta ' );
3435
3536 $ result = bulk_add_metadata ( 'post ' , $ post_id , $ meta );
3637
@@ -39,6 +40,7 @@ public function test_all_meta_fields_should_be_added() {
3940 'key2 ' => get_post_meta ( $ post_id , 'key2 ' , true ),
4041 'key3 ' => get_post_meta ( $ post_id , 'key3 ' , true ),
4142 );
43+
4244 $ expected_vals = $ meta ;
4345 $ expected_mids = array (
4446 'key1 ' => ( $ latest_mid + 1 ),
@@ -66,15 +68,16 @@ static function ( $check, $object_id, $meta_key ) {
6668 );
6769
6870 $ post_id = self ::factory ()->post ->create ();
69- $ meta = array (
71+ $ meta = array (
7072 'key1 ' => '1 ' ,
7173 'key2 ' => '2 ' ,
7274 'key3 ' => '3 ' ,
7375 );
74- $ latest_mid = (int ) $ wpdb ->get_var ( "SELECT MAX( meta_id ) FROM {$ wpdb ->postmeta }" );
76+
77+ $ latest_mid = (int ) $ wpdb ->get_var ( "SELECT MAX( meta_id ) FROM {$ wpdb ->postmeta }" );
7578 $ add_post_metadata_calls = did_filter ( 'add_post_metadata ' );
76- $ add_post_meta_calls = did_action ( 'add_post_meta ' );
77- $ added_post_meta_calls = did_action ( 'added_post_meta ' );
79+ $ add_post_meta_calls = did_action ( 'add_post_meta ' );
80+ $ added_post_meta_calls = did_action ( 'added_post_meta ' );
7881
7982 $ result = bulk_add_metadata ( 'post ' , $ post_id , $ meta );
8083
@@ -83,11 +86,13 @@ static function ( $check, $object_id, $meta_key ) {
8386 'key2 ' => '' ,
8487 'key3 ' => '3 ' ,
8588 );
89+
8690 $ actual_vals = array (
8791 'key1 ' => get_post_meta ( $ post_id , 'key1 ' , true ),
8892 'key2 ' => get_post_meta ( $ post_id , 'key2 ' , true ),
8993 'key3 ' => get_post_meta ( $ post_id , 'key3 ' , true ),
9094 );
95+
9196 $ expected_mids = array (
9297 'key2 ' => 123456 ,
9398 'key1 ' => ( $ latest_mid + 1 ),
@@ -103,7 +108,7 @@ static function ( $check, $object_id, $meta_key ) {
103108
104109 public function test_slashed_data_should_be_handled_correctly () {
105110 $ post_id = self ::factory ()->post ->create ();
106- $ meta = array (
111+ $ meta = array (
107112 'key1 ' => addslashes ( self ::SLASH_1 ),
108113 'key2 ' => addslashes ( self ::SLASH_2 ),
109114 'key3 ' => addslashes ( self ::SLASH_3 ),
@@ -112,6 +117,7 @@ public function test_slashed_data_should_be_handled_correctly() {
112117 'key6 ' => addslashes ( self ::SLASH_6 ),
113118 'key7 ' => addslashes ( self ::SLASH_7 ),
114119 );
120+
115121 $ result = bulk_add_metadata ( 'post ' , $ post_id , $ meta );
116122
117123 $ actual_vals = array (
@@ -123,6 +129,7 @@ public function test_slashed_data_should_be_handled_correctly() {
123129 'key6 ' => get_post_meta ( $ post_id , 'key6 ' , true ),
124130 'key7 ' => get_post_meta ( $ post_id , 'key7 ' , true ),
125131 );
132+
126133 $ expected_vals = array (
127134 'key1 ' => self ::SLASH_1 ,
128135 'key2 ' => self ::SLASH_2 ,
0 commit comments