@@ -94,6 +94,33 @@ public function testNamedArgumentsToConfigureInteger(): void
9494 $ this ->assertTrue ($ foo ->isNullable ());
9595 }
9696
97+ public function testNamedArgumentsToConfigureBoolean (): void
98+ {
99+ $ schema = $ this ->schema ('foo ' );
100+ $ schema ->boolean ('bar ' )->defaultValue (false )->unsigned (true )->size (1 );
101+ $ schema ->boolean ('baz ' , nullable: true , unsigned: true , size: 1 );
102+ $ schema ->save ();
103+
104+ $ this ->assertInstanceOf (MySQLColumn::class, $ bar = $ this ->fetchSchema ($ schema )->column ('bar ' ));
105+ $ this ->assertInstanceOf (MySQLColumn::class, $ baz = $ this ->fetchSchema ($ schema )->column ('baz ' ));
106+
107+ \assert ($ bar instanceof MySQLColumn);
108+ \assert ($ baz instanceof MySQLColumn);
109+ $ this ->assertFalse ($ bar ->isZerofill ());
110+ $ this ->assertFalse ($ baz ->isZerofill ());
111+ $ this ->assertTrue ($ bar ->isUnsigned ());
112+ $ this ->assertTrue ($ baz ->isUnsigned ());
113+
114+ // Below assertion fails. We expect boolean to have a default size of 1 however we receive 4,
115+ // even when explicitly declaring the column size. Likely due to MySQLColumn::createInstance
116+ // not knowing the `userType` at this point, or that the default size should be 1. Instead, the
117+ // size is resolved as 4, default value when resolving a tinyint (DBMS specific column type).
118+ $ this ->assertSame (1 , $ bar ->getSize ());
119+ $ this ->assertSame (1 , $ baz ->getSize ());
120+ $ this ->assertFalse ($ bar ->isNullable ());
121+ $ this ->assertTrue ($ baz ->isNullable ());
122+ }
123+
97124 /**
98125 * The `text` have no the `unsigned` attribute. It will be stored in the additional attributes.
99126 */
0 commit comments