@@ -94,6 +94,45 @@ 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 )->nullable (false )->unsigned (true )->size (1 )->zerofill (true );
101+ $ schema ->boolean ('baz ' , nullable: true , unsigned: true , size: 1 , zerofill: true );
102+ $ schema ->boolean ('qux ' , nullable: false , unsigned: true );
103+ $ schema ->boolean ('quux ' , nullable: false );
104+ $ schema ->save ();
105+
106+ $ this ->assertInstanceOf (MySQLColumn::class, $ bar = $ this ->fetchSchema ($ schema )->column ('bar ' ));
107+ $ this ->assertInstanceOf (MySQLColumn::class, $ baz = $ this ->fetchSchema ($ schema )->column ('baz ' ));
108+ $ this ->assertInstanceOf (MySQLColumn::class, $ qux = $ this ->fetchSchema ($ schema )->column ('qux ' ));
109+ $ this ->assertInstanceOf (MySQLColumn::class, $ quux = $ this ->fetchSchema ($ schema )->column ('quux ' ));
110+
111+ self ::assertInstanceOf (MySQLColumn::class, $ bar );
112+ self ::assertInstanceOf (MySQLColumn::class, $ baz );
113+ self ::assertInstanceOf (MySQLColumn::class, $ qux );
114+ self ::assertInstanceOf (MySQLColumn::class, $ quux );
115+ $ this ->assertTrue ($ bar ->isZerofill ());
116+ $ this ->assertTrue ($ baz ->isZerofill ());
117+ $ this ->assertFalse ($ qux ->isZerofill ());
118+ $ this ->assertFalse ($ quux ->isZerofill ());
119+ $ this ->assertTrue ($ bar ->isUnsigned ());
120+ $ this ->assertTrue ($ baz ->isUnsigned ());
121+ $ this ->assertTrue ($ qux ->isUnsigned ());
122+ $ this ->assertFalse ($ quux ->isUnsigned ());
123+
124+ $ this ->assertSame (1 , $ bar ->getSize ());
125+ $ this ->assertSame (1 , $ baz ->getSize ());
126+ // In case of zerofill=false and unsigned=true the size value might be resolved to 4
127+ $ this ->assertTrue (\in_array ($ qux ->getSize (), [1 , 4 ], true ));
128+ $ this ->assertSame (1 , $ quux ->getSize ());
129+
130+ $ this ->assertFalse ($ bar ->isNullable ());
131+ $ this ->assertTrue ($ baz ->isNullable ());
132+ $ this ->assertFalse ($ qux ->isNullable ());
133+ $ this ->assertFalse ($ quux ->isNullable ());
134+ }
135+
97136 /**
98137 * The `text` have no the `unsigned` attribute. It will be stored in the additional attributes.
99138 */
0 commit comments