|
267 | 267 | assertTemplateResult( |
268 | 268 | '{test=>1234}', |
269 | 269 | '{{ foo | map: "registers" }}', |
270 | | - assigns: [ |
| 270 | + staticData: [ |
271 | 271 | 'foo' => $model, |
272 | 272 | ], |
273 | 273 | registers: [ |
|
280 | 280 | assertTemplateResult( |
281 | 281 | '4217', |
282 | 282 | '{{ thing | map: "foo" | map: "bar" }}', |
283 | | - assigns: ['thing' => ['foo' => [['bar' => 42], ['bar' => 17]]]] |
| 283 | + staticData: ['thing' => ['foo' => [['bar' => 42], ['bar' => 17]]]] |
284 | 284 | ); |
285 | 285 | }); |
286 | 286 |
|
287 | 287 | test('legacy map on hashes with dynamic key', function () { |
288 | 288 | assertTemplateResult( |
289 | 289 | '42', |
290 | 290 | '{% assign key = \'foo\' %}{{ thing | map: key | map: \'bar\' }}', |
291 | | - assigns: ['thing' => ['foo' => ['bar' => 42]]] |
| 291 | + staticData: ['thing' => ['foo' => ['bar' => 42]]] |
292 | 292 | ); |
293 | 293 | }); |
294 | 294 |
|
|
298 | 298 | assertTemplateResult( |
299 | 299 | 'woot: 1', |
300 | 300 | '{{ foo | sort: "whatever" }}', |
301 | | - assigns: ['foo' => [$t]] |
| 301 | + staticData: ['foo' => [$t]] |
302 | 302 | ); |
303 | 303 |
|
304 | 304 | expect($t->value)->toBe(1); |
|
311 | 311 | assertTemplateResult( |
312 | 312 | 'testfoo', |
313 | 313 | '{{ closures | map: "value" }}', |
314 | | - assigns: ['closures' => [$c]] |
| 314 | + staticData: ['closures' => [$c]] |
315 | 315 | ); |
316 | 316 | }); |
317 | 317 |
|
|
324 | 324 | assertTemplateResult( |
325 | 325 | 'foobar', |
326 | 326 | '{{ drops | map: "closure" }}', |
327 | | - assigns: ['drops' => $drops] |
| 327 | + staticData: ['drops' => $drops] |
328 | 328 | ); |
329 | 329 | }); |
330 | 330 |
|
331 | 331 | test('map works on iterator', function () { |
332 | 332 | assertTemplateResult( |
333 | 333 | '123', |
334 | 334 | '{{ foo | map: "foo" }}', |
335 | | - assigns: ['foo' => new \Keepsuit\Liquid\Tests\Stubs\IteratorDrop] |
| 335 | + staticData: ['foo' => new \Keepsuit\Liquid\Tests\Stubs\IteratorDrop] |
336 | 336 | ); |
337 | 337 | }); |
338 | 338 |
|
|
360 | 360 | assertTemplateResult( |
361 | 361 | '213', |
362 | 362 | '{{ foo | sort: "bar" | map: "foo" }}', |
363 | | - assigns: ['foo' => new \Keepsuit\Liquid\Tests\Stubs\IteratorDrop] |
| 363 | + staticData: ['foo' => new \Keepsuit\Liquid\Tests\Stubs\IteratorDrop] |
364 | 364 | ); |
365 | 365 | }); |
366 | 366 |
|
367 | 367 | test('first and last calls toLiquid', function () { |
368 | 368 | assertTemplateResult( |
369 | 369 | 'foobar', |
370 | 370 | '{{ foo | first }}', |
371 | | - assigns: ['foo' => [new \Keepsuit\Liquid\Tests\Stubs\ThingWithToLiquid]] |
| 371 | + staticData: ['foo' => [new \Keepsuit\Liquid\Tests\Stubs\ThingWithToLiquid]] |
372 | 372 | ); |
373 | 373 | assertTemplateResult( |
374 | 374 | 'foobar', |
375 | 375 | '{{ foo | last }}', |
376 | | - assigns: ['foo' => [new \Keepsuit\Liquid\Tests\Stubs\ThingWithToLiquid]] |
| 376 | + staticData: ['foo' => [new \Keepsuit\Liquid\Tests\Stubs\ThingWithToLiquid]] |
377 | 377 | ); |
378 | 378 | }); |
379 | 379 |
|
380 | 380 | test('truncate calls toLiquid', function () { |
381 | 381 | assertTemplateResult( |
382 | 382 | 'wo...', |
383 | 383 | '{{ foo | truncate: 5 }}', |
384 | | - assigns: ['foo' => new ThingWithParamToLiquid] |
| 384 | + staticData: ['foo' => new ThingWithParamToLiquid] |
385 | 385 | ); |
386 | 386 | }); |
387 | 387 |
|
|
469 | 469 | }); |
470 | 470 |
|
471 | 471 | test('strip', function () { |
472 | | - assertTemplateResult('ab c', '{{ source | strip }}', assigns: ['source' => ' ab c ']); |
473 | | - assertTemplateResult('ab c', '{{ source | strip }}', assigns: ['source' => " \tab c \n \t"]); |
| 472 | + assertTemplateResult('ab c', '{{ source | strip }}', staticData: ['source' => ' ab c ']); |
| 473 | + assertTemplateResult('ab c', '{{ source | strip }}', staticData: ['source' => " \tab c \n \t"]); |
474 | 474 | }); |
475 | 475 |
|
476 | 476 | test('lstrip', function () { |
477 | | - assertTemplateResult('ab c ', '{{ source | lstrip }}', assigns: ['source' => ' ab c ']); |
478 | | - assertTemplateResult("ab c \n \t", '{{ source | lstrip }}', assigns: ['source' => " \tab c \n \t"]); |
| 477 | + assertTemplateResult('ab c ', '{{ source | lstrip }}', staticData: ['source' => ' ab c ']); |
| 478 | + assertTemplateResult("ab c \n \t", '{{ source | lstrip }}', staticData: ['source' => " \tab c \n \t"]); |
479 | 479 | }); |
480 | 480 |
|
481 | 481 | test('rstrip', function () { |
482 | | - assertTemplateResult(' ab c', '{{ source | rstrip }}', assigns: ['source' => ' ab c ']); |
483 | | - assertTemplateResult(" \tab c", '{{ source | rstrip }}', assigns: ['source' => " \tab c \n \t"]); |
| 482 | + assertTemplateResult(' ab c', '{{ source | rstrip }}', staticData: ['source' => ' ab c ']); |
| 483 | + assertTemplateResult(" \tab c", '{{ source | rstrip }}', staticData: ['source' => " \tab c \n \t"]); |
484 | 484 | }); |
485 | 485 |
|
486 | 486 | test('strip new lines', function () { |
487 | | - assertTemplateResult('abc', '{{ source | strip_newlines }}', assigns: ['source' => "a\nb\nc"]); |
488 | | - assertTemplateResult('abc', '{{ source | strip_newlines }}', assigns: ['source' => "a\r\nb\nc"]); |
| 487 | + assertTemplateResult('abc', '{{ source | strip_newlines }}', staticData: ['source' => "a\nb\nc"]); |
| 488 | + assertTemplateResult('abc', '{{ source | strip_newlines }}', staticData: ['source' => "a\r\nb\nc"]); |
489 | 489 | }); |
490 | 490 |
|
491 | 491 | test('new lines to br', function () { |
492 | | - assertTemplateResult("a<br />\nb<br />\nc", '{{ source | newline_to_br }}', assigns: ['source' => "a\nb\nc"]); |
493 | | - assertTemplateResult("a<br />\nb<br />\nc", '{{ source | newline_to_br }}', assigns: ['source' => "a\r\nb\nc"]); |
| 492 | + assertTemplateResult("a<br />\nb<br />\nc", '{{ source | newline_to_br }}', staticData: ['source' => "a\nb\nc"]); |
| 493 | + assertTemplateResult("a<br />\nb<br />\nc", '{{ source | newline_to_br }}', staticData: ['source' => "a\r\nb\nc"]); |
494 | 494 | }); |
495 | 495 |
|
496 | 496 | test('plus', function () { |
497 | 497 | assertTemplateResult('2', '{{ 1 | plus:1 }}'); |
498 | 498 | assertTemplateResult('2.1', "{{ '1' | plus:'1.1' }}"); |
499 | 499 |
|
500 | | - assertTemplateResult('5', "{{ price | plus:'2' }}", assigns: ['price' => new NumberDrop(3)]); |
| 500 | + assertTemplateResult('5', "{{ price | plus:'2' }}", staticData: ['price' => new NumberDrop(3)]); |
501 | 501 | }); |
502 | 502 |
|
503 | 503 | test('minus', function () { |
504 | 504 | assertTemplateResult('4', '{{ 5 | minus:1 }}'); |
505 | 505 | assertTemplateResult('2.3', "{{ '4.3' | minus:'2' }}"); |
506 | 506 |
|
507 | | - assertTemplateResult('5', "{{ price | minus:'2' }}", assigns: ['price' => new NumberDrop(7)]); |
| 507 | + assertTemplateResult('5', "{{ price | minus:'2' }}", staticData: ['price' => new NumberDrop(7)]); |
508 | 508 | }); |
509 | 509 |
|
510 | 510 | test('abs', function () { |
|
762 | 762 | test('sum without property calls to liquid', function () { |
763 | 763 | $t = new ThingWithParamToLiquid; |
764 | 764 |
|
765 | | - renderTemplate('{{ foo | sum }}', assigns: ['foo' => [$t]]); |
| 765 | + renderTemplate('{{ foo | sum }}', staticData: ['foo' => [$t]]); |
766 | 766 |
|
767 | 767 | expect($t->value)->toBe(1); |
768 | 768 | }); |
769 | 769 |
|
770 | 770 | test('sum with property calls to liquid on property values', function () { |
771 | 771 | $t = new ThingWithParamToLiquid; |
772 | 772 |
|
773 | | - renderTemplate('{{ foo | sum: "quantity" }}', assigns: ['foo' => [['quantity' => $t]]]); |
| 773 | + renderTemplate('{{ foo | sum: "quantity" }}', staticData: ['foo' => [['quantity' => $t]]]); |
774 | 774 |
|
775 | 775 | expect($t->value)->toBe(1); |
776 | 776 | }); |
0 commit comments