@@ -455,7 +455,7 @@ public function testGetArrayFixedTypeString() {
455455 }
456456 }
457457
458- public function testGetArrayFixedTypeString_typeErrorWithObject () {
458+ public function testGetArrayFixedTypeString_typeErrorWithDateTime () {
459459 $ wordsArray = [
460460 "one " ,
461461 "two " ,
@@ -465,7 +465,7 @@ public function testGetArrayFixedTypeString_typeErrorWithObject() {
465465 ];
466466 $ sut = (new DataObject ())
467467 ->with ("words " , $ wordsArray );
468- self ::expectExceptionMessage ("Array index 3 must be of type string, DateTime given " );
468+ self ::expectExceptionMessage ("Object of class DateTime could not be converted to string " );
469469 $ sut ->getArray ("words " , "string " );
470470 }
471471
@@ -478,7 +478,7 @@ public function testGetArrayFixedTypeDateTime() {
478478 ->with ("dates " , $ dateArray );
479479 $ array = $ sut ->getArray ("dates " , DateTimeInterface::class);
480480 foreach ($ array as $ i => $ value ) {
481- self ::assertInstanceOf (DateTimeInterface ::class, $ value );
481+ self ::assertInstanceOf (DateTime ::class, $ value );
482482 }
483483 }
484484
@@ -492,9 +492,8 @@ public function testGetArrayFixedTypesMismatch() {
492492 ];
493493 $ sut = (new DataObject ())
494494 ->with ("timestamps " , $ timestampArray );
495- self ::expectException (TypeError::class);
496- self ::expectExceptionMessage ("Array index 2 must be of type int, double given " );
497- $ sut ->getArray ("timestamps " , "int " );
495+ $ array = $ sut ->getArray ("timestamps " , "int " );
496+ self ::assertSame (49999 , $ array [2 ]);
498497 }
499498
500499 public function testGetArray_nullableType ():void {
0 commit comments