File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 5
5
namespace Yiisoft \ActiveRecord \Tests ;
6
6
7
7
use DateTimeImmutable ;
8
+ use DateTimeZone ;
8
9
use DivisionByZeroError ;
9
10
use Yiisoft \ActiveRecord \ActiveQuery ;
10
11
use Yiisoft \ActiveRecord \Tests \Stubs \MagicActiveRecord \Alpha ;
@@ -151,9 +152,12 @@ public function testDefaultValues(): void
151
152
$ this ->assertEquals (1.23 , $ arClass ->float_col2 );
152
153
$ this ->assertEquals (33.22 , $ arClass ->numeric_col );
153
154
$ this ->assertTrue ($ arClass ->bool_col2 );
154
- $ this ->assertEquals ('2002-01-01 00:00:00 ' , $ arClass ->time );
155
155
156
- if ($ this ->db ()->getDriverName () !== 'mysql ' ) {
156
+ if ($ this ->db ()->getDriverName () === 'mysql ' ) {
157
+ $ dbTimezone = $ this ->db ()->getServerInfo ()->getTimezone ();
158
+ $ this ->assertEquals (new DateTimeImmutable ('2002-01-01 00:00:00 ' , new DateTimeZone ($ dbTimezone )), $ arClass ->time );
159
+ } else {
160
+ $ this ->assertEquals (new DateTimeImmutable ('2002-01-01 00:00:00 ' ), $ arClass ->time );
157
161
$ this ->assertSame (['a ' => 1 ], $ arClass ->json_col );
158
162
}
159
163
Original file line number Diff line number Diff line change 4
4
5
5
namespace Yiisoft \ActiveRecord \Tests \Stubs \ActiveRecord ;
6
6
7
+ use DateTimeInterface ;
7
8
use Yiisoft \ActiveRecord \ActiveRecord ;
8
9
use Yiisoft \Db \Expression \Expression ;
9
10
@@ -23,10 +24,10 @@ class Type extends ActiveRecord
23
24
public float |null $ float_col2 = 1.23 ;
24
25
public mixed $ blob_col ;
25
26
public float |null $ numeric_col = 33.22 ;
26
- public string |Expression $ time = '2002-01-01 00:00:00 ' ;
27
+ public string |DateTimeInterface | Expression $ time = '2002-01-01 00:00:00 ' ;
27
28
public bool |int |string $ bool_col ;
28
29
public bool |int |string |null $ bool_col2 = true ;
29
- public string |Expression $ ts_default ;
30
+ public DateTimeInterface |Expression $ ts_default ;
30
31
public int |string $ bit_col = 0b1000_0010 ;
31
32
public array |null $ json_col = null ;
32
33
You can’t perform that action at this time.
0 commit comments