Skip to content

Commit

Permalink
refactor: added schema changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaoFerrazfs committed Oct 3, 2024
1 parent 598ad5d commit 24aa6d3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/Schema/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Mongolid\Schema;

use Illuminate\Contracts\Container\BindingResolutionException;
use MongoDB\BSON\ObjectId;
use MongoDB\BSON\UTCDateTime;
use Mongolid\Container\Container;
Expand Down Expand Up @@ -53,8 +54,8 @@ abstract class Schema
public string $entityClass = 'stdClass';

/**
* Filters any field in the $fields that has it's value specified as a
* 'objectId'. It will wraps the $value, if any, into a ObjectId object.
* Filters any field in the $fields that has its value specified as a
* 'objectId'. It will wrap the $value, if any, into a ObjectId object.
*
* @param mixed $value value that may be converted to ObjectId
*/
Expand All @@ -77,6 +78,7 @@ public function objectId(mixed $value = null): mixed
* the schema. The sequence generation is done by the SequenceService.
*
* @param int|null $value value that will be evaluated
* @throws BindingResolutionException
*/
public function sequence(?int $value = null): int
{
Expand Down
8 changes: 4 additions & 4 deletions tests/Unit/Schema/SchemaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function testShouldRefreshUpdatedAtTimestamps(): void
// Arrange
$schema = new class extends Schema {
};
$value = (new UTCDateTime(25));
$value = new UTCDateTime(25);

// Assertion
$result = $schema->updatedAtTimestamp($value);
Expand All @@ -157,9 +157,9 @@ public function testShouldRefreshUpdatedAtTimestamps(): void
* @dataProvider createdAtTimestampsFixture
*/
public function testShouldNotRefreshCreatedAtTimestamps(
$value,
$expectation,
$compareTimestamp = true
mixed $value,
UTCDateTime $expectation,
bool $compareTimestamp = true
): void {
// Arrange
$schema = new class extends Schema {
Expand Down

0 comments on commit 24aa6d3

Please sign in to comment.