File tree Expand file tree Collapse file tree 2 files changed +23
-7
lines changed Expand file tree Collapse file tree 2 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -35,19 +35,22 @@ public static function new(string $name): self
3535 return $ object ;
3636 }
3737
38- public static function newWithContext (string $ name , string $ tableName ): self
38+ public static function newWithContext (string $ name , string $ tableName, ? \ Throwable $ previous ): self
3939 {
40- $ object = new self (sprintf (
41- 'Unknown column type "%s" requested for table "%s". Any Doctrine type that you use has '
40+ $ object = new self (
41+ sprintf (
42+ 'Unknown column type "%s" requested for table "%s". Any Doctrine type that you use has '
4243 . 'to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the '
4344 . 'known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error occurs during database '
4445 . 'introspection then you might have forgotten to register all database types for a Doctrine Type. '
4546 . 'Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement '
4647 . 'Type#getMappedDatabaseTypes(). If the type name is empty you might '
4748 . 'have a problem with the cache or forgot some mapping information. ' ,
48- $ name ,
49- $ tableName ,
50- ));
49+ $ name ,
50+ $ tableName ,
51+ ),
52+ previous: $ previous
53+ );
5154
5255 $ object ->requestedType = $ name ;
5356
Original file line number Diff line number Diff line change 77use Doctrine \DBAL \Schema \Column ;
88use Doctrine \DBAL \Schema \Exception \InvalidColumnDefinition ;
99use Doctrine \DBAL \Schema \Name \UnqualifiedName ;
10+ use Doctrine \DBAL \Types \Exception \UnknownColumnType ;
1011use Doctrine \DBAL \Types \IntegerType ;
1112use Doctrine \DBAL \Types \Type ;
1213use Doctrine \DBAL \Types \Types ;
1314use PHPUnit \Framework \TestCase ;
14-
1515class ColumnEditorTest extends TestCase
1616{
1717 public function testSetUnquotedName (): void
@@ -78,4 +78,17 @@ public function testTypeNotSet(): void
7878
7979 $ editor ->create ();
8080 }
81+ public function testInvalidType (): void
82+ {
83+ $ this ->expectException (UnknownColumnType::class);
84+ $ this ->expectExceptionMessage ('Unknown column type "unknown_type" ' );
85+
86+ Column::editor ()
87+ ->setUnquotedName ('column_char ' )
88+ ->setTypeName ('unknown_type ' )
89+ ->setFixed (true )
90+ ->setLength (2 )
91+ ->create ();
92+
93+ }
8194}
You can’t perform that action at this time.
0 commit comments