Add test case for saving custom reports
This commit is contained in:
parent
89c47c1879
commit
c68a2a36fa
1 changed files with 17 additions and 1 deletions
|
@ -38,7 +38,23 @@ class SavedReportsTest extends TestCase
|
||||||
|
|
||||||
public function testCanSaveACustomReport()
|
public function testCanSaveACustomReport()
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete();
|
$user = User::factory()->canViewReports()->create();
|
||||||
|
|
||||||
|
$this->actingAs($user)
|
||||||
|
->post(route('savedreports/store'), [
|
||||||
|
'name' => 'My Awesome Report',
|
||||||
|
'company' => '1',
|
||||||
|
'by_company_id' => ['1', '2'],
|
||||||
|
])
|
||||||
|
->assertRedirect();
|
||||||
|
|
||||||
|
$report = $user->savedReports->first(function ($report) {
|
||||||
|
return $report->name === 'My Awesome Report';
|
||||||
|
});
|
||||||
|
|
||||||
|
$this->assertNotNull($report);
|
||||||
|
$this->assertEquals('1', $report->options['company']);
|
||||||
|
$this->assertEquals(['1', '2'], $report->options['by_company_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSavingReportRequiresValidFields()
|
public function testSavingReportRequiresValidFields()
|
||||||
|
|
Loading…
Add table
Reference in a new issue