not->toBeFalse(); file_put_contents($filePath, 'header'); $fileObject = new \SplFileObject($filePath, 'r'); // WHEN $input = new ImportEmployeesInput($fileObject); // THEN expect($input->inputStream)->toBe($fileObject); unlink($filePath); }); it('throws when stream is not readable', function (): void { // GIVEN $unreadable = new class ('/dev/null', 'r') extends \SplFileObject { public function isReadable(): bool { return false; } }; // WHEN + THEN expect(fn () => new ImportEmployeesInput($unreadable)) ->toThrow(\InvalidArgumentException::class, 'Input stream must be readable.'); }); it('throws when input is not a SplFileObject', function (): void { // GIVEN $notAStream = 'employees.csv'; // WHEN + THEN expect(fn () => new ImportEmployeesInput($notAStream)) // @phpstan-ignore argument.type ->toThrow(\TypeError::class); }); });