packages/sql-semantics-mysql/tests/Unit/Statement/Dml/Load/BulkOptionsTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Dml\Load;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Medium;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\MySql\Semantics;
11use SqlSemantics\Platform\MySql\Statement\Dml\Load\BulkOptions;
12
13#[CoversClass(BulkOptions::class)]
14#[Medium]
15final class BulkOptionsTest extends TestCase
16{
17 public function testRenderWritesTheOptions(): void
18 {
19 self::assertSame("LOAD DATA INFILE 'f' INTO TABLE t PARALLEL = 4 MEMORY = `10M` ALGORITHM = BULK", (new Semantics())->analyze("load data infile 'f' into table t parallel = 4 memory = 10M algorithm = bulk")->toString());
20 }
21
22 public function testRenderRejectsNoOption(): void
23 {
24 $this->expectExceptionMessage('Bulk options hold at least one option.');
25
26 new BulkOptions();
27 }
28}
29