1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace PhpMyAdmin\Tests\Config\Settings; |
6
|
|
|
|
7
|
|
|
use PhpMyAdmin\Config\Settings\Export; |
8
|
|
|
use PHPUnit\Framework\Attributes\CoversClass; |
9
|
|
|
use PHPUnit\Framework\Attributes\DataProvider; |
10
|
|
|
use PHPUnit\Framework\TestCase; |
11
|
|
|
|
12
|
|
|
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps |
13
|
|
|
#[CoversClass(Export::class)] |
14
|
|
|
class ExportTest extends TestCase |
15
|
|
|
{ |
16
|
|
|
#[DataProvider('valuesForFormatProvider')] |
17
|
|
|
public function testFormat(mixed $actual, string $expected): void |
18
|
|
|
{ |
19
|
|
|
$export = new Export(['format' => $actual]); |
20
|
|
|
$exportArray = $export->asArray(); |
21
|
|
|
self::assertSame($expected, $export->format); |
22
|
|
|
self::assertSame($expected, $exportArray['format']); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
26
|
|
|
public static function valuesForFormatProvider(): iterable |
27
|
|
|
{ |
28
|
|
|
yield 'null value' => [null, 'sql']; |
29
|
|
|
yield 'valid value' => ['codegen', 'codegen']; |
30
|
|
|
yield 'valid value 2' => ['csv', 'csv']; |
31
|
|
|
yield 'valid value 3' => ['excel', 'excel']; |
32
|
|
|
yield 'valid value 4' => ['htmlexcel', 'htmlexcel']; |
33
|
|
|
yield 'valid value 5' => ['htmlword', 'htmlword']; |
34
|
|
|
yield 'valid value 6' => ['latex', 'latex']; |
35
|
|
|
yield 'valid value 7' => ['ods', 'ods']; |
36
|
|
|
yield 'valid value 8' => ['odt', 'odt']; |
37
|
|
|
yield 'valid value 9' => ['pdf', 'pdf']; |
38
|
|
|
yield 'valid value 10' => ['sql', 'sql']; |
39
|
|
|
yield 'valid value 11' => ['texytext', 'texytext']; |
40
|
|
|
yield 'valid value 12' => ['xml', 'xml']; |
41
|
|
|
yield 'valid value 13' => ['yaml', 'yaml']; |
42
|
|
|
yield 'invalid value' => ['invalid', 'sql']; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
#[DataProvider('valuesForMethodProvider')] |
46
|
|
|
public function testMethod(mixed $actual, string $expected): void |
47
|
|
|
{ |
48
|
|
|
$export = new Export(['method' => $actual]); |
49
|
|
|
$exportArray = $export->asArray(); |
50
|
|
|
self::assertSame($expected, $export->method); |
51
|
|
|
self::assertSame($expected, $exportArray['method']); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
55
|
|
|
public static function valuesForMethodProvider(): iterable |
56
|
|
|
{ |
57
|
|
|
yield 'null value' => [null, 'quick']; |
58
|
|
|
yield 'valid value' => ['quick', 'quick']; |
59
|
|
|
yield 'valid value 2' => ['custom', 'custom']; |
60
|
|
|
yield 'valid value 3' => ['custom-no-form', 'custom-no-form']; |
61
|
|
|
yield 'invalid value' => ['invalid', 'quick']; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
#[DataProvider('valuesForCompressionProvider')] |
65
|
|
|
public function testCompression(mixed $actual, string $expected): void |
66
|
|
|
{ |
67
|
|
|
$export = new Export(['compression' => $actual]); |
68
|
|
|
$exportArray = $export->asArray(); |
69
|
|
|
self::assertSame($expected, $export->compression); |
70
|
|
|
self::assertSame($expected, $exportArray['compression']); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
74
|
|
|
public static function valuesForCompressionProvider(): iterable |
75
|
|
|
{ |
76
|
|
|
yield 'null value' => [null, 'none']; |
77
|
|
|
yield 'valid value' => ['none', 'none']; |
78
|
|
|
yield 'valid value 2' => ['zip', 'zip']; |
79
|
|
|
yield 'valid value 3' => ['gzip', 'gzip']; |
80
|
|
|
yield 'invalid value' => ['invalid', 'none']; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
84
|
|
|
public function testLockTables(mixed $actual, bool $expected): void |
85
|
|
|
{ |
86
|
|
|
$export = new Export(['lock_tables' => $actual]); |
87
|
|
|
$exportArray = $export->asArray(); |
88
|
|
|
self::assertSame($expected, $export->lock_tables); |
89
|
|
|
self::assertSame($expected, $exportArray['lock_tables']); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** @return iterable<string, array{mixed, bool}> */ |
93
|
|
|
public static function booleanWithDefaultFalseProvider(): iterable |
94
|
|
|
{ |
95
|
|
|
yield 'null value' => [null, false]; |
96
|
|
|
yield 'valid value' => [false, false]; |
97
|
|
|
yield 'valid value 2' => [true, true]; |
98
|
|
|
yield 'valid value with type coercion' => [1, true]; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
102
|
|
|
public function testAsSeparateFiles(mixed $actual, bool $expected): void |
103
|
|
|
{ |
104
|
|
|
$export = new Export(['as_separate_files' => $actual]); |
105
|
|
|
$exportArray = $export->asArray(); |
106
|
|
|
self::assertSame($expected, $export->as_separate_files); |
107
|
|
|
self::assertSame($expected, $exportArray['as_separate_files']); |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
111
|
|
|
public function testAsfile(mixed $actual, bool $expected): void |
112
|
|
|
{ |
113
|
|
|
$export = new Export(['asfile' => $actual]); |
114
|
|
|
$exportArray = $export->asArray(); |
115
|
|
|
self::assertSame($expected, $export->asfile); |
116
|
|
|
self::assertSame($expected, $exportArray['asfile']); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** @return iterable<string, array{mixed, bool}> */ |
120
|
|
|
public static function booleanWithDefaultTrueProvider(): iterable |
121
|
|
|
{ |
122
|
|
|
yield 'null value' => [null, true]; |
123
|
|
|
yield 'valid value' => [true, true]; |
124
|
|
|
yield 'valid value 2' => [false, false]; |
125
|
|
|
yield 'valid value with type coercion' => [0, false]; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
#[DataProvider('valuesForCharsetProvider')] |
129
|
|
|
public function testCharset(mixed $actual, string $expected): void |
130
|
|
|
{ |
131
|
|
|
$export = new Export(['charset' => $actual]); |
132
|
|
|
$exportArray = $export->asArray(); |
133
|
|
|
self::assertSame($expected, $export->charset); |
134
|
|
|
self::assertSame($expected, $exportArray['charset']); |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
138
|
|
|
public static function valuesForCharsetProvider(): iterable |
139
|
|
|
{ |
140
|
|
|
yield 'null value' => [null, '']; |
141
|
|
|
yield 'valid value' => ['', '']; |
142
|
|
|
yield 'valid value 2' => ['test', 'test']; |
143
|
|
|
yield 'valid value with type coercion' => [1234, '1234']; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
147
|
|
|
public function testOnserver(mixed $actual, bool $expected): void |
148
|
|
|
{ |
149
|
|
|
$export = new Export(['onserver' => $actual]); |
150
|
|
|
$exportArray = $export->asArray(); |
151
|
|
|
self::assertSame($expected, $export->onserver); |
152
|
|
|
self::assertSame($expected, $exportArray['onserver']); |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
156
|
|
|
public function testOnserverOverwrite(mixed $actual, bool $expected): void |
157
|
|
|
{ |
158
|
|
|
$export = new Export(['onserver_overwrite' => $actual]); |
159
|
|
|
$exportArray = $export->asArray(); |
160
|
|
|
self::assertSame($expected, $export->onserver_overwrite); |
161
|
|
|
self::assertSame($expected, $exportArray['onserver_overwrite']); |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
165
|
|
|
public function testQuickExportOnserver(mixed $actual, bool $expected): void |
166
|
|
|
{ |
167
|
|
|
$export = new Export(['quick_export_onserver' => $actual]); |
168
|
|
|
$exportArray = $export->asArray(); |
169
|
|
|
self::assertSame($expected, $export->quick_export_onserver); |
170
|
|
|
self::assertSame($expected, $exportArray['quick_export_onserver']); |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
174
|
|
|
public function testQuickExportOnserverOverwrite(mixed $actual, bool $expected): void |
175
|
|
|
{ |
176
|
|
|
$export = new Export(['quick_export_onserver_overwrite' => $actual]); |
177
|
|
|
$exportArray = $export->asArray(); |
178
|
|
|
self::assertSame($expected, $export->quick_export_onserver_overwrite); |
179
|
|
|
self::assertSame($expected, $exportArray['quick_export_onserver_overwrite']); |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
183
|
|
|
public function testRememberFileTemplate(mixed $actual, bool $expected): void |
184
|
|
|
{ |
185
|
|
|
$export = new Export(['remember_file_template' => $actual]); |
186
|
|
|
$exportArray = $export->asArray(); |
187
|
|
|
self::assertSame($expected, $export->remember_file_template); |
188
|
|
|
self::assertSame($expected, $exportArray['remember_file_template']); |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
#[DataProvider('valuesForFileTemplateTableProvider')] |
192
|
|
|
public function testFileTemplateTable(mixed $actual, string $expected): void |
193
|
|
|
{ |
194
|
|
|
$export = new Export(['file_template_table' => $actual]); |
195
|
|
|
$exportArray = $export->asArray(); |
196
|
|
|
self::assertSame($expected, $export->file_template_table); |
197
|
|
|
self::assertSame($expected, $exportArray['file_template_table']); |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
201
|
|
|
public static function valuesForFileTemplateTableProvider(): iterable |
202
|
|
|
{ |
203
|
|
|
yield 'null value' => [null, '@TABLE@']; |
204
|
|
|
yield 'valid value' => ['', '']; |
205
|
|
|
yield 'valid value 2' => ['test', 'test']; |
206
|
|
|
yield 'valid value with type coercion' => [1234, '1234']; |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
#[DataProvider('valuesForFileTemplateDatabaseProvider')] |
210
|
|
|
public function testFileTemplateDatabase(mixed $actual, string $expected): void |
211
|
|
|
{ |
212
|
|
|
$export = new Export(['file_template_database' => $actual]); |
213
|
|
|
$exportArray = $export->asArray(); |
214
|
|
|
self::assertSame($expected, $export->file_template_database); |
215
|
|
|
self::assertSame($expected, $exportArray['file_template_database']); |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
219
|
|
|
public static function valuesForFileTemplateDatabaseProvider(): iterable |
220
|
|
|
{ |
221
|
|
|
yield 'null value' => [null, '@DATABASE@']; |
222
|
|
|
yield 'valid value' => ['', '']; |
223
|
|
|
yield 'valid value 2' => ['test', 'test']; |
224
|
|
|
yield 'valid value with type coercion' => [1234, '1234']; |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
#[DataProvider('valuesForFileTemplateServerProvider')] |
228
|
|
|
public function testFileTemplateServer(mixed $actual, string $expected): void |
229
|
|
|
{ |
230
|
|
|
$export = new Export(['file_template_server' => $actual]); |
231
|
|
|
$exportArray = $export->asArray(); |
232
|
|
|
self::assertSame($expected, $export->file_template_server); |
233
|
|
|
self::assertSame($expected, $exportArray['file_template_server']); |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
237
|
|
|
public static function valuesForFileTemplateServerProvider(): iterable |
238
|
|
|
{ |
239
|
|
|
yield 'null value' => [null, '@SERVER@']; |
240
|
|
|
yield 'valid value' => ['', '']; |
241
|
|
|
yield 'valid value 2' => ['test', 'test']; |
242
|
|
|
yield 'valid value with type coercion' => [1234, '1234']; |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
#[DataProvider('structureOrDataWithDefaultDataProvider')] |
246
|
|
|
public function testCodegenStructureOrData(mixed $actual, string $expected): void |
247
|
|
|
{ |
248
|
|
|
$export = new Export(['codegen_structure_or_data' => $actual]); |
249
|
|
|
$exportArray = $export->asArray(); |
250
|
|
|
self::assertSame($expected, $export->codegen_structure_or_data); |
251
|
|
|
self::assertSame($expected, $exportArray['codegen_structure_or_data']); |
252
|
|
|
} |
253
|
|
|
|
254
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
255
|
|
|
public static function structureOrDataWithDefaultDataProvider(): iterable |
256
|
|
|
{ |
257
|
|
|
yield 'null value' => [null, 'data']; |
258
|
|
|
yield 'valid value' => ['structure', 'structure']; |
259
|
|
|
yield 'valid value 2' => ['data', 'data']; |
260
|
|
|
yield 'valid value 3' => ['structure_and_data', 'structure_and_data']; |
261
|
|
|
yield 'invalid value' => ['invalid', 'data']; |
262
|
|
|
} |
263
|
|
|
|
264
|
|
|
#[DataProvider('valuesForCodegenFormatProvider')] |
265
|
|
|
public function testCodegenFormat(mixed $actual, int $expected): void |
266
|
|
|
{ |
267
|
|
|
$export = new Export(['codegen_format' => $actual]); |
268
|
|
|
$exportArray = $export->asArray(); |
269
|
|
|
self::assertSame($expected, $export->codegen_format); |
270
|
|
|
self::assertSame($expected, $exportArray['codegen_format']); |
271
|
|
|
} |
272
|
|
|
|
273
|
|
|
/** @return iterable<string, array{mixed, int}> */ |
274
|
|
|
public static function valuesForCodegenFormatProvider(): iterable |
275
|
|
|
{ |
276
|
|
|
yield 'null value' => [null, 0]; |
277
|
|
|
yield 'valid value' => [0, 0]; |
278
|
|
|
yield 'valid value 2' => [1, 1]; |
279
|
|
|
yield 'valid value with type coercion' => ['1', 1]; |
280
|
|
|
yield 'invalid value' => [-1, 0]; |
281
|
|
|
yield 'invalid value 2' => [2, 0]; |
282
|
|
|
} |
283
|
|
|
|
284
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
285
|
|
|
public function testOdsColumns(mixed $actual, bool $expected): void |
286
|
|
|
{ |
287
|
|
|
$export = new Export(['ods_columns' => $actual]); |
288
|
|
|
$exportArray = $export->asArray(); |
289
|
|
|
self::assertSame($expected, $export->ods_columns); |
290
|
|
|
self::assertSame($expected, $exportArray['ods_columns']); |
291
|
|
|
} |
292
|
|
|
|
293
|
|
|
#[DataProvider('valuesForOdsNullProvider')] |
294
|
|
|
public function testOdsNull(mixed $actual, string $expected): void |
295
|
|
|
{ |
296
|
|
|
$export = new Export(['ods_null' => $actual]); |
297
|
|
|
$exportArray = $export->asArray(); |
298
|
|
|
self::assertSame($expected, $export->ods_null); |
299
|
|
|
self::assertSame($expected, $exportArray['ods_null']); |
300
|
|
|
} |
301
|
|
|
|
302
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
303
|
|
|
public static function valuesForOdsNullProvider(): iterable |
304
|
|
|
{ |
305
|
|
|
yield 'null value' => [null, 'NULL']; |
306
|
|
|
yield 'valid value' => ['', '']; |
307
|
|
|
yield 'valid value 2' => ['test', 'test']; |
308
|
|
|
yield 'valid value with type coercion' => [1234, '1234']; |
309
|
|
|
} |
310
|
|
|
|
311
|
|
|
#[DataProvider('structureOrDataWithDefaultStructureOrDataProvider')] |
312
|
|
|
public function testOdtStructureOrData(mixed $actual, string $expected): void |
313
|
|
|
{ |
314
|
|
|
$export = new Export(['odt_structure_or_data' => $actual]); |
315
|
|
|
$exportArray = $export->asArray(); |
316
|
|
|
self::assertSame($expected, $export->odt_structure_or_data); |
317
|
|
|
self::assertSame($expected, $exportArray['odt_structure_or_data']); |
318
|
|
|
} |
319
|
|
|
|
320
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
321
|
|
|
public static function structureOrDataWithDefaultStructureOrDataProvider(): iterable |
322
|
|
|
{ |
323
|
|
|
yield 'null value' => [null, 'structure_and_data']; |
324
|
|
|
yield 'valid value' => ['structure', 'structure']; |
325
|
|
|
yield 'valid value 2' => ['data', 'data']; |
326
|
|
|
yield 'valid value 3' => ['structure_and_data', 'structure_and_data']; |
327
|
|
|
yield 'invalid value' => ['invalid', 'structure_and_data']; |
328
|
|
|
} |
329
|
|
|
|
330
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
331
|
|
|
public function testOdtColumns(mixed $actual, bool $expected): void |
332
|
|
|
{ |
333
|
|
|
$export = new Export(['odt_columns' => $actual]); |
334
|
|
|
$exportArray = $export->asArray(); |
335
|
|
|
self::assertSame($expected, $export->odt_columns); |
336
|
|
|
self::assertSame($expected, $exportArray['odt_columns']); |
337
|
|
|
} |
338
|
|
|
|
339
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
340
|
|
|
public function testOdtRelation(mixed $actual, bool $expected): void |
341
|
|
|
{ |
342
|
|
|
$export = new Export(['odt_relation' => $actual]); |
343
|
|
|
$exportArray = $export->asArray(); |
344
|
|
|
self::assertSame($expected, $export->odt_relation); |
345
|
|
|
self::assertSame($expected, $exportArray['odt_relation']); |
346
|
|
|
} |
347
|
|
|
|
348
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
349
|
|
|
public function testOdtComments(mixed $actual, bool $expected): void |
350
|
|
|
{ |
351
|
|
|
$export = new Export(['odt_comments' => $actual]); |
352
|
|
|
$exportArray = $export->asArray(); |
353
|
|
|
self::assertSame($expected, $export->odt_comments); |
354
|
|
|
self::assertSame($expected, $exportArray['odt_comments']); |
355
|
|
|
} |
356
|
|
|
|
357
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
358
|
|
|
public function testOdtMime(mixed $actual, bool $expected): void |
359
|
|
|
{ |
360
|
|
|
$export = new Export(['odt_mime' => $actual]); |
361
|
|
|
$exportArray = $export->asArray(); |
362
|
|
|
self::assertSame($expected, $export->odt_mime); |
363
|
|
|
self::assertSame($expected, $exportArray['odt_mime']); |
364
|
|
|
} |
365
|
|
|
|
366
|
|
|
#[DataProvider('valuesForOdtNullProvider')] |
367
|
|
|
public function testOdtNull(mixed $actual, string $expected): void |
368
|
|
|
{ |
369
|
|
|
$export = new Export(['odt_null' => $actual]); |
370
|
|
|
$exportArray = $export->asArray(); |
371
|
|
|
self::assertSame($expected, $export->odt_null); |
372
|
|
|
self::assertSame($expected, $exportArray['odt_null']); |
373
|
|
|
} |
374
|
|
|
|
375
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
376
|
|
|
public static function valuesForOdtNullProvider(): iterable |
377
|
|
|
{ |
378
|
|
|
yield 'null value' => [null, 'NULL']; |
379
|
|
|
yield 'valid value' => ['', '']; |
380
|
|
|
yield 'valid value 2' => ['test', 'test']; |
381
|
|
|
yield 'valid value with type coercion' => [1234, '1234']; |
382
|
|
|
} |
383
|
|
|
|
384
|
|
|
#[DataProvider('structureOrDataWithDefaultStructureOrDataProvider')] |
385
|
|
|
public function testHtmlwordStructureOrData(mixed $actual, string $expected): void |
386
|
|
|
{ |
387
|
|
|
$export = new Export(['htmlword_structure_or_data' => $actual]); |
388
|
|
|
$exportArray = $export->asArray(); |
389
|
|
|
self::assertSame($expected, $export->htmlword_structure_or_data); |
390
|
|
|
self::assertSame($expected, $exportArray['htmlword_structure_or_data']); |
391
|
|
|
} |
392
|
|
|
|
393
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
394
|
|
|
public function testHtmlwordColumns(mixed $actual, bool $expected): void |
395
|
|
|
{ |
396
|
|
|
$export = new Export(['htmlword_columns' => $actual]); |
397
|
|
|
$exportArray = $export->asArray(); |
398
|
|
|
self::assertSame($expected, $export->htmlword_columns); |
399
|
|
|
self::assertSame($expected, $exportArray['htmlword_columns']); |
400
|
|
|
} |
401
|
|
|
|
402
|
|
|
#[DataProvider('valuesForHtmlwordNullProvider')] |
403
|
|
|
public function testHtmlwordNull(mixed $actual, string $expected): void |
404
|
|
|
{ |
405
|
|
|
$export = new Export(['htmlword_null' => $actual]); |
406
|
|
|
$exportArray = $export->asArray(); |
407
|
|
|
self::assertSame($expected, $export->htmlword_null); |
408
|
|
|
self::assertSame($expected, $exportArray['htmlword_null']); |
409
|
|
|
} |
410
|
|
|
|
411
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
412
|
|
|
public static function valuesForHtmlwordNullProvider(): iterable |
413
|
|
|
{ |
414
|
|
|
yield 'null value' => [null, 'NULL']; |
415
|
|
|
yield 'valid value' => ['', '']; |
416
|
|
|
yield 'valid value 2' => ['test', 'test']; |
417
|
|
|
yield 'valid value with type coercion' => [1234, '1234']; |
418
|
|
|
} |
419
|
|
|
|
420
|
|
|
#[DataProvider('structureOrDataWithDefaultStructureOrDataProvider')] |
421
|
|
|
public function testTexytextStructureOrData(mixed $actual, string $expected): void |
422
|
|
|
{ |
423
|
|
|
$export = new Export(['texytext_structure_or_data' => $actual]); |
424
|
|
|
$exportArray = $export->asArray(); |
425
|
|
|
self::assertSame($expected, $export->texytext_structure_or_data); |
426
|
|
|
self::assertSame($expected, $exportArray['texytext_structure_or_data']); |
427
|
|
|
} |
428
|
|
|
|
429
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
430
|
|
|
public function testTexytextColumns(mixed $actual, bool $expected): void |
431
|
|
|
{ |
432
|
|
|
$export = new Export(['texytext_columns' => $actual]); |
433
|
|
|
$exportArray = $export->asArray(); |
434
|
|
|
self::assertSame($expected, $export->texytext_columns); |
435
|
|
|
self::assertSame($expected, $exportArray['texytext_columns']); |
436
|
|
|
} |
437
|
|
|
|
438
|
|
|
#[DataProvider('valuesForTexytextNullProvider')] |
439
|
|
|
public function testTexytextNull(mixed $actual, string $expected): void |
440
|
|
|
{ |
441
|
|
|
$export = new Export(['texytext_null' => $actual]); |
442
|
|
|
$exportArray = $export->asArray(); |
443
|
|
|
self::assertSame($expected, $export->texytext_null); |
444
|
|
|
self::assertSame($expected, $exportArray['texytext_null']); |
445
|
|
|
} |
446
|
|
|
|
447
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
448
|
|
|
public static function valuesForTexytextNullProvider(): iterable |
449
|
|
|
{ |
450
|
|
|
yield 'null value' => [null, 'NULL']; |
451
|
|
|
yield 'valid value' => ['', '']; |
452
|
|
|
yield 'valid value 2' => ['test', 'test']; |
453
|
|
|
yield 'valid value with type coercion' => [1234, '1234']; |
454
|
|
|
} |
455
|
|
|
|
456
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
457
|
|
|
public function testCsvColumns(mixed $actual, bool $expected): void |
458
|
|
|
{ |
459
|
|
|
$export = new Export(['csv_columns' => $actual]); |
460
|
|
|
$exportArray = $export->asArray(); |
461
|
|
|
self::assertSame($expected, $export->csv_columns); |
462
|
|
|
self::assertSame($expected, $exportArray['csv_columns']); |
463
|
|
|
} |
464
|
|
|
|
465
|
|
|
#[DataProvider('structureOrDataWithDefaultDataProvider')] |
466
|
|
|
public function testCsvStructureOrData(mixed $actual, string $expected): void |
467
|
|
|
{ |
468
|
|
|
$export = new Export(['csv_structure_or_data' => $actual]); |
469
|
|
|
$exportArray = $export->asArray(); |
470
|
|
|
self::assertSame($expected, $export->csv_structure_or_data); |
471
|
|
|
self::assertSame($expected, $exportArray['csv_structure_or_data']); |
472
|
|
|
} |
473
|
|
|
|
474
|
|
|
#[DataProvider('valuesForCsvNullProvider')] |
475
|
|
|
public function testCsvNull(mixed $actual, string $expected): void |
476
|
|
|
{ |
477
|
|
|
$export = new Export(['csv_null' => $actual]); |
478
|
|
|
$exportArray = $export->asArray(); |
479
|
|
|
self::assertSame($expected, $export->csv_null); |
480
|
|
|
self::assertSame($expected, $exportArray['csv_null']); |
481
|
|
|
} |
482
|
|
|
|
483
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
484
|
|
|
public static function valuesForCsvNullProvider(): iterable |
485
|
|
|
{ |
486
|
|
|
yield 'null value' => [null, 'NULL']; |
487
|
|
|
yield 'valid value' => ['', '']; |
488
|
|
|
yield 'valid value 2' => ['test', 'test']; |
489
|
|
|
yield 'valid value with type coercion' => [1234, '1234']; |
490
|
|
|
} |
491
|
|
|
|
492
|
|
|
#[DataProvider('valuesForCsvSeparatorProvider')] |
493
|
|
|
public function testCsvSeparator(mixed $actual, string $expected): void |
494
|
|
|
{ |
495
|
|
|
$export = new Export(['csv_separator' => $actual]); |
496
|
|
|
$exportArray = $export->asArray(); |
497
|
|
|
self::assertSame($expected, $export->csv_separator); |
498
|
|
|
self::assertSame($expected, $exportArray['csv_separator']); |
499
|
|
|
} |
500
|
|
|
|
501
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
502
|
|
|
public static function valuesForCsvSeparatorProvider(): iterable |
503
|
|
|
{ |
504
|
|
|
yield 'null value' => [null, ',']; |
505
|
|
|
yield 'valid value' => ['', '']; |
506
|
|
|
yield 'valid value 2' => ['test', 'test']; |
507
|
|
|
yield 'valid value with type coercion' => [1234, '1234']; |
508
|
|
|
} |
509
|
|
|
|
510
|
|
|
#[DataProvider('valuesForCsvEnclosedProvider')] |
511
|
|
|
public function testCsvEnclosed(mixed $actual, string $expected): void |
512
|
|
|
{ |
513
|
|
|
$export = new Export(['csv_enclosed' => $actual]); |
514
|
|
|
$exportArray = $export->asArray(); |
515
|
|
|
self::assertSame($expected, $export->csv_enclosed); |
516
|
|
|
self::assertSame($expected, $exportArray['csv_enclosed']); |
517
|
|
|
} |
518
|
|
|
|
519
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
520
|
|
|
public static function valuesForCsvEnclosedProvider(): iterable |
521
|
|
|
{ |
522
|
|
|
yield 'null value' => [null, '"']; |
523
|
|
|
yield 'valid value' => ['', '']; |
524
|
|
|
yield 'valid value 2' => ['test', 'test']; |
525
|
|
|
yield 'valid value with type coercion' => [1234, '1234']; |
526
|
|
|
} |
527
|
|
|
|
528
|
|
|
#[DataProvider('valuesForCsvEscapedProvider')] |
529
|
|
|
public function testCsvEscaped(mixed $actual, string $expected): void |
530
|
|
|
{ |
531
|
|
|
$export = new Export(['csv_escaped' => $actual]); |
532
|
|
|
$exportArray = $export->asArray(); |
533
|
|
|
self::assertSame($expected, $export->csv_escaped); |
534
|
|
|
self::assertSame($expected, $exportArray['csv_escaped']); |
535
|
|
|
} |
536
|
|
|
|
537
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
538
|
|
|
public static function valuesForCsvEscapedProvider(): iterable |
539
|
|
|
{ |
540
|
|
|
yield 'null value' => [null, '"']; |
541
|
|
|
yield 'valid value' => ['', '']; |
542
|
|
|
yield 'valid value 2' => ['test', 'test']; |
543
|
|
|
yield 'valid value with type coercion' => [1234, '1234']; |
544
|
|
|
} |
545
|
|
|
|
546
|
|
|
#[DataProvider('valuesForCsvTerminatedProvider')] |
547
|
|
|
public function testCsvTerminated(mixed $actual, string $expected): void |
548
|
|
|
{ |
549
|
|
|
$export = new Export(['csv_terminated' => $actual]); |
550
|
|
|
$exportArray = $export->asArray(); |
551
|
|
|
self::assertSame($expected, $export->csv_terminated); |
552
|
|
|
self::assertSame($expected, $exportArray['csv_terminated']); |
553
|
|
|
} |
554
|
|
|
|
555
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
556
|
|
|
public static function valuesForCsvTerminatedProvider(): iterable |
557
|
|
|
{ |
558
|
|
|
yield 'null value' => [null, 'AUTO']; |
559
|
|
|
yield 'valid value' => ['', '']; |
560
|
|
|
yield 'valid value 2' => ['test', 'test']; |
561
|
|
|
yield 'valid value with type coercion' => [1234, '1234']; |
562
|
|
|
} |
563
|
|
|
|
564
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
565
|
|
|
public function testCsvRemoveCRLF(mixed $actual, bool $expected): void |
566
|
|
|
{ |
567
|
|
|
$export = new Export(['csv_removeCRLF' => $actual]); |
568
|
|
|
$exportArray = $export->asArray(); |
569
|
|
|
self::assertSame($expected, $export->csv_removeCRLF); |
570
|
|
|
self::assertSame($expected, $exportArray['csv_removeCRLF']); |
571
|
|
|
} |
572
|
|
|
|
573
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
574
|
|
|
public function testExcelColumns(mixed $actual, bool $expected): void |
575
|
|
|
{ |
576
|
|
|
$export = new Export(['excel_columns' => $actual]); |
577
|
|
|
$exportArray = $export->asArray(); |
578
|
|
|
self::assertSame($expected, $export->excel_columns); |
579
|
|
|
self::assertSame($expected, $exportArray['excel_columns']); |
580
|
|
|
} |
581
|
|
|
|
582
|
|
|
#[DataProvider('valuesForExcelNullProvider')] |
583
|
|
|
public function testExcelNull(mixed $actual, string $expected): void |
584
|
|
|
{ |
585
|
|
|
$export = new Export(['excel_null' => $actual]); |
586
|
|
|
$exportArray = $export->asArray(); |
587
|
|
|
self::assertSame($expected, $export->excel_null); |
588
|
|
|
self::assertSame($expected, $exportArray['excel_null']); |
589
|
|
|
} |
590
|
|
|
|
591
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
592
|
|
|
public static function valuesForExcelNullProvider(): iterable |
593
|
|
|
{ |
594
|
|
|
yield 'null value' => [null, 'NULL']; |
595
|
|
|
yield 'valid value' => ['', '']; |
596
|
|
|
yield 'valid value 2' => ['test', 'test']; |
597
|
|
|
yield 'valid value with type coercion' => [1234, '1234']; |
598
|
|
|
} |
599
|
|
|
|
600
|
|
|
#[DataProvider('valuesForExcelEditionProvider')] |
601
|
|
|
public function testExcelEdition(mixed $actual, string $expected): void |
602
|
|
|
{ |
603
|
|
|
$export = new Export(['excel_edition' => $actual]); |
604
|
|
|
$exportArray = $export->asArray(); |
605
|
|
|
self::assertSame($expected, $export->excel_edition); |
606
|
|
|
self::assertSame($expected, $exportArray['excel_edition']); |
607
|
|
|
} |
608
|
|
|
|
609
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
610
|
|
|
public static function valuesForExcelEditionProvider(): iterable |
611
|
|
|
{ |
612
|
|
|
yield 'null value' => [null, 'win']; |
613
|
|
|
yield 'valid value' => ['win', 'win']; |
614
|
|
|
yield 'valid value 2' => ['mac_excel2003', 'mac_excel2003']; |
615
|
|
|
yield 'valid value 3' => ['mac_excel2008', 'mac_excel2008']; |
616
|
|
|
yield 'invalid value' => ['invalid', 'win']; |
617
|
|
|
} |
618
|
|
|
|
619
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
620
|
|
|
public function testExcelRemoveCRLF(mixed $actual, bool $expected): void |
621
|
|
|
{ |
622
|
|
|
$export = new Export(['excel_removeCRLF' => $actual]); |
623
|
|
|
$exportArray = $export->asArray(); |
624
|
|
|
self::assertSame($expected, $export->excel_removeCRLF); |
625
|
|
|
self::assertSame($expected, $exportArray['excel_removeCRLF']); |
626
|
|
|
} |
627
|
|
|
|
628
|
|
|
#[DataProvider('structureOrDataWithDefaultDataProvider')] |
629
|
|
|
public function testExcelStructureOrData(mixed $actual, string $expected): void |
630
|
|
|
{ |
631
|
|
|
$export = new Export(['excel_structure_or_data' => $actual]); |
632
|
|
|
$exportArray = $export->asArray(); |
633
|
|
|
self::assertSame($expected, $export->excel_structure_or_data); |
634
|
|
|
self::assertSame($expected, $exportArray['excel_structure_or_data']); |
635
|
|
|
} |
636
|
|
|
|
637
|
|
|
#[DataProvider('structureOrDataWithDefaultStructureOrDataProvider')] |
638
|
|
|
public function testLatexStructureOrData(mixed $actual, string $expected): void |
639
|
|
|
{ |
640
|
|
|
$export = new Export(['latex_structure_or_data' => $actual]); |
641
|
|
|
$exportArray = $export->asArray(); |
642
|
|
|
self::assertSame($expected, $export->latex_structure_or_data); |
643
|
|
|
self::assertSame($expected, $exportArray['latex_structure_or_data']); |
644
|
|
|
} |
645
|
|
|
|
646
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
647
|
|
|
public function testLatexColumns(mixed $actual, bool $expected): void |
648
|
|
|
{ |
649
|
|
|
$export = new Export(['latex_columns' => $actual]); |
650
|
|
|
$exportArray = $export->asArray(); |
651
|
|
|
self::assertSame($expected, $export->latex_columns); |
652
|
|
|
self::assertSame($expected, $exportArray['latex_columns']); |
653
|
|
|
} |
654
|
|
|
|
655
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
656
|
|
|
public function testLatexRelation(mixed $actual, bool $expected): void |
657
|
|
|
{ |
658
|
|
|
$export = new Export(['latex_relation' => $actual]); |
659
|
|
|
$exportArray = $export->asArray(); |
660
|
|
|
self::assertSame($expected, $export->latex_relation); |
661
|
|
|
self::assertSame($expected, $exportArray['latex_relation']); |
662
|
|
|
} |
663
|
|
|
|
664
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
665
|
|
|
public function testLatexComments(mixed $actual, bool $expected): void |
666
|
|
|
{ |
667
|
|
|
$export = new Export(['latex_comments' => $actual]); |
668
|
|
|
$exportArray = $export->asArray(); |
669
|
|
|
self::assertSame($expected, $export->latex_comments); |
670
|
|
|
self::assertSame($expected, $exportArray['latex_comments']); |
671
|
|
|
} |
672
|
|
|
|
673
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
674
|
|
|
public function testLatexMime(mixed $actual, bool $expected): void |
675
|
|
|
{ |
676
|
|
|
$export = new Export(['latex_mime' => $actual]); |
677
|
|
|
$exportArray = $export->asArray(); |
678
|
|
|
self::assertSame($expected, $export->latex_mime); |
679
|
|
|
self::assertSame($expected, $exportArray['latex_mime']); |
680
|
|
|
} |
681
|
|
|
|
682
|
|
|
#[DataProvider('valuesForLatexNullProvider')] |
683
|
|
|
public function testLatexNull(mixed $actual, string $expected): void |
684
|
|
|
{ |
685
|
|
|
$export = new Export(['latex_null' => $actual]); |
686
|
|
|
$exportArray = $export->asArray(); |
687
|
|
|
self::assertSame($expected, $export->latex_null); |
688
|
|
|
self::assertSame($expected, $exportArray['latex_null']); |
689
|
|
|
} |
690
|
|
|
|
691
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
692
|
|
|
public static function valuesForLatexNullProvider(): iterable |
693
|
|
|
{ |
694
|
|
|
yield 'null value' => [null, '\textit{NULL}']; |
695
|
|
|
yield 'valid value' => ['', '']; |
696
|
|
|
yield 'valid value 2' => ['test', 'test']; |
697
|
|
|
yield 'valid value with type coercion' => [1234, '1234']; |
698
|
|
|
} |
699
|
|
|
|
700
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
701
|
|
|
public function testLatexCaption(mixed $actual, bool $expected): void |
702
|
|
|
{ |
703
|
|
|
$export = new Export(['latex_caption' => $actual]); |
704
|
|
|
$exportArray = $export->asArray(); |
705
|
|
|
self::assertSame($expected, $export->latex_caption); |
706
|
|
|
self::assertSame($expected, $exportArray['latex_caption']); |
707
|
|
|
} |
708
|
|
|
|
709
|
|
|
#[DataProvider('valuesForLatexStructureCaptionProvider')] |
710
|
|
|
public function testLatexStructureCaption(mixed $actual, string $expected): void |
711
|
|
|
{ |
712
|
|
|
$export = new Export(['latex_structure_caption' => $actual]); |
713
|
|
|
$exportArray = $export->asArray(); |
714
|
|
|
self::assertSame($expected, $export->latex_structure_caption); |
715
|
|
|
self::assertSame($expected, $exportArray['latex_structure_caption']); |
716
|
|
|
} |
717
|
|
|
|
718
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
719
|
|
|
public static function valuesForLatexStructureCaptionProvider(): iterable |
720
|
|
|
{ |
721
|
|
|
yield 'null value' => [null, 'strLatexStructure']; |
722
|
|
|
yield 'valid value' => ['', '']; |
723
|
|
|
yield 'valid value 2' => ['test', 'test']; |
724
|
|
|
yield 'valid value with type coercion' => [1234, '1234']; |
725
|
|
|
} |
726
|
|
|
|
727
|
|
|
#[DataProvider('valuesForLatexStructureContinuedCaptionProvider')] |
728
|
|
|
public function testLatexStructureContinuedCaption(mixed $actual, string $expected): void |
729
|
|
|
{ |
730
|
|
|
$export = new Export(['latex_structure_continued_caption' => $actual]); |
731
|
|
|
$exportArray = $export->asArray(); |
732
|
|
|
self::assertSame($expected, $export->latex_structure_continued_caption); |
733
|
|
|
self::assertSame($expected, $exportArray['latex_structure_continued_caption']); |
734
|
|
|
} |
735
|
|
|
|
736
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
737
|
|
|
public static function valuesForLatexStructureContinuedCaptionProvider(): iterable |
738
|
|
|
{ |
739
|
|
|
yield 'null value' => [null, 'strLatexStructure strLatexContinued']; |
740
|
|
|
yield 'valid value' => ['', '']; |
741
|
|
|
yield 'valid value 2' => ['test', 'test']; |
742
|
|
|
yield 'valid value with type coercion' => [1234, '1234']; |
743
|
|
|
} |
744
|
|
|
|
745
|
|
|
#[DataProvider('valuesForLatexDataCaptionProvider')] |
746
|
|
|
public function testLatexDataCaption(mixed $actual, string $expected): void |
747
|
|
|
{ |
748
|
|
|
$export = new Export(['latex_data_caption' => $actual]); |
749
|
|
|
$exportArray = $export->asArray(); |
750
|
|
|
self::assertSame($expected, $export->latex_data_caption); |
751
|
|
|
self::assertSame($expected, $exportArray['latex_data_caption']); |
752
|
|
|
} |
753
|
|
|
|
754
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
755
|
|
|
public static function valuesForLatexDataCaptionProvider(): iterable |
756
|
|
|
{ |
757
|
|
|
yield 'null value' => [null, 'strLatexContent']; |
758
|
|
|
yield 'valid value' => ['', '']; |
759
|
|
|
yield 'valid value 2' => ['test', 'test']; |
760
|
|
|
yield 'valid value with type coercion' => [1234, '1234']; |
761
|
|
|
} |
762
|
|
|
|
763
|
|
|
#[DataProvider('valuesForLatexDataContinuedCaptionProvider')] |
764
|
|
|
public function testLatexDataContinuedCaption(mixed $actual, string $expected): void |
765
|
|
|
{ |
766
|
|
|
$export = new Export(['latex_data_continued_caption' => $actual]); |
767
|
|
|
$exportArray = $export->asArray(); |
768
|
|
|
self::assertSame($expected, $export->latex_data_continued_caption); |
769
|
|
|
self::assertSame($expected, $exportArray['latex_data_continued_caption']); |
770
|
|
|
} |
771
|
|
|
|
772
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
773
|
|
|
public static function valuesForLatexDataContinuedCaptionProvider(): iterable |
774
|
|
|
{ |
775
|
|
|
yield 'null value' => [null, 'strLatexContent strLatexContinued']; |
776
|
|
|
yield 'valid value' => ['', '']; |
777
|
|
|
yield 'valid value 2' => ['test', 'test']; |
778
|
|
|
yield 'valid value with type coercion' => [1234, '1234']; |
779
|
|
|
} |
780
|
|
|
|
781
|
|
|
#[DataProvider('valuesForLatexDataLabelProvider')] |
782
|
|
|
public function testLatexDataLabel(mixed $actual, string $expected): void |
783
|
|
|
{ |
784
|
|
|
$export = new Export(['latex_data_label' => $actual]); |
785
|
|
|
$exportArray = $export->asArray(); |
786
|
|
|
self::assertSame($expected, $export->latex_data_label); |
787
|
|
|
self::assertSame($expected, $exportArray['latex_data_label']); |
788
|
|
|
} |
789
|
|
|
|
790
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
791
|
|
|
public static function valuesForLatexDataLabelProvider(): iterable |
792
|
|
|
{ |
793
|
|
|
yield 'null value' => [null, 'tab:@TABLE@-data']; |
794
|
|
|
yield 'valid value' => ['', '']; |
795
|
|
|
yield 'valid value 2' => ['test', 'test']; |
796
|
|
|
yield 'valid value with type coercion' => [1234, '1234']; |
797
|
|
|
} |
798
|
|
|
|
799
|
|
|
#[DataProvider('valuesForLatexStructureLabelProvider')] |
800
|
|
|
public function testLatexStructureLabel(mixed $actual, string $expected): void |
801
|
|
|
{ |
802
|
|
|
$export = new Export(['latex_structure_label' => $actual]); |
803
|
|
|
$exportArray = $export->asArray(); |
804
|
|
|
self::assertSame($expected, $export->latex_structure_label); |
805
|
|
|
self::assertSame($expected, $exportArray['latex_structure_label']); |
806
|
|
|
} |
807
|
|
|
|
808
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
809
|
|
|
public static function valuesForLatexStructureLabelProvider(): iterable |
810
|
|
|
{ |
811
|
|
|
yield 'null value' => [null, 'tab:@TABLE@-structure']; |
812
|
|
|
yield 'valid value' => ['', '']; |
813
|
|
|
yield 'valid value 2' => ['test', 'test']; |
814
|
|
|
yield 'valid value with type coercion' => [1234, '1234']; |
815
|
|
|
} |
816
|
|
|
|
817
|
|
|
#[DataProvider('structureOrDataWithDefaultDataProvider')] |
818
|
|
|
public function testMediawikiStructureOrData(mixed $actual, string $expected): void |
819
|
|
|
{ |
820
|
|
|
$export = new Export(['mediawiki_structure_or_data' => $actual]); |
821
|
|
|
$exportArray = $export->asArray(); |
822
|
|
|
self::assertSame($expected, $export->mediawiki_structure_or_data); |
823
|
|
|
self::assertSame($expected, $exportArray['mediawiki_structure_or_data']); |
824
|
|
|
} |
825
|
|
|
|
826
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
827
|
|
|
public function testMediawikiCaption(mixed $actual, bool $expected): void |
828
|
|
|
{ |
829
|
|
|
$export = new Export(['mediawiki_caption' => $actual]); |
830
|
|
|
$exportArray = $export->asArray(); |
831
|
|
|
self::assertSame($expected, $export->mediawiki_caption); |
832
|
|
|
self::assertSame($expected, $exportArray['mediawiki_caption']); |
833
|
|
|
} |
834
|
|
|
|
835
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
836
|
|
|
public function testMediawikiHeaders(mixed $actual, bool $expected): void |
837
|
|
|
{ |
838
|
|
|
$export = new Export(['mediawiki_headers' => $actual]); |
839
|
|
|
$exportArray = $export->asArray(); |
840
|
|
|
self::assertSame($expected, $export->mediawiki_headers); |
841
|
|
|
self::assertSame($expected, $exportArray['mediawiki_headers']); |
842
|
|
|
} |
843
|
|
|
|
844
|
|
|
#[DataProvider('structureOrDataWithDefaultDataProvider')] |
845
|
|
|
public function testOdsStructureOrData(mixed $actual, string $expected): void |
846
|
|
|
{ |
847
|
|
|
$export = new Export(['ods_structure_or_data' => $actual]); |
848
|
|
|
$exportArray = $export->asArray(); |
849
|
|
|
self::assertSame($expected, $export->ods_structure_or_data); |
850
|
|
|
self::assertSame($expected, $exportArray['ods_structure_or_data']); |
851
|
|
|
} |
852
|
|
|
|
853
|
|
|
#[DataProvider('structureOrDataWithDefaultDataProvider')] |
854
|
|
|
public function testPdfStructureOrData(mixed $actual, string $expected): void |
855
|
|
|
{ |
856
|
|
|
$export = new Export(['pdf_structure_or_data' => $actual]); |
857
|
|
|
$exportArray = $export->asArray(); |
858
|
|
|
self::assertSame($expected, $export->pdf_structure_or_data); |
859
|
|
|
self::assertSame($expected, $exportArray['pdf_structure_or_data']); |
860
|
|
|
} |
861
|
|
|
|
862
|
|
|
#[DataProvider('structureOrDataWithDefaultDataProvider')] |
863
|
|
|
public function testPhparrayStructureOrData(mixed $actual, string $expected): void |
864
|
|
|
{ |
865
|
|
|
$export = new Export(['phparray_structure_or_data' => $actual]); |
866
|
|
|
$exportArray = $export->asArray(); |
867
|
|
|
self::assertSame($expected, $export->phparray_structure_or_data); |
868
|
|
|
self::assertSame($expected, $exportArray['phparray_structure_or_data']); |
869
|
|
|
} |
870
|
|
|
|
871
|
|
|
#[DataProvider('structureOrDataWithDefaultDataProvider')] |
872
|
|
|
public function testJsonStructureOrData(mixed $actual, string $expected): void |
873
|
|
|
{ |
874
|
|
|
$export = new Export(['json_structure_or_data' => $actual]); |
875
|
|
|
$exportArray = $export->asArray(); |
876
|
|
|
self::assertSame($expected, $export->json_structure_or_data); |
877
|
|
|
self::assertSame($expected, $exportArray['json_structure_or_data']); |
878
|
|
|
} |
879
|
|
|
|
880
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
881
|
|
|
public function testJsonPrettyPrint(mixed $actual, bool $expected): void |
882
|
|
|
{ |
883
|
|
|
$export = new Export(['json_pretty_print' => $actual]); |
884
|
|
|
$exportArray = $export->asArray(); |
885
|
|
|
self::assertSame($expected, $export->json_pretty_print); |
886
|
|
|
self::assertSame($expected, $exportArray['json_pretty_print']); |
887
|
|
|
} |
888
|
|
|
|
889
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
890
|
|
|
public function testJsonUnicode(mixed $actual, bool $expected): void |
891
|
|
|
{ |
892
|
|
|
$export = new Export(['json_unicode' => $actual]); |
893
|
|
|
$exportArray = $export->asArray(); |
894
|
|
|
self::assertSame($expected, $export->json_unicode); |
895
|
|
|
self::assertSame($expected, $exportArray['json_unicode']); |
896
|
|
|
} |
897
|
|
|
|
898
|
|
|
#[DataProvider('structureOrDataWithDefaultStructureOrDataProvider')] |
899
|
|
|
public function testSqlStructureOrData(mixed $actual, string $expected): void |
900
|
|
|
{ |
901
|
|
|
$export = new Export(['sql_structure_or_data' => $actual]); |
902
|
|
|
$exportArray = $export->asArray(); |
903
|
|
|
self::assertSame($expected, $export->sql_structure_or_data); |
904
|
|
|
self::assertSame($expected, $exportArray['sql_structure_or_data']); |
905
|
|
|
} |
906
|
|
|
|
907
|
|
|
#[DataProvider('valuesForSqlCompatibilityProvider')] |
908
|
|
|
public function testSqlCompatibility(mixed $actual, string $expected): void |
909
|
|
|
{ |
910
|
|
|
$export = new Export(['sql_compatibility' => $actual]); |
911
|
|
|
$exportArray = $export->asArray(); |
912
|
|
|
self::assertSame($expected, $export->sql_compatibility); |
913
|
|
|
self::assertSame($expected, $exportArray['sql_compatibility']); |
914
|
|
|
} |
915
|
|
|
|
916
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
917
|
|
|
public static function valuesForSqlCompatibilityProvider(): iterable |
918
|
|
|
{ |
919
|
|
|
yield 'null value' => [null, 'NONE']; |
920
|
|
|
yield 'valid value' => ['NONE', 'NONE']; |
921
|
|
|
yield 'valid value 2' => ['ANSI', 'ANSI']; |
922
|
|
|
yield 'valid value 3' => ['DB2', 'DB2']; |
923
|
|
|
yield 'valid value 4' => ['MAXDB', 'MAXDB']; |
924
|
|
|
yield 'valid value 5' => ['MYSQL323', 'MYSQL323']; |
925
|
|
|
yield 'valid value 6' => ['MYSQL40', 'MYSQL40']; |
926
|
|
|
yield 'valid value 7' => ['MSSQL', 'MSSQL']; |
927
|
|
|
yield 'valid value 8' => ['ORACLE', 'ORACLE']; |
928
|
|
|
yield 'valid value 9' => ['TRADITIONAL', 'TRADITIONAL']; |
929
|
|
|
yield 'valid value 10' => ['', 'NONE']; |
930
|
|
|
yield 'invalid value' => ['invalid', 'NONE']; |
931
|
|
|
} |
932
|
|
|
|
933
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
934
|
|
|
public function testSqlIncludeComments(mixed $actual, bool $expected): void |
935
|
|
|
{ |
936
|
|
|
$export = new Export(['sql_include_comments' => $actual]); |
937
|
|
|
$exportArray = $export->asArray(); |
938
|
|
|
self::assertSame($expected, $export->sql_include_comments); |
939
|
|
|
self::assertSame($expected, $exportArray['sql_include_comments']); |
940
|
|
|
} |
941
|
|
|
|
942
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
943
|
|
|
public function testSqlDisableFk(mixed $actual, bool $expected): void |
944
|
|
|
{ |
945
|
|
|
$export = new Export(['sql_disable_fk' => $actual]); |
946
|
|
|
$exportArray = $export->asArray(); |
947
|
|
|
self::assertSame($expected, $export->sql_disable_fk); |
948
|
|
|
self::assertSame($expected, $exportArray['sql_disable_fk']); |
949
|
|
|
} |
950
|
|
|
|
951
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
952
|
|
|
public function testSqlViewsAsTables(mixed $actual, bool $expected): void |
953
|
|
|
{ |
954
|
|
|
$export = new Export(['sql_views_as_tables' => $actual]); |
955
|
|
|
$exportArray = $export->asArray(); |
956
|
|
|
self::assertSame($expected, $export->sql_views_as_tables); |
957
|
|
|
self::assertSame($expected, $exportArray['sql_views_as_tables']); |
958
|
|
|
} |
959
|
|
|
|
960
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
961
|
|
|
public function testSqlMetadata(mixed $actual, bool $expected): void |
962
|
|
|
{ |
963
|
|
|
$export = new Export(['sql_metadata' => $actual]); |
964
|
|
|
$exportArray = $export->asArray(); |
965
|
|
|
self::assertSame($expected, $export->sql_metadata); |
966
|
|
|
self::assertSame($expected, $exportArray['sql_metadata']); |
967
|
|
|
} |
968
|
|
|
|
969
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
970
|
|
|
public function testSqlUseTransaction(mixed $actual, bool $expected): void |
971
|
|
|
{ |
972
|
|
|
$export = new Export(['sql_use_transaction' => $actual]); |
973
|
|
|
$exportArray = $export->asArray(); |
974
|
|
|
self::assertSame($expected, $export->sql_use_transaction); |
975
|
|
|
self::assertSame($expected, $exportArray['sql_use_transaction']); |
976
|
|
|
} |
977
|
|
|
|
978
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
979
|
|
|
public function testSqlCreateDatabase(mixed $actual, bool $expected): void |
980
|
|
|
{ |
981
|
|
|
$export = new Export(['sql_create_database' => $actual]); |
982
|
|
|
$exportArray = $export->asArray(); |
983
|
|
|
self::assertSame($expected, $export->sql_create_database); |
984
|
|
|
self::assertSame($expected, $exportArray['sql_create_database']); |
985
|
|
|
} |
986
|
|
|
|
987
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
988
|
|
|
public function testSqlDropDatabase(mixed $actual, bool $expected): void |
989
|
|
|
{ |
990
|
|
|
$export = new Export(['sql_drop_database' => $actual]); |
991
|
|
|
$exportArray = $export->asArray(); |
992
|
|
|
self::assertSame($expected, $export->sql_drop_database); |
993
|
|
|
self::assertSame($expected, $exportArray['sql_drop_database']); |
994
|
|
|
} |
995
|
|
|
|
996
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
997
|
|
|
public function testSqlDropTable(mixed $actual, bool $expected): void |
998
|
|
|
{ |
999
|
|
|
$export = new Export(['sql_drop_table' => $actual]); |
1000
|
|
|
$exportArray = $export->asArray(); |
1001
|
|
|
self::assertSame($expected, $export->sql_drop_table); |
1002
|
|
|
self::assertSame($expected, $exportArray['sql_drop_table']); |
1003
|
|
|
} |
1004
|
|
|
|
1005
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
1006
|
|
|
public function testSqlIfNotExists(mixed $actual, bool $expected): void |
1007
|
|
|
{ |
1008
|
|
|
$export = new Export(['sql_if_not_exists' => $actual]); |
1009
|
|
|
$exportArray = $export->asArray(); |
1010
|
|
|
self::assertSame($expected, $export->sql_if_not_exists); |
1011
|
|
|
self::assertSame($expected, $exportArray['sql_if_not_exists']); |
1012
|
|
|
} |
1013
|
|
|
|
1014
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
1015
|
|
|
public function testSqlViewCurrentUser(mixed $actual, bool $expected): void |
1016
|
|
|
{ |
1017
|
|
|
$export = new Export(['sql_view_current_user' => $actual]); |
1018
|
|
|
$exportArray = $export->asArray(); |
1019
|
|
|
self::assertSame($expected, $export->sql_view_current_user); |
1020
|
|
|
self::assertSame($expected, $exportArray['sql_view_current_user']); |
1021
|
|
|
} |
1022
|
|
|
|
1023
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
1024
|
|
|
public function testSqlOrReplaceView(mixed $actual, bool $expected): void |
1025
|
|
|
{ |
1026
|
|
|
$export = new Export(['sql_or_replace_view' => $actual]); |
1027
|
|
|
$exportArray = $export->asArray(); |
1028
|
|
|
self::assertSame($expected, $export->sql_or_replace_view); |
1029
|
|
|
self::assertSame($expected, $exportArray['sql_or_replace_view']); |
1030
|
|
|
} |
1031
|
|
|
|
1032
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
1033
|
|
|
public function testSqlProcedureFunction(mixed $actual, bool $expected): void |
1034
|
|
|
{ |
1035
|
|
|
$export = new Export(['sql_procedure_function' => $actual]); |
1036
|
|
|
$exportArray = $export->asArray(); |
1037
|
|
|
self::assertSame($expected, $export->sql_procedure_function); |
1038
|
|
|
self::assertSame($expected, $exportArray['sql_procedure_function']); |
1039
|
|
|
} |
1040
|
|
|
|
1041
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
1042
|
|
|
public function testSqlCreateTable(mixed $actual, bool $expected): void |
1043
|
|
|
{ |
1044
|
|
|
$export = new Export(['sql_create_table' => $actual]); |
1045
|
|
|
$exportArray = $export->asArray(); |
1046
|
|
|
self::assertSame($expected, $export->sql_create_table); |
1047
|
|
|
self::assertSame($expected, $exportArray['sql_create_table']); |
1048
|
|
|
} |
1049
|
|
|
|
1050
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
1051
|
|
|
public function testSqlCreateView(mixed $actual, bool $expected): void |
1052
|
|
|
{ |
1053
|
|
|
$export = new Export(['sql_create_view' => $actual]); |
1054
|
|
|
$exportArray = $export->asArray(); |
1055
|
|
|
self::assertSame($expected, $export->sql_create_view); |
1056
|
|
|
self::assertSame($expected, $exportArray['sql_create_view']); |
1057
|
|
|
} |
1058
|
|
|
|
1059
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
1060
|
|
|
public function testSqlCreateTrigger(mixed $actual, bool $expected): void |
1061
|
|
|
{ |
1062
|
|
|
$export = new Export(['sql_create_trigger' => $actual]); |
1063
|
|
|
$exportArray = $export->asArray(); |
1064
|
|
|
self::assertSame($expected, $export->sql_create_trigger); |
1065
|
|
|
self::assertSame($expected, $exportArray['sql_create_trigger']); |
1066
|
|
|
} |
1067
|
|
|
|
1068
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
1069
|
|
|
public function testSqlAutoIncrement(mixed $actual, bool $expected): void |
1070
|
|
|
{ |
1071
|
|
|
$export = new Export(['sql_auto_increment' => $actual]); |
1072
|
|
|
$exportArray = $export->asArray(); |
1073
|
|
|
self::assertSame($expected, $export->sql_auto_increment); |
1074
|
|
|
self::assertSame($expected, $exportArray['sql_auto_increment']); |
1075
|
|
|
} |
1076
|
|
|
|
1077
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
1078
|
|
|
public function testSqlBackquotes(mixed $actual, bool $expected): void |
1079
|
|
|
{ |
1080
|
|
|
$export = new Export(['sql_backquotes' => $actual]); |
1081
|
|
|
$exportArray = $export->asArray(); |
1082
|
|
|
self::assertSame($expected, $export->sql_backquotes); |
1083
|
|
|
self::assertSame($expected, $exportArray['sql_backquotes']); |
1084
|
|
|
} |
1085
|
|
|
|
1086
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
1087
|
|
|
public function testSqlDates(mixed $actual, bool $expected): void |
1088
|
|
|
{ |
1089
|
|
|
$export = new Export(['sql_dates' => $actual]); |
1090
|
|
|
$exportArray = $export->asArray(); |
1091
|
|
|
self::assertSame($expected, $export->sql_dates); |
1092
|
|
|
self::assertSame($expected, $exportArray['sql_dates']); |
1093
|
|
|
} |
1094
|
|
|
|
1095
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
1096
|
|
|
public function testSqlRelation(mixed $actual, bool $expected): void |
1097
|
|
|
{ |
1098
|
|
|
$export = new Export(['sql_relation' => $actual]); |
1099
|
|
|
$exportArray = $export->asArray(); |
1100
|
|
|
self::assertSame($expected, $export->sql_relation); |
1101
|
|
|
self::assertSame($expected, $exportArray['sql_relation']); |
1102
|
|
|
} |
1103
|
|
|
|
1104
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
1105
|
|
|
public function testSqlTruncate(mixed $actual, bool $expected): void |
1106
|
|
|
{ |
1107
|
|
|
$export = new Export(['sql_truncate' => $actual]); |
1108
|
|
|
$exportArray = $export->asArray(); |
1109
|
|
|
self::assertSame($expected, $export->sql_truncate); |
1110
|
|
|
self::assertSame($expected, $exportArray['sql_truncate']); |
1111
|
|
|
} |
1112
|
|
|
|
1113
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
1114
|
|
|
public function testSqlDelayed(mixed $actual, bool $expected): void |
1115
|
|
|
{ |
1116
|
|
|
$export = new Export(['sql_delayed' => $actual]); |
1117
|
|
|
$exportArray = $export->asArray(); |
1118
|
|
|
self::assertSame($expected, $export->sql_delayed); |
1119
|
|
|
self::assertSame($expected, $exportArray['sql_delayed']); |
1120
|
|
|
} |
1121
|
|
|
|
1122
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
1123
|
|
|
public function testSqlIgnore(mixed $actual, bool $expected): void |
1124
|
|
|
{ |
1125
|
|
|
$export = new Export(['sql_ignore' => $actual]); |
1126
|
|
|
$exportArray = $export->asArray(); |
1127
|
|
|
self::assertSame($expected, $export->sql_ignore); |
1128
|
|
|
self::assertSame($expected, $exportArray['sql_ignore']); |
1129
|
|
|
} |
1130
|
|
|
|
1131
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
1132
|
|
|
public function testSqlUtcTime(mixed $actual, bool $expected): void |
1133
|
|
|
{ |
1134
|
|
|
$export = new Export(['sql_utc_time' => $actual]); |
1135
|
|
|
$exportArray = $export->asArray(); |
1136
|
|
|
self::assertSame($expected, $export->sql_utc_time); |
1137
|
|
|
self::assertSame($expected, $exportArray['sql_utc_time']); |
1138
|
|
|
} |
1139
|
|
|
|
1140
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
1141
|
|
|
public function testSqlHexForBinary(mixed $actual, bool $expected): void |
1142
|
|
|
{ |
1143
|
|
|
$export = new Export(['sql_hex_for_binary' => $actual]); |
1144
|
|
|
$exportArray = $export->asArray(); |
1145
|
|
|
self::assertSame($expected, $export->sql_hex_for_binary); |
1146
|
|
|
self::assertSame($expected, $exportArray['sql_hex_for_binary']); |
1147
|
|
|
} |
1148
|
|
|
|
1149
|
|
|
#[DataProvider('valuesForSqlTypeProvider')] |
1150
|
|
|
public function testSqlType(mixed $actual, string $expected): void |
1151
|
|
|
{ |
1152
|
|
|
$export = new Export(['sql_type' => $actual]); |
1153
|
|
|
$exportArray = $export->asArray(); |
1154
|
|
|
self::assertSame($expected, $export->sql_type); |
1155
|
|
|
self::assertSame($expected, $exportArray['sql_type']); |
1156
|
|
|
} |
1157
|
|
|
|
1158
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
1159
|
|
|
public static function valuesForSqlTypeProvider(): iterable |
1160
|
|
|
{ |
1161
|
|
|
yield 'null value' => [null, 'INSERT']; |
1162
|
|
|
yield 'valid value' => ['INSERT', 'INSERT']; |
1163
|
|
|
yield 'valid value 2' => ['UPDATE', 'UPDATE']; |
1164
|
|
|
yield 'valid value 3' => ['REPLACE', 'REPLACE']; |
1165
|
|
|
yield 'invalid value' => ['invalid', 'INSERT']; |
1166
|
|
|
} |
1167
|
|
|
|
1168
|
|
|
#[DataProvider('valuesForSqlMaxQuerySizeProvider')] |
1169
|
|
|
public function testSqlMaxQuerySize(mixed $actual, int $expected): void |
1170
|
|
|
{ |
1171
|
|
|
$export = new Export(['sql_max_query_size' => $actual]); |
1172
|
|
|
$exportArray = $export->asArray(); |
1173
|
|
|
self::assertSame($expected, $export->sql_max_query_size); |
1174
|
|
|
self::assertSame($expected, $exportArray['sql_max_query_size']); |
1175
|
|
|
} |
1176
|
|
|
|
1177
|
|
|
/** @return iterable<string, array{mixed, int}> */ |
1178
|
|
|
public static function valuesForSqlMaxQuerySizeProvider(): iterable |
1179
|
|
|
{ |
1180
|
|
|
yield 'null value' => [null, 50000]; |
1181
|
|
|
yield 'valid value' => [0, 0]; |
1182
|
|
|
yield 'valid value with type coercion' => ['1', 1]; |
1183
|
|
|
yield 'invalid value' => [-1, 50000]; |
1184
|
|
|
} |
1185
|
|
|
|
1186
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
1187
|
|
|
public function testSqlMime(mixed $actual, bool $expected): void |
1188
|
|
|
{ |
1189
|
|
|
$export = new Export(['sql_mime' => $actual]); |
1190
|
|
|
$exportArray = $export->asArray(); |
1191
|
|
|
self::assertSame($expected, $export->sql_mime); |
1192
|
|
|
self::assertSame($expected, $exportArray['sql_mime']); |
1193
|
|
|
} |
1194
|
|
|
|
1195
|
|
|
#[DataProvider('valuesForSqlHeaderCommentProvider')] |
1196
|
|
|
public function testSqlHeaderComment(mixed $actual, string $expected): void |
1197
|
|
|
{ |
1198
|
|
|
$export = new Export(['sql_header_comment' => $actual]); |
1199
|
|
|
$exportArray = $export->asArray(); |
1200
|
|
|
self::assertSame($expected, $export->sql_header_comment); |
1201
|
|
|
self::assertSame($expected, $exportArray['sql_header_comment']); |
1202
|
|
|
} |
1203
|
|
|
|
1204
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
1205
|
|
|
public static function valuesForSqlHeaderCommentProvider(): iterable |
1206
|
|
|
{ |
1207
|
|
|
yield 'null value' => [null, '']; |
1208
|
|
|
yield 'valid value' => ['', '']; |
1209
|
|
|
yield 'valid value 2' => ['test', 'test']; |
1210
|
|
|
yield 'valid value with type coercion' => [1234, '1234']; |
1211
|
|
|
} |
1212
|
|
|
|
1213
|
|
|
#[DataProvider('valuesForSqlInsertSyntaxProvider')] |
1214
|
|
|
public function testSqlInsertSyntax(mixed $actual, string $expected): void |
1215
|
|
|
{ |
1216
|
|
|
$export = new Export(['sql_insert_syntax' => $actual]); |
1217
|
|
|
$exportArray = $export->asArray(); |
1218
|
|
|
self::assertSame($expected, $export->sql_insert_syntax); |
1219
|
|
|
self::assertSame($expected, $exportArray['sql_insert_syntax']); |
1220
|
|
|
} |
1221
|
|
|
|
1222
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
1223
|
|
|
public static function valuesForSqlInsertSyntaxProvider(): iterable |
1224
|
|
|
{ |
1225
|
|
|
yield 'null value' => [null, 'both']; |
1226
|
|
|
yield 'valid value' => ['complete', 'complete']; |
1227
|
|
|
yield 'valid value 2' => ['extended', 'extended']; |
1228
|
|
|
yield 'valid value 3' => ['both', 'both']; |
1229
|
|
|
yield 'valid value 4' => ['none', 'none']; |
1230
|
|
|
yield 'invalid value' => ['invalid', 'both']; |
1231
|
|
|
yield 'invalid value 2' => ['', 'both']; |
1232
|
|
|
} |
1233
|
|
|
|
1234
|
|
|
#[DataProvider('valuesForPdfReportTitleProvider')] |
1235
|
|
|
public function testPdfReportTitle(mixed $actual, string $expected): void |
1236
|
|
|
{ |
1237
|
|
|
$export = new Export(['pdf_report_title' => $actual]); |
1238
|
|
|
$exportArray = $export->asArray(); |
1239
|
|
|
self::assertSame($expected, $export->pdf_report_title); |
1240
|
|
|
self::assertSame($expected, $exportArray['pdf_report_title']); |
1241
|
|
|
} |
1242
|
|
|
|
1243
|
|
|
/** @return iterable<string, array{mixed, string}> */ |
1244
|
|
|
public static function valuesForPdfReportTitleProvider(): iterable |
1245
|
|
|
{ |
1246
|
|
|
yield 'null value' => [null, '']; |
1247
|
|
|
yield 'valid value' => ['', '']; |
1248
|
|
|
yield 'valid value 2' => ['test', 'test']; |
1249
|
|
|
yield 'valid value with type coercion' => [1234, '1234']; |
1250
|
|
|
} |
1251
|
|
|
|
1252
|
|
|
#[DataProvider('structureOrDataWithDefaultDataProvider')] |
1253
|
|
|
public function testXmlStructureOrData(mixed $actual, string $expected): void |
1254
|
|
|
{ |
1255
|
|
|
$export = new Export(['xml_structure_or_data' => $actual]); |
1256
|
|
|
$exportArray = $export->asArray(); |
1257
|
|
|
self::assertSame($expected, $export->xml_structure_or_data); |
1258
|
|
|
self::assertSame($expected, $exportArray['xml_structure_or_data']); |
1259
|
|
|
} |
1260
|
|
|
|
1261
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
1262
|
|
|
public function testXmlExportStruc(mixed $actual, bool $expected): void |
1263
|
|
|
{ |
1264
|
|
|
$export = new Export(['xml_export_struc' => $actual]); |
1265
|
|
|
$exportArray = $export->asArray(); |
1266
|
|
|
self::assertSame($expected, $export->xml_export_struc); |
1267
|
|
|
self::assertSame($expected, $exportArray['xml_export_struc']); |
1268
|
|
|
} |
1269
|
|
|
|
1270
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
1271
|
|
|
public function testXmlExportEvents(mixed $actual, bool $expected): void |
1272
|
|
|
{ |
1273
|
|
|
$export = new Export(['xml_export_events' => $actual]); |
1274
|
|
|
$exportArray = $export->asArray(); |
1275
|
|
|
self::assertSame($expected, $export->xml_export_events); |
1276
|
|
|
self::assertSame($expected, $exportArray['xml_export_events']); |
1277
|
|
|
} |
1278
|
|
|
|
1279
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
1280
|
|
|
public function testXmlExportFunctions(mixed $actual, bool $expected): void |
1281
|
|
|
{ |
1282
|
|
|
$export = new Export(['xml_export_functions' => $actual]); |
1283
|
|
|
$exportArray = $export->asArray(); |
1284
|
|
|
self::assertSame($expected, $export->xml_export_functions); |
1285
|
|
|
self::assertSame($expected, $exportArray['xml_export_functions']); |
1286
|
|
|
} |
1287
|
|
|
|
1288
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
1289
|
|
|
public function testXmlExportProcedures(mixed $actual, bool $expected): void |
1290
|
|
|
{ |
1291
|
|
|
$export = new Export(['xml_export_procedures' => $actual]); |
1292
|
|
|
$exportArray = $export->asArray(); |
1293
|
|
|
self::assertSame($expected, $export->xml_export_procedures); |
1294
|
|
|
self::assertSame($expected, $exportArray['xml_export_procedures']); |
1295
|
|
|
} |
1296
|
|
|
|
1297
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
1298
|
|
|
public function testXmlExportTables(mixed $actual, bool $expected): void |
1299
|
|
|
{ |
1300
|
|
|
$export = new Export(['xml_export_tables' => $actual]); |
1301
|
|
|
$exportArray = $export->asArray(); |
1302
|
|
|
self::assertSame($expected, $export->xml_export_tables); |
1303
|
|
|
self::assertSame($expected, $exportArray['xml_export_tables']); |
1304
|
|
|
} |
1305
|
|
|
|
1306
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
1307
|
|
|
public function testXmlExportTriggers(mixed $actual, bool $expected): void |
1308
|
|
|
{ |
1309
|
|
|
$export = new Export(['xml_export_triggers' => $actual]); |
1310
|
|
|
$exportArray = $export->asArray(); |
1311
|
|
|
self::assertSame($expected, $export->xml_export_triggers); |
1312
|
|
|
self::assertSame($expected, $exportArray['xml_export_triggers']); |
1313
|
|
|
} |
1314
|
|
|
|
1315
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
1316
|
|
|
public function testXmlExportViews(mixed $actual, bool $expected): void |
1317
|
|
|
{ |
1318
|
|
|
$export = new Export(['xml_export_views' => $actual]); |
1319
|
|
|
$exportArray = $export->asArray(); |
1320
|
|
|
self::assertSame($expected, $export->xml_export_views); |
1321
|
|
|
self::assertSame($expected, $exportArray['xml_export_views']); |
1322
|
|
|
} |
1323
|
|
|
|
1324
|
|
|
#[DataProvider('booleanWithDefaultTrueProvider')] |
1325
|
|
|
public function testXmlExportContents(mixed $actual, bool $expected): void |
1326
|
|
|
{ |
1327
|
|
|
$export = new Export(['xml_export_contents' => $actual]); |
1328
|
|
|
$exportArray = $export->asArray(); |
1329
|
|
|
self::assertSame($expected, $export->xml_export_contents); |
1330
|
|
|
self::assertSame($expected, $exportArray['xml_export_contents']); |
1331
|
|
|
} |
1332
|
|
|
|
1333
|
|
|
#[DataProvider('structureOrDataWithDefaultDataProvider')] |
1334
|
|
|
public function testYamlStructureOrData(mixed $actual, string $expected): void |
1335
|
|
|
{ |
1336
|
|
|
$export = new Export(['yaml_structure_or_data' => $actual]); |
1337
|
|
|
$exportArray = $export->asArray(); |
1338
|
|
|
self::assertSame($expected, $export->yaml_structure_or_data); |
1339
|
|
|
self::assertSame($expected, $exportArray['yaml_structure_or_data']); |
1340
|
|
|
} |
1341
|
|
|
|
1342
|
|
|
#[DataProvider('booleanWithDefaultFalseProvider')] |
1343
|
|
|
public function testRemoveDefinerFromDefinitions(mixed $actual, bool $expected): void |
1344
|
|
|
{ |
1345
|
|
|
$export = new Export(['remove_definer_from_definitions' => $actual]); |
1346
|
|
|
$exportArray = $export->asArray(); |
1347
|
|
|
self::assertSame($expected, $export->remove_definer_from_definitions); |
1348
|
|
|
self::assertSame($expected, $exportArray['remove_definer_from_definitions']); |
1349
|
|
|
} |
1350
|
|
|
} |
1351
|
|
|
|