File tree Expand file tree Collapse file tree 7 files changed +59
-10
lines changed Expand file tree Collapse file tree 7 files changed +59
-10
lines changed Original file line number Diff line number Diff line change 88 bootstrap =" tests/bootstrap.php"
99 colors =" true"
1010 verbose =" true"
11+ forceCoversAnnotation =" true"
12+ failOnRisky =" true"
1113>
1214 <coverage >
1315 <include >
Original file line number Diff line number Diff line change @@ -11,6 +11,6 @@ final class ServerError extends Exception
1111{
1212 public static function fromResponse (ResponseInterface $ response ): self
1313 {
14- return new self (( string ) $ response ->getBody ());
14+ return new self ($ response ->getBody ()-> __toString ());
1515 }
1616}
Original file line number Diff line number Diff line change 1111use SimPod \ClickHouseClient \Tests \TestCaseBase ;
1212use SimPod \ClickHouseClient \Tests \WithClient ;
1313
14+ /**
15+ * @covers \SimPod\ClickHouseClient\Client\Http\RequestFactory
16+ * @covers \SimPod\ClickHouseClient\Client\PsrClickHouseClient
17+ * @covers \SimPod\ClickHouseClient\Exception\CannotInsert
18+ * @covers \SimPod\ClickHouseClient\Exception\ServerError
19+ * @covers \SimPod\ClickHouseClient\Format\JsonEachRow
20+ * @covers \SimPod\ClickHouseClient\Format\JsonCompact
21+ */
1422final class InsertTest extends TestCaseBase
1523{
1624 use WithClient;
@@ -30,8 +38,7 @@ public function testInsert(string $tableSql): void
3038 $ output = $ this ->client ->select (
3139 <<<'CLICKHOUSE'
3240SELECT * FROM UserActivity
33- CLICKHOUSE
34- ,
41+ CLICKHOUSE,
3542 new JsonEachRow ()
3643 );
3744
@@ -62,8 +69,7 @@ public function testInsertUseColumns(string $tableSql): void
6269 $ output = $ this ->client ->select (
6370 <<<'CLICKHOUSE'
6471SELECT * FROM UserActivity
65- CLICKHOUSE
66- ,
72+ CLICKHOUSE,
6773 new JsonEachRow ()
6874 );
6975
@@ -91,8 +97,7 @@ public function testInsertEscaping(): void
9197 $ output = $ this ->client ->select (
9298 <<<'CLICKHOUSE'
9399SELECT * FROM a
94- CLICKHOUSE
95- ,
100+ CLICKHOUSE,
96101 new JsonCompact ()
97102 );
98103
Original file line number Diff line number Diff line change 1111use SimPod \ClickHouseClient \Tests \TestCaseBase ;
1212use SimPod \ClickHouseClient \Tests \WithClient ;
1313
14+ /**
15+ * @covers \SimPod\ClickHouseClient\Client\Http\RequestFactory
16+ * @covers \SimPod\ClickHouseClient\Client\PsrClickHouseAsyncClient
17+ * @covers \SimPod\ClickHouseClient\Exception\ServerError
18+ * @covers \SimPod\ClickHouseClient\Format\JsonEachRow
19+ * @covers \SimPod\ClickHouseClient\Format\TabSeparated
20+ */
1421final class SelectAsyncTest extends TestCaseBase
1522{
1623 use WithClient;
@@ -24,7 +31,8 @@ public function testAsyncSelect(): void
2431CLICKHOUSE;
2532
2633 /** @var JsonEachRow<array{number: string}> $format */
27- $ format = new JsonEachRow ();
34+ $ format = new JsonEachRow ();
35+
2836 $ promises = [
2937 $ client ->select ($ sql , $ format ),
3038 $ client ->select ($ sql , $ format ),
Original file line number Diff line number Diff line change 1111use SimPod \ClickHouseClient \Tests \TestCaseBase ;
1212use SimPod \ClickHouseClient \Tests \WithClient ;
1313
14+ /**
15+ * @covers \SimPod\ClickHouseClient\Client\Http\RequestFactory
16+ * @covers \SimPod\ClickHouseClient\Client\PsrClickHouseClient
17+ * @covers \SimPod\ClickHouseClient\Exception\ServerError
18+ * @covers \SimPod\ClickHouseClient\Format\Json
19+ * @covers \SimPod\ClickHouseClient\Format\JsonEachRow
20+ * @covers \SimPod\ClickHouseClient\Format\JsonCompact
21+ */
1422final class SelectTest extends TestCaseBase
1523{
1624 use WithClient;
Original file line number Diff line number Diff line change 44
55namespace SimPod \ClickHouseClient \Tests \Logger ;
66
7- use PHPUnit \Framework \TestCase ;
87use SimPod \ClickHouseClient \Logger \LoggerChain ;
98use SimPod \ClickHouseClient \Logger \SqlLogger ;
9+ use SimPod \ClickHouseClient \Tests \TestCaseBase ;
1010
11- final class LoggerChainTest extends TestCase
11+ /** @covers \SimPod\ClickHouseClient\Logger\LoggerChain */
12+ final class LoggerChainTest extends TestCaseBase
1213{
1314 public function testLog (): void
1415 {
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace SimPod \ClickHouseClient \Tests \Output ;
6+
7+ use SimPod \ClickHouseClient \Output \JsonEachRow ;
8+ use SimPod \ClickHouseClient \Tests \TestCaseBase ;
9+
10+ /** @covers \SimPod\ClickHouseClient\Output\JsonEachRow */
11+ final class JsonEachRowTest extends TestCaseBase
12+ {
13+ public function testPropertiesAreSet (): void
14+ {
15+ $ format = new JsonEachRow (
16+ <<<'JSON'
17+ {"number":"0"}
18+ {"number":"1"}
19+
20+ JSON
21+ );
22+
23+ self ::assertSame ([['number ' => '0 ' ], ['number ' => '1 ' ]], $ format ->data );
24+ }
25+ }
You can’t perform that action at this time.
0 commit comments