PHPackages                             fchris82/time-traveller-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. fchris82/time-traveller-bundle

ActiveSymfony-bundle[Testing &amp; Quality](/categories/testing)

fchris82/time-traveller-bundle
==============================

Helps to handle 'now' in tests.

v1.0.0(3y ago)04MITPHPPHP &gt;=7.4

Since Aug 6Pushed 3y ago1 watchersCompare

[ Source](https://github.com/fchris82/time-traveller-bundle)[ Packagist](https://packagist.org/packages/fchris82/time-traveller-bundle)[ RSS](/packages/fchris82-time-traveller-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

Time Traveller Bundle
=====================

[](#time-traveller-bundle)

It helps you in writing tests for project which has time dependencies. You can control what `now` means.

```
// Original way:
$entity->setCreatedAt(new \DateTime());

// New way with the TimeManager:
$entity->setCreatedAt($timeManager->getNow());
```

> ### Limitations
>
> [](#limitations)
>
> - The `CURRENT_TIMESTAMP()` in Doctrine or the PDO `NOW()` functions will get back the "right" dates and times. You have to avoid these "outside" functions.
> - Some (third party) listeners (eg: TimestampableListener) use the original `new DateTime()` method. You have to pay attention to this, and you have to override, or fix in the background with your own listener.

Install
-------

[](#install)

### Install the bundle

[](#install-the-bundle)

Install bundle with composer:

```
$ composer require fchris82/time-traveller-bundle
```

Edit the `config/bundles.php` file:

```
