mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-13 10:42:16 +01:00
add support for archived projects in the clockify importer
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace Tests\Unit\Service\Import\Importers;
|
||||
|
||||
use App\Models\Organization;
|
||||
use App\Models\Project;
|
||||
use App\Service\Import\Importers\ClockifyProjectsImporter;
|
||||
use App\Service\Import\Importers\DefaultImporter;
|
||||
use App\Service\Import\Importers\ImportException;
|
||||
@@ -50,4 +51,26 @@ class ClockifyProjectsImporterTest extends ImporterTestAbstract
|
||||
// Assert
|
||||
$this->checkTestScenarioProjectsOnlyAfterImport();
|
||||
}
|
||||
|
||||
public function test_import_sets_archived_at_based_on_status_column(): void
|
||||
{
|
||||
// Arrange
|
||||
$organization = Organization::factory()->create();
|
||||
$timezone = 'Europe/Vienna';
|
||||
$importer = new ClockifyProjectsImporter;
|
||||
$importer->init($organization);
|
||||
$data = Storage::disk('testfiles')->get('clockify_projects_import_test_2.csv');
|
||||
|
||||
// Act
|
||||
$importer->importData($data, $timezone);
|
||||
|
||||
// Assert
|
||||
$activeProject = Project::query()->where('organization_id', $organization->id)->where('name', 'Active Project')->firstOrFail();
|
||||
$this->assertNull($activeProject->archived_at);
|
||||
$this->assertFalse($activeProject->is_archived);
|
||||
|
||||
$archivedProject = Project::query()->where('organization_id', $organization->id)->where('name', 'Archived Project')->firstOrFail();
|
||||
$this->assertNotNull($archivedProject->archived_at);
|
||||
$this->assertTrue($archivedProject->is_archived);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user