mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-08 08:12:17 +01:00
Added more imports
This commit is contained in:
@@ -16,13 +16,29 @@ class TogglTimeEntriesImporterTest extends ImporterTestAbstract
|
||||
$organization = Organization::factory()->create();
|
||||
$importer = new TogglTimeEntriesImporter();
|
||||
$importer->init($organization);
|
||||
$data = file_get_contents(storage_path('tests/toggl_import_test_1.csv'));
|
||||
$data = file_get_contents(storage_path('tests/toggl_time_entries_import_test_1.csv'));
|
||||
|
||||
// Act
|
||||
$importer->importData($data, []);
|
||||
|
||||
// Assert
|
||||
$this->checkTestScenarioAfterImportExcludingTimeEntries();
|
||||
$testScenario = $this->checkTestScenarioAfterImportExcludingTimeEntries();
|
||||
$timeEntries = TimeEntry::all();
|
||||
$this->assertCount(2, $timeEntries);
|
||||
$timeEntry1 = $timeEntries->firstWhere('description', '');
|
||||
$this->assertNotNull($timeEntry1);
|
||||
$this->assertSame('', $timeEntry1->description);
|
||||
$this->assertSame('2024-03-04 10:23:52', $timeEntry1->start->toDateTimeString());
|
||||
$this->assertSame('2024-03-04 10:23:52', $timeEntry1->end->toDateTimeString());
|
||||
$this->assertFalse($timeEntry1->billable);
|
||||
$this->assertSame([$testScenario->tag1->getKey(), $testScenario->tag2->getKey()], $timeEntry1->tags);
|
||||
$timeEntry2 = $timeEntries->firstWhere('description', 'Working hard');
|
||||
$this->assertNotNull($timeEntry2);
|
||||
$this->assertSame('Working hard', $timeEntry2->description);
|
||||
$this->assertSame('2024-03-04 10:23:00', $timeEntry2->start->toDateTimeString());
|
||||
$this->assertSame('2024-03-04 11:23:01', $timeEntry2->end->toDateTimeString());
|
||||
$this->assertTrue($timeEntry2->billable);
|
||||
$this->assertSame([], $timeEntry2->tags);
|
||||
}
|
||||
|
||||
public function test_import_of_test_file_twice_succeeds(): void
|
||||
@@ -31,7 +47,7 @@ class TogglTimeEntriesImporterTest extends ImporterTestAbstract
|
||||
$organization = Organization::factory()->create();
|
||||
$importer = new TogglTimeEntriesImporter();
|
||||
$importer->init($organization);
|
||||
$data = file_get_contents(storage_path('tests/toggl_import_test_1.csv'));
|
||||
$data = file_get_contents(storage_path('tests/toggl_time_entries_import_test_1.csv'));
|
||||
$importer->importData($data, []);
|
||||
$importer = new TogglTimeEntriesImporter();
|
||||
$importer->init($organization);
|
||||
@@ -49,7 +65,7 @@ class TogglTimeEntriesImporterTest extends ImporterTestAbstract
|
||||
$this->assertSame('2024-03-04 10:23:52', $timeEntry1->start->toDateTimeString());
|
||||
$this->assertSame('2024-03-04 10:23:52', $timeEntry1->end->toDateTimeString());
|
||||
$this->assertFalse($timeEntry1->billable);
|
||||
$this->assertSame([$testScenario->tag1->getKey()], $timeEntry1->tags);
|
||||
$this->assertSame([$testScenario->tag1->getKey(), $testScenario->tag2->getKey()], $timeEntry1->tags);
|
||||
$timeEntry2 = $timeEntries->firstWhere('description', 'Working hard');
|
||||
$this->assertNotNull($timeEntry2);
|
||||
$this->assertSame('Working hard', $timeEntry2->description);
|
||||
|
||||
Reference in New Issue
Block a user