Skip to content

Fix Test #475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 3, 2021
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
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ dist: trusty
php:
- '7.1'
- '7.2'
- '7.3'
- '7.3.24'
cache:
directories:
- node_modules
- vendor
before_install:
- nvm install 8.11
- nvm install 14.16.1
- sudo apt-get install graphviz
install:
- composer install
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"ext-json": "*"
},
"require-dev": {
"phpunit/phpunit": "^7",
"squizlabs/php_codesniffer": "^3.0.1",
"phpdocumentor/phpdocumentor": "~2.9",
"phpunit/phpunit": "7",
"squizlabs/php_codesniffer": "3.6.0",
"phpdocumentor/phpdocumentor": "2.9",
"jms/serializer": "1.7.1"
},
"autoload": {
Expand Down
3,239 changes: 1,870 additions & 1,369 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
"name": "parse-php-sdk",
"scripts": {
"test": "./vendor/bin/phpunit --stderr",
"test:coverage": "./vendor/bin/phpunit --stderr --coverage-clover=coverage.xml",
"test-stream:coverage": "./vendor/bin/phpunit --stderr --bootstrap=./tests/bootstrap-stream.php --coverage-clover=coverage.xml",
"test:coverage": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --stderr --coverage-clover=coverage.xml",
"test-stream:coverage": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --stderr --bootstrap=./tests/bootstrap-stream.php --coverage-clover=coverage.xml",
"lint": "./vendor/bin/phpcs --standard=./phpcs.xml.dist ./src/Parse ./tests/Parse",
"lint:fix": "./vendor/bin/phpcbf --standard=./phpcs.xml.dist ./src/Parse ./tests/Parse",
"prestart": "MONGODB_VERSION=4.0.4 MONGODB_TOPOLOGY=replicaset MONGODB_STORAGE_ENGINE=wiredTiger mongodb-runner start",
"start": "TESTING=1 node ./tests/server.js &",
"server-only": "TESTING=1 node ./tests/server.js",
"document-check": "./vendor/bin/phpdoc -d ./src/ --template=checkstyle",
"document": "./vendor/bin/phpdoc -d ./src/ --title 'Parse PHP SDK API Reference' --template='responsive-twig'"
},
Expand All @@ -18,8 +19,11 @@
"license": "BSD-3-Clause",
"homepage": "https://github.com/montymxb/parse-server-test#readme",
"devDependencies": {
"mongodb-runner": "4.7.2",
"mongodb-runner": "4.8.1",
"parse-server": "github:parse-community/parse-server#master",
"winston": "3.2.1"
},
"dependencies": {
"@parse/simple-mailgun-adapter": "1.2.0"
}
}
4 changes: 3 additions & 1 deletion src/Parse/ParseObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,9 @@ public static function create($className, $objectId = null, $isPointer = false)
{
if (isset(self::$registeredSubclasses[$className])) {
return new self::$registeredSubclasses[$className](
$className, $objectId, $isPointer
$className,
$objectId,
$isPointer
);
} else {
return new self($className, $objectId, $isPointer);
Expand Down
4 changes: 3 additions & 1 deletion src/Parse/ParseQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,9 @@ public function aggregate($pipeline)
null,
true
);

if (!isset($result['results'])) {
return [];
}
return $result['results'];
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Parse/ParseGeoPointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public function testGeoPointBase()

// Round trip encoding
$actualPoint = $results[0]->get('location');
$this->assertEqualsWithDelta(44.0, $actualPoint->getLatitude(), 0.0001, '');
$this->assertEqualsWithDelta(-11.0, $actualPoint->getLongitude(), 0.0001, '');
$this->assertEquals(44.0, $actualPoint->getLatitude());
$this->assertEquals(-11.0, $actualPoint->getLongitude());

// nearsphere
$point->setLatitude(66.0);
Expand Down
6 changes: 1 addition & 5 deletions tests/Parse/ParseQueryAggregateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,8 @@ public function testAggregatePipelineInvalid()
];
$this->loadObjects();
$query = new ParseQuery('TestObject');
$this->expectException(
'Parse\ParseException',
'Invalid parameter for query: unknown',
102
);
$results = $query->aggregate($pipeline);
$this->assertEquals(0, count($results));
}

public function testAggregateGroupInvalid()
Expand Down
4 changes: 2 additions & 2 deletions tests/Parse/ParseQueryRelativeTimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,15 +276,15 @@ public function testLongRelativeTime()

$query = new ParseQuery('TestObject');
$query->lessThanRelativeTime('date', '1 year 3 weeks ago');
$this->assertEquals(1, $query->count());
$this->assertEquals(0, $query->count());

$query = new ParseQuery('TestObject');
$query->greaterThanRelativeTime('date', 'in 1 year 3 weeks');
$this->assertEquals(0, $query->count());

$query = new ParseQuery('TestObject');
$query->greaterThanRelativeTime('date', '1 year 3 weeks ago');
$this->assertEquals(3, $query->count());
$this->assertEquals(4, $query->count());
}

/**
Expand Down
8 changes: 7 additions & 1 deletion tests/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ const api = new ParseServer({
"TestObject",
"_User"
]
}
},

fileUpload: {
enableForPublic: true,
enableForAnonymousUser: true,
enableForAuthenticatedUser: true,
},
});

// Serve the Parse API on the /parse URL prefix
Expand Down