File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ class TsTzRangeType extends Type
1515 */
1616 public function getSQLDeclaration (array $ column , AbstractPlatform $ platform )
1717 {
18- if ($ platform instanceof PostgreSQLPlatform) {
18+ if (! $ platform instanceof PostgreSQLPlatform) {
1919 throw new \LogicException ('TsTzRangeType only supports postgresql. ' );
2020 }
2121
Original file line number Diff line number Diff line change 44
55namespace Linkage \DoctrinePostgreSqlTsTzRange \Tests ;
66
7+ use Doctrine \DBAL \Platforms \MySQLPlatform ;
78use Doctrine \DBAL \Platforms \PostgreSQLPlatform ;
89use Linkage \DoctrinePostgreSqlTsTzRange \Period ;
910use Linkage \DoctrinePostgreSqlTsTzRange \TsTzRangeType ;
1011use PHPUnit \Framework \TestCase ;
1112
1213class TsTzRangeTypeTest extends TestCase
1314{
15+ public function testGetSQLDeclaration (): void
16+ {
17+ $ platformMock = $ this ->createMock (PostgreSQLPlatform::class);
18+ $ SUT = new TsTzRangeType ();
19+ $ column = [];
20+ $ actual = $ SUT ->getSQLDeclaration ($ column , $ platformMock );
21+ $ this ->assertEquals ('tstzrange ' , $ actual );
22+ }
23+
24+ public function testGetSQLDeclarationWithNotPostgres (): void
25+ {
26+ $ this ->expectException (\LogicException::class);
27+ $ this ->expectExceptionMessage ("TsTzRangeType only supports postgresql. " );
28+
29+ $ platformMock = $ this ->createMock (MySQLPlatform::class);
30+ $ SUT = new TsTzRangeType ();
31+ $ column = [];
32+ $ SUT ->getSQLDeclaration ($ column , $ platformMock );
33+ }
34+
1435 public function testConvertToPHPValue (): void
1536 {
1637 $ platformMock = $ this ->createMock (PostgreSQLPlatform::class);
You can’t perform that action at this time.
0 commit comments