Skip to content

Commit 6b1e96c

Browse files
committed
Test for non-unique collection names
1 parent 079acfe commit 6b1e96c

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

tests/Database/Base.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ public function testCreateListDeleteCollection()
6464

6565
$this->assertCount(1, static::getDatabase()->listCollections());
6666

67+
// Collection names should not be unique
68+
$this->assertInstanceOf('Utopia\Database\Document', static::getDatabase()->createCollection('actors2'));
69+
$this->assertCount(2, static::getDatabase()->listCollections());
70+
$collection = static::getDatabase()->getCollection('actors2');
71+
$collection->setAttribute('name', 'actors'); // change name to one that exists
72+
$this->assertInstanceOf('Utopia\Database\Document', static::getDatabase()->updateDocument($collection->getCollection(), $collection->getId(), $collection));
73+
$this->assertEquals(true, static::getDatabase()->deleteCollection('actors2')); // Delete collection when finished
74+
$this->assertCount(1, static::getDatabase()->listCollections());
75+
6776
$this->assertEquals(false, static::getDatabase()->getCollection('actors')->isEmpty());
6877
$this->assertEquals(true, static::getDatabase()->deleteCollection('actors'));
6978
$this->assertEquals(true, static::getDatabase()->getCollection('actors')->isEmpty());

0 commit comments

Comments
 (0)