mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Implement test
This commit is contained in:
parent
691e81d827
commit
bbfee27fd3
|
@ -28,25 +28,15 @@ class UpdateReportTemplateTest extends TestCase
|
||||||
->assertOk();
|
->assertOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUpdatingReportTemplateRequiresValidFields()
|
|
||||||
{
|
|
||||||
$this->markTestIncomplete();
|
|
||||||
|
|
||||||
$this->actingAs(User::factory()->canViewReports()->create())
|
|
||||||
->post(route('report-templates.update', ReportTemplate::factory()->create()))
|
|
||||||
// @todo: name isn't being passed in this case
|
|
||||||
->assertSessionHasErrors('name');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testCanUpdateAReportTemplate()
|
public function testCanUpdateAReportTemplate()
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete();
|
|
||||||
|
|
||||||
$user = User::factory()->canViewReports()->create();
|
$user = User::factory()->canViewReports()->create();
|
||||||
|
|
||||||
$reportTemplate = ReportTemplate::factory()->for($user)->create([
|
$reportTemplate = ReportTemplate::factory()->for($user)->create([
|
||||||
'options' => [
|
'options' => [
|
||||||
'id' => 1,
|
'id' => 1,
|
||||||
|
'category' => 1,
|
||||||
|
'by_category_id' => 2,
|
||||||
'company' => 1,
|
'company' => 1,
|
||||||
'by_company_id' => [1, 2],
|
'by_company_id' => [1, 2],
|
||||||
],
|
],
|
||||||
|
@ -55,12 +45,15 @@ class UpdateReportTemplateTest extends TestCase
|
||||||
$this->actingAs($user)
|
$this->actingAs($user)
|
||||||
->post(route('report-templates.update', $reportTemplate), [
|
->post(route('report-templates.update', $reportTemplate), [
|
||||||
'id' => 1,
|
'id' => 1,
|
||||||
|
'company' => 1,
|
||||||
'by_company_id' => [3],
|
'by_company_id' => [3],
|
||||||
])
|
]);
|
||||||
->assertOk();
|
|
||||||
|
|
||||||
// @todo:
|
$reportTemplate->refresh();
|
||||||
$reportTemplate->fresh();
|
$this->assertEquals(1, $reportTemplate->checkmarkValue('id'));
|
||||||
dd($reportTemplate->options);
|
$this->assertEquals(0, $reportTemplate->checkmarkValue('category'));
|
||||||
|
$this->assertEquals([], $reportTemplate->selectValues('by_category_id'));
|
||||||
|
$this->assertEquals(1, $reportTemplate->checkmarkValue('company'));
|
||||||
|
$this->assertEquals([3], $reportTemplate->selectValues('by_company_id'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue