Skip to content

Commit 0cb5a10

Browse files
committed
test: osFileProcClause
1 parent 600f9e9 commit 0cb5a10

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/Feature/SQLLoaderTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,3 +257,26 @@
257257
->toContain("updated_by CONSTANT 1,\n")
258258
->toContain("updated_at EXPRESSION \"current_timestamp(3)\"\n");
259259
});
260+
261+
test('it can set input file os file proc clause', function () {
262+
Process::fake();
263+
264+
$loader = new SQLLoader();
265+
$loader->inFile(__DIR__.'/../data/users.dat', osFileProcClause: 'os file proc')
266+
->as('users.ctl')
267+
->withHeaders()
268+
->into('users')
269+
->execute();
270+
271+
$controlFile = $loader->buildControlFile();
272+
273+
expect($controlFile)->toBeString()
274+
->toContain("INFILE '".__DIR__."/../data/users.dat' \"os file proc\"")
275+
->toContain('INTO TABLE users')
276+
->toContain('FIELDS TERMINATED BY \',\' OPTIONALLY ENCLOSED BY \'"\'')
277+
->toContain('TRAILING NULLCOLS')
278+
->toContain('(')
279+
->toContain('"NAME",')
280+
->toContain('"EMAIL"')
281+
->toContain(')');
282+
});

0 commit comments

Comments
 (0)