Skip to content

Commit

Permalink
Support DateTime instances
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed Aug 5, 2023
1 parent 0ebe2c7 commit b295440
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion tests/ActiveRecordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Yiisoft\ActiveRecord\Tests;

use DateTimeImmutable;
use ReflectionException;
use Yiisoft\ActiveRecord\ActiveQuery;
use Yiisoft\ActiveRecord\Tests\Stubs\ActiveRecord\Animal;
Expand Down Expand Up @@ -155,7 +156,7 @@ public function testDefaultValues(): void
$this->assertEquals(1.23, $arClass->float_col2);
$this->assertEquals(33.22, $arClass->numeric_col);
$this->assertEquals(true, $arClass->bool_col2);
$this->assertEquals('2002-01-01 00:00:00', $arClass->time);
$this->assertEquals(new DateTimeImmutable('2002-01-01 00:00:00'), $arClass->time);

$arClass = new Type($this->db);
$arClass->char_col2 = 'not something';
Expand Down
4 changes: 2 additions & 2 deletions tests/Driver/Oracle/ActiveRecordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Yiisoft\ActiveRecord\Tests\Driver\Oracle;

use DateTimeImmutable;
use Yiisoft\ActiveRecord\ActiveQuery;
use Yiisoft\ActiveRecord\Tests\Driver\Oracle\Stubs\Customer;
use Yiisoft\ActiveRecord\Tests\Stubs\ActiveRecord\CustomerClosureField;
Expand Down Expand Up @@ -75,8 +76,7 @@ public function testDefaultValues(): void
$this->assertEquals(1.23, $arClass->float_col2);
$this->assertEquals(33.22, $arClass->numeric_col);
$this->assertEquals('1', $arClass->bool_col2);

// not testing $arClass->time, because oci\Schema can't read default value
$this->assertEquals(new DateTimeImmutable('2002-01-01 00:00:00'), $arClass->time);

$arClass = new Type($this->db);
$arClass->char_col2 = 'not something';
Expand Down

0 comments on commit b295440

Please sign in to comment.