Skip to content

Commit d78ce6a

Browse files
committed
improve test
1 parent f4ee6b4 commit d78ce6a

File tree

2 files changed

+59
-9
lines changed

2 files changed

+59
-9
lines changed

composer.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/functional/ServiceTest.php

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ protected function setUp(): void
2424

2525
protected function tearDown(): void
2626
{
27-
if ($this->vfs !== null) {
28-
$this->vfs->unmount();
29-
}
27+
$this->vfs?->unmount();
3028
}
3129

3230
public function testValidatingExtractorConfiguration(): void
@@ -719,5 +717,57 @@ public function testLoader(): void
719717
}
720718

721719
public function testConditionalLoader(): void
722-
{}
720+
{
721+
$service = new Service();
722+
723+
$this->assertBuildsLoaderLoadsExactly(
724+
[
725+
[
726+
'id' => '2',
727+
'value' => 'Sit amet consecutir',
728+
]
729+
],
730+
[
731+
[
732+
'id' => '2',
733+
'value' => 'Sit amet consecutir',
734+
]
735+
],
736+
$service->compile([
737+
'expression_language' => [],
738+
'before' => [
739+
'queries' => [
740+
'CREATE TABLE IF NOT EXISTS foo (id INTEGER NOT NULL, value VARCHAR(255) NOT NULL)',
741+
'INSERT INTO foo (id, value) VALUES (1, "Lorem ipsum dolor")',
742+
],
743+
],
744+
'after' => [
745+
'queries' => [
746+
'DROP TABLE foo',
747+
],
748+
],
749+
'loader' => [
750+
'conditional' => [
751+
[
752+
'condition' => 'cond',
753+
'query' => 'INSERT INTO foo (id, value) VALUES (:id, :value)',
754+
'parameters' => [
755+
[
756+
'key' => 'id',
757+
'value' => new Expression('input["id"]')
758+
],
759+
[
760+
'key' => 'value',
761+
'value' => new Expression('input["value"]'),
762+
]
763+
]
764+
]
765+
]
766+
],
767+
'connection' => [
768+
'dsn' => 'sqlite::memory:',
769+
],
770+
])->getBuilder(),
771+
);
772+
}
723773
}

0 commit comments

Comments
 (0)