From cebf2004b50592fa9208be16a1e60f8417dba1ea Mon Sep 17 00:00:00 2001 From: GitHub Date: Thu, 29 Aug 2024 09:47:03 +0000 Subject: [PATCH] [general] Use global date provider for doctrine timestampable (#310) --- composer.json | 1 - tests/cases/unit/DbTestCase.php | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index dcdb824..3202964 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/tests/cases/unit/DbTestCase.php b/tests/cases/unit/DbTestCase.php index 701f88e..6687ecc 100644 --- a/tests/cases/unit/DbTestCase.php +++ b/tests/cases/unit/DbTestCase.php @@ -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; @@ -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