File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
tests/Feature/ReportTemplates Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 44
55use App \Models \CustomField ;
66use App \Models \ReportTemplate ;
7- use Illuminate \Contracts \View \View ;
87use Illuminate \Http \RedirectResponse ;
98use Illuminate \Http \Request ;
109
@@ -47,13 +46,20 @@ public function show($reportId)
4746 ]);
4847 }
4948
50- public function edit ($ reportId ): View
49+ public function edit ($ reportId )
5150 {
5251 $ this ->authorize ('reports.view ' );
5352
53+ $ reportTemplate = ReportTemplate::find ($ reportId );
54+
55+ if (!$ reportTemplate ) {
56+ return redirect ()->route ('reports/custom ' )
57+ ->with ('error ' , trans ('admin/reports/message.no_report_permission ' ));
58+ }
59+
5460 return view ('reports/custom ' , [
5561 'customfields ' => CustomField::get (),
56- 'template ' => ReportTemplate:: findOrFail ( $ reportId ) ,
62+ 'template ' => $ reportTemplate ,
5763 ]);
5864 }
5965
Original file line number Diff line number Diff line change @@ -18,8 +18,6 @@ public function testRequiresPermission()
1818
1919 public function testCannotLoadEditPageForAnotherUsersReportTemplate ()
2020 {
21- $ this ->markTestIncomplete ('Returns 404... ' );
22-
2321 $ user = User::factory ()->canViewReports ()->create ();
2422 $ reportTemplate = ReportTemplate::factory ()->create ();
2523
You can’t perform that action at this time.
0 commit comments