@@ -418,4 +418,68 @@ public function it_can_filter_results_by_a_different_key()
418
418
419
419
$ this ->assertSame (json_encode ($ expected ), $ workflow ->filterResults ('ID 2 ' , 'uid ' )->output ());
420
420
}
421
+
422
+ /** @test */
423
+ public function it_can_add_variables ()
424
+ {
425
+ $ workflow = new Workflow ;
426
+
427
+ $ workflow ->variable ('fruit ' ,'apple ' )
428
+ ->variable ('vegetables ' ,'carrots ' );
429
+
430
+ $ workflow ->result ()
431
+ ->uid ('THE ID ' )
432
+ ->title ('Item Title ' )
433
+ ->subtitle ('Item Subtitle ' )
434
+ ->quicklookurl ('https://www.google.com ' )
435
+ ->type ('file ' )
436
+ ->arg ('ARGUMENT ' )
437
+ ->valid (false )
438
+ ->icon ('icon.png ' )
439
+ ->mod ('cmd ' , 'Do Something Different ' , 'something-different ' )
440
+ ->mod ('shift ' , 'Another Different ' , 'another-different ' , false )
441
+ ->copy ('Please copy this ' )
442
+ ->largetype ('This will be huge ' )
443
+ ->autocomplete ('AutoComplete This ' );
444
+
445
+ $ expected = [
446
+ 'items ' => [
447
+ [
448
+ 'arg ' => 'ARGUMENT ' ,
449
+ 'autocomplete ' => 'AutoComplete This ' ,
450
+ 'icon ' => [
451
+ 'path ' => 'icon.png ' ,
452
+ ],
453
+ 'mods ' => [
454
+ 'cmd ' => [
455
+ 'subtitle ' => 'Do Something Different ' ,
456
+ 'arg ' => 'something-different ' ,
457
+ 'valid ' => true ,
458
+ ],
459
+ 'shift ' => [
460
+ 'subtitle ' => 'Another Different ' ,
461
+ 'arg ' => 'another-different ' ,
462
+ 'valid ' => false ,
463
+ ],
464
+ ],
465
+ 'quicklookurl ' => 'https://www.google.com ' ,
466
+ 'subtitle ' => 'Item Subtitle ' ,
467
+ 'text ' => [
468
+ 'copy ' => 'Please copy this ' ,
469
+ 'largetype ' => 'This will be huge ' ,
470
+ ],
471
+ 'title ' => 'Item Title ' ,
472
+ 'type ' => 'file ' ,
473
+ 'uid ' => 'THE ID ' ,
474
+ 'valid ' => false ,
475
+ ],
476
+ ],
477
+ 'variables ' => [
478
+ 'fruit ' => 'apple ' ,
479
+ 'vegetables ' => 'carrots '
480
+ ]
481
+ ];
482
+
483
+ $ this ->assertSame (json_encode ($ expected ), $ workflow ->output ());
484
+ }
421
485
}
0 commit comments