ldc-cocotte/tests/Feature/App/Console/Commands/UpsertEmployeesFormFileTest.php

31 lines
751 B
PHP

<?php
declare(strict_types=1);
namespace Tests\Feature\App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Testing\PendingCommand;
use Webmozart\Assert\Assert;
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,
]);
Assert::isInstanceOf($result, PendingCommand::class);
// THEN
$result->assertExitCode(Command::FAILURE);
});
});