File tree Expand file tree Collapse file tree 4 files changed +26
-31
lines changed
resources/views/pages/inventory/⚡index
Feature/Actions/Inventory Expand file tree Collapse file tree 4 files changed +26
-31
lines changed Original file line number Diff line number Diff line change 77use Illuminate \Http \UploadedFile ;
88use Livewire \Livewire ;
99
10- function amazonFixtureUpload (): UploadedFile
11- {
12- return UploadedFile::fake ()->createWithContent (
13- 'amazon-import.csv ' ,
14- file_get_contents (base_path ('tests/Fixtures/csv/amazon-import.csv ' )),
15- );
16- }
17-
1810test ('guests are redirected to the login page ' , function () {
1911 $ this ->get (route ('inventory.index ' ))
2012 ->assertRedirect (route ('login ' ));
Original file line number Diff line number Diff line change 22
33use App \Actions \Inventory \ImportItemsFromAmazonAction ;
44use App \Models \Team ;
5- use Illuminate \Http \UploadedFile ;
6-
7- function amazonFixture (): UploadedFile
8- {
9- return new UploadedFile (
10- path: base_path ('tests/Fixtures/csv/amazon-import.csv ' ),
11- originalName: 'amazon-import.csv ' ,
12- test: true ,
13- );
14- }
155
166test ('it imports items from amazon csv ' , function () {
177 $ team = Team::factory ()->create ();
Original file line number Diff line number Diff line change 22
33use Tests \TestCase ;
44use Illuminate \Foundation \Testing \RefreshDatabase ;
5+ use Illuminate \Http \UploadedFile ;
56
67/*
78|--------------------------------------------------------------------------
4445|
4546*/
4647
47- function something ()
48+ function amazonFixture (): UploadedFile
4849{
49- // ..
50+ return new UploadedFile (
51+ path: base_path ('tests/Fixtures/csv/amazon-import.csv ' ),
52+ originalName: 'amazon-import.csv ' ,
53+ test: true ,
54+ );
55+ }
56+
57+ function amazonFixtureUpload (): UploadedFile
58+ {
59+ return UploadedFile::fake ()->createWithContent (
60+ 'amazon-import.csv ' ,
61+ file_get_contents (base_path ('tests/Fixtures/csv/amazon-import.csv ' )),
62+ );
63+ }
64+
65+ function fakeRecipeHtml (array $ schema ): string
66+ {
67+ $ json = json_encode ($ schema );
68+
69+ return <<<HTML
70+ <html><head>
71+ <script type="application/ld+json"> {$ json }</script>
72+ </head><body></body></html>
73+ HTML ;
5074}
Original file line number Diff line number Diff line change 33use App \Actions \Recipes \ImportRecipeFromUrl ;
44use Illuminate \Support \Facades \Http ;
55
6- function fakeRecipeHtml (array $ schema ): string
7- {
8- $ json = json_encode ($ schema );
9-
10- return <<<HTML
11- <html><head>
12- <script type="application/ld+json"> {$ json }</script>
13- </head><body></body></html>
14- HTML ;
15- }
16-
176test ('parses direct Recipe JSON-LD ' , function () {
187 Http::fake ([
198 'example.com/* ' => Http::response (fakeRecipeHtml ([
You can’t perform that action at this time.
0 commit comments