- Added EmployeesImportResults class to encapsulate import results. - Created ImportEmployees action to handle CSV import and upsert employees. - Introduced ImportEmployeesInput class for input validation. - Developed EmployeeCsvReaderService for reading and parsing CSV files. - Implemented EmployeeCsvImportLine to map CSV rows to employee data. - Added EnhancedCsvReader for improved CSV handling. - Updated composer.json to include fusonic/csv-reader dependency. - Created tests for the new employee import functionality.
27 lines
602 B
PHP
27 lines
602 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Contracts\Executor;
|
|
use Illuminate\Console\Command;
|
|
|
|
afterEach(function (): void {
|
|
\Mockery::close();
|
|
});
|
|
|
|
describe('UpsertEmployeesFormFile command', function (): void {
|
|
it('returns failure when input file does not exist', function (): void {
|
|
/** @var \Tests\TestCase $this */
|
|
// GIVEN
|
|
$filePath = '/tmp/does-not-exist.csv';
|
|
|
|
// WHEN
|
|
$result = $this->artisan('uwil:employees:upsert', [
|
|
'file' => $filePath,
|
|
]);
|
|
|
|
// THEN
|
|
$result->assertExitCode(Command::FAILURE);
|
|
});
|
|
|
|
});
|