Add tests for billable rate restriction in importers and API edge cases

This commit is contained in:
Constantin Graf
2026-10-14 13:29:32 +02:00
committed by Gregor Vostrak
parent 902270a189
commit c69edc81be
11 changed files with 287 additions and 0 deletions

View File

@@ -157,4 +157,26 @@ class ClockifyProjectsImporterTest extends ImporterTestAbstract
Task::query()->where('project_id', $project->id)->pluck('name')->all(),
);
}
public function test_import_drops_billable_flags_and_rates_if_organization_can_not_use_billable_rates(): void
{
// Arrange
$this->actAsOrganizationWithoutBillableRates();
$organization = Organization::factory()->create();
$timezone = 'Europe/Vienna';
$importer = new ClockifyProjectsImporter;
$importer->init($organization);
$data = Storage::disk('testfiles')->get('clockify_projects_import_test_1.csv');
// Act
$importer->importData($data, $timezone);
// Assert
$projects = Project::query()->whereBelongsTo($organization, 'organization')->get();
$this->assertCount(2, $projects);
foreach ($projects as $project) {
$this->assertFalse($project->is_billable);
$this->assertNull($project->billable_rate);
}
}
}