@@ -2069,7 +2069,6 @@ public function testCreateCollectionValidator(): void
20692069
20702070 public function testCreateDocument(): Document
20712071 {
2072-
20732072 static::getDatabase()->createCollection('documents');
20742073
20752074 $this->assertEquals(true, static::getDatabase()->createAttribute('documents', 'string', Database::VAR_STRING, 128, true));
@@ -2836,27 +2835,28 @@ function (mixed $value) {
28362835 }
28372836 );
28382837
2839- static::getDatabase()->createCollection('test_documents');
2838+ $col = static::getDatabase()->createCollection(__FUNCTION__);
2839+ $this->assertNotNull($col->getId());
28402840
2841- static::getDatabase()->createAttribute('test_documents' , 'title', Database::VAR_STRING, 255, true);
2842- static::getDatabase()->createAttribute('test_documents' , 'encrypt', Database::VAR_STRING, 128, true, filters: ['encrypt']);
2841+ static::getDatabase()->createAttribute($col->getId() , 'title', Database::VAR_STRING, 255, true);
2842+ static::getDatabase()->createAttribute($col->getId() , 'encrypt', Database::VAR_STRING, 128, true, filters: ['encrypt']);
28432843
2844- static::getDatabase()->createDocument('test_documents' , new Document([
2844+ static::getDatabase()->createDocument($col->getId() , new Document([
28452845 'title' => 'Sample Title',
28462846 'encrypt' => 'secret',
28472847 ]));
28482848 // query against encrypt
28492849 try {
28502850 $queries = [Query::equal('encrypt', ['test'])];
2851- $doc = static::getDatabase()->find('test_documents' , $queries);
2851+ $doc = static::getDatabase()->find($col->getId() , $queries);
28522852 $this->fail('Queried against encrypt field. Failed to throw exeception.');
28532853 } catch (Throwable $e) {
28542854 $this->assertTrue($e instanceof QueryException);
28552855 }
28562856
28572857 try {
28582858 $queries = [Query::equal('title', ['test'])];
2859- static::getDatabase()->find('test_documents' , $queries);
2859+ static::getDatabase()->find($col->getId() , $queries);
28602860 } catch (Throwable $e) {
28612861 $this->fail('Should not have thrown error');
28622862 }
0 commit comments