|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * This file is part of the event-engine/php-postgres-document-store. |
| 4 | + * (c) 2019 prooph software GmbH <contact@prooph.de> |
| 5 | + * |
| 6 | + * For the full copyright and license information, please view the LICENSE |
| 7 | + * file that was distributed with this source code. |
| 8 | + */ |
| 9 | + |
| 10 | +declare(strict_types=1); |
| 11 | + |
| 12 | +namespace EventEngine\DocumentStoreTest\Postgres; |
| 13 | + |
| 14 | +use EventEngine\DocumentStore\Filter\AnyOfDocIdFilter; |
| 15 | +use EventEngine\DocumentStore\Filter\AnyOfFilter; |
| 16 | +use EventEngine\DocumentStore\Filter\DocIdFilter; |
| 17 | +use EventEngine\DocumentStore\Filter\NotFilter; |
| 18 | +use PHPUnit\Framework\TestCase; |
| 19 | +use EventEngine\DocumentStore\FieldIndex; |
| 20 | +use EventEngine\DocumentStore\Index; |
| 21 | +use EventEngine\DocumentStore\MultiFieldIndex; |
| 22 | +use EventEngine\DocumentStore\Postgres\PostgresDocumentStore; |
| 23 | +use Ramsey\Uuid\Uuid; |
| 24 | + |
| 25 | +class SchemedPostgresDocumentStoreTest extends TestCase |
| 26 | +{ |
| 27 | + private CONST TABLE_PREFIX = 'test_'; |
| 28 | + private CONST SCHEMA = 'test.'; |
| 29 | + |
| 30 | + /** |
| 31 | + * @var PostgresDocumentStore |
| 32 | + */ |
| 33 | + protected $documentStore; |
| 34 | + |
| 35 | + /** |
| 36 | + * @var \PDO |
| 37 | + */ |
| 38 | + protected $connection; |
| 39 | + |
| 40 | + protected function setUp(): void |
| 41 | + { |
| 42 | + $this->connection = TestUtil::getConnection(); |
| 43 | + $this->documentStore = new PostgresDocumentStore($this->connection, self::TABLE_PREFIX); |
| 44 | + } |
| 45 | + |
| 46 | + public function tearDown(): void |
| 47 | + { |
| 48 | + TestUtil::tearDownDatabase(); |
| 49 | + } |
| 50 | + |
| 51 | + /** |
| 52 | + * @test |
| 53 | + */ |
| 54 | + public function it_adds_collection_with_schema(): void |
| 55 | + { |
| 56 | + $this->documentStore->addCollection(self::SCHEMA . 'test'); |
| 57 | + $this->assertFalse($this->documentStore->hasCollection('test')); |
| 58 | + $this->assertTrue($this->documentStore->hasCollection(self::SCHEMA . 'test')); |
| 59 | + } |
| 60 | +} |
0 commit comments