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 d666ba7 commit da2811a
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 @@ -39,7 +39,6 @@
"contributte/translation": "^2.0",
"cweagans/composer-patches": "^1.7",
"fastybird/application-library": "dev-main",
"fastybird/datetime-factory": "^0.6",
"fastybird/devices-module": "dev-main",
"fastybird/metadata-library": "dev-main",
"fastybird/tools-library": "dev-main",
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 @@ -11,6 +11,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 IPub\DoctrineCrud;
use Nette;
use Nettrine\ORM as NettrineORM;
Expand Down Expand Up @@ -70,6 +71,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 da2811a

Please sign in to comment.