Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions bin/tasks/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
);

// A coroutine is assigned per 1000 documents
for ($i=0; $i < $limit/1000; $i++) {
for ($i = 0; $i < $limit / 1000; $i++) {
go(function () use ($pool, $faker, $name, $cache, $namespace) {
$pdo = $pool->get();

Expand All @@ -93,7 +93,7 @@
$database->setNamespace($namespace);

// Each coroutine loads 1000 documents
for ($i=0; $i < 1000; $i++) {
for ($i = 0; $i < 1000; $i++) {
addArticle($database, $faker);
}

Expand Down Expand Up @@ -145,7 +145,7 @@
);

// A coroutine is assigned per 1000 documents
for ($i=0; $i < $limit/1000; $i++) {
for ($i = 0; $i < $limit / 1000; $i++) {
go(function () use ($pool, $faker, $name, $cache, $namespace) {
$pdo = $pool->get();

Expand All @@ -154,7 +154,7 @@
$database->setNamespace($namespace);

// Each coroutine loads 1000 documents
for ($i=0; $i < 1000; $i++) {
for ($i = 0; $i < 1000; $i++) {
addArticle($database, $faker);
}

Expand Down Expand Up @@ -189,14 +189,14 @@

$start = microtime(true);

for ($i=0; $i < $limit/1000; $i++) {
for ($i = 0; $i < $limit / 1000; $i++) {
go(function () use ($client, $faker, $name, $namespace, $cache) {
$database = new Database(new Mongo($client), $cache);
$database->setDefaultDatabase($name);
$database->setNamespace($namespace);

// Each coroutine loads 1000 documents
for ($i=0; $i < 1000; $i++) {
for ($i = 0; $i < 1000; $i++) {
addArticle($database, $faker);
}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"pcov/clobber": "^2.0",
"swoole/ide-helper": "4.8.0",
"utopia-php/cli": "^0.14.0",
"laravel/pint": "1.4.*",
"laravel/pint": "1.13.*",
"phpstan/phpstan": "1.10.*",
"rregeer/phpunit-coverage-check": "^0.3.1"
},
Expand Down
30 changes: 15 additions & 15 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Database/Adapter/Mongo.php
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ private function timeFilter(array $filters): array
foreach ($filters as $k => $v) {
if ($k === '_createdAt' || $k == '_updatedAt') {
if (is_array($v)) {
foreach ($v as $sk=>$sv) {
foreach ($v as $sk => $sv) {
$results[$k][$sk] = $this->toMongoDatetime($sv);
}
} else {
Expand Down
12 changes: 6 additions & 6 deletions src/Database/Adapter/MySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ protected function processException(PDOException $e): void
throw $e;
}

/**
* Get Collection Size
* @param string $collection
* @return int
* @throws DatabaseException
*/
/**
* Get Collection Size
* @param string $collection
* @return int
* @throws DatabaseException
*/
public function getSizeOfCollection(string $collection): int
{
$collection = $this->filter($collection);
Expand Down
14 changes: 7 additions & 7 deletions src/Database/Validator/Roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Roles extends Validator
'allowed' => false,
'required' => false,
],
'dimension' =>[
'dimension' => [
'allowed' => false,
'required' => false,
],
Expand All @@ -51,7 +51,7 @@ class Roles extends Validator
'allowed' => false,
'required' => false,
],
'dimension' =>[
'dimension' => [
'allowed' => false,
'required' => false,
],
Expand All @@ -61,7 +61,7 @@ class Roles extends Validator
'allowed' => false,
'required' => false,
],
'dimension' =>[
'dimension' => [
'allowed' => true,
'required' => false,
'options' => self::USER_DIMENSIONS
Expand All @@ -72,7 +72,7 @@ class Roles extends Validator
'allowed' => true,
'required' => true,
],
'dimension' =>[
'dimension' => [
'allowed' => true,
'required' => false,
'options' => self::USER_DIMENSIONS
Expand All @@ -83,7 +83,7 @@ class Roles extends Validator
'allowed' => true,
'required' => true,
],
'dimension' =>[
'dimension' => [
'allowed' => true,
'required' => false,
],
Expand All @@ -93,7 +93,7 @@ class Roles extends Validator
'allowed' => true,
'required' => true,
],
'dimension' =>[
'dimension' => [
'allowed' => false,
'required' => false,
],
Expand All @@ -103,7 +103,7 @@ class Roles extends Validator
'allowed' => true,
'required' => true,
],
'dimension' =>[
'dimension' => [
'allowed' => false,
'required' => false,
],
Expand Down
18 changes: 9 additions & 9 deletions tests/Database/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -3427,13 +3427,13 @@ public function testNoChangeUpdateDocumentWithRelationWithoutPermission(): void
Permission::create(Role::any()),
Permission::delete(Role::any()),
];
for ($i=1; $i < 6; $i++) {
for ($i = 1; $i < 6; $i++) {
static::getDatabase()->createCollection("level{$i}", [$attribute], [], $permissions);
}

for ($i = 1; $i < 5; $i++) {
$collectionId = $i;
$relatedCollectionId = $i+1;
$relatedCollectionId = $i + 1;
static::getDatabase()->createRelationship(
collection: "level{$collectionId}",
relatedCollection: "level{$relatedCollectionId}",
Expand Down Expand Up @@ -3495,7 +3495,7 @@ public function testNoChangeUpdateDocumentWithRelationWithoutPermission(): void
$level1 = static::getDatabase()->updateDocument('level1', $level1->getId(), $level1);
$this->assertEquals('updated value', $level1['level2']['level3']['name']);

for ($i=1; $i < 6; $i++) {
for ($i = 1; $i < 6; $i++) {
static::getDatabase()->deleteCollection("level{$i}");
}
}
Expand Down Expand Up @@ -3661,7 +3661,7 @@ public function testExceptionWidthLimit(int $key, int $stringSize, int $stringCo
*/
public function testCheckAttributeWidthLimit(int $key, int $stringSize, int $stringCount, int $intCount, int $floatCount, int $boolCount): void
{
if (static::getDatabase()->getAdapter()::getDocumentSizeLimit()> 0) {
if (static::getDatabase()->getAdapter()::getDocumentSizeLimit() > 0) {
$collection = static::getDatabase()->getCollection("widthLimit{$key}");

// create same attribute in testExceptionWidthLimit
Expand Down Expand Up @@ -4116,7 +4116,7 @@ public function testUpdateAttributeStructure(): void
$this->assertEquals(false, $attribute['array']);
$this->assertEquals(false, $attribute['required']);
$this->assertEquals('priceRange', $attribute['format']);
$this->assertEquals(['min'=>1, 'max'=>10000], $attribute['formatOptions']);
$this->assertEquals(['min' => 1, 'max' => 10000], $attribute['formatOptions']);

$database->updateAttribute('flowers', 'price', default: 100);
$collection = $database->getCollection('flowers');
Expand All @@ -4128,7 +4128,7 @@ public function testUpdateAttributeStructure(): void
$this->assertEquals(false, $attribute['array']);
$this->assertEquals(false, $attribute['required']);
$this->assertEquals('priceRange', $attribute['format']);
$this->assertEquals(['min'=>1, 'max'=>10000], $attribute['formatOptions']);
$this->assertEquals(['min' => 1, 'max' => 10000], $attribute['formatOptions']);

$database->updateAttribute('flowers', 'price', format: 'priceRangeNew');
$collection = $database->getCollection('flowers');
Expand All @@ -4140,7 +4140,7 @@ public function testUpdateAttributeStructure(): void
$this->assertEquals(false, $attribute['array']);
$this->assertEquals(false, $attribute['required']);
$this->assertEquals('priceRangeNew', $attribute['format']);
$this->assertEquals(['min'=>1, 'max'=>10000], $attribute['formatOptions']);
$this->assertEquals(['min' => 1, 'max' => 10000], $attribute['formatOptions']);

$database->updateAttribute('flowers', 'price', format: '');
$collection = $database->getCollection('flowers');
Expand All @@ -4152,7 +4152,7 @@ public function testUpdateAttributeStructure(): void
$this->assertEquals(false, $attribute['array']);
$this->assertEquals(false, $attribute['required']);
$this->assertEquals('', $attribute['format']);
$this->assertEquals(['min'=>1, 'max'=>10000], $attribute['formatOptions']);
$this->assertEquals(['min' => 1, 'max' => 10000], $attribute['formatOptions']);

$database->updateAttribute('flowers', 'price', formatOptions: ['min' => 1, 'max' => 999]);
$collection = $database->getCollection('flowers');
Expand All @@ -4164,7 +4164,7 @@ public function testUpdateAttributeStructure(): void
$this->assertEquals(false, $attribute['array']);
$this->assertEquals(false, $attribute['required']);
$this->assertEquals('', $attribute['format']);
$this->assertEquals(['min'=>1, 'max'=>999], $attribute['formatOptions']);
$this->assertEquals(['min' => 1, 'max' => 999], $attribute['formatOptions']);

$database->updateAttribute('flowers', 'price', formatOptions: []);
$collection = $database->getCollection('flowers');
Expand Down
2 changes: 1 addition & 1 deletion tests/Database/Validator/IndexedQueriesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function testValid(): void
);

$this->assertEquals(true, $validator->isValid(['cursorAfter("asdf")']), $validator->getDescription());
$this->assertEquals(true, $validator->isValid([Query::cursorAfter(new Document(['$id'=>'asdf']))]), $validator->getDescription());
$this->assertEquals(true, $validator->isValid([Query::cursorAfter(new Document(['$id' => 'asdf']))]), $validator->getDescription());
$this->assertEquals(true, $validator->isValid(['equal("name", "value")']), $validator->getDescription());
$this->assertEquals(true, $validator->isValid([Query::equal('name', ['value'])]), $validator->getDescription());
$this->assertEquals(true, $validator->isValid(['limit(10)']), $validator->getDescription());
Expand Down