mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-10-15 09:13:16 +01:00
Add tests for billable rate restriction in importers and API edge cases
This commit is contained in:
@@ -56,4 +56,26 @@ class HarvestProjectsImporterTest extends ImporterTestAbstract
|
||||
$this->assertSame(null, $project2->estimated_time);
|
||||
$this->assertSame(false, $project2->is_billable);
|
||||
}
|
||||
|
||||
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 HarvestProjectsImporter;
|
||||
$importer->init($organization);
|
||||
$data = Storage::disk('testfiles')->get('harvest_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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user