@@ -17,6 +17,14 @@ protected function setUp(): void
1717 {
1818 parent ::setUp ();
1919
20+ // Start session for Livewire tests
21+ $ this ->startSession ();
22+
23+ // Initialize view shared error bag for Livewire with a default MessageBag
24+ $ errorBag = new \Illuminate \Support \ViewErrorBag ();
25+ $ errorBag ->put ('default ' , new \Illuminate \Support \MessageBag ());
26+ $ this ->app ['view ' ]->share ('errors ' , $ errorBag );
27+
2028 // Set the current panel for testing
2129 \Filament \Facades \Filament::setCurrentPanel ('lms ' );
2230 }
@@ -161,15 +169,21 @@ protected function setUpDatabase($app)
161169
162170 protected function getPackageProviders ($ app )
163171 {
164- return [
172+ $ providers = [
165173 LivewireServiceProvider::class,
166174 FilamentServiceProvider::class,
167175 SupportServiceProvider::class,
168176 MediaLibraryServiceProvider::class,
169177 FilamentLmsServiceProvider::class,
170- FilamentFormBuilderServiceProvider::class,
171178 \Tapp \FilamentLms \LmsPanelProvider::class,
172179 ];
180+
181+ // Only add FilamentFormBuilderServiceProvider if it exists
182+ if (class_exists (\Tapp \FilamentFormBuilder \FilamentFormBuilderServiceProvider::class)) {
183+ $ providers [] = \Tapp \FilamentFormBuilder \FilamentFormBuilderServiceProvider::class;
184+ }
185+
186+ return $ providers ;
173187 }
174188
175189 public function getEnvironmentSetUp ($ app )
@@ -189,6 +203,12 @@ public function getEnvironmentSetUp($app)
189203 'root ' => storage_path ('app ' ),
190204 ]);
191205
206+ // Set up session configuration
207+ $ app ['config ' ]->set ('session.driver ' , 'array ' );
208+
209+ // Set up view error bag sharing
210+ $ app ['config ' ]->set ('view.compiled ' , storage_path ('framework/views ' ));
211+
192212 // Set up media library configuration
193213 $ app ['config ' ]->set ('media-library.disk_name ' , 'local ' );
194214 $ app ['config ' ]->set ('media-library.media_model ' , \Spatie \MediaLibrary \MediaCollections \Models \Media::class);
0 commit comments