|
1 | 1 | <?php |
2 | 2 |
|
3 | | -uses(Tests\TestCase::class); |
4 | | - |
5 | 3 | declare(strict_types=1); |
6 | 4 |
|
7 | | -test('get collections before version38', function () { |
8 | | - $this->skipTestOnArangoVersions('3.8', '>='); |
9 | | - $result = $this->schemaManager->getCollections(); |
10 | | - |
11 | | - expect(10)->toBeLessThanOrEqual(count($result)); |
12 | | - expect($result[0])->toBeObject(); |
13 | | -}); |
| 5 | +uses(Tests\TestCase::class); |
14 | 6 |
|
15 | 7 | test('get collections', function () { |
16 | | - $this->skipTestOnArangoVersions('3.8', '<'); |
17 | 8 | $result = $this->schemaManager->getCollections(); |
18 | 9 |
|
19 | 10 | expect(8)->toBeLessThanOrEqual(count($result)); |
|
32 | 23 | $result = $this->schemaManager->getCollection($collections[0]->name); |
33 | 24 |
|
34 | 25 | expect($result)->toBeObject(); |
35 | | - $this->assertObjectHasProperty('name', $result); |
36 | | - $this->assertObjectHasProperty('isSystem', $result); |
| 26 | + expect((array) $result)->toHaveKeys(['globallyUniqueId', 'isSystem', 'status', 'type', 'name', 'id']); |
37 | 27 | }); |
38 | 28 |
|
39 | 29 | test('has collection', function () { |
|
131 | 121 | if (!$this->schemaManager->hasCollection($collection)) { |
132 | 122 | $this->schemaManager->createCollection($collection); |
133 | 123 | } |
| 124 | + |
134 | 125 | expect($this->schemaManager->getCollectionWithDocumentCount($collection)->count)->toBe(0); |
| 126 | + |
135 | 127 | $query = 'FOR i IN 1..10 |
136 | 128 | INSERT { |
137 | 129 | _key: CONCAT("test", i), |
|
146 | 138 | $this->schemaManager->truncateCollection($collection); |
147 | 139 |
|
148 | 140 | expect($this->schemaManager->getCollectionWithDocumentCount($collection)->count)->toBe(0); |
149 | | - $this->schemaManager->deleteCollection($collection); |
| 141 | + |
| 142 | + if ($this->schemaManager->hasCollection($collection)) { |
| 143 | + $this->schemaManager->deleteCollection($collection); |
| 144 | + } |
| 145 | + |
150 | 146 | }); |
151 | 147 |
|
152 | 148 | test('create and delete collection', function () { |
|
0 commit comments