mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-10-14 16:53:17 +01:00
Throw import exception for missing references in solidtime import
Time entries referencing a user, member, client, project or task that is not part of the import caused a TypeError, which surfaced as "Unknown error".
This commit is contained in:
committed by
Constantin Graf
parent
0c58896b00
commit
65525791a6
@@ -140,6 +140,28 @@ class SolidtimeImporterTest extends ImporterTestAbstract
|
||||
$this->assertSame([], $breakEntry->tags);
|
||||
}
|
||||
|
||||
public function test_import_throws_exception_if_time_entry_references_task_that_does_not_exist(): void
|
||||
{
|
||||
// Arrange
|
||||
$zipPath = $this->createTestZip('solidtime_import_test_missing_task');
|
||||
$timezone = 'Europe/Vienna';
|
||||
$organization = Organization::factory()->create();
|
||||
$importer = new SolidtimeImporter;
|
||||
$importer->init($organization);
|
||||
$data = file_get_contents($zipPath);
|
||||
|
||||
// Act
|
||||
try {
|
||||
$importer->importData($data, $timezone);
|
||||
} catch (Exception $e) {
|
||||
$this->assertInstanceOf(ImportException::class, $e);
|
||||
$this->assertSame('Time entry references a task that does not exist in the import', $e->getMessage());
|
||||
|
||||
return;
|
||||
}
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function test_import_of_test_file_twice_succeeds(): void
|
||||
{
|
||||
// Arrange
|
||||
|
||||
Reference in New Issue
Block a user