mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
some tests :)
This commit is contained in:
1 parent
37a7e9386e
commit
d133fab2ba
2 files changed
+13
-13
No files matched your search
+1
-1
@@ -123,7 +123,6 @@ class MongoClient
|
||||
public function send(mixed $data): stdClass|array|int
|
||||
{
|
||||
$this->client->send($data);
|
||||
|
||||
return $this->receive();
|
||||
}
|
||||
|
||||
@@ -282,6 +281,7 @@ class MongoClient
|
||||
*/
|
||||
public function listCollectionNames(array $filter = [], array $options = []): stdClass
|
||||
{
|
||||
|
||||
$qry = array_merge(
|
||||
[
|
||||
"listCollections" => 1.0,
|
||||
|
||||
+12
-12
@@ -25,43 +25,43 @@ class MongoTest extends TestCase
|
||||
);
|
||||
|
||||
$client = new MongoClient($options, false);
|
||||
$client->connect();
|
||||
|
||||
self::$db = $client;
|
||||
return self::$db;
|
||||
}
|
||||
|
||||
public function testListDatabases()
|
||||
{
|
||||
$this->getDatabase()->listDatabaseNames();
|
||||
}
|
||||
|
||||
public function testDeleteDatabase()
|
||||
{
|
||||
$this->getDatabase()->dropDatabase([]);
|
||||
self::assertTrue(!!$this->getDatabase()->dropDatabase([]));
|
||||
}
|
||||
|
||||
public function testCreateCollection()
|
||||
{
|
||||
$this->getDatabase()->createCollection('movies');
|
||||
self::assertTrue(!!$this->getDatabase()->createCollection('movies'));
|
||||
}
|
||||
|
||||
public function testListDatabases()
|
||||
{
|
||||
self::assertCount(4, $this->getDatabase()->listDatabaseNames()->databases);
|
||||
}
|
||||
|
||||
public function testCreateDocument()
|
||||
{
|
||||
$this->getDatabase()->insert('movies', [
|
||||
$doc = $this->getDatabase()->insert('movies', [
|
||||
'name' => 'Armageddon',
|
||||
'country' => 'USA',
|
||||
'language' => 'English'
|
||||
]
|
||||
);
|
||||
|
||||
var_dump($doc['_id']);
|
||||
|
||||
$this->getDatabase()->insert('movies', ['9 Monkeys']);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function testCreateExistsDelete()
|
||||
{
|
||||
var_dump($this->getDatabase()->selectDatabase());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user