Skip to content

Commit

Permalink
added more assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalill committed Jul 9, 2023
1 parent c4c6e2a commit f901305
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
],
"test": [
"Composer\\Config::disableProcessTimeout",
"docker compose exec tests vendor/bin/phpunit --configuration phpunit.xml"
"docker compose exec tests vendor/bin/phpunit --configuration phpunit.xml --stop-on-failure"
],
"lint": "./vendor/bin/pint --test",
"format": "./vendor/bin/pint",
Expand Down
26 changes: 19 additions & 7 deletions tests/Database/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,9 @@ public function testGetDocument(Document $document): Document
*/
public function testGetDocumentSelect(Document $document): Document
{
$document = static::getDatabase()->getDocument('documents', $document->getId(), [
$documentId = $document->getId();

$document = static::getDatabase()->getDocument('documents', $documentId, [
Query::select(['string', 'integer']),
]);

Expand All @@ -1029,12 +1031,22 @@ public function testGetDocumentSelect(Document $document): Document
$this->assertArrayNotHasKey('boolean', $document->getAttributes());
$this->assertArrayNotHasKey('colors', $document->getAttributes());
$this->assertArrayNotHasKey('with-dash', $document->getAttributes());
$this->assertEmpty($document->getAttribute('$id'));
$this->assertEmpty($document->getAttribute('$internalId'));
$this->assertEmpty($document->getAttribute('$collection'));
$this->assertEmpty($document->getAttribute('$permissions'));
$this->assertEmpty($document->getAttribute('$createdAt'));
$this->assertEmpty($document->getAttribute('$updatedAt'));
$this->assertArrayNotHasKey('$id', $document);
$this->assertArrayNotHasKey('$internalId', $document);
$this->assertArrayNotHasKey('$collection', $document);
$this->assertArrayNotHasKey('$permissions', $document);
$this->assertArrayNotHasKey('$createdAt', $document);
$this->assertArrayNotHasKey('$updatedAt', $document);

$document = static::getDatabase()->getDocument('documents', $documentId, [
Query::select(['string', 'integer', '$id', '$internalId', '$permissions', '$createdAt', '$updatedAt']),
]);

$this->assertArrayHasKey('$id', $document);
$this->assertArrayHasKey('$internalId', $document);
$this->assertArrayHasKey('$permissions', $document);
$this->assertArrayHasKey('$createdAt', $document);
$this->assertArrayHasKey('$updatedAt', $document);

return $document;
}
Expand Down

0 comments on commit f901305

Please sign in to comment.