Passed
Pull Request — master (#2)
by Mike
04:45
created
unit-tests/Tests/Version3/reports-customers-totals.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		$users_count     = count_users();
44 44
 		$total_customers = 0;
45 45
 
46
-		foreach ( $users_count['avail_roles'] as $role => $total ) {
46
+		foreach ( $users_count[ 'avail_roles' ] as $role => $total ) {
47 47
 			if ( in_array( $role, array( 'administrator', 'shop_manager' ), true ) ) {
48 48
 				continue;
49 49
 			}
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 		$request    = new WP_REST_Request( 'OPTIONS', '/wc/v3/reports/customers/totals' );
110 110
 		$response   = $this->server->dispatch( $request );
111 111
 		$data       = $response->get_data();
112
-		$properties = $data['schema']['properties'];
112
+		$properties = $data[ 'schema' ][ 'properties' ];
113 113
 
114 114
 		$this->assertEquals( 3, count( $properties ) );
115 115
 		$this->assertArrayHasKey( 'slug', $properties );
Please login to merge, or discard this patch.
unit-tests/Tests/Version2/shipping-zones.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 				'role' => 'administrator',
27 27
 			)
28 28
 		);
29
-		$this->zones    = array();
29
+		$this->zones = array();
30 30
 	}
31 31
 
32 32
 	/**
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		$zone->set_locations( $locations );
44 44
 		$zone->save();
45 45
 
46
-		$this->zones[] = $zone;
46
+		$this->zones[ ] = $zone;
47 47
 
48 48
 		return $zone;
49 49
 	}
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
 		$this->assertEquals( count( $data ), 1 );
77 77
 		$this->assertContains(
78 78
 			array(
79
-				'id'     => $data[0]['id'],
79
+				'id'     => $data[ 0 ][ 'id' ],
80 80
 				'name'   => 'Locations not covered by your other zones',
81 81
 				'order'  => 0,
82 82
 				'_links' => array(
83 83
 					'self'        => array(
84 84
 						array(
85
-							'href' => rest_url( '/wc/v2/shipping/zones/' . $data[0]['id'] ),
85
+							'href' => rest_url( '/wc/v2/shipping/zones/' . $data[ 0 ][ 'id' ] ),
86 86
 						),
87 87
 					),
88 88
 					'collection'  => array(
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 					),
93 93
 					'describedby' => array(
94 94
 						array(
95
-							'href' => rest_url( '/wc/v2/shipping/zones/' . $data[0]['id'] . '/locations' ),
95
+							'href' => rest_url( '/wc/v2/shipping/zones/' . $data[ 0 ][ 'id' ] . '/locations' ),
96 96
 						),
97 97
 					),
98 98
 				),
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
 		$this->assertEquals( count( $data ), 2 );
111 111
 		$this->assertContains(
112 112
 			array(
113
-				'id'     => $data[1]['id'],
113
+				'id'     => $data[ 1 ][ 'id' ],
114 114
 				'name'   => 'Zone 1',
115 115
 				'order'  => 0,
116 116
 				'_links' => array(
117 117
 					'self'        => array(
118 118
 						array(
119
-							'href' => rest_url( '/wc/v2/shipping/zones/' . $data[1]['id'] ),
119
+							'href' => rest_url( '/wc/v2/shipping/zones/' . $data[ 1 ][ 'id' ] ),
120 120
 						),
121 121
 					),
122 122
 					'collection'  => array(
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 					),
127 127
 					'describedby' => array(
128 128
 						array(
129
-							'href' => rest_url( '/wc/v2/shipping/zones/' . $data[1]['id'] . '/locations' ),
129
+							'href' => rest_url( '/wc/v2/shipping/zones/' . $data[ 1 ][ 'id' ] . '/locations' ),
130 130
 						),
131 131
 					),
132 132
 				),
@@ -169,10 +169,10 @@  discard block
 block discarded – undo
169 169
 		$request    = new WP_REST_Request( 'OPTIONS', '/wc/v2/shipping/zones' );
170 170
 		$response   = $this->server->dispatch( $request );
171 171
 		$data       = $response->get_data();
172
-		$properties = $data['schema']['properties'];
172
+		$properties = $data[ 'schema' ][ 'properties' ];
173 173
 		$this->assertEquals( 3, count( $properties ) );
174 174
 		$this->assertArrayHasKey( 'id', $properties );
175
-		$this->assertTrue( $properties['id']['readonly'] );
175
+		$this->assertTrue( $properties[ 'id' ][ 'readonly' ] );
176 176
 		$this->assertArrayHasKey( 'name', $properties );
177 177
 		$this->assertArrayHasKey( 'order', $properties );
178 178
 	}
@@ -197,13 +197,13 @@  discard block
 block discarded – undo
197 197
 		$this->assertEquals( 201, $response->get_status() );
198 198
 		$this->assertEquals(
199 199
 			array(
200
-				'id'     => $data['id'],
200
+				'id'     => $data[ 'id' ],
201 201
 				'name'   => 'Test Zone',
202 202
 				'order'  => 1,
203 203
 				'_links' => array(
204 204
 					'self'        => array(
205 205
 						array(
206
-							'href' => rest_url( '/wc/v2/shipping/zones/' . $data['id'] ),
206
+							'href' => rest_url( '/wc/v2/shipping/zones/' . $data[ 'id' ] ),
207 207
 						),
208 208
 					),
209 209
 					'collection'  => array(
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 					),
214 214
 					'describedby' => array(
215 215
 						array(
216
-							'href' => rest_url( '/wc/v2/shipping/zones/' . $data['id'] . '/locations' ),
216
+							'href' => rest_url( '/wc/v2/shipping/zones/' . $data[ 'id' ] . '/locations' ),
217 217
 						),
218 218
 					),
219 219
 				),
@@ -577,16 +577,16 @@  discard block
 block discarded – undo
577 577
 		foreach ( $method->get_instance_form_fields() as $id => $field ) {
578 578
 			$data = array(
579 579
 				'id'          => $id,
580
-				'label'       => $field['title'],
581
-				'description' => ( empty( $field['description'] ) ? '' : $field['description'] ),
582
-				'type'        => $field['type'],
580
+				'label'       => $field[ 'title' ],
581
+				'description' => ( empty( $field[ 'description' ] ) ? '' : $field[ 'description' ] ),
582
+				'type'        => $field[ 'type' ],
583 583
 				'value'       => $method->instance_settings[ $id ],
584
-				'default'     => ( empty( $field['default'] ) ? '' : $field['default'] ),
585
-				'tip'         => ( empty( $field['description'] ) ? '' : $field['description'] ),
586
-				'placeholder' => ( empty( $field['placeholder'] ) ? '' : $field['placeholder'] ),
584
+				'default'     => ( empty( $field[ 'default' ] ) ? '' : $field[ 'default' ] ),
585
+				'tip'         => ( empty( $field[ 'description' ] ) ? '' : $field[ 'description' ] ),
586
+				'placeholder' => ( empty( $field[ 'placeholder' ] ) ? '' : $field[ 'placeholder' ] ),
587 587
 			);
588
-			if ( ! empty( $field['options'] ) ) {
589
-				$data['options'] = $field['options'];
588
+			if ( ! empty( $field[ 'options' ] ) ) {
589
+				$data[ 'options' ] = $field[ 'options' ];
590 590
 			}
591 591
 			$settings[ $id ] = $data;
592 592
 		}
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 		$expected = array(
597 597
 			'id'                 => $instance_id,
598 598
 			'instance_id'        => $instance_id,
599
-			'title'              => $method->instance_settings['title'],
599
+			'title'              => $method->instance_settings[ 'title' ],
600 600
 			'order'              => $method->method_order,
601 601
 			'enabled'            => ( 'yes' === $method->enabled ),
602 602
 			'method_id'          => $method->id,
@@ -679,12 +679,12 @@  discard block
 block discarded – undo
679 679
 		$response = $this->server->dispatch( $request );
680 680
 		$data     = $response->get_data();
681 681
 
682
-		$this->assertArrayHasKey( 'title', $data['settings'] );
683
-		$this->assertEquals( 'Flat rate', $data['settings']['title']['value'] );
684
-		$this->assertArrayHasKey( 'tax_status', $data['settings'] );
685
-		$this->assertEquals( 'taxable', $data['settings']['tax_status']['value'] );
686
-		$this->assertArrayHasKey( 'cost', $data['settings'] );
687
-		$this->assertEquals( '0', $data['settings']['cost']['value'] );
682
+		$this->assertArrayHasKey( 'title', $data[ 'settings' ] );
683
+		$this->assertEquals( 'Flat rate', $data[ 'settings' ][ 'title' ][ 'value' ] );
684
+		$this->assertArrayHasKey( 'tax_status', $data[ 'settings' ] );
685
+		$this->assertEquals( 'taxable', $data[ 'settings' ][ 'tax_status' ][ 'value' ] );
686
+		$this->assertArrayHasKey( 'cost', $data[ 'settings' ] );
687
+		$this->assertEquals( '0', $data[ 'settings' ][ 'cost' ][ 'value' ] );
688 688
 
689 689
 		// Update a single value
690 690
 		$request = new WP_REST_Request( 'POST', '/wc/v2/shipping/zones/' . $zone->get_id() . '/methods/' . $instance_id );
@@ -698,12 +698,12 @@  discard block
 block discarded – undo
698 698
 		$response = $this->server->dispatch( $request );
699 699
 		$data     = $response->get_data();
700 700
 
701
-		$this->assertArrayHasKey( 'title', $data['settings'] );
702
-		$this->assertEquals( 'Flat rate', $data['settings']['title']['value'] );
703
-		$this->assertArrayHasKey( 'tax_status', $data['settings'] );
704
-		$this->assertEquals( 'taxable', $data['settings']['tax_status']['value'] );
705
-		$this->assertArrayHasKey( 'cost', $data['settings'] );
706
-		$this->assertEquals( '5', $data['settings']['cost']['value'] );
701
+		$this->assertArrayHasKey( 'title', $data[ 'settings' ] );
702
+		$this->assertEquals( 'Flat rate', $data[ 'settings' ][ 'title' ][ 'value' ] );
703
+		$this->assertArrayHasKey( 'tax_status', $data[ 'settings' ] );
704
+		$this->assertEquals( 'taxable', $data[ 'settings' ][ 'tax_status' ][ 'value' ] );
705
+		$this->assertArrayHasKey( 'cost', $data[ 'settings' ] );
706
+		$this->assertEquals( '5', $data[ 'settings' ][ 'cost' ][ 'value' ] );
707 707
 
708 708
 		// Test multiple settings
709 709
 		$request = new WP_REST_Request( 'POST', '/wc/v2/shipping/zones/' . $zone->get_id() . '/methods/' . $instance_id );
@@ -718,12 +718,12 @@  discard block
 block discarded – undo
718 718
 		$response = $this->server->dispatch( $request );
719 719
 		$data     = $response->get_data();
720 720
 
721
-		$this->assertArrayHasKey( 'title', $data['settings'] );
722
-		$this->assertEquals( 'Flat rate', $data['settings']['title']['value'] );
723
-		$this->assertArrayHasKey( 'tax_status', $data['settings'] );
724
-		$this->assertEquals( 'none', $data['settings']['tax_status']['value'] );
725
-		$this->assertArrayHasKey( 'cost', $data['settings'] );
726
-		$this->assertEquals( '10', $data['settings']['cost']['value'] );
721
+		$this->assertArrayHasKey( 'title', $data[ 'settings' ] );
722
+		$this->assertEquals( 'Flat rate', $data[ 'settings' ][ 'title' ][ 'value' ] );
723
+		$this->assertArrayHasKey( 'tax_status', $data[ 'settings' ] );
724
+		$this->assertEquals( 'none', $data[ 'settings' ][ 'tax_status' ][ 'value' ] );
725
+		$this->assertArrayHasKey( 'cost', $data[ 'settings' ] );
726
+		$this->assertEquals( '10', $data[ 'settings' ][ 'cost' ][ 'value' ] );
727 727
 
728 728
 		// Test bogus
729 729
 		$request = new WP_REST_Request( 'POST', '/wc/v2/shipping/zones/' . $zone->get_id() . '/methods/' . $instance_id );
@@ -739,8 +739,8 @@  discard block
 block discarded – undo
739 739
 		$this->assertEquals( 400, $response->get_status() );
740 740
 
741 741
 		// Test other parameters
742
-		$this->assertTrue( $data['enabled'] );
743
-		$this->assertEquals( 1, $data['order'] );
742
+		$this->assertTrue( $data[ 'enabled' ] );
743
+		$this->assertEquals( 1, $data[ 'order' ] );
744 744
 
745 745
 		$request = new WP_REST_Request( 'POST', '/wc/v2/shipping/zones/' . $zone->get_id() . '/methods/' . $instance_id );
746 746
 		$request->set_body_params(
@@ -752,10 +752,10 @@  discard block
 block discarded – undo
752 752
 		$response = $this->server->dispatch( $request );
753 753
 		$data     = $response->get_data();
754 754
 
755
-		$this->assertFalse( $data['enabled'] );
756
-		$this->assertEquals( 2, $data['order'] );
757
-		$this->assertArrayHasKey( 'cost', $data['settings'] );
758
-		$this->assertEquals( '10', $data['settings']['cost']['value'] );
755
+		$this->assertFalse( $data[ 'enabled' ] );
756
+		$this->assertEquals( 2, $data[ 'order' ] );
757
+		$this->assertArrayHasKey( 'cost', $data[ 'settings' ] );
758
+		$this->assertEquals( '10', $data[ 'settings' ][ 'cost' ][ 'value' ] );
759 759
 	}
760 760
 
761 761
 	/**
@@ -776,10 +776,10 @@  discard block
 block discarded – undo
776 776
 		$response = $this->server->dispatch( $request );
777 777
 		$data     = $response->get_data();
778 778
 
779
-		$this->assertFalse( $data['enabled'] );
780
-		$this->assertEquals( 2, $data['order'] );
781
-		$this->assertArrayHasKey( 'cost', $data['settings'] );
782
-		$this->assertEquals( '0', $data['settings']['cost']['value'] );
779
+		$this->assertFalse( $data[ 'enabled' ] );
780
+		$this->assertEquals( 2, $data[ 'order' ] );
781
+		$this->assertArrayHasKey( 'cost', $data[ 'settings' ] );
782
+		$this->assertEquals( '0', $data[ 'settings' ][ 'cost' ][ 'value' ] );
783 783
 	}
784 784
 
785 785
 	/**
Please login to merge, or discard this patch.
unit-tests/Tests/Version2/settings.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		$request    = new WP_REST_Request( 'OPTIONS', '/wc/v2/settings' );
123 123
 		$response   = $this->server->dispatch( $request );
124 124
 		$data       = $response->get_data();
125
-		$properties = $data['schema']['properties'];
125
+		$properties = $data[ 'schema' ][ 'properties' ];
126 126
 		$this->assertEquals( 5, count( $properties ) );
127 127
 		$this->assertArrayHasKey( 'id', $properties );
128 128
 		$this->assertArrayHasKey( 'parent_id', $properties );
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 		$request    = new WP_REST_Request( 'OPTIONS', '/wc/v2/settings/test/woocommerce_shop_page_display' );
141 141
 		$response   = $this->server->dispatch( $request );
142 142
 		$data       = $response->get_data();
143
-		$properties = $data['schema']['properties'];
143
+		$properties = $data[ 'schema' ][ 'properties' ];
144 144
 		$this->assertEquals( 9, count( $properties ) );
145 145
 		$this->assertArrayHasKey( 'id', $properties );
146 146
 		$this->assertArrayHasKey( 'label', $properties );
@@ -177,8 +177,8 @@  discard block
 block discarded – undo
177 177
 		$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/settings/test' ) );
178 178
 		$data     = $response->get_data();
179 179
 		$this->assertEquals( 1, count( $data ) );
180
-		$this->assertEquals( 'woocommerce_shop_page_display', $data[0]['id'] );
181
-		$this->assertEmpty( $data[0]['value'] );
180
+		$this->assertEquals( 'woocommerce_shop_page_display', $data[ 0 ][ 'id' ] );
181
+		$this->assertEmpty( $data[ 0 ][ 'value' ] );
182 182
 	}
183 183
 
184 184
 	/**
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 		// test defaults first
205 205
 		$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/settings/test/woocommerce_shop_page_display' ) );
206 206
 		$data     = $response->get_data();
207
-		$this->assertEquals( '', $data['value'] );
207
+		$this->assertEquals( '', $data[ 'value' ] );
208 208
 
209 209
 		// test updating shop display setting
210 210
 		$request = new WP_REST_Request( 'PUT', sprintf( '/wc/v2/settings/%s/%s', 'test', 'woocommerce_shop_page_display' ) );
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 		$response = $this->server->dispatch( $request );
217 217
 		$data     = $response->get_data();
218 218
 
219
-		$this->assertEquals( 'both', $data['value'] );
219
+		$this->assertEquals( 'both', $data[ 'value' ] );
220 220
 		$this->assertEquals( 'both', get_option( 'woocommerce_shop_page_display' ) );
221 221
 
222 222
 		$request = new WP_REST_Request( 'PUT', sprintf( '/wc/v2/settings/%s/%s', 'test', 'woocommerce_shop_page_display' ) );
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 		$response = $this->server->dispatch( $request );
229 229
 		$data     = $response->get_data();
230 230
 
231
-		$this->assertEquals( 'subcategories', $data['value'] );
231
+		$this->assertEquals( 'subcategories', $data[ 'value' ] );
232 232
 		$this->assertEquals( 'subcategories', get_option( 'woocommerce_shop_page_display' ) );
233 233
 
234 234
 		$request = new WP_REST_Request( 'PUT', sprintf( '/wc/v2/settings/%s/%s', 'test', 'woocommerce_shop_page_display' ) );
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 		$response = $this->server->dispatch( $request );
241 241
 		$data     = $response->get_data();
242 242
 
243
-		$this->assertEquals( '', $data['value'] );
243
+		$this->assertEquals( '', $data[ 'value' ] );
244 244
 		$this->assertEquals( '', get_option( 'woocommerce_shop_page_display' ) );
245 245
 	}
246 246
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 		// test defaults first
256 256
 		$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/settings/test' ) );
257 257
 		$data     = $response->get_data();
258
-		$this->assertEquals( '', $data[0]['value'] );
258
+		$this->assertEquals( '', $data[ 0 ][ 'value' ] );
259 259
 
260 260
 		// test setting both at once
261 261
 		$request = new WP_REST_Request( 'POST', '/wc/v2/settings/test/batch' );
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 		$response = $this->server->dispatch( $request );
273 273
 		$data     = $response->get_data();
274 274
 
275
-		$this->assertEquals( 'both', $data['update'][0]['value'] );
275
+		$this->assertEquals( 'both', $data[ 'update' ][ 0 ][ 'value' ] );
276 276
 		$this->assertEquals( 'both', get_option( 'woocommerce_shop_page_display' ) );
277 277
 
278 278
 		// test updating one, but making sure the other value stays the same
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 		);
290 290
 		$response = $this->server->dispatch( $request );
291 291
 		$data     = $response->get_data();
292
-		$this->assertEquals( 'subcategories', $data['update'][0]['value'] );
292
+		$this->assertEquals( 'subcategories', $data[ 'update' ][ 0 ][ 'value' ] );
293 293
 		$this->assertEquals( 'subcategories', get_option( 'woocommerce_shop_page_display' ) );
294 294
 	}
295 295
 
@@ -317,11 +317,11 @@  discard block
 block discarded – undo
317 317
 
318 318
 		$this->assertEquals( 200, $response->get_status() );
319 319
 
320
-		$this->assertEquals( 'woocommerce_shop_page_display', $data['id'] );
321
-		$this->assertEquals( 'Shop page display', $data['label'] );
322
-		$this->assertEquals( '', $data['default'] );
323
-		$this->assertEquals( 'select', $data['type'] );
324
-		$this->assertEquals( '', $data['value'] );
320
+		$this->assertEquals( 'woocommerce_shop_page_display', $data[ 'id' ] );
321
+		$this->assertEquals( 'Shop page display', $data[ 'label' ] );
322
+		$this->assertEquals( '', $data[ 'default' ] );
323
+		$this->assertEquals( 'select', $data[ 'type' ] );
324
+		$this->assertEquals( '', $data[ 'value' ] );
325 325
 	}
326 326
 
327 327
 	/**
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 		$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/settings/products/woocommerce_dimension_unit' ) );
485 485
 		$data     = $response->get_data();
486 486
 
487
-		$this->assertEquals( 'cm', $data['default'] );
487
+		$this->assertEquals( 'cm', $data[ 'default' ] );
488 488
 
489 489
 		// test update
490 490
 		$request = new WP_REST_Request( 'PUT', sprintf( '/wc/v2/settings/%s/%s', 'products', 'woocommerce_dimension_unit' ) );
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 		$response = $this->server->dispatch( $request );
497 497
 		$data     = $response->get_data();
498 498
 
499
-		$this->assertEquals( 'yd', $data['value'] );
499
+		$this->assertEquals( 'yd', $data[ 'value' ] );
500 500
 		$this->assertEquals( 'yd', get_option( 'woocommerce_dimension_unit' ) );
501 501
 	}
502 502
 
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 		$response = $this->server->dispatch( $request );
584 584
 		$setting  = $response->get_data();
585 585
 
586
-		$this->assertEmpty( $setting['value'] );
586
+		$this->assertEmpty( $setting[ 'value' ] );
587 587
 
588 588
 		// test update
589 589
 		$request = new WP_REST_Request( 'PUT', sprintf( '/wc/v2/settings/%s/%s', 'email_customer_new_account', 'subject' ) );
@@ -595,13 +595,13 @@  discard block
 block discarded – undo
595 595
 		$response = $this->server->dispatch( $request );
596 596
 		$setting  = $response->get_data();
597 597
 
598
-		$this->assertEquals( 'This is my new subject', $setting['value'] );
598
+		$this->assertEquals( 'This is my new subject', $setting[ 'value' ] );
599 599
 
600 600
 		// make sure the other is what we left it
601 601
 		$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/settings/email_new_order/subject' ) );
602 602
 		$setting  = $response->get_data();
603 603
 
604
-		$this->assertEquals( 'This is my subject', $setting['value'] );
604
+		$this->assertEquals( 'This is my subject', $setting[ 'value' ] );
605 605
 	}
606 606
 
607 607
 	/**
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
 
683 683
 		$response = $this->server->dispatch( new WP_REST_Request( 'GET', sprintf( '/wc/v2/settings/%s/%s', 'general', 'woocommerce_specific_allowed_countries' ) ) );
684 684
 		$setting  = $response->get_data();
685
-		$this->assertEmpty( $setting['value'] );
685
+		$this->assertEmpty( $setting[ 'value' ] );
686 686
 
687 687
 		$request = new WP_REST_Request( 'PUT', sprintf( '/wc/v2/settings/%s/%s', 'general', 'woocommerce_specific_allowed_countries' ) );
688 688
 		$request->set_body_params(
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 		);
693 693
 		$response = $this->server->dispatch( $request );
694 694
 		$setting  = $response->get_data();
695
-		$this->assertEquals( array( 'AX', 'DZ' ), $setting['value'] );
695
+		$this->assertEquals( array( 'AX', 'DZ' ), $setting[ 'value' ] );
696 696
 	}
697 697
 
698 698
 	/**
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
 
706 706
 		$response = $this->server->dispatch( new WP_REST_Request( 'GET', sprintf( '/wc/v2/settings/%s/%s', 'products', 'woocommerce_weight_unit' ) ) );
707 707
 		$setting  = $response->get_data();
708
-		$this->assertEquals( 'kg', $setting['value'] );
708
+		$this->assertEquals( 'kg', $setting[ 'value' ] );
709 709
 
710 710
 		// invalid
711 711
 		$request = new WP_REST_Request( 'PUT', sprintf( '/wc/v2/settings/%s/%s', 'products', 'woocommerce_weight_unit' ) );
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 		);
727 727
 		$response = $this->server->dispatch( $request );
728 728
 		$setting  = $response->get_data();
729
-		$this->assertEquals( 'lbs', $setting['value'] );
729
+		$this->assertEquals( 'lbs', $setting[ 'value' ] );
730 730
 	}
731 731
 
732 732
 	/**
@@ -741,9 +741,9 @@  discard block
 block discarded – undo
741 741
 		$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/settings/general/woocommerce_default_country' ) );
742 742
 		$setting  = $response->get_data();
743 743
 
744
-		$this->assertEquals( 'select', $setting['type'] );
745
-		$this->assertArrayHasKey( 'GB', $setting['options'] );
746
-		$this->assertArrayHasKey( 'US:OR', $setting['options'] );
744
+		$this->assertEquals( 'select', $setting[ 'type' ] );
745
+		$this->assertArrayHasKey( 'GB', $setting[ 'options' ] );
746
+		$this->assertArrayHasKey( 'US:OR', $setting[ 'options' ] );
747 747
 	}
748 748
 
749 749
 	/**
@@ -755,10 +755,10 @@  discard block
 block discarded – undo
755 755
 		wp_set_current_user( $this->user );
756 756
 		$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/settings/general/woocommerce_store_address' ) );
757 757
 		$setting  = $response->get_data();
758
-		$this->assertEquals( 'text', $setting['type'] );
758
+		$this->assertEquals( 'text', $setting[ 'type' ] );
759 759
 
760 760
 		// Repalce the old value with something uniquely new
761
-		$old_value = $setting['value'];
761
+		$old_value = $setting[ 'value' ];
762 762
 		$new_value = $old_value . ' ' . rand( 1000, 9999 );
763 763
 		$request   = new WP_REST_Request( 'PUT', '/wc/v2/settings/general/woocommerce_store_address' );
764 764
 		$request->set_body_params(
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
 		);
769 769
 		$response = $this->server->dispatch( $request );
770 770
 		$setting  = $response->get_data();
771
-		$this->assertEquals( $new_value, $setting['value'] );
771
+		$this->assertEquals( $new_value, $setting[ 'value' ] );
772 772
 
773 773
 		// Put the original value back
774 774
 		$request = new WP_REST_Request( 'PUT', '/wc/v2/settings/general/woocommerce_store_address' );
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
 		);
780 780
 		$response = $this->server->dispatch( $request );
781 781
 		$setting  = $response->get_data();
782
-		$this->assertEquals( $old_value, $setting['value'] );
782
+		$this->assertEquals( $old_value, $setting[ 'value' ] );
783 783
 	}
784 784
 
785 785
 	/**
@@ -791,10 +791,10 @@  discard block
 block discarded – undo
791 791
 		wp_set_current_user( $this->user );
792 792
 		$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/settings/general/woocommerce_store_address_2' ) );
793 793
 		$setting  = $response->get_data();
794
-		$this->assertEquals( 'text', $setting['type'] );
794
+		$this->assertEquals( 'text', $setting[ 'type' ] );
795 795
 
796 796
 		// Repalce the old value with something uniquely new
797
-		$old_value = $setting['value'];
797
+		$old_value = $setting[ 'value' ];
798 798
 		$new_value = $old_value . ' ' . rand( 1000, 9999 );
799 799
 		$request   = new WP_REST_Request( 'PUT', '/wc/v2/settings/general/woocommerce_store_address_2' );
800 800
 		$request->set_body_params(
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 		);
805 805
 		$response = $this->server->dispatch( $request );
806 806
 		$setting  = $response->get_data();
807
-		$this->assertEquals( $new_value, $setting['value'] );
807
+		$this->assertEquals( $new_value, $setting[ 'value' ] );
808 808
 
809 809
 		// Put the original value back
810 810
 		$request = new WP_REST_Request( 'PUT', '/wc/v2/settings/general/woocommerce_store_address_2' );
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
 		);
816 816
 		$response = $this->server->dispatch( $request );
817 817
 		$setting  = $response->get_data();
818
-		$this->assertEquals( $old_value, $setting['value'] );
818
+		$this->assertEquals( $old_value, $setting[ 'value' ] );
819 819
 	}
820 820
 
821 821
 	/**
@@ -827,10 +827,10 @@  discard block
 block discarded – undo
827 827
 		wp_set_current_user( $this->user );
828 828
 		$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/settings/general/woocommerce_store_city' ) );
829 829
 		$setting  = $response->get_data();
830
-		$this->assertEquals( 'text', $setting['type'] );
830
+		$this->assertEquals( 'text', $setting[ 'type' ] );
831 831
 
832 832
 		// Repalce the old value with something uniquely new
833
-		$old_value = $setting['value'];
833
+		$old_value = $setting[ 'value' ];
834 834
 		$new_value = $old_value . ' ' . rand( 1000, 9999 );
835 835
 		$request   = new WP_REST_Request( 'PUT', '/wc/v2/settings/general/woocommerce_store_city' );
836 836
 		$request->set_body_params(
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 		);
841 841
 		$response = $this->server->dispatch( $request );
842 842
 		$setting  = $response->get_data();
843
-		$this->assertEquals( $new_value, $setting['value'] );
843
+		$this->assertEquals( $new_value, $setting[ 'value' ] );
844 844
 
845 845
 		// Put the original value back
846 846
 		$request = new WP_REST_Request( 'PUT', '/wc/v2/settings/general/woocommerce_store_city' );
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
 		);
852 852
 		$response = $this->server->dispatch( $request );
853 853
 		$setting  = $response->get_data();
854
-		$this->assertEquals( $old_value, $setting['value'] );
854
+		$this->assertEquals( $old_value, $setting[ 'value' ] );
855 855
 	}
856 856
 
857 857
 	/**
@@ -863,10 +863,10 @@  discard block
 block discarded – undo
863 863
 		wp_set_current_user( $this->user );
864 864
 		$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/settings/general/woocommerce_store_postcode' ) );
865 865
 		$setting  = $response->get_data();
866
-		$this->assertEquals( 'text', $setting['type'] );
866
+		$this->assertEquals( 'text', $setting[ 'type' ] );
867 867
 
868 868
 		// Repalce the old value with something uniquely new
869
-		$old_value = $setting['value'];
869
+		$old_value = $setting[ 'value' ];
870 870
 		$new_value = $old_value . ' ' . rand( 1000, 9999 );
871 871
 		$request   = new WP_REST_Request( 'PUT', '/wc/v2/settings/general/woocommerce_store_postcode' );
872 872
 		$request->set_body_params(
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 		);
877 877
 		$response = $this->server->dispatch( $request );
878 878
 		$setting  = $response->get_data();
879
-		$this->assertEquals( $new_value, $setting['value'] );
879
+		$this->assertEquals( $new_value, $setting[ 'value' ] );
880 880
 
881 881
 		// Put the original value back
882 882
 		$request = new WP_REST_Request( 'PUT', '/wc/v2/settings/general/woocommerce_store_postcode' );
@@ -887,6 +887,6 @@  discard block
 block discarded – undo
887 887
 		);
888 888
 		$response = $this->server->dispatch( $request );
889 889
 		$setting  = $response->get_data();
890
-		$this->assertEquals( $old_value, $setting['value'] );
890
+		$this->assertEquals( $old_value, $setting[ 'value' ] );
891 891
 	}
892 892
 }
Please login to merge, or discard this patch.
unit-tests/Tests/Version2/product-variations.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 		$variations = $response->get_data();
46 46
 		$this->assertEquals( 200, $response->get_status() );
47 47
 		$this->assertEquals( 2, count( $variations ) );
48
-		$this->assertEquals( 'DUMMY SKU VARIABLE LARGE', $variations[0]['sku'] );
49
-		$this->assertEquals( 'size', $variations[0]['attributes'][0]['name'] );
48
+		$this->assertEquals( 'DUMMY SKU VARIABLE LARGE', $variations[ 0 ][ 'sku' ] );
49
+		$this->assertEquals( 'size', $variations[ 0 ][ 'attributes' ][ 0 ][ 'name' ] );
50 50
 	}
51 51
 
52 52
 	/**
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
 		wp_set_current_user( $this->user );
71 71
 		$product      = \Automattic\WooCommerce\RestApi\UnitTests\Helpers\ProductHelper::create_variation_product();
72 72
 		$children     = $product->get_children();
73
-		$variation_id = $children[0];
73
+		$variation_id = $children[ 0 ];
74 74
 
75 75
 		$response  = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/products/' . $product->get_id() . '/variations/' . $variation_id ) );
76 76
 		$variation = $response->get_data();
77 77
 
78 78
 		$this->assertEquals( 200, $response->get_status() );
79
-		$this->assertEquals( $variation_id, $variation['id'] );
80
-		$this->assertEquals( 'size', $variation['attributes'][0]['name'] );
79
+		$this->assertEquals( $variation_id, $variation[ 'id' ] );
80
+		$this->assertEquals( 'size', $variation[ 'attributes' ][ 0 ][ 'name' ] );
81 81
 	}
82 82
 
83 83
 	/**
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 		wp_set_current_user( 0 );
90 90
 		$product      = \Automattic\WooCommerce\RestApi\UnitTests\Helpers\ProductHelper::create_variation_product();
91 91
 		$children     = $product->get_children();
92
-		$variation_id = $children[0];
92
+		$variation_id = $children[ 0 ];
93 93
 		$response     = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/products/' . $product->get_id() . '/variations/' . $variation_id ) );
94 94
 		$this->assertEquals( 401, $response->get_status() );
95 95
 	}
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		wp_set_current_user( $this->user );
104 104
 		$product      = \Automattic\WooCommerce\RestApi\UnitTests\Helpers\ProductHelper::create_variation_product();
105 105
 		$children     = $product->get_children();
106
-		$variation_id = $children[0];
106
+		$variation_id = $children[ 0 ];
107 107
 
108 108
 		$request = new WP_REST_Request( 'DELETE', '/wc/v2/products/' . $product->get_id() . '/variations/' . $variation_id );
109 109
 		$request->set_param( 'force', true );
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 		wp_set_current_user( 0 );
125 125
 		$product      = \Automattic\WooCommerce\RestApi\UnitTests\Helpers\ProductHelper::create_variation_product();
126 126
 		$children     = $product->get_children();
127
-		$variation_id = $children[0];
127
+		$variation_id = $children[ 0 ];
128 128
 
129 129
 		$request = new WP_REST_Request( 'DELETE', '/wc/v2/products/' . $product->get_id() . '/variations/' . $variation_id );
130 130
 		$request->set_param( 'force', true );
@@ -155,15 +155,15 @@  discard block
 block discarded – undo
155 155
 		wp_set_current_user( $this->user );
156 156
 		$product      = \Automattic\WooCommerce\RestApi\UnitTests\Helpers\ProductHelper::create_variation_product();
157 157
 		$children     = $product->get_children();
158
-		$variation_id = $children[0];
158
+		$variation_id = $children[ 0 ];
159 159
 
160 160
 		$response  = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/products/' . $product->get_id() . '/variations/' . $variation_id ) );
161 161
 		$variation = $response->get_data();
162 162
 
163
-		$this->assertEquals( 'DUMMY SKU VARIABLE SMALL', $variation['sku'] );
164
-		$this->assertEquals( 10, $variation['regular_price'] );
165
-		$this->assertEmpty( $variation['sale_price'] );
166
-		$this->assertEquals( 'small', $variation['attributes'][0]['option'] );
163
+		$this->assertEquals( 'DUMMY SKU VARIABLE SMALL', $variation[ 'sku' ] );
164
+		$this->assertEquals( 10, $variation[ 'regular_price' ] );
165
+		$this->assertEmpty( $variation[ 'sale_price' ] );
166
+		$this->assertEquals( 'small', $variation[ 'attributes' ][ 0 ][ 'option' ] );
167 167
 
168 168
 		$request = new WP_REST_Request( 'PUT', '/wc/v2/products/' . $product->get_id() . '/variations/' . $variation_id );
169 169
 		$request->set_body_params(
@@ -187,15 +187,15 @@  discard block
 block discarded – undo
187 187
 		$response  = $this->server->dispatch( $request );
188 188
 		$variation = $response->get_data();
189 189
 
190
-		$this->assertTrue( isset( $variation['description'] ), print_r( $variation, true ) );
191
-		$this->assertContains( 'O_O', $variation['description'], print_r( $variation, true ) );
192
-		$this->assertEquals( '8', $variation['price'], print_r( $variation, true ) );
193
-		$this->assertEquals( '8', $variation['sale_price'], print_r( $variation, true ) );
194
-		$this->assertEquals( '10', $variation['regular_price'], print_r( $variation, true ) );
195
-		$this->assertEquals( 'FIXED-SKU', $variation['sku'], print_r( $variation, true ) );
196
-		$this->assertEquals( 'medium', $variation['attributes'][0]['option'], print_r( $variation, true ) );
197
-		$this->assertContains( 'Dr1Bczxq4q', $variation['image']['src'], print_r( $variation, true ) );
198
-		$this->assertContains( 'test upload image', $variation['image']['alt'], print_r( $variation, true ) );
190
+		$this->assertTrue( isset( $variation[ 'description' ] ), print_r( $variation, true ) );
191
+		$this->assertContains( 'O_O', $variation[ 'description' ], print_r( $variation, true ) );
192
+		$this->assertEquals( '8', $variation[ 'price' ], print_r( $variation, true ) );
193
+		$this->assertEquals( '8', $variation[ 'sale_price' ], print_r( $variation, true ) );
194
+		$this->assertEquals( '10', $variation[ 'regular_price' ], print_r( $variation, true ) );
195
+		$this->assertEquals( 'FIXED-SKU', $variation[ 'sku' ], print_r( $variation, true ) );
196
+		$this->assertEquals( 'medium', $variation[ 'attributes' ][ 0 ][ 'option' ], print_r( $variation, true ) );
197
+		$this->assertContains( 'Dr1Bczxq4q', $variation[ 'image' ][ 'src' ], print_r( $variation, true ) );
198
+		$this->assertContains( 'test upload image', $variation[ 'image' ][ 'alt' ], print_r( $variation, true ) );
199 199
 	}
200 200
 
201 201
 	/**
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 		wp_set_current_user( 0 );
208 208
 		$product      = \Automattic\WooCommerce\RestApi\UnitTests\Helpers\ProductHelper::create_variation_product();
209 209
 		$children     = $product->get_children();
210
-		$variation_id = $children[0];
210
+		$variation_id = $children[ 0 ];
211 211
 
212 212
 		$request = new WP_REST_Request( 'PUT', '/wc/v2/products/' . $product->get_id() . '/variations/' . $variation_id );
213 213
 		$request->set_body_params(
@@ -267,12 +267,12 @@  discard block
 block discarded – undo
267 267
 		$response  = $this->server->dispatch( $request );
268 268
 		$variation = $response->get_data();
269 269
 
270
-		$this->assertContains( 'A medium size.', $variation['description'] );
271
-		$this->assertEquals( '12', $variation['price'] );
272
-		$this->assertEquals( '12', $variation['regular_price'] );
273
-		$this->assertTrue( $variation['purchasable'] );
274
-		$this->assertEquals( 'DUMMY SKU VARIABLE MEDIUM', $variation['sku'] );
275
-		$this->assertEquals( 'medium', $variation['attributes'][0]['option'] );
270
+		$this->assertContains( 'A medium size.', $variation[ 'description' ] );
271
+		$this->assertEquals( '12', $variation[ 'price' ] );
272
+		$this->assertEquals( '12', $variation[ 'regular_price' ] );
273
+		$this->assertTrue( $variation[ 'purchasable' ] );
274
+		$this->assertEquals( 'DUMMY SKU VARIABLE MEDIUM', $variation[ 'sku' ] );
275
+		$this->assertEquals( 'medium', $variation[ 'attributes' ][ 0 ][ 'option' ] );
276 276
 
277 277
 		$response   = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/products/' . $product->get_id() . '/variations' ) );
278 278
 		$variations = $response->get_data();
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 			array(
319 319
 				'update' => array(
320 320
 					array(
321
-						'id'          => $children[0],
321
+						'id'          => $children[ 0 ],
322 322
 						'description' => 'Updated description.',
323 323
 						'image'       => array(
324 324
 							'position' => 0,
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 					),
329 329
 				),
330 330
 				'delete' => array(
331
-					$children[1],
331
+					$children[ 1 ],
332 332
 				),
333 333
 				'create' => array(
334 334
 					array(
@@ -348,10 +348,10 @@  discard block
 block discarded – undo
348 348
 		$response = $this->server->dispatch( $request );
349 349
 		$data     = $response->get_data();
350 350
 
351
-		$this->assertContains( 'Updated description.', $data['update'][0]['description'] );
352
-		$this->assertEquals( 'DUMMY SKU VARIABLE MEDIUM', $data['create'][0]['sku'] );
353
-		$this->assertEquals( 'medium', $data['create'][0]['attributes'][0]['option'] );
354
-		$this->assertEquals( $children[1], $data['delete'][0]['id'] );
351
+		$this->assertContains( 'Updated description.', $data[ 'update' ][ 0 ][ 'description' ] );
352
+		$this->assertEquals( 'DUMMY SKU VARIABLE MEDIUM', $data[ 'create' ][ 0 ][ 'sku' ] );
353
+		$this->assertEquals( 'medium', $data[ 'create' ][ 0 ][ 'attributes' ][ 0 ][ 'option' ] );
354
+		$this->assertEquals( $children[ 1 ], $data[ 'delete' ][ 0 ][ 'id' ] );
355 355
 
356 356
 		$request  = new WP_REST_Request( 'GET', '/wc/v2/products/' . $product->get_id() . '/variations' );
357 357
 		$response = $this->server->dispatch( $request );
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 		$request    = new WP_REST_Request( 'OPTIONS', '/wc/v2/products/' . $product->get_id() . '/variations' );
372 372
 		$response   = $this->server->dispatch( $request );
373 373
 		$data       = $response->get_data();
374
-		$properties = $data['schema']['properties'];
374
+		$properties = $data[ 'schema' ][ 'properties' ];
375 375
 
376 376
 		$this->assertEquals( 37, count( $properties ) );
377 377
 		$this->assertArrayHasKey( 'id', $properties );
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 		$product->save();
425 425
 
426 426
 		$children     = $product->get_children();
427
-		$variation_id = $children[0];
427
+		$variation_id = $children[ 0 ];
428 428
 
429 429
 		// Set stock to true.
430 430
 		$request = new WP_REST_Request( 'PUT', '/wc/v2/products/' . $product->get_id() . '/variations/' . $variation_id );
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 		$variation = $response->get_data();
439 439
 
440 440
 		$this->assertEquals( 200, $response->get_status() );
441
-		$this->assertEquals( true, $variation['manage_stock'] );
441
+		$this->assertEquals( true, $variation[ 'manage_stock' ] );
442 442
 
443 443
 		// Set stock to false.
444 444
 		$request = new WP_REST_Request( 'PUT', '/wc/v2/products/' . $product->get_id() . '/variations/' . $variation_id );
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 		$variation = $response->get_data();
453 453
 
454 454
 		$this->assertEquals( 200, $response->get_status() );
455
-		$this->assertEquals( false, $variation['manage_stock'] );
455
+		$this->assertEquals( false, $variation[ 'manage_stock' ] );
456 456
 
457 457
 		// Set stock to false but parent is managing stock.
458 458
 		$product->set_manage_stock( true );
@@ -468,6 +468,6 @@  discard block
 block discarded – undo
468 468
 		$variation = $response->get_data();
469 469
 
470 470
 		$this->assertEquals( 200, $response->get_status() );
471
-		$this->assertEquals( 'parent', $variation['manage_stock'] );
471
+		$this->assertEquals( 'parent', $variation[ 'manage_stock' ] );
472 472
 	}
473 473
 }
Please login to merge, or discard this patch.
unit-tests/Tests/Version2/coupons.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -194,13 +194,13 @@  discard block
 block discarded – undo
194 194
 		$this->assertEquals( 201, $response->get_status() );
195 195
 		$this->assertEquals(
196 196
 			array(
197
-				'id'                          => $data['id'],
197
+				'id'                          => $data[ 'id' ],
198 198
 				'code'                        => 'test',
199 199
 				'amount'                      => '5.00',
200
-				'date_created'                => $data['date_created'],
201
-				'date_created_gmt'            => $data['date_created_gmt'],
202
-				'date_modified'               => $data['date_modified'],
203
-				'date_modified_gmt'           => $data['date_modified_gmt'],
200
+				'date_created'                => $data[ 'date_created' ],
201
+				'date_created_gmt'            => $data[ 'date_created_gmt' ],
202
+				'date_modified'               => $data[ 'date_modified' ],
203
+				'date_modified_gmt'           => $data[ 'date_modified_gmt' ],
204 204
 				'discount_type'               => 'fixed_product',
205 205
 				'description'                 => 'Test',
206 206
 				'date_expires'                => null,
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
 
281 281
 		$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/coupons/' . $coupon->get_id() ) );
282 282
 		$data     = $response->get_data();
283
-		$this->assertEquals( 'This is a dummy coupon', $data['description'] );
284
-		$this->assertEquals( 'fixed_cart', $data['discount_type'] );
285
-		$this->assertEquals( '1.00', $data['amount'] );
283
+		$this->assertEquals( 'This is a dummy coupon', $data[ 'description' ] );
284
+		$this->assertEquals( 'fixed_cart', $data[ 'discount_type' ] );
285
+		$this->assertEquals( '1.00', $data[ 'amount' ] );
286 286
 
287 287
 		$request = new WP_REST_Request( 'PUT', '/wc/v2/coupons/' . $coupon->get_id() );
288 288
 		$request->set_body_params(
@@ -294,9 +294,9 @@  discard block
 block discarded – undo
294 294
 		$response = $this->server->dispatch( $request );
295 295
 		$data     = $response->get_data();
296 296
 
297
-		$this->assertEquals( '10.00', $data['amount'] );
298
-		$this->assertEquals( 'New description', $data['description'] );
299
-		$this->assertEquals( 'fixed_cart', $data['discount_type'] );
297
+		$this->assertEquals( '10.00', $data[ 'amount' ] );
298
+		$this->assertEquals( 'New description', $data[ 'description' ] );
299
+		$this->assertEquals( 'fixed_cart', $data[ 'discount_type' ] );
300 300
 	}
301 301
 
302 302
 	/**
@@ -416,11 +416,11 @@  discard block
 block discarded – undo
416 416
 		$response = $this->server->dispatch( $request );
417 417
 		$data     = $response->get_data();
418 418
 
419
-		$this->assertEquals( '5.15', $data['update'][0]['amount'] );
420
-		$this->assertEquals( '11.00', $data['create'][0]['amount'] );
421
-		$this->assertEquals( 'new-coupon', $data['create'][0]['code'] );
422
-		$this->assertEquals( $coupon_2->get_id(), $data['delete'][0]['id'] );
423
-		$this->assertEquals( $coupon_3->get_id(), $data['delete'][1]['id'] );
419
+		$this->assertEquals( '5.15', $data[ 'update' ][ 0 ][ 'amount' ] );
420
+		$this->assertEquals( '11.00', $data[ 'create' ][ 0 ][ 'amount' ] );
421
+		$this->assertEquals( 'new-coupon', $data[ 'create' ][ 0 ][ 'code' ] );
422
+		$this->assertEquals( $coupon_2->get_id(), $data[ 'delete' ][ 0 ][ 'id' ] );
423
+		$this->assertEquals( $coupon_3->get_id(), $data[ 'delete' ][ 1 ][ 'id' ] );
424 424
 
425 425
 		$request  = new WP_REST_Request( 'GET', '/wc/v2/coupons' );
426 426
 		$response = $this->server->dispatch( $request );
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 		$request    = new WP_REST_Request( 'OPTIONS', '/wc/v2/coupons' );
439 439
 		$response   = $this->server->dispatch( $request );
440 440
 		$data       = $response->get_data();
441
-		$properties = $data['schema']['properties'];
441
+		$properties = $data[ 'schema' ][ 'properties' ];
442 442
 
443 443
 		$this->assertEquals( 27, count( $properties ) );
444 444
 		$this->assertArrayHasKey( 'id', $properties );
Please login to merge, or discard this patch.
unit-tests/Tests/Version2/orders.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
 		// Create 10 orders.
48 48
 		for ( $i = 0; $i < 10; $i++ ) {
49
-			$this->orders[] = \Automattic\WooCommerce\RestApi\UnitTests\Helpers\OrderHelper::create_order( $this->user );
49
+			$this->orders[ ] = \Automattic\WooCommerce\RestApi\UnitTests\Helpers\OrderHelper::create_order( $this->user );
50 50
 		}
51 51
 
52 52
 		$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/orders' ) );
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	public function test_get_items_without_permission() {
65 65
 		wp_set_current_user( 0 );
66
-		$this->orders[] = \Automattic\WooCommerce\RestApi\UnitTests\Helpers\OrderHelper::create_order();
66
+		$this->orders[ ] = \Automattic\WooCommerce\RestApi\UnitTests\Helpers\OrderHelper::create_order();
67 67
 		$response       = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/orders' ) );
68 68
 		$this->assertEquals( 401, $response->get_status() );
69 69
 	}
@@ -78,18 +78,18 @@  discard block
 block discarded – undo
78 78
 		$order->add_meta_data( 'key', 'value' );
79 79
 		$order->add_meta_data( 'key2', 'value2' );
80 80
 		$order->save();
81
-		$this->orders[] = $order;
81
+		$this->orders[ ] = $order;
82 82
 		$response       = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/orders/' . $order->get_id() ) );
83 83
 		$data           = $response->get_data();
84 84
 
85 85
 		$this->assertEquals( 200, $response->get_status() );
86
-		$this->assertEquals( $order->get_id(), $data['id'] );
86
+		$this->assertEquals( $order->get_id(), $data[ 'id' ] );
87 87
 
88 88
 		// Test meta data is set.
89
-		$this->assertEquals( 'key', $data['meta_data'][0]->key );
90
-		$this->assertEquals( 'value', $data['meta_data'][0]->value );
91
-		$this->assertEquals( 'key2', $data['meta_data'][1]->key );
92
-		$this->assertEquals( 'value2', $data['meta_data'][1]->value );
89
+		$this->assertEquals( 'key', $data[ 'meta_data' ][ 0 ]->key );
90
+		$this->assertEquals( 'value', $data[ 'meta_data' ][ 0 ]->value );
91
+		$this->assertEquals( 'key2', $data[ 'meta_data' ][ 1 ]->key );
92
+		$this->assertEquals( 'value2', $data[ 'meta_data' ][ 1 ]->value );
93 93
 	}
94 94
 
95 95
 	/**
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	public function test_get_item_without_permission() {
100 100
 		wp_set_current_user( 0 );
101 101
 		$order          = \Automattic\WooCommerce\RestApi\UnitTests\Helpers\OrderHelper::create_order();
102
-		$this->orders[] = $order;
102
+		$this->orders[ ] = $order;
103 103
 		$response       = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/orders/' . $order->get_id() ) );
104 104
 		$this->assertEquals( 401, $response->get_status() );
105 105
 	}
@@ -182,32 +182,32 @@  discard block
 block discarded – undo
182 182
 		);
183 183
 		$response = $this->server->dispatch( $request );
184 184
 		$data     = $response->get_data();
185
-		$order    = wc_get_order( $data['id'] );
185
+		$order    = wc_get_order( $data[ 'id' ] );
186 186
 		$this->assertEquals( 201, $response->get_status() );
187
-		$this->assertEquals( $order->get_payment_method(), $data['payment_method'] );
188
-		$this->assertEquals( $order->get_payment_method_title(), $data['payment_method_title'] );
189
-		$this->assertEquals( $order->get_billing_first_name(), $data['billing']['first_name'] );
190
-		$this->assertEquals( $order->get_billing_last_name(), $data['billing']['last_name'] );
191
-		$this->assertEquals( '', $data['billing']['company'] );
192
-		$this->assertEquals( $order->get_billing_address_1(), $data['billing']['address_1'] );
193
-		$this->assertEquals( $order->get_billing_address_2(), $data['billing']['address_2'] );
194
-		$this->assertEquals( $order->get_billing_city(), $data['billing']['city'] );
195
-		$this->assertEquals( $order->get_billing_state(), $data['billing']['state'] );
196
-		$this->assertEquals( $order->get_billing_postcode(), $data['billing']['postcode'] );
197
-		$this->assertEquals( $order->get_billing_country(), $data['billing']['country'] );
198
-		$this->assertEquals( $order->get_billing_email(), $data['billing']['email'] );
199
-		$this->assertEquals( $order->get_billing_phone(), $data['billing']['phone'] );
200
-		$this->assertEquals( $order->get_shipping_first_name(), $data['shipping']['first_name'] );
201
-		$this->assertEquals( $order->get_shipping_last_name(), $data['shipping']['last_name'] );
202
-		$this->assertEquals( '', $data['shipping']['company'] );
203
-		$this->assertEquals( $order->get_shipping_address_1(), $data['shipping']['address_1'] );
204
-		$this->assertEquals( $order->get_shipping_address_2(), $data['shipping']['address_2'] );
205
-		$this->assertEquals( $order->get_shipping_city(), $data['shipping']['city'] );
206
-		$this->assertEquals( $order->get_shipping_state(), $data['shipping']['state'] );
207
-		$this->assertEquals( $order->get_shipping_postcode(), $data['shipping']['postcode'] );
208
-		$this->assertEquals( $order->get_shipping_country(), $data['shipping']['country'] );
209
-		$this->assertEquals( 1, count( $data['line_items'] ) );
210
-		$this->assertEquals( 1, count( $data['shipping_lines'] ) );
187
+		$this->assertEquals( $order->get_payment_method(), $data[ 'payment_method' ] );
188
+		$this->assertEquals( $order->get_payment_method_title(), $data[ 'payment_method_title' ] );
189
+		$this->assertEquals( $order->get_billing_first_name(), $data[ 'billing' ][ 'first_name' ] );
190
+		$this->assertEquals( $order->get_billing_last_name(), $data[ 'billing' ][ 'last_name' ] );
191
+		$this->assertEquals( '', $data[ 'billing' ][ 'company' ] );
192
+		$this->assertEquals( $order->get_billing_address_1(), $data[ 'billing' ][ 'address_1' ] );
193
+		$this->assertEquals( $order->get_billing_address_2(), $data[ 'billing' ][ 'address_2' ] );
194
+		$this->assertEquals( $order->get_billing_city(), $data[ 'billing' ][ 'city' ] );
195
+		$this->assertEquals( $order->get_billing_state(), $data[ 'billing' ][ 'state' ] );
196
+		$this->assertEquals( $order->get_billing_postcode(), $data[ 'billing' ][ 'postcode' ] );
197
+		$this->assertEquals( $order->get_billing_country(), $data[ 'billing' ][ 'country' ] );
198
+		$this->assertEquals( $order->get_billing_email(), $data[ 'billing' ][ 'email' ] );
199
+		$this->assertEquals( $order->get_billing_phone(), $data[ 'billing' ][ 'phone' ] );
200
+		$this->assertEquals( $order->get_shipping_first_name(), $data[ 'shipping' ][ 'first_name' ] );
201
+		$this->assertEquals( $order->get_shipping_last_name(), $data[ 'shipping' ][ 'last_name' ] );
202
+		$this->assertEquals( '', $data[ 'shipping' ][ 'company' ] );
203
+		$this->assertEquals( $order->get_shipping_address_1(), $data[ 'shipping' ][ 'address_1' ] );
204
+		$this->assertEquals( $order->get_shipping_address_2(), $data[ 'shipping' ][ 'address_2' ] );
205
+		$this->assertEquals( $order->get_shipping_city(), $data[ 'shipping' ][ 'city' ] );
206
+		$this->assertEquals( $order->get_shipping_state(), $data[ 'shipping' ][ 'state' ] );
207
+		$this->assertEquals( $order->get_shipping_postcode(), $data[ 'shipping' ][ 'postcode' ] );
208
+		$this->assertEquals( $order->get_shipping_country(), $data[ 'shipping' ][ 'country' ] );
209
+		$this->assertEquals( 1, count( $data[ 'line_items' ] ) );
210
+		$this->assertEquals( 1, count( $data[ 'shipping_lines' ] ) );
211 211
 	}
212 212
 
213 213
 	/**
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
 		);
266 266
 		$response = $this->server->dispatch( $request );
267 267
 		$data     = $response->get_data();
268
-		$order    = wc_get_order( $data['id'] );
268
+		$order    = wc_get_order( $data[ 'id' ] );
269 269
 		$this->assertEquals( 201, $response->get_status() );
270
-		$this->assertEquals( $order->get_payment_method(), $data['payment_method'] );
270
+		$this->assertEquals( $order->get_payment_method(), $data[ 'payment_method' ] );
271 271
 		$this->assertEquals( $order->get_payment_method_title(), 'Sanitize this' );
272 272
 
273 273
 		// Test when updating order.
274
-		$request = new WP_REST_Request( 'PUT', '/wc/v3/orders/' . $data['id'] );
274
+		$request = new WP_REST_Request( 'PUT', '/wc/v3/orders/' . $data[ 'id' ] );
275 275
 		$request->set_body_params(
276 276
 			array(
277 277
 				'payment_method'       => 'bacs',
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
 		);
281 281
 		$response = $this->server->dispatch( $request );
282 282
 		$data     = $response->get_data();
283
-		$order    = wc_get_order( $data['id'] );
283
+		$order    = wc_get_order( $data[ 'id' ] );
284 284
 		$this->assertEquals( 200, $response->get_status() );
285
-		$this->assertEquals( $order->get_payment_method(), $data['payment_method'] );
285
+		$this->assertEquals( $order->get_payment_method(), $data[ 'payment_method' ] );
286 286
 		$this->assertEquals( $order->get_payment_method_title(), 'Sanitize this too' );
287 287
 	}
288 288
 
@@ -366,9 +366,9 @@  discard block
 block discarded – undo
366 366
 		$data     = $response->get_data();
367 367
 
368 368
 		$this->assertEquals( 200, $response->get_status() );
369
-		$this->assertEquals( 'test-update', $data['payment_method'] );
370
-		$this->assertEquals( 'Fish', $data['billing']['first_name'] );
371
-		$this->assertEquals( 'Face', $data['billing']['last_name'] );
369
+		$this->assertEquals( 'test-update', $data[ 'payment_method' ] );
370
+		$this->assertEquals( 'Fish', $data[ 'billing' ][ 'first_name' ] );
371
+		$this->assertEquals( 'Face', $data[ 'billing' ][ 'last_name' ] );
372 372
 	}
373 373
 
374 374
 	/**
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 		$data     = $response->get_data();
409 409
 
410 410
 		$this->assertEquals( 200, $response->get_status() );
411
-		$this->assertTrue( empty( $data['fee_lines'] ) );
411
+		$this->assertTrue( empty( $data[ 'fee_lines' ] ) );
412 412
 	}
413 413
 
414 414
 	/**
@@ -446,8 +446,8 @@  discard block
 block discarded – undo
446 446
 		$data     = $response->get_data();
447 447
 
448 448
 		$this->assertEquals( 200, $response->get_status() );
449
-		$this->assertCount( 1, $data['coupon_lines'] );
450
-		$this->assertEquals( '45.00', $data['total'] );
449
+		$this->assertCount( 1, $data[ 'coupon_lines' ] );
450
+		$this->assertEquals( '45.00', $data[ 'total' ] );
451 451
 	}
452 452
 
453 453
 	/**
@@ -493,8 +493,8 @@  discard block
 block discarded – undo
493 493
 		$data     = $response->get_data();
494 494
 
495 495
 		$this->assertEquals( 200, $response->get_status() );
496
-		$this->assertTrue( empty( $data['coupon_lines'] ) );
497
-		$this->assertEquals( '50.00', $data['total'] );
496
+		$this->assertTrue( empty( $data[ 'coupon_lines' ] ) );
497
+		$this->assertEquals( '50.00', $data[ 'total' ] );
498 498
 	}
499 499
 
500 500
 	/**
@@ -607,9 +607,9 @@  discard block
 block discarded – undo
607 607
 		$response = $this->server->dispatch( $request );
608 608
 		$data     = $response->get_data();
609 609
 
610
-		$this->assertEquals( 'updated', $data['update'][0]['payment_method'] );
611
-		$this->assertEquals( $order2->get_id(), $data['delete'][0]['id'] );
612
-		$this->assertEquals( $order3->get_id(), $data['delete'][1]['id'] );
610
+		$this->assertEquals( 'updated', $data[ 'update' ][ 0 ][ 'payment_method' ] );
611
+		$this->assertEquals( $order2->get_id(), $data[ 'delete' ][ 0 ][ 'id' ] );
612
+		$this->assertEquals( $order3->get_id(), $data[ 'delete' ][ 1 ][ 'id' ] );
613 613
 
614 614
 		$request  = new WP_REST_Request( 'GET', '/wc/v2/orders' );
615 615
 		$response = $this->server->dispatch( $request );
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 		$request    = new WP_REST_Request( 'OPTIONS', '/wc/v2/orders/' . $order->get_id() );
628 628
 		$response   = $this->server->dispatch( $request );
629 629
 		$data       = $response->get_data();
630
-		$properties = $data['schema']['properties'];
630
+		$properties = $data[ 'schema' ][ 'properties' ];
631 631
 
632 632
 		$this->assertEquals( 42, count( $properties ) );
633 633
 		$this->assertArrayHasKey( 'id', $properties );
Please login to merge, or discard this patch.
unit-tests/Tests/Version2/customers.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
 		$this->assertEquals( 201, $response->get_status() );
145 145
 		$this->assertEquals(
146 146
 			array(
147
-				'id'                 => $data['id'],
148
-				'date_created'       => $data['date_created'],
149
-				'date_created_gmt'   => $data['date_created_gmt'],
150
-				'date_modified'      => $data['date_modified'],
151
-				'date_modified_gmt'  => $data['date_modified_gmt'],
147
+				'id'                 => $data[ 'id' ],
148
+				'date_created'       => $data[ 'date_created' ],
149
+				'date_created_gmt'   => $data[ 'date_created_gmt' ],
150
+				'date_modified'      => $data[ 'date_modified' ],
151
+				'date_modified_gmt'  => $data[ 'date_modified_gmt' ],
152 152
 				'email'              => '[email protected]',
153 153
 				'first_name'         => '',
154 154
 				'last_name'          => '',
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 				'meta_data'          => array(),
183 183
 				'orders_count'       => 0,
184 184
 				'total_spent'        => '0.00',
185
-				'avatar_url'         => $data['avatar_url'],
185
+				'avatar_url'         => $data[ 'avatar_url' ],
186 186
 			),
187 187
 			$data
188 188
 		);
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
 		$this->assertEquals( 201, $response->get_status() );
213 213
 		$this->assertEquals(
214 214
 			array(
215
-				'id'                 => $data['id'],
216
-				'date_created'       => $data['date_created'],
217
-				'date_created_gmt'   => $data['date_created_gmt'],
218
-				'date_modified'      => $data['date_modified'],
219
-				'date_modified_gmt'  => $data['date_modified_gmt'],
215
+				'id'                 => $data[ 'id' ],
216
+				'date_created'       => $data[ 'date_created' ],
217
+				'date_created_gmt'   => $data[ 'date_created_gmt' ],
218
+				'date_modified'      => $data[ 'date_modified' ],
219
+				'date_modified_gmt'  => $data[ 'date_modified_gmt' ],
220 220
 				'email'              => '[email protected]',
221 221
 				'first_name'         => 'Test',
222 222
 				'last_name'          => 'McTestFace',
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 				'meta_data'          => array(),
251 251
 				'orders_count'       => 0,
252 252
 				'total_spent'        => '0.00',
253
-				'avatar_url'         => $data['avatar_url'],
253
+				'avatar_url'         => $data[ 'avatar_url' ],
254 254
 			),
255 255
 			$data
256 256
 		);
@@ -302,11 +302,11 @@  discard block
 block discarded – undo
302 302
 
303 303
 		$this->assertEquals(
304 304
 			array(
305
-				'id'                 => $data['id'],
306
-				'date_created'       => $data['date_created'],
307
-				'date_created_gmt'   => $data['date_created_gmt'],
308
-				'date_modified'      => $data['date_modified'],
309
-				'date_modified_gmt'  => $data['date_modified_gmt'],
305
+				'id'                 => $data[ 'id' ],
306
+				'date_created'       => $data[ 'date_created' ],
307
+				'date_created_gmt'   => $data[ 'date_created_gmt' ],
308
+				'date_modified'      => $data[ 'date_modified' ],
309
+				'date_modified_gmt'  => $data[ 'date_modified_gmt' ],
310 310
 				'email'              => '[email protected]',
311 311
 				'first_name'         => 'Justin',
312 312
 				'billing'            => array(
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 				'username'           => 'get_customer_test',
341 341
 				'orders_count'       => 0,
342 342
 				'total_spent'        => '0.00',
343
-				'avatar_url'         => $data['avatar_url'],
343
+				'avatar_url'         => $data[ 'avatar_url' ],
344 344
 			),
345 345
 			$data
346 346
 		);
@@ -380,8 +380,8 @@  discard block
 block discarded – undo
380 380
 
381 381
 		$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/customers/' . $customer->get_id() ) );
382 382
 		$data     = $response->get_data();
383
-		$this->assertEquals( 'update_customer_test', $data['username'] );
384
-		$this->assertEquals( '[email protected]', $data['email'] );
383
+		$this->assertEquals( 'update_customer_test', $data[ 'username' ] );
384
+		$this->assertEquals( '[email protected]', $data[ 'email' ] );
385 385
 
386 386
 		$request = new WP_REST_Request( 'PUT', '/wc/v2/customers/' . $customer->get_id() );
387 387
 		$request->set_body_params(
@@ -393,8 +393,8 @@  discard block
 block discarded – undo
393 393
 		$response = $this->server->dispatch( $request );
394 394
 		$data     = $response->get_data();
395 395
 
396
-		$this->assertEquals( '[email protected]', $data['email'] );
397
-		$this->assertEquals( 'UpdatedTest', $data['first_name'] );
396
+		$this->assertEquals( '[email protected]', $data[ 'email' ] );
397
+		$this->assertEquals( 'UpdatedTest', $data[ 'first_name' ] );
398 398
 	}
399 399
 
400 400
 	/**
@@ -500,11 +500,11 @@  discard block
 block discarded – undo
500 500
 		$response = $this->server->dispatch( $request );
501 501
 		$data     = $response->get_data();
502 502
 
503
-		$this->assertEquals( 'McTest', $data['update'][0]['last_name'] );
504
-		$this->assertEquals( 'newuser', $data['create'][0]['username'] );
505
-		$this->assertEmpty( $data['create'][0]['last_name'] );
506
-		$this->assertEquals( $customer_2->get_id(), $data['delete'][0]['id'] );
507
-		$this->assertEquals( $customer_3->get_id(), $data['delete'][1]['id'] );
503
+		$this->assertEquals( 'McTest', $data[ 'update' ][ 0 ][ 'last_name' ] );
504
+		$this->assertEquals( 'newuser', $data[ 'create' ][ 0 ][ 'username' ] );
505
+		$this->assertEmpty( $data[ 'create' ][ 0 ][ 'last_name' ] );
506
+		$this->assertEquals( $customer_2->get_id(), $data[ 'delete' ][ 0 ][ 'id' ] );
507
+		$this->assertEquals( $customer_3->get_id(), $data[ 'delete' ][ 1 ][ 'id' ] );
508 508
 
509 509
 		$request  = new WP_REST_Request( 'GET', '/wc/v2/customers' );
510 510
 		$response = $this->server->dispatch( $request );
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 		$request    = new WP_REST_Request( 'OPTIONS', '/wc/v2/customers' );
524 524
 		$response   = $this->server->dispatch( $request );
525 525
 		$data       = $response->get_data();
526
-		$properties = $data['schema']['properties'];
526
+		$properties = $data[ 'schema' ][ 'properties' ];
527 527
 
528 528
 		$this->assertEquals( 18, count( $properties ) );
529 529
 		$this->assertArrayHasKey( 'id', $properties );
@@ -541,26 +541,26 @@  discard block
 block discarded – undo
541 541
 		$this->assertArrayHasKey( 'total_spent', $properties );
542 542
 		$this->assertArrayHasKey( 'avatar_url', $properties );
543 543
 		$this->assertArrayHasKey( 'billing', $properties );
544
-		$this->assertArrayHasKey( 'first_name', $properties['billing']['properties'] );
545
-		$this->assertArrayHasKey( 'last_name', $properties['billing']['properties'] );
546
-		$this->assertArrayHasKey( 'company', $properties['billing']['properties'] );
547
-		$this->assertArrayHasKey( 'address_1', $properties['billing']['properties'] );
548
-		$this->assertArrayHasKey( 'address_2', $properties['billing']['properties'] );
549
-		$this->assertArrayHasKey( 'city', $properties['billing']['properties'] );
550
-		$this->assertArrayHasKey( 'state', $properties['billing']['properties'] );
551
-		$this->assertArrayHasKey( 'postcode', $properties['billing']['properties'] );
552
-		$this->assertArrayHasKey( 'country', $properties['billing']['properties'] );
553
-		$this->assertArrayHasKey( 'email', $properties['billing']['properties'] );
554
-		$this->assertArrayHasKey( 'phone', $properties['billing']['properties'] );
544
+		$this->assertArrayHasKey( 'first_name', $properties[ 'billing' ][ 'properties' ] );
545
+		$this->assertArrayHasKey( 'last_name', $properties[ 'billing' ][ 'properties' ] );
546
+		$this->assertArrayHasKey( 'company', $properties[ 'billing' ][ 'properties' ] );
547
+		$this->assertArrayHasKey( 'address_1', $properties[ 'billing' ][ 'properties' ] );
548
+		$this->assertArrayHasKey( 'address_2', $properties[ 'billing' ][ 'properties' ] );
549
+		$this->assertArrayHasKey( 'city', $properties[ 'billing' ][ 'properties' ] );
550
+		$this->assertArrayHasKey( 'state', $properties[ 'billing' ][ 'properties' ] );
551
+		$this->assertArrayHasKey( 'postcode', $properties[ 'billing' ][ 'properties' ] );
552
+		$this->assertArrayHasKey( 'country', $properties[ 'billing' ][ 'properties' ] );
553
+		$this->assertArrayHasKey( 'email', $properties[ 'billing' ][ 'properties' ] );
554
+		$this->assertArrayHasKey( 'phone', $properties[ 'billing' ][ 'properties' ] );
555 555
 		$this->assertArrayHasKey( 'shipping', $properties );
556
-		$this->assertArrayHasKey( 'first_name', $properties['shipping']['properties'] );
557
-		$this->assertArrayHasKey( 'last_name', $properties['shipping']['properties'] );
558
-		$this->assertArrayHasKey( 'company', $properties['shipping']['properties'] );
559
-		$this->assertArrayHasKey( 'address_1', $properties['shipping']['properties'] );
560
-		$this->assertArrayHasKey( 'address_2', $properties['shipping']['properties'] );
561
-		$this->assertArrayHasKey( 'city', $properties['shipping']['properties'] );
562
-		$this->assertArrayHasKey( 'state', $properties['shipping']['properties'] );
563
-		$this->assertArrayHasKey( 'postcode', $properties['shipping']['properties'] );
564
-		$this->assertArrayHasKey( 'country', $properties['shipping']['properties'] );
556
+		$this->assertArrayHasKey( 'first_name', $properties[ 'shipping' ][ 'properties' ] );
557
+		$this->assertArrayHasKey( 'last_name', $properties[ 'shipping' ][ 'properties' ] );
558
+		$this->assertArrayHasKey( 'company', $properties[ 'shipping' ][ 'properties' ] );
559
+		$this->assertArrayHasKey( 'address_1', $properties[ 'shipping' ][ 'properties' ] );
560
+		$this->assertArrayHasKey( 'address_2', $properties[ 'shipping' ][ 'properties' ] );
561
+		$this->assertArrayHasKey( 'city', $properties[ 'shipping' ][ 'properties' ] );
562
+		$this->assertArrayHasKey( 'state', $properties[ 'shipping' ][ 'properties' ] );
563
+		$this->assertArrayHasKey( 'postcode', $properties[ 'shipping' ][ 'properties' ] );
564
+		$this->assertArrayHasKey( 'country', $properties[ 'shipping' ][ 'properties' ] );
565 565
 	}
566 566
 }
Please login to merge, or discard this patch.
unit-tests/Tests/Version2/products.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
 		$this->assertEquals( 200, $response->get_status() );
53 53
 
54 54
 		$this->assertEquals( 2, count( $products ) );
55
-		$this->assertEquals( 'Dummy Product', $products[0]['name'] );
56
-		$this->assertEquals( 'DUMMY SKU', $products[0]['sku'] );
57
-		$this->assertEquals( 'Dummy External Product', $products[1]['name'] );
58
-		$this->assertEquals( 'DUMMY EXTERNAL SKU', $products[1]['sku'] );
55
+		$this->assertEquals( 'Dummy Product', $products[ 0 ][ 'name' ] );
56
+		$this->assertEquals( 'DUMMY SKU', $products[ 0 ][ 'sku' ] );
57
+		$this->assertEquals( 'Dummy External Product', $products[ 1 ][ 'name' ] );
58
+		$this->assertEquals( 'DUMMY EXTERNAL SKU', $products[ 1 ][ 'sku' ] );
59 59
 	}
60 60
 
61 61
 	/**
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
 		$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/products/' . $product->get_id() ) );
167 167
 		$data     = $response->get_data();
168 168
 
169
-		$this->assertEquals( 'DUMMY SKU', $data['sku'] );
170
-		$this->assertEquals( 10, $data['regular_price'] );
171
-		$this->assertEmpty( $data['sale_price'] );
169
+		$this->assertEquals( 'DUMMY SKU', $data[ 'sku' ] );
170
+		$this->assertEquals( 10, $data[ 'regular_price' ] );
171
+		$this->assertEmpty( $data[ 'sale_price' ] );
172 172
 
173 173
 		$request = new WP_REST_Request( 'PUT', '/wc/v2/products/' . $product->get_id() );
174 174
 		$request->set_body_params(
@@ -188,13 +188,13 @@  discard block
 block discarded – undo
188 188
 		$response = $this->server->dispatch( $request );
189 189
 		$data     = $response->get_data();
190 190
 
191
-		$this->assertContains( 'Testing', $data['description'] );
192
-		$this->assertEquals( '8', $data['price'] );
193
-		$this->assertEquals( '8', $data['sale_price'] );
194
-		$this->assertEquals( '10', $data['regular_price'] );
195
-		$this->assertEquals( 'FIXED-SKU', $data['sku'] );
196
-		$this->assertContains( 'Dr1Bczxq4q', $data['images'][0]['src'] );
197
-		$this->assertContains( 'test upload image', $data['images'][0]['alt'] );
191
+		$this->assertContains( 'Testing', $data[ 'description' ] );
192
+		$this->assertEquals( '8', $data[ 'price' ] );
193
+		$this->assertEquals( '8', $data[ 'sale_price' ] );
194
+		$this->assertEquals( '10', $data[ 'regular_price' ] );
195
+		$this->assertEquals( 'FIXED-SKU', $data[ 'sku' ] );
196
+		$this->assertContains( 'Dr1Bczxq4q', $data[ 'images' ][ 0 ][ 'src' ] );
197
+		$this->assertContains( 'test upload image', $data[ 'images' ][ 0 ][ 'alt' ] );
198 198
 		$product->delete( true );
199 199
 
200 200
 		// test variable product (variations are tested in product-variations.php).
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 		$data     = $response->get_data();
204 204
 
205 205
 		foreach ( array( 'small', 'large' ) as $term_name ) {
206
-			$this->assertContains( $term_name, $data['attributes'][0]['options'] );
206
+			$this->assertContains( $term_name, $data[ 'attributes' ][ 0 ][ 'options' ] );
207 207
 		}
208 208
 
209 209
 		$request = new WP_REST_Request( 'PUT', '/wc/v2/products/' . $product->get_id() );
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 		$response = $this->server->dispatch( $request );
236 236
 		$data     = $response->get_data();
237 237
 
238
-		$this->assertEquals( array( 'small' ), $data['attributes'][0]['options'] );
239
-		$this->assertEquals( array( 'red', 'yellow' ), $data['attributes'][1]['options'] );
238
+		$this->assertEquals( array( 'small' ), $data[ 'attributes' ][ 0 ][ 'options' ] );
239
+		$this->assertEquals( array( 'red', 'yellow' ), $data[ 'attributes' ][ 1 ][ 'options' ] );
240 240
 		$product->delete( true );
241 241
 
242 242
 		// test external product.
@@ -244,8 +244,8 @@  discard block
 block discarded – undo
244 244
 		$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/products/' . $product->get_id() ) );
245 245
 		$data     = $response->get_data();
246 246
 
247
-		$this->assertEquals( 'Buy external product', $data['button_text'] );
248
-		$this->assertEquals( 'http://woocommerce.com', $data['external_url'] );
247
+		$this->assertEquals( 'Buy external product', $data[ 'button_text' ] );
248
+		$this->assertEquals( 'http://woocommerce.com', $data[ 'external_url' ] );
249 249
 
250 250
 		$request = new WP_REST_Request( 'PUT', '/wc/v2/products/' . $product->get_id() );
251 251
 		$request->set_body_params(
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
 		$response = $this->server->dispatch( $request );
258 258
 		$data     = $response->get_data();
259 259
 
260
-		$this->assertEquals( 'Test API Update', $data['button_text'] );
261
-		$this->assertEquals( 'http://automattic.com', $data['external_url'] );
260
+		$this->assertEquals( 'Test API Update', $data[ 'button_text' ] );
261
+		$this->assertEquals( 'http://automattic.com', $data[ 'external_url' ] );
262 262
 	}
263 263
 
264 264
 	/**
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 		);
314 314
 		$response          = $this->server->dispatch( $request );
315 315
 		$data              = $response->get_data();
316
-		$shipping_class_id = $data['id'];
316
+		$shipping_class_id = $data[ 'id' ];
317 317
 
318 318
 		// Create simple.
319 319
 		$request = new WP_REST_Request( 'POST', '/wc/v2/products' );
@@ -329,13 +329,13 @@  discard block
 block discarded – undo
329 329
 		$response = $this->server->dispatch( $request );
330 330
 		$data     = $response->get_data();
331 331
 
332
-		$this->assertEquals( '10', $data['price'] );
333
-		$this->assertEquals( '10', $data['regular_price'] );
334
-		$this->assertTrue( $data['purchasable'] );
335
-		$this->assertEquals( 'DUMMY SKU SIMPLE API', $data['sku'] );
336
-		$this->assertEquals( 'Test Simple Product', $data['name'] );
337
-		$this->assertEquals( 'simple', $data['type'] );
338
-		$this->assertEquals( $shipping_class_id, $data['shipping_class_id'] );
332
+		$this->assertEquals( '10', $data[ 'price' ] );
333
+		$this->assertEquals( '10', $data[ 'regular_price' ] );
334
+		$this->assertTrue( $data[ 'purchasable' ] );
335
+		$this->assertEquals( 'DUMMY SKU SIMPLE API', $data[ 'sku' ] );
336
+		$this->assertEquals( 'Test Simple Product', $data[ 'name' ] );
337
+		$this->assertEquals( 'simple', $data[ 'type' ] );
338
+		$this->assertEquals( $shipping_class_id, $data[ 'shipping_class_id' ] );
339 339
 
340 340
 		// Create external.
341 341
 		$request = new WP_REST_Request( 'POST', '/wc/v2/products' );
@@ -352,14 +352,14 @@  discard block
 block discarded – undo
352 352
 		$response = $this->server->dispatch( $request );
353 353
 		$data     = $response->get_data();
354 354
 
355
-		$this->assertEquals( '10', $data['price'] );
356
-		$this->assertEquals( '10', $data['regular_price'] );
357
-		$this->assertFalse( $data['purchasable'] );
358
-		$this->assertEquals( 'DUMMY SKU EXTERNAL API', $data['sku'] );
359
-		$this->assertEquals( 'Test External Product', $data['name'] );
360
-		$this->assertEquals( 'external', $data['type'] );
361
-		$this->assertEquals( 'Test Button', $data['button_text'] );
362
-		$this->assertEquals( 'https://wordpress.org', $data['external_url'] );
355
+		$this->assertEquals( '10', $data[ 'price' ] );
356
+		$this->assertEquals( '10', $data[ 'regular_price' ] );
357
+		$this->assertFalse( $data[ 'purchasable' ] );
358
+		$this->assertEquals( 'DUMMY SKU EXTERNAL API', $data[ 'sku' ] );
359
+		$this->assertEquals( 'Test External Product', $data[ 'name' ] );
360
+		$this->assertEquals( 'external', $data[ 'type' ] );
361
+		$this->assertEquals( 'Test Button', $data[ 'button_text' ] );
362
+		$this->assertEquals( 'https://wordpress.org', $data[ 'external_url' ] );
363 363
 
364 364
 		// Create variable.
365 365
 		$request = new WP_REST_Request( 'POST', '/wc/v2/products' );
@@ -385,10 +385,10 @@  discard block
 block discarded – undo
385 385
 		$response = $this->server->dispatch( $request );
386 386
 		$data     = $response->get_data();
387 387
 
388
-		$this->assertEquals( 'DUMMY SKU VARIABLE API', $data['sku'] );
389
-		$this->assertEquals( 'Test Variable Product', $data['name'] );
390
-		$this->assertEquals( 'variable', $data['type'] );
391
-		$this->assertEquals( array( 'small', 'medium' ), $data['attributes'][0]['options'] );
388
+		$this->assertEquals( 'DUMMY SKU VARIABLE API', $data[ 'sku' ] );
389
+		$this->assertEquals( 'Test Variable Product', $data[ 'name' ] );
390
+		$this->assertEquals( 'variable', $data[ 'type' ] );
391
+		$this->assertEquals( array( 'small', 'medium' ), $data[ 'attributes' ][ 0 ][ 'options' ] );
392 392
 
393 393
 		$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/products' ) );
394 394
 		$products = $response->get_data();
@@ -453,13 +453,13 @@  discard block
 block discarded – undo
453 453
 		$response = $this->server->dispatch( $request );
454 454
 		$data     = $response->get_data();
455 455
 
456
-		$this->assertContains( 'Updated description.', $data['update'][0]['description'] );
457
-		$this->assertEquals( 'DUMMY SKU BATCH TEST 1', $data['create'][0]['sku'] );
458
-		$this->assertEquals( 'DUMMY SKU BATCH TEST 2', $data['create'][1]['sku'] );
459
-		$this->assertEquals( 'Test Button', $data['create'][0]['button_text'] );
460
-		$this->assertEquals( 'external', $data['create'][0]['type'] );
461
-		$this->assertEquals( 'simple', $data['create'][1]['type'] );
462
-		$this->assertEquals( $product_2->get_id(), $data['delete'][0]['id'] );
456
+		$this->assertContains( 'Updated description.', $data[ 'update' ][ 0 ][ 'description' ] );
457
+		$this->assertEquals( 'DUMMY SKU BATCH TEST 1', $data[ 'create' ][ 0 ][ 'sku' ] );
458
+		$this->assertEquals( 'DUMMY SKU BATCH TEST 2', $data[ 'create' ][ 1 ][ 'sku' ] );
459
+		$this->assertEquals( 'Test Button', $data[ 'create' ][ 0 ][ 'button_text' ] );
460
+		$this->assertEquals( 'external', $data[ 'create' ][ 0 ][ 'type' ] );
461
+		$this->assertEquals( 'simple', $data[ 'create' ][ 1 ][ 'type' ] );
462
+		$this->assertEquals( $product_2->get_id(), $data[ 'delete' ][ 0 ][ 'id' ] );
463 463
 
464 464
 		$request  = new WP_REST_Request( 'GET', '/wc/v2/products' );
465 465
 		$response = $this->server->dispatch( $request );
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 
497 497
 		$this->assertEquals( 4, count( $products ) );
498 498
 		foreach ( $products as $product ) {
499
-			$this->assertEquals( 'publish', $product['status'] );
499
+			$this->assertEquals( 'publish', $product[ 'status' ] );
500 500
 		}
501 501
 
502 502
 		// Test filtering with status=draft.
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 
508 508
 		$this->assertEquals( 4, count( $products ) );
509 509
 		foreach ( $products as $product ) {
510
-			$this->assertEquals( 'draft', $product['status'] );
510
+			$this->assertEquals( 'draft', $product[ 'status' ] );
511 511
 		}
512 512
 
513 513
 		// Test filtering with no filters - which should return 'any' (all 8).
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 		$request    = new WP_REST_Request( 'OPTIONS', '/wc/v2/products/' . $product->get_id() );
530 530
 		$response   = $this->server->dispatch( $request );
531 531
 		$data       = $response->get_data();
532
-		$properties = $data['schema']['properties'];
532
+		$properties = $data[ 'schema' ][ 'properties' ];
533 533
 		$this->assertEquals( 65, count( $properties ) );
534 534
 	}
535 535
 }
Please login to merge, or discard this patch.
unit-tests/Tests/Version2/payment-gateways.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 		$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/payment_gateways/paypal' ) );
156 156
 		$paypal   = $response->get_data();
157 157
 
158
-		$this->assertEquals( 'PayPal', $paypal['settings']['title']['value'] );
159
-		$this->assertEquals( '[email protected]', $paypal['settings']['email']['value'] );
160
-		$this->assertEquals( 'no', $paypal['settings']['testmode']['value'] );
158
+		$this->assertEquals( 'PayPal', $paypal[ 'settings' ][ 'title' ][ 'value' ] );
159
+		$this->assertEquals( '[email protected]', $paypal[ 'settings' ][ 'email' ][ 'value' ] );
160
+		$this->assertEquals( 'no', $paypal[ 'settings' ][ 'testmode' ][ 'value' ] );
161 161
 
162 162
 		// test updating single setting
163 163
 		$request = new WP_REST_Request( 'POST', '/wc/v2/payment_gateways/paypal' );
@@ -172,9 +172,9 @@  discard block
 block discarded – undo
172 172
 		$paypal   = $response->get_data();
173 173
 
174 174
 		$this->assertEquals( 200, $response->get_status() );
175
-		$this->assertEquals( 'PayPal', $paypal['settings']['title']['value'] );
176
-		$this->assertEquals( '[email protected]', $paypal['settings']['email']['value'] );
177
-		$this->assertEquals( 'no', $paypal['settings']['testmode']['value'] );
175
+		$this->assertEquals( 'PayPal', $paypal[ 'settings' ][ 'title' ][ 'value' ] );
176
+		$this->assertEquals( '[email protected]', $paypal[ 'settings' ][ 'email' ][ 'value' ] );
177
+		$this->assertEquals( 'no', $paypal[ 'settings' ][ 'testmode' ][ 'value' ] );
178 178
 
179 179
 		// test updating multiple settings
180 180
 		$request = new WP_REST_Request( 'POST', '/wc/v2/payment_gateways/paypal' );
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 		$paypal   = $response->get_data();
191 191
 
192 192
 		$this->assertEquals( 200, $response->get_status() );
193
-		$this->assertEquals( 'PayPal - New Title', $paypal['settings']['title']['value'] );
194
-		$this->assertEquals( '[email protected]', $paypal['settings']['email']['value'] );
195
-		$this->assertEquals( 'yes', $paypal['settings']['testmode']['value'] );
193
+		$this->assertEquals( 'PayPal - New Title', $paypal[ 'settings' ][ 'title' ][ 'value' ] );
194
+		$this->assertEquals( '[email protected]', $paypal[ 'settings' ][ 'email' ][ 'value' ] );
195
+		$this->assertEquals( 'yes', $paypal[ 'settings' ][ 'testmode' ][ 'value' ] );
196 196
 
197 197
 		// Test other parameters, and recheck settings
198 198
 		$request = new WP_REST_Request( 'POST', '/wc/v2/payment_gateways/paypal' );
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
 		$response = $this->server->dispatch( $request );
206 206
 		$paypal   = $response->get_data();
207 207
 
208
-		$this->assertFalse( $paypal['enabled'] );
209
-		$this->assertEquals( 2, $paypal['order'] );
210
-		$this->assertEquals( 'PayPal - New Title', $paypal['settings']['title']['value'] );
211
-		$this->assertEquals( '[email protected]', $paypal['settings']['email']['value'] );
212
-		$this->assertEquals( 'yes', $paypal['settings']['testmode']['value'] );
208
+		$this->assertFalse( $paypal[ 'enabled' ] );
209
+		$this->assertEquals( 2, $paypal[ 'order' ] );
210
+		$this->assertEquals( 'PayPal - New Title', $paypal[ 'settings' ][ 'title' ][ 'value' ] );
211
+		$this->assertEquals( '[email protected]', $paypal[ 'settings' ][ 'email' ][ 'value' ] );
212
+		$this->assertEquals( 'yes', $paypal[ 'settings' ][ 'testmode' ][ 'value' ] );
213 213
 
214 214
 		// test bogus
215 215
 		$request = new WP_REST_Request( 'POST', '/wc/v2/payment_gateways/paypal' );
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 		);
234 234
 		$response = $this->server->dispatch( $request );
235 235
 		$paypal   = $response->get_data();
236
-		$this->assertEquals( 'authorization', $paypal['settings']['paymentaction']['value'] );
236
+		$this->assertEquals( 'authorization', $paypal[ 'settings' ][ 'paymentaction' ][ 'value' ] );
237 237
 	}
238 238
 
239 239
 	/**
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 		$request    = new WP_REST_Request( 'OPTIONS', '/wc/v2/payment_gateways' );
285 285
 		$response   = $this->server->dispatch( $request );
286 286
 		$data       = $response->get_data();
287
-		$properties = $data['schema']['properties'];
287
+		$properties = $data[ 'schema' ][ 'properties' ];
288 288
 
289 289
 		$this->assertEquals( 8, count( $properties ) );
290 290
 		$this->assertArrayHasKey( 'id', $properties );
@@ -309,25 +309,25 @@  discard block
 block discarded – undo
309 309
 		$gateway->init_form_fields();
310 310
 		foreach ( $gateway->form_fields as $id => $field ) {
311 311
 			// Make sure we at least have a title and type
312
-			if ( empty( $field['title'] ) || empty( $field['type'] ) ) {
312
+			if ( empty( $field[ 'title' ] ) || empty( $field[ 'type' ] ) ) {
313 313
 				continue;
314 314
 			}
315 315
 			// Ignore 'title' settings/fields -- they are UI only
316
-			if ( 'title' === $field['type'] ) {
316
+			if ( 'title' === $field[ 'type' ] ) {
317 317
 				continue;
318 318
 			}
319 319
 			$data = array(
320 320
 				'id'          => $id,
321
-				'label'       => empty( $field['label'] ) ? $field['title'] : $field['label'],
322
-				'description' => empty( $field['description'] ) ? '' : $field['description'],
323
-				'type'        => $field['type'],
321
+				'label'       => empty( $field[ 'label' ] ) ? $field[ 'title' ] : $field[ 'label' ],
322
+				'description' => empty( $field[ 'description' ] ) ? '' : $field[ 'description' ],
323
+				'type'        => $field[ 'type' ],
324 324
 				'value'       => $gateway->settings[ $id ],
325
-				'default'     => empty( $field['default'] ) ? '' : $field['default'],
326
-				'tip'         => empty( $field['description'] ) ? '' : $field['description'],
327
-				'placeholder' => empty( $field['placeholder'] ) ? '' : $field['placeholder'],
325
+				'default'     => empty( $field[ 'default' ] ) ? '' : $field[ 'default' ],
326
+				'tip'         => empty( $field[ 'description' ] ) ? '' : $field[ 'description' ],
327
+				'placeholder' => empty( $field[ 'placeholder' ] ) ? '' : $field[ 'placeholder' ],
328 328
 			);
329
-			if ( ! empty( $field['options'] ) ) {
330
-				$data['options'] = $field['options'];
329
+			if ( ! empty( $field[ 'options' ] ) ) {
330
+				$data[ 'options' ] = $field[ 'options' ];
331 331
 			}
332 332
 			$settings[ $id ] = $data;
333 333
 		}
Please login to merge, or discard this patch.