Skip to content

Commit

Permalink
Improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
simPod committed Sep 22, 2020
1 parent 17ad379 commit 66c26bd
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion tests/Snippet/TableSizesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace SimPod\ClickHouseClient\Tests\Snippet;

use DateTimeImmutable;
use SimPod\ClickHouseClient\Snippet\TableSizes;
use SimPod\ClickHouseClient\Tests\TestCaseBase;
use SimPod\ClickHouseClient\Tests\WithClient;
Expand All @@ -13,8 +14,35 @@ final class TableSizesTest extends TestCaseBase
{
use WithClient;

public function setUp() : void
{
$this->client->executeQuery(
<<<CLICKHOUSE
CREATE TABLE test (
a_date DateTime,
value Int8
)
ENGINE = MergeTree
PARTITION BY toDate(a_date)
ORDER BY (value)
CLICKHOUSE
);
}

public function testRun() : void
{
self::assertSame([], TableSizes::run($this->client));
$this->client->insert('test', [[new DateTimeImmutable(), 1]]);

self::assertCount(1, TableSizes::run($this->client));
}

public function testRunOnNonexistentDatabase() : void
{
self::assertSame([], TableSizes::run($this->client, 'does not exist'));
}

public function tearDown() : void
{
$this->client->executeQuery('DROP TABLE test');
}
}

0 comments on commit 66c26bd

Please sign in to comment.