Skip to content

Commit 39ec2c9

Browse files
committed
test: date format
1 parent 2a0685f commit 39ec2c9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/Feature/SQLLoaderTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,3 +210,23 @@
210210
->toContain('"EMAIL"')
211211
->toContain(')');
212212
});
213+
214+
test('it can set the default date format', function () {
215+
Process::fake();
216+
217+
$loader = new SQLLoader();
218+
$loader->inFile(__DIR__.'/../data/filler.dat')
219+
->as('users.ctl')
220+
->dateFormat('YYYY-MM-DD')
221+
->withHeaders()
222+
->into('users')
223+
->execute();
224+
225+
$controlFile = $loader->buildControlFile();
226+
227+
expect($controlFile)->toBeString()
228+
->toContain("DATE FORMAT 'YYYY-MM-DD'\n")
229+
->toContain("TIMESTAMP FORMAT 'YYYY-MM-DD'\n")
230+
->toContain("TIMESTAMP WITH TIME ZONE 'YYYY-MM-DD'\n")
231+
->toContain("TIMESTAMP WITH LOCAL TIME ZONE 'YYYY-MM-DD'\n");
232+
});

0 commit comments

Comments
 (0)