Skip to content

A free open source IT asset/license management system

More scaffolding

Marcus Moore6cf1f329fa07
diff --git a/resources/views/reports/custom/component.blade.php b/resources/views/reports/custom/component.blade.php
index 27cfb3da06..00c42459f1 100644
--- a/resources/views/reports/custom/component.blade.php
+++ b/resources/views/reports/custom/component.blade.php
@@ -436,6 +436,14 @@
</label>
</div>
+ <div class="col-md-9 col-md-offset-3">
+ <label class="form-control">
+ <input type="checkbox" name="use_bom" value="1" @checked($template->checkmarkValue('include_assignments', '0')) />
+ Include Assignments
+ </label>
+ <p class="help-block">todo: details</p>
+ </div>
+
<div class="col-md-9 col-md-offset-3">
<label class="form-control">
<input
diff --git a/tests/Feature/Reporting/Custom/CustomComponentReportTest.php b/tests/Feature/Reporting/Custom/CustomComponentReportTest.php
index acec881d01..3704a99053 100644
--- a/tests/Feature/Reporting/Custom/CustomComponentReportTest.php
+++ b/tests/Feature/Reporting/Custom/CustomComponentReportTest.php
@@ -558,6 +558,39 @@ class CustomComponentReportTest extends TestCase
->assertSeeTextInStreamedResponse('Deleted Component');
}
+ public function test_does_not_included_assignments_by_default()
+ {
+ $this->markTestIncomplete();
+ }
+
+ public function test_can_include_assignments()
+ {
+ $this->markTestIncomplete();
+
+ [$assetA, $assetB] = Asset::factory()
+ ->count(2)
+ ->sequence(
+ ['name' => 'Asset 001'],
+ ['name' => 'Asset 002'],
+ )->create();
+
+ Component::factory()->create(['name' => 'Component A']);
+ Component::factory()->checkedOutToAsset($assetA)->create(['name' => 'Component B']);
+ Component::factory()->checkedOutToAsset($assetB)->create(['name' => 'Component C']);
+
+ $this->sendRequest([
+ 'component_name' => '1',
+ 'include_assignments' => '1',
+ ])
+ ->assertOk()
+ ->assertCsvHeader()
+ ->assertSeeTextInStreamedResponse('Component A')
+ ->assertSeeTextInStreamedResponse('Component B')
+ ->assertSeeTextInStreamedResponse('Component C')
+ ->assertSeeTextInStreamedResponse('Asset 001')
+ ->assertSeeTextInStreamedResponse('Asset 002');
+ }
+
public function test_custom_component_report_adheres_to_company_scoping_for_non_super_users()
{
[$companyA, $companyB] = Company::factory()->count(2)->create()->all();
@@ -600,11 +633,6 @@ class CustomComponentReportTest extends TestCase
->assertSeeTextInStreamedResponse('Company B Component');
}
- public function test_can_include_assignments()
- {
- $this->markTestIncomplete();
- }
-
private function sendRequest(array $data): TestResponse
{
return $this->actingAs($this->actor)