Skip to content

Commit

Permalink
优化单测
Browse files Browse the repository at this point in the history
  • Loading branch information
limingxinleo committed Jul 15, 2024
1 parent 098718a commit 9edc530
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function import(array $config, string $sql, bool $once = true): Result
$result = new Result(true);
foreach ($sqls as $line) {
try {
if (str_starts_with($line, '--') || $line == '') {
if (str_starts_with($line, '#') || str_starts_with($line, '--') || $line == '') {
continue;
}

Expand Down
6 changes: 6 additions & 0 deletions tests/Cases/ImportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public function testLoadConfig()
$import = new Importer($this->getContainer());
$res = $import->import($config, file_get_contents(__DIR__ . '/../sql/init.sql'));
$this->assertTrue($res->isSuccess);

$res = $import->import($config, file_get_contents(__DIR__ . '/../sql/init.sql'), false);
$this->assertTrue($res->isSuccess);
}

public function testLoadPath()
Expand All @@ -65,6 +68,9 @@ public function testLoadPath()
$import = new Importer($this->getContainer());
$res = $import->importPath($config, __DIR__ . '/../sql/init.sql');
$this->assertTrue($res->isSuccess);

$res = $import->importPath($config, __DIR__ . '/../sql/init.sql', true);
$this->assertTrue($res->isSuccess);
}

public function testPrivilegeCreateUser()
Expand Down

0 comments on commit 9edc530

Please sign in to comment.