@@ -46,10 +46,17 @@ class ColumnTest extends TestCase
4646 #[Column(
4747 type: 'enum ' ,
4848 default: 'a ' ,
49- values: [ StringEnum::A, StringEnum::B] ,
49+ values: StringEnum::A,
5050 )]
5151 private string $ column8 = 'a ' ;
5252
53+ #[Column(
54+ type: 'enum ' ,
55+ default: 'a ' ,
56+ values: [StringEnum::A, StringEnum::B],
57+ )]
58+ private string $ column9 = 'a ' ;
59+
5360 public function testOneAttribute (): void
5461 {
5562 $ column = $ this ->getColumn ('column1 ' );
@@ -101,7 +108,7 @@ public function testEnumTypeArray(): void
101108 $ this ->assertArrayNotHasKey ('values ' , $ column ->getAttributes ());
102109 }
103110
104- public function testEnumTypeBackedEnum (): void
111+ public function testEnumTypeStringClass (): void
105112 {
106113 $ column = $ this ->getColumn ('column7 ' );
107114
@@ -110,7 +117,7 @@ public function testEnumTypeBackedEnum(): void
110117 $ this ->assertArrayNotHasKey ('values ' , $ column ->getAttributes ());
111118 }
112119
113- public function testEnumTypeArrayBackedEnum (): void
120+ public function testEnumTypeBackedEnum (): void
114121 {
115122 $ column = $ this ->getColumn ('column8 ' );
116123
@@ -119,6 +126,15 @@ public function testEnumTypeArrayBackedEnum(): void
119126 $ this ->assertArrayNotHasKey ('values ' , $ column ->getAttributes ());
120127 }
121128
129+ public function testEnumTypeArrayBackedEnum (): void
130+ {
131+ $ column = $ this ->getColumn ('column9 ' );
132+
133+ $ this ->assertSame ('enum(a,b) ' , $ column ->getType ());
134+ $ this ->assertSame ('a ' , $ column ->getDefault ());
135+ $ this ->assertArrayNotHasKey ('values ' , $ column ->getAttributes ());
136+ }
137+
122138 private function getColumn (string $ field ): Column
123139 {
124140 $ ref = new \ReflectionClass (static ::class);
0 commit comments