|
272 | 272 | it('returns true for enableConnection when enabled and connectionPosts is not empty', function () { |
273 | 273 | $attributes = BlockAttributes::from([ |
274 | 274 | 'enableConnection' => true, |
275 | | - 'connectionPosts' => ['page' => ['label' => 'My Page', 'value' => '42']], |
| 275 | + 'connectionPosts' => ['page' => [['label' => 'My Page', 'value' => '42']]], |
276 | 276 | ]); |
277 | 277 | expect($attributes->enableConnection())->toBeTrue(); |
278 | 278 | }); |
|
288 | 288 | it('returns false for enableConnection when disabled even if connectionPosts is not empty', function () { |
289 | 289 | $attributes = BlockAttributes::from([ |
290 | 290 | 'enableConnection' => false, |
291 | | - 'connectionPosts' => ['page' => ['label' => 'My Page', 'value' => '42']], |
| 291 | + 'connectionPosts' => ['page' => [['label' => 'My Page', 'value' => '42']]], |
292 | 292 | ]); |
293 | 293 | expect($attributes->enableConnection())->toBeFalse(); |
294 | 294 | }); |
|
297 | 297 | config(['yard-query-block.connections' => []]); |
298 | 298 | $attributes = BlockAttributes::from([ |
299 | 299 | 'enableConnection' => true, |
300 | | - 'connectionPosts' => ['page' => ['label' => 'My Page', 'value' => '42']], |
| 300 | + 'connectionPosts' => ['page' => [['label' => 'My Page', 'value' => '42']]], |
301 | 301 | ]); |
302 | 302 | expect($attributes->postConnections())->toBe([]); |
303 | 303 | }); |
|
308 | 308 | ]]); |
309 | 309 | $attributes = BlockAttributes::from([ |
310 | 310 | 'enableConnection' => true, |
311 | | - 'connectionPosts' => ['page' => ['label' => 'My Page', 'value' => '42']], |
| 311 | + 'connectionPosts' => ['page' => [['label' => 'My Page', 'value' => '42']]], |
312 | 312 | ]); |
313 | 313 | expect($attributes->postConnections())->toBe([]); |
314 | 314 | }); |
|
320 | 320 | ]]); |
321 | 321 | $attributes = BlockAttributes::from([ |
322 | 322 | 'enableConnection' => true, |
323 | | - 'connectionPosts' => ['page' => ['label' => 'My Page', 'value' => '42']], |
| 323 | + 'connectionPosts' => ['page' => [['label' => 'My Page', 'value' => '42']]], |
324 | 324 | ]); |
325 | 325 | expect($attributes->postConnections())->toBe([ |
326 | | - ['post_type' => 'post', 'meta_key' => 'related_page', 'meta_value' => 42], |
327 | | - ['post_type' => 'product', 'meta_key' => 'featured_page', 'meta_value' => 42], |
| 326 | + ['post_type' => 'post', 'meta_key' => 'related_page', 'meta_value' => [42]], |
| 327 | + ['post_type' => 'product', 'meta_key' => 'featured_page', 'meta_value' => [42]], |
328 | 328 | ]); |
329 | 329 | }); |
330 | 330 |
|
|
336 | 336 | $attributes = BlockAttributes::from([ |
337 | 337 | 'enableConnection' => true, |
338 | 338 | 'connectionPosts' => [ |
339 | | - 'page' => ['label' => 'My Page', 'value' => '42'], |
340 | | - 'category' => ['label' => 'My Category', 'value' => '10'], |
| 339 | + 'page' => [['label' => 'My Page', 'value' => '42']], |
| 340 | + 'category' => [['label' => 'My Category', 'value' => '10']], |
341 | 341 | ], |
342 | 342 | ]); |
343 | 343 | expect($attributes->postConnections())->toBe([ |
344 | | - ['post_type' => 'post', 'meta_key' => 'related_page', 'meta_value' => 42], |
345 | | - ['post_type' => 'post', 'meta_key' => 'related_category', 'meta_value' => 10], |
| 344 | + ['post_type' => 'post', 'meta_key' => 'related_page', 'meta_value' => [42]], |
| 345 | + ['post_type' => 'post', 'meta_key' => 'related_category', 'meta_value' => [10]], |
346 | 346 | ]); |
347 | 347 | }); |
348 | 348 |
|
|
353 | 353 | $attributes = BlockAttributes::from([ |
354 | 354 | 'enableConnection' => true, |
355 | 355 | 'connectionPosts' => [ |
356 | | - 'page' => ['label' => 'My Page', 'value' => '42'], |
357 | | - 'event' => ['label' => 'My Event', 'value' => '99'], |
| 356 | + 'page' => [['label' => 'My Page', 'value' => '42']], |
| 357 | + 'event' => [['label' => 'My Event', 'value' => '99']], |
358 | 358 | ], |
359 | 359 | ]); |
360 | 360 | expect($attributes->postConnections())->toBe([ |
361 | | - ['post_type' => 'post', 'meta_key' => 'related_page', 'meta_value' => 42], |
| 361 | + ['post_type' => 'post', 'meta_key' => 'related_page', 'meta_value' => [42]], |
362 | 362 | ]); |
363 | 363 | }); |
0 commit comments