create(); $timezone = 'Europe/Vienna'; $importer = new GenericTimeEntriesImporter; $importer->init($organization); $data = Storage::disk('testfiles')->get('generic_time_entries_import_test_1.csv'); // Act $importer->importData($data, $timezone); $report = $importer->getReport(); // Assert $testScenario = $this->checkTestScenarioAfterImportExcludingTimeEntries(); $this->checkTimeEntries($testScenario); $this->assertSame(2, $report->timeEntriesCreated); $this->assertSame(2, $report->tagsCreated); $this->assertSame(1, $report->tasksCreated); $this->assertSame(1, $report->usersCreated); $this->assertSame(2, $report->projectsCreated); $this->assertSame(1, $report->clientsCreated); } public function test_import_of_test_file_twice_succeeds(): void { // Arrange $organization = Organization::factory()->create(); $timezone = 'Europe/Vienna'; $importer = new GenericTimeEntriesImporter; $importer->init($organization); $data = Storage::disk('testfiles')->get('generic_time_entries_import_test_1.csv'); $importer->importData($data, $timezone); $importer = new GenericTimeEntriesImporter; $importer->init($organization); // Act $importer->importData($data, $timezone); $report = $importer->getReport(); // Assert $testScenario = $this->checkTestScenarioAfterImportExcludingTimeEntries(); $this->checkTimeEntries($testScenario, true); $this->assertSame(2, $report->timeEntriesCreated); $this->assertSame(0, $report->tagsCreated); $this->assertSame(0, $report->tasksCreated); $this->assertSame(0, $report->usersCreated); $this->assertSame(0, $report->projectsCreated); $this->assertSame(0, $report->clientsCreated); } }