@@ -384,6 +384,15 @@ public function testFieldAsArray(): void
384384 ], $ def ->getFieldAsArray ());
385385 }
386386
387+ /**
388+ * @dataProvider provideTestGetTypeFromAlias
389+ */
390+ public function testBackendBasetypeFromAlias (string $ type , string $ expectedType ): void
391+ {
392+ $ definition = new Bigquery ($ type );
393+ $ this ->assertSame ($ expectedType , $ definition ->getBackendBasetype ());
394+ }
395+
387396 public static function getTestedClass (): string
388397 {
389398 return Bigquery::class;
@@ -476,4 +485,34 @@ public static function provideTestGetDefinitionForBasetype(): Generator
476485 'expectToFail ' => true ,
477486 ];
478487 }
488+
489+ public function provideTestGetTypeFromAlias (): Generator
490+ {
491+ foreach (Bigquery::TYPES as $ type ) {
492+ switch ($ type ) {
493+ case Bigquery::TYPE_INT :
494+ case Bigquery::TYPE_SMALLINT :
495+ case Bigquery::TYPE_INTEGER :
496+ case Bigquery::TYPE_BIGINT :
497+ case Bigquery::TYPE_TINYINT :
498+ case Bigquery::TYPE_BYTEINT :
499+ $ expectedType = Bigquery::TYPE_INT64 ;
500+ break ;
501+ case Bigquery::TYPE_DECIMAL :
502+ $ expectedType = Bigquery::TYPE_NUMERIC ;
503+ break ;
504+ case Bigquery::TYPE_BIGDECIMAL :
505+ $ expectedType = Bigquery::TYPE_BIGNUMERIC ;
506+ break ;
507+ default :
508+ $ expectedType = $ type ;
509+ break ;
510+ }
511+
512+ yield $ type => [
513+ 'type ' => $ type ,
514+ 'expectedType ' => $ expectedType ,
515+ ];
516+ }
517+ }
479518}
0 commit comments