File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ protected function compileData(): array
2525 'secondaryFields ' => $ this ->secondaryFields ?->values()->toArray (),
2626 'headerFields ' => $ this ->headerFields ?->values()->toArray (),
2727 'auxiliaryFields ' => $ this ->auxiliaryFields ?->values()->toArray (),
28+ 'backFields ' => $ this ->backFields ?->values()->toArray (),
2829 ]),
2930 ],
3031 );
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ protected function compileData(): array
2525 'secondaryFields ' => $ this ->secondaryFields ?->values()->toArray (),
2626 'headerFields ' => $ this ->headerFields ?->values()->toArray (),
2727 'auxiliaryFields ' => $ this ->auxiliaryFields ?->values()->toArray (),
28+ 'backFields ' => $ this ->backFields ?->values()->toArray (),
2829 ]),
2930 ],
3031 );
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ protected function compileData(): array
2525 'secondaryFields ' => $ this ->secondaryFields ?->values()->toArray (),
2626 'headerFields ' => $ this ->headerFields ?->values()->toArray (),
2727 'auxiliaryFields ' => $ this ->auxiliaryFields ?->values()->toArray (),
28+ 'backFields ' => $ this ->backFields ?->values()->toArray (),
2829 ]),
2930 ],
3031 );
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ use Spatie \LaravelMobilePass \Builders \Apple \CouponPassBuilder ;
4+
5+ it ('compiles back fields into the coupon payload ' , function () {
6+ $ compiledData = CouponPassBuilder::make ()
7+ ->setOrganizationName ('My organization ' )
8+ ->setSerialNumber (123456 )
9+ ->setDescription ('Hello! ' )
10+ ->addBackField ('terms ' , 'Terms and conditions apply. ' )
11+ ->setIconImage (getTestSupportPath ('images/spatie-thumbnail.png ' ))
12+ ->data ();
13+
14+ expect ($ compiledData )->toHaveKey ('coupon ' );
15+ expect ($ compiledData ['coupon ' ])->toHaveKey ('backFields ' );
16+ expect ($ compiledData ['coupon ' ]['backFields ' ])->toHaveCount (1 );
17+ expect ($ compiledData ['coupon ' ]['backFields ' ][0 ])->toMatchArray ([
18+ 'key ' => 'terms ' ,
19+ 'value ' => 'Terms and conditions apply. ' ,
20+ ]);
21+ });
22+
23+ it ('has a name ' , function () {
24+ expect (CouponPassBuilder::name ())->toBe ('coupon ' );
25+ });
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ use Spatie \LaravelMobilePass \Builders \Apple \GenericPassBuilder ;
4+
5+ it ('compiles back fields into the generic payload ' , function () {
6+ $ compiledData = GenericPassBuilder::make ()
7+ ->setOrganizationName ('My organization ' )
8+ ->setSerialNumber (123456 )
9+ ->setDescription ('Hello! ' )
10+ ->addBackField ('terms ' , 'Terms and conditions apply. ' )
11+ ->setIconImage (getTestSupportPath ('images/spatie-thumbnail.png ' ))
12+ ->data ();
13+
14+ expect ($ compiledData )->toHaveKey ('generic ' );
15+ expect ($ compiledData ['generic ' ])->toHaveKey ('backFields ' );
16+ expect ($ compiledData ['generic ' ]['backFields ' ])->toHaveCount (1 );
17+ expect ($ compiledData ['generic ' ]['backFields ' ][0 ])->toMatchArray ([
18+ 'key ' => 'terms ' ,
19+ 'value ' => 'Terms and conditions apply. ' ,
20+ ]);
21+ });
22+
23+ it ('has a name ' , function () {
24+ expect (GenericPassBuilder::name ())->toBe ('generic ' );
25+ });
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ use Spatie \LaravelMobilePass \Builders \Apple \StoreCardPassBuilder ;
4+
5+ it ('compiles back fields into the store card payload ' , function () {
6+ $ compiledData = StoreCardPassBuilder::make ()
7+ ->setOrganizationName ('My organization ' )
8+ ->setSerialNumber (123456 )
9+ ->setDescription ('Hello! ' )
10+ ->addBackField ('terms ' , 'Terms and conditions apply. ' )
11+ ->setIconImage (getTestSupportPath ('images/spatie-thumbnail.png ' ))
12+ ->data ();
13+
14+ expect ($ compiledData )->toHaveKey ('storeCard ' );
15+ expect ($ compiledData ['storeCard ' ])->toHaveKey ('backFields ' );
16+ expect ($ compiledData ['storeCard ' ]['backFields ' ])->toHaveCount (1 );
17+ expect ($ compiledData ['storeCard ' ]['backFields ' ][0 ])->toMatchArray ([
18+ 'key ' => 'terms ' ,
19+ 'value ' => 'Terms and conditions apply. ' ,
20+ ]);
21+ });
22+
23+ it ('has a name ' , function () {
24+ expect (StoreCardPassBuilder::name ())->toBe ('store_card ' );
25+ });
You can’t perform that action at this time.
0 commit comments