Skip to content

Commit

Permalink
[general] Use global date provider for doctrine timestampable (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Aug 29, 2024
1 parent 1d0eb5a commit cebf200
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"fastybird/metadata-library": "dev-main",
"fastybird/simple-auth": "^0.14",
"ipub/doctrine-phone": "^1.6",
"ipub/doctrine-timestampable": "^2.0",
"ipub/slim-router": "^0.2",
"nettrine/dbal": "^0.8",
"nettrine/orm": "^0.8",
Expand Down
14 changes: 14 additions & 0 deletions tests/cases/unit/DbTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use FastyBird\DateTimeFactory;
use FastyBird\Library\Application\Boot as ApplicationBoot;
use FastyBird\Library\Application\Exceptions as ApplicationExceptions;
use FastyBird\Library\Application\Utilities as ApplicationUtilities;
use FastyBird\Module\Triggers\DI;
use FastyBird\Module\Triggers\Exceptions;
use IPub\DoctrineCrud;
Expand Down Expand Up @@ -86,6 +87,19 @@ public function setUp(): void
DateTimeFactory\Factory::class,
$dateTimeFactory,
);

$dateTimeProvider = $this->createMock(ApplicationUtilities\DateTimeProvider::class);
$dateTimeProvider
->method('getDate')
->willReturn($dateTimeFactory->getNow());
$dateTimeProvider
->method('getTimestamp')
->willReturn($dateTimeFactory->getNow()->getTimestamp());

$this->mockContainerService(
ApplicationUtilities\DateTimeProvider::class,
$dateTimeProvider,
);
}

protected function registerDatabaseSchemaFile(string $file): void
Expand Down

0 comments on commit cebf200

Please sign in to comment.