Skip to content

Commit 532267b

Browse files
committed
Coding standards.
1 parent 60b07f9 commit 532267b

1 file changed

Lines changed: 17 additions & 11 deletions

File tree

tests/phpunit/tests/db/insertMultiple.php

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,19 @@ public function set_up() {
2222
*/
2323
public function test_correct_rows_are_inserted() {
2424
$table = $this->wpdb->postmeta;
25+
2526
$columns = array(
2627
'post_id',
2728
'meta_key',
2829
'meta_value',
2930
);
31+
3032
$datas = array(
3133
array( 1, 'key1', 'value1' ),
3234
array( 2, 'key2', 'value2' ),
3335
array( 3, 'key3', 'value3' ),
3436
);
37+
3538
$format = array(
3639
'%d',
3740
'%s',
@@ -46,28 +49,31 @@ public function test_correct_rows_are_inserted() {
4649
);
4750

4851
$rows = $this->wpdb->get_results(
49-
"
50-
SELECT post_id, meta_key, meta_value
51-
FROM $table
52-
ORDER BY post_id ASC
53-
",
52+
$this->wpdb->prepare(
53+
"
54+
SELECT post_id, meta_key, meta_value
55+
FROM %i
56+
ORDER BY post_id ASC
57+
",
58+
$table
59+
),
5460
ARRAY_A
5561
);
5662

5763
$expected_rows = array(
5864
array(
59-
'post_id' => '1',
60-
'meta_key' => 'key1',
65+
'post_id' => '1',
66+
'meta_key' => 'key1',
6167
'meta_value' => 'value1',
6268
),
6369
array(
64-
'post_id' => '2',
65-
'meta_key' => 'key2',
70+
'post_id' => '2',
71+
'meta_key' => 'key2',
6672
'meta_value' => 'value2',
6773
),
6874
array(
69-
'post_id' => '3',
70-
'meta_key' => 'key3',
75+
'post_id' => '3',
76+
'meta_key' => 'key3',
7177
'meta_value' => 'value3',
7278
),
7379
);

0 commit comments

Comments
 (0)