|
155 | 155 | assertStringContainsString("\"EMAIL\",\n", $controlFile);
|
156 | 156 | assertStringContainsString('"PHONE" FILLER', $controlFile);
|
157 | 157 | assertStringContainsString('"CREATED_AT" DATE', $controlFile);
|
158 |
| - assertStringContainsString("\"IS_ACTIVE\" \"DECODE(:is_active, '', '1', :is_active)\"\n", $controlFile); |
| 158 | + assertStringContainsString("\"IS_ACTIVE\" \"DECODE(:is_active, '', '1', :is_active)\"", $controlFile); |
| 159 | +}); |
| 160 | + |
| 161 | +test('it can detect BOOLEAN columns and set the default value to 0 if no default was defined', function () { |
| 162 | + Process::fake(); |
| 163 | + |
| 164 | + $loader = new SQLLoader(); |
| 165 | + $loader->inFile(__DIR__.'/../data/filler.dat') |
| 166 | + ->as('users.ctl') |
| 167 | + ->withHeaders() |
| 168 | + ->into('users_bool_no_default') |
| 169 | + ->execute(); |
| 170 | + |
| 171 | + $controlFile = $loader->buildControlFile(); |
| 172 | + assertStringContainsString("\"NAME\",\n", $controlFile); |
| 173 | + assertStringContainsString("\"EMAIL\",\n", $controlFile); |
| 174 | + assertStringContainsString('"PHONE" FILLER', $controlFile); |
| 175 | + assertStringContainsString('"CREATED_AT" DATE', $controlFile); |
| 176 | + assertStringContainsString("\"IS_ACTIVE\" \"DECODE(:is_active, '', '0', :is_active)\"", $controlFile); |
159 | 177 | });
|
160 | 178 |
|
161 | 179 | test('it accepts withHeader on input file with wildcard', function () {
|
|
0 commit comments