From 6708187aae739ee22413f4766a2b1c2c1d35feba Mon Sep 17 00:00:00 2001 From: Olivier Laviale Date: Fri, 30 Sep 2016 23:00:42 +0200 Subject: [PATCH] Use icanboogie/datetime v2.0 #17 --- README.md | 11 ++++--- composer.json | 2 +- lib/ActiveRecord/Driver/BasicDriver.php | 4 +-- .../Property/CreatedAtProperty.php | 6 ++-- lib/ActiveRecord/Property/DateProperty.php | 6 ++-- .../Property/DateTimeProperty.php | 6 ++-- .../Property/DateTimePropertySupport.php | 12 ++++--- .../Property/FinishAtProperty.php | 6 ++-- .../Property/FinishedAtProperty.php | 6 ++-- lib/ActiveRecord/Property/StartAtProperty.php | 6 ++-- .../Property/StartedAtProperty.php | 6 ++-- .../Property/UpdatedAtProperty.php | 6 ++-- lib/ActiveRecord/Query.php | 4 +-- tests/ActiveRecord/ModelTest.php | 20 ++++++------ .../Property/CreatedAtPropertyTest.php | 7 +++-- .../Property/DateTimePropertiesTest.php | 31 ++++++++++--------- .../Property/UpdatedAtPropertyTest.php | 8 +++-- tests/ActiveRecord/QueryTest.php | 3 +- 18 files changed, 79 insertions(+), 71 deletions(-) diff --git a/README.md b/README.md index 1896e2e..08ba4cd 100644 --- a/README.md +++ b/README.md @@ -442,7 +442,7 @@ The `EXTENDING` attribute specifies the model to extend. use ICanBoogie\ActiveRecord\Model; use ICanBoogie\ActiveRecord\ModelCollection; -use ICanBoogie\DateTime; +use ICanBoogie\ImmutableDateTime; /* @var $connections \ICanBoogie\ActiveRecord\ConnectionCollection */ @@ -480,7 +480,7 @@ $models['news']->save([ 'title' => "Testing!", 'body' => "Testing...", - 'date' => DateTime::now() + 'date' => ImmutableDateTime::now() ]); ``` @@ -837,7 +837,7 @@ $record->delete(); The package comes with three trait properties especially designed to handle [DateTime][] instances: [DateTimeProperty][], [CreatedAtProperty][], [UpdatedAtProperty][]. Using this -properties you are guaranteed to always get a [DateTime][] instance, no matter what value type +properties you are guaranteed to always get a [ImmutableDateTime][] instance, no matter what value type is used to set the date and time. ```php @@ -859,7 +859,7 @@ class Node extends ActiveRecord $node = new Node; -echo get_class($node->created_at); // ICanBoogie\Datetime +echo get_class($node->created_at); // ICanBoogie\ImmutableDateTime echo $node->created_at->is_empty; // true $node->created_at = 'now'; echo $node->created_at; // 2014-02-21T15:00:00+0100 @@ -2526,7 +2526,8 @@ The package is continuously tested by [Travis CI](http://about.travis-ci.org/). [StatementNotValid]: http://api.icanboogie.org/activerecord/4.0/class-ICanBoogie.ActiveRecord.StatementNotValid.html [UnableToSetFetchMode]: http://api.icanboogie.org/activerecord/4.0/class-ICanBoogie.ActiveRecord.UnableToSetFetchMode.html [UpdatedAtProperty]: http://api.icanboogie.org/activerecord/4.0/class-ICanBoogie.ActiveRecord.Property.UpdatedAtProperty.html -[DateTime]: http://api.icanboogie.org/datetime/1.2/class-ICanBoogie.DateTime.html +[DateTime]: http://api.icanboogie.org/datetime/2.0/class-ICanBoogie.DateTime.html +[ImmutableDateTime]: http://api.icanboogie.org/datetime/2.0/class-ICanBoogie.DateTime.html [ValidationErrors]: http://api.icanboogie.org/validate/latest/class-ICanBoogie.Validate.ValidationErrors.html [icanboogie/bind-activerecord]: https://github.com/ICanBoogie/bind-activerecord [ICanBoogie]: http://icanboogie.org diff --git a/composer.json b/composer.json index 8057b29..0b67fac 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "ext-pdo": "*", "icanboogie/prototype": "^3.0", "icanboogie/inflector": "^1.4", - "icanboogie/datetime": "^1.2", + "icanboogie/datetime": "^2.0", "icanboogie/validate": "dev-master" }, diff --git a/lib/ActiveRecord/Driver/BasicDriver.php b/lib/ActiveRecord/Driver/BasicDriver.php index 92edeb7..595b5e1 100644 --- a/lib/ActiveRecord/Driver/BasicDriver.php +++ b/lib/ActiveRecord/Driver/BasicDriver.php @@ -14,7 +14,7 @@ use ICanBoogie\Accessor\AccessorTrait; use ICanBoogie\ActiveRecord\Connection; use ICanBoogie\ActiveRecord\Driver; -use ICanBoogie\DateTime; +use ICanBoogie\ImmutableDateTime; /** * Basic connection driver. @@ -93,7 +93,7 @@ public function cast_value($value, $type = null) { if ($value instanceof \DateTimeInterface) { - $value = DateTime::from($value); + $value = ImmutableDateTime::from($value); return $value->utc->as_db; } diff --git a/lib/ActiveRecord/Property/CreatedAtProperty.php b/lib/ActiveRecord/Property/CreatedAtProperty.php index 1ecdcd3..98bff88 100644 --- a/lib/ActiveRecord/Property/CreatedAtProperty.php +++ b/lib/ActiveRecord/Property/CreatedAtProperty.php @@ -11,14 +11,14 @@ namespace ICanBoogie\ActiveRecord\Property; -use ICanBoogie\DateTime; +use ICanBoogie\ImmutableDateTime; /** * Implements a `created_at` property. * * @see DateTimeProperty * - * @property DateTime $created_at + * @property ImmutableDateTime $created_at */ trait CreatedAtProperty { @@ -32,7 +32,7 @@ trait CreatedAtProperty /** * Returns the date and time at which the record was created. * - * @return DateTime + * @return ImmutableDateTime */ protected function get_created_at() { diff --git a/lib/ActiveRecord/Property/DateProperty.php b/lib/ActiveRecord/Property/DateProperty.php index 0a49712..96a47a7 100644 --- a/lib/ActiveRecord/Property/DateProperty.php +++ b/lib/ActiveRecord/Property/DateProperty.php @@ -11,12 +11,12 @@ namespace ICanBoogie\ActiveRecord\Property; -use ICanBoogie\DateTime; +use ICanBoogie\ImmutableDateTime; /** * Implements a `date` property. * - * @property DateTime $date + * @property ImmutableDateTime $date * * @codeCoverageIgnore */ @@ -32,7 +32,7 @@ trait DateProperty /** * Returns the date. * - * @return DateTime + * @return ImmutableDateTime */ protected function get_date() { diff --git a/lib/ActiveRecord/Property/DateTimeProperty.php b/lib/ActiveRecord/Property/DateTimeProperty.php index cf521bc..9463254 100644 --- a/lib/ActiveRecord/Property/DateTimeProperty.php +++ b/lib/ActiveRecord/Property/DateTimeProperty.php @@ -11,12 +11,12 @@ namespace ICanBoogie\ActiveRecord\Property; -use ICanBoogie\DateTime; +use ICanBoogie\ImmutableDateTime; /** * Implements a `datetime` property. * - * @property DateTime $datetime + * @property ImmutableDateTime $datetime */ trait DateTimeProperty { @@ -30,7 +30,7 @@ trait DateTimeProperty /** * Returns the date and time. * - * @return DateTime + * @return ImmutableDateTime */ protected function get_datetime() { diff --git a/lib/ActiveRecord/Property/DateTimePropertySupport.php b/lib/ActiveRecord/Property/DateTimePropertySupport.php index 70904c0..1e68a3b 100644 --- a/lib/ActiveRecord/Property/DateTimePropertySupport.php +++ b/lib/ActiveRecord/Property/DateTimePropertySupport.php @@ -11,7 +11,7 @@ namespace ICanBoogie\ActiveRecord\Property; -use ICanBoogie\DateTime; +use ICanBoogie\ImmutableDateTime; /** * Provides support for datetime properties. @@ -26,7 +26,7 @@ class DateTimePropertySupport */ static public function set(&$property, $datetime) { - $property = $datetime === 'now' ? DateTime::now() : $datetime; + $property = $datetime === 'now' ? ImmutableDateTime::now() : $datetime; } /** @@ -34,15 +34,17 @@ static public function set(&$property, $datetime) * * @param mixed $property Reference to the property to return. * - * @return DateTime The function always return a {@link DateTime} instance. + * @return ImmutableDateTime The function always return a {@link ImmutableDateTime} instance. */ static public function get(&$property) { - if ($property instanceof DateTime) + if ($property instanceof ImmutableDateTime) { return $property; } - return $property = $property === null ? DateTime::none() : new DateTime($property, 'utc'); + return $property = $property === null + ? ImmutableDateTime::none() + : ImmutableDateTime::from($property, 'utc'); } } diff --git a/lib/ActiveRecord/Property/FinishAtProperty.php b/lib/ActiveRecord/Property/FinishAtProperty.php index 7ffdb13..15019b7 100644 --- a/lib/ActiveRecord/Property/FinishAtProperty.php +++ b/lib/ActiveRecord/Property/FinishAtProperty.php @@ -11,14 +11,14 @@ namespace ICanBoogie\ActiveRecord\Property; -use ICanBoogie\DateTime; +use ICanBoogie\ImmutableDateTime; /** * Implements a `finish_at` property. * * @see DateTimeProperty * - * @property DateTime $finish_at + * @property ImmutableDateTime $finish_at * * @codeCoverageIgnore */ @@ -34,7 +34,7 @@ trait FinishAtProperty /** * Returns the date and time at which the record was finish. * - * @return DateTime + * @return ImmutableDateTime */ protected function get_finish_at() { diff --git a/lib/ActiveRecord/Property/FinishedAtProperty.php b/lib/ActiveRecord/Property/FinishedAtProperty.php index e635989..d4eb821 100644 --- a/lib/ActiveRecord/Property/FinishedAtProperty.php +++ b/lib/ActiveRecord/Property/FinishedAtProperty.php @@ -11,14 +11,14 @@ namespace ICanBoogie\ActiveRecord\Property; -use ICanBoogie\DateTime; +use ICanBoogie\ImmutableDateTime; /** * Implements a `finished_at` property. * * @see DateTimeProperty * - * @property DateTime $finished_at + * @property ImmutableDateTime $finished_at * * @codeCoverageIgnore */ @@ -34,7 +34,7 @@ trait FinishedAtProperty /** * Returns the date and time at which the record was finished. * - * @return DateTime + * @return ImmutableDateTime */ protected function get_finished_at() { diff --git a/lib/ActiveRecord/Property/StartAtProperty.php b/lib/ActiveRecord/Property/StartAtProperty.php index 74d4708..859c1bc 100644 --- a/lib/ActiveRecord/Property/StartAtProperty.php +++ b/lib/ActiveRecord/Property/StartAtProperty.php @@ -11,14 +11,14 @@ namespace ICanBoogie\ActiveRecord\Property; -use ICanBoogie\DateTime; +use ICanBoogie\ImmutableDateTime; /** * Implements a `start_at` property. * * @see DateTimeProperty * - * @property DateTime $start_at + * @property ImmutableDateTime $start_at * * @codeCoverageIgnore */ @@ -34,7 +34,7 @@ trait StartAtProperty /** * Returns the date and time at which the record was start. * - * @return DateTime + * @return ImmutableDateTime */ protected function get_start_at() { diff --git a/lib/ActiveRecord/Property/StartedAtProperty.php b/lib/ActiveRecord/Property/StartedAtProperty.php index ad98006..68a5f1c 100644 --- a/lib/ActiveRecord/Property/StartedAtProperty.php +++ b/lib/ActiveRecord/Property/StartedAtProperty.php @@ -11,14 +11,14 @@ namespace ICanBoogie\ActiveRecord\Property; -use ICanBoogie\DateTime; +use ICanBoogie\ImmutableDateTime; /** * Implements a `started_at` property. * * @see DateTimeProperty * - * @property DateTime $started_at + * @property ImmutableDateTime $started_at * * @codeCoverageIgnore */ @@ -34,7 +34,7 @@ trait StartedAtProperty /** * Returns the date and time at which the record was started. * - * @return DateTime + * @return ImmutableDateTime */ protected function get_started_at() { diff --git a/lib/ActiveRecord/Property/UpdatedAtProperty.php b/lib/ActiveRecord/Property/UpdatedAtProperty.php index 3093fb0..484a7a4 100644 --- a/lib/ActiveRecord/Property/UpdatedAtProperty.php +++ b/lib/ActiveRecord/Property/UpdatedAtProperty.php @@ -11,14 +11,14 @@ namespace ICanBoogie\ActiveRecord\Property; -use ICanBoogie\DateTime; +use ICanBoogie\ImmutableDateTime; /** * Implements a `updated_at` property. * * @see DateTimeProperty * - * @property DateTime $updated_at + * @property ImmutableDateTime $updated_at */ trait UpdatedAtProperty { @@ -32,7 +32,7 @@ trait UpdatedAtProperty /** * Returns the date and time at which the record was updated. * - * @return DateTime + * @return ImmutableDateTime */ protected function get_updated_at() { diff --git a/lib/ActiveRecord/Query.php b/lib/ActiveRecord/Query.php index 3fd2e5c..a39649d 100644 --- a/lib/ActiveRecord/Query.php +++ b/lib/ActiveRecord/Query.php @@ -12,7 +12,7 @@ namespace ICanBoogie\ActiveRecord; use ICanBoogie\ActiveRecord; -use ICanBoogie\DateTime; +use ICanBoogie\ImmutableDateTime; use ICanBoogie\Prototype\MethodNotDefined; use ICanBoogie\PrototypeTrait; @@ -779,7 +779,7 @@ private function deferred_parse_conditions(...$conditions_and_args) { if ($value instanceof \DateTimeInterface) { - $value = DateTime::from($value)->utc->as_db; + $value = ImmutableDateTime::from($value)->utc->as_db; } } diff --git a/tests/ActiveRecord/ModelTest.php b/tests/ActiveRecord/ModelTest.php index 9f144f5..d81ac0c 100644 --- a/tests/ActiveRecord/ModelTest.php +++ b/tests/ActiveRecord/ModelTest.php @@ -18,7 +18,7 @@ use ICanBoogie\ActiveRecord\ModelTest\Car; use ICanBoogie\ActiveRecord\ModelTest\Comment; use ICanBoogie\ActiveRecord\ModelTest\Driver; -use ICanBoogie\DateTime; +use ICanBoogie\ImmutableDateTime; use ICanBoogie\OffsetNotWritable; class ModelTest extends \PHPUnit_Framework_TestCase @@ -137,7 +137,7 @@ public function setUp() foreach ($names as $name) { - $counts->save([ 'name' => $name, 'date' => DateTime::now() ]); + $counts->save([ 'name' => $name, 'date' => ImmutableDateTime::now() ]); } $this->connections = $connections; @@ -285,7 +285,7 @@ public function test_should_throw_not_found_when_all_record_do_not_exists() public function test_find_one() { $model = $this->models['articles']; - $id = $model->save([ 'title' => uniqid(), 'body' => uniqid(), 'date' => DateTime::now() ]); + $id = $model->save([ 'title' => uniqid(), 'body' => uniqid(), 'date' => ImmutableDateTime::now() ]); $this->assertNotEmpty($id); $record = $model->find($id); @@ -296,9 +296,9 @@ public function test_find_one() public function test_find_many() { $model = $this->models['articles']; - $id1 = $model->save([ 'title' => uniqid(), 'body' => uniqid(), 'date' => DateTime::now() ]); - $id2 = $model->save([ 'title' => uniqid(), 'body' => uniqid(), 'date' => DateTime::now() ]); - $id3 = $model->save([ 'title' => uniqid(), 'body' => uniqid(), 'date' => DateTime::now() ]); + $id1 = $model->save([ 'title' => uniqid(), 'body' => uniqid(), 'date' => ImmutableDateTime::now() ]); + $id2 = $model->save([ 'title' => uniqid(), 'body' => uniqid(), 'date' => ImmutableDateTime::now() ]); + $id3 = $model->save([ 'title' => uniqid(), 'body' => uniqid(), 'date' => ImmutableDateTime::now() ]); $this->assertNotEmpty($id1); $this->assertNotEmpty($id2); $this->assertNotEmpty($id3); @@ -319,9 +319,9 @@ public function test_find_many() public function test_find_many_with_an_array() { $model = $this->models['articles']; - $id1 = $model->save([ 'title' => uniqid(), 'body' => uniqid(), 'date' => DateTime::now() ]); - $id2 = $model->save([ 'title' => uniqid(), 'body' => uniqid(), 'date' => DateTime::now() ]); - $id3 = $model->save([ 'title' => uniqid(), 'body' => uniqid(), 'date' => DateTime::now() ]); + $id1 = $model->save([ 'title' => uniqid(), 'body' => uniqid(), 'date' => ImmutableDateTime::now() ]); + $id2 = $model->save([ 'title' => uniqid(), 'body' => uniqid(), 'date' => ImmutableDateTime::now() ]); + $id3 = $model->save([ 'title' => uniqid(), 'body' => uniqid(), 'date' => ImmutableDateTime::now() ]); $this->assertNotEmpty($id1); $this->assertNotEmpty($id2); $this->assertNotEmpty($id3); @@ -640,7 +640,7 @@ public function test_cache_should_be_revoked_on_save() $name2 = uniqid(); $model = $this->counts_model; - $id = $model->save([ 'name' => $name1, 'date' => DateTime::now() ]); + $id = $model->save([ 'name' => $name1, 'date' => ImmutableDateTime::now() ]); $record = $model[$id]; $model->save([ 'name' => $name2 ], $id); $record_now = $model[$id]; diff --git a/tests/ActiveRecord/Property/CreatedAtPropertyTest.php b/tests/ActiveRecord/Property/CreatedAtPropertyTest.php index c4e50d6..5c553fd 100644 --- a/tests/ActiveRecord/Property/CreatedAtPropertyTest.php +++ b/tests/ActiveRecord/Property/CreatedAtPropertyTest.php @@ -14,6 +14,7 @@ use ICanBoogie\DateTime; use ICanBoogie\ActiveRecord\CreatedAtPropertyTest\A; use ICanBoogie\ActiveRecord\CreatedAtPropertyTest\B; +use ICanBoogie\ImmutableDateTime; class CreatedAtPropertyTest extends \PHPUnit_Framework_TestCase { @@ -24,9 +25,9 @@ public function test_property($classname) { /* @var $r A */ $r = new $classname; - $datetime = new DateTime(); + $datetime = new ImmutableDateTime; - $this->assertInstanceOf(DateTime::class, $r->created_at); + $this->assertInstanceOf(ImmutableDateTime::class, $r->created_at); $this->assertTrue($r->created_at->is_empty); $r->created_at = $datetime; @@ -37,7 +38,7 @@ public function test_property($classname) $this->assertArrayHasKey('created_at', $r->__sleep()); $r->created_at = null; - $this->assertInstanceOf(DateTime::class, $r->created_at); + $this->assertInstanceOf(ImmutableDateTime::class, $r->created_at); $this->assertTrue($r->created_at->is_empty); } diff --git a/tests/ActiveRecord/Property/DateTimePropertiesTest.php b/tests/ActiveRecord/Property/DateTimePropertiesTest.php index 5c29db9..9b33f1a 100644 --- a/tests/ActiveRecord/Property/DateTimePropertiesTest.php +++ b/tests/ActiveRecord/Property/DateTimePropertiesTest.php @@ -14,17 +14,18 @@ use ICanBoogie\DateTime; use ICanBoogie\ActiveRecord\DateTimePropertiesTest\A; use ICanBoogie\ActiveRecord\DateTimePropertiesTest\B; +use ICanBoogie\ImmutableDateTime; class DateTimePropertiesTest extends \PHPUnit_Framework_TestCase { public function test_properties() { $r = new A(); - $created_at = new DateTime('-10 day'); - $updated_at = new DateTime('-1 day'); + $created_at = new ImmutableDateTime('-10 day'); + $updated_at = new ImmutableDateTime('-1 day'); - $this->assertInstanceOf(DateTime::class, $r->created_at); - $this->assertInstanceOf(DateTime::class, $r->updated_at); + $this->assertInstanceOf(ImmutableDateTime::class, $r->created_at); + $this->assertInstanceOf(ImmutableDateTime::class, $r->updated_at); $this->assertTrue($r->created_at->is_empty); $this->assertTrue($r->updated_at->is_empty); @@ -42,8 +43,8 @@ public function test_properties() $r->created_at = null; $r->updated_at = null; - $this->assertInstanceOf(DateTime::class, $r->created_at); - $this->assertInstanceOf(DateTime::class, $r->updated_at); + $this->assertInstanceOf(ImmutableDateTime::class, $r->created_at); + $this->assertInstanceOf(ImmutableDateTime::class, $r->updated_at); $this->assertTrue($r->created_at->is_empty); $this->assertTrue($r->updated_at->is_empty); } @@ -51,13 +52,13 @@ public function test_properties() public function test_properties_extended() { $r = new B; - $created_at = new DateTime('-10 day'); - $updated_at = new DateTime('-1 day'); - $datetime = new DateTime(); + $created_at = new ImmutableDateTime('-10 day'); + $updated_at = new ImmutableDateTime('-1 day'); + $datetime = new ImmutableDateTime; - $this->assertInstanceOf(DateTime::class, $r->created_at); - $this->assertInstanceOf(DateTime::class, $r->updated_at); - $this->assertInstanceOf(DateTime::class, $r->datetime); + $this->assertInstanceOf(ImmutableDateTime::class, $r->created_at); + $this->assertInstanceOf(ImmutableDateTime::class, $r->updated_at); + $this->assertInstanceOf(ImmutableDateTime::class, $r->datetime); $this->assertTrue($r->created_at->is_empty); $this->assertTrue($r->updated_at->is_empty); $this->assertTrue($r->datetime->is_empty); @@ -82,9 +83,9 @@ public function test_properties_extended() $r->created_at = null; $r->updated_at = null; $r->datetime = null; - $this->assertInstanceOf(DateTime::class, $r->created_at); - $this->assertInstanceOf(DateTime::class, $r->updated_at); - $this->assertInstanceOf(DateTime::class, $r->datetime); + $this->assertInstanceOf(ImmutableDateTime::class, $r->created_at); + $this->assertInstanceOf(ImmutableDateTime::class, $r->updated_at); + $this->assertInstanceOf(ImmutableDateTime::class, $r->datetime); $this->assertTrue($r->created_at->is_empty); $this->assertTrue($r->updated_at->is_empty); $this->assertTrue($r->datetime->is_empty); diff --git a/tests/ActiveRecord/Property/UpdatedAtPropertyTest.php b/tests/ActiveRecord/Property/UpdatedAtPropertyTest.php index ec8cb30..08a42a5 100644 --- a/tests/ActiveRecord/Property/UpdatedAtPropertyTest.php +++ b/tests/ActiveRecord/Property/UpdatedAtPropertyTest.php @@ -14,6 +14,8 @@ use ICanBoogie\DateTime; use ICanBoogie\ActiveRecord\UpdatedAtPropertyTest\A; use ICanBoogie\ActiveRecord\UpdatedAtPropertyTest\B; +use ICanBoogie\ImmutableDateTime; +use ICanBoogie\MutableDateTime; class UpdatedAtPropertyTest extends \PHPUnit_Framework_TestCase { @@ -24,9 +26,9 @@ public function test_property($classname) { /* @var $r A|B */ $r = new $classname; - $datetime = new DateTime(); + $datetime = new ImmutableDateTime; - $this->assertInstanceOf(DateTime::class, $r->updated_at); + $this->assertInstanceOf(ImmutableDateTime::class, $r->updated_at); $this->assertTrue($r->updated_at->is_empty); $r->updated_at = $datetime; @@ -37,7 +39,7 @@ public function test_property($classname) $this->assertArrayHasKey('updated_at', $r->__sleep()); $r->updated_at = null; - $this->assertInstanceOf(DateTime::class, $r->updated_at); + $this->assertInstanceOf(ImmutableDateTime::class, $r->updated_at); $this->assertTrue($r->updated_at->is_empty); } diff --git a/tests/ActiveRecord/QueryTest.php b/tests/ActiveRecord/QueryTest.php index 2669066..3138055 100644 --- a/tests/ActiveRecord/QueryTest.php +++ b/tests/ActiveRecord/QueryTest.php @@ -13,6 +13,7 @@ use ICanBoogie\DateTime; use ICanBoogie\ActiveRecord\QueryTest\Dog; +use ICanBoogie\ImmutableDateTime; class QueryTest extends \PHPUnit_Framework_TestCase { @@ -229,7 +230,7 @@ public function test_join_with_query_with_args() $models = self::$models; $updates = $models['updates']; $subscribers = $models['subscribers']; - $now = DateTime::now(); + $now = ImmutableDateTime::now(); $update_query = $updates ->select('subscriber_id, updated_at, update_hash')