77use Composite \Entity \Attributes \SkipSerialization ;
88use Composite \Entity \Columns \AbstractColumn ;
99use Composite \Entity \Tests \TestStand \TestSubEntity ;
10+ use PHPUnit \Framework \Attributes \DataProvider ;
1011
1112final class ColumnBuilderTest extends \PHPUnit \Framework \TestCase
1213{
@@ -51,9 +52,7 @@ public function __construct(
5152 ];
5253 }
5354
54- /**
55- * @dataProvider visibility_dataProvider
56- */
55+ #[DataProvider('visibility_dataProvider ' )]
5756 public function test_visibility (AbstractEntity $ entity , array $ expected ): void
5857 {
5958 $ schema = $ entity ::schema ();
@@ -90,9 +89,7 @@ public static function type_dataProvider(): array
9089 ];
9190 }
9291
93- /**
94- * @dataProvider type_dataProvider
95- */
92+ #[DataProvider('type_dataProvider ' )]
9693 public function test_type (AbstractEntity $ entity , array $ expected ): void
9794 {
9895 $ schema = $ entity ::schema ();
@@ -124,9 +121,7 @@ public function __construct(
124121 ];
125122 }
126123
127- /**
128- * @dataProvider hasDefaultValue_dataProvider
129- */
124+ #[DataProvider('hasDefaultValue_dataProvider ' )]
130125 public function test_hasDefaultValue (AbstractEntity $ class , array $ expected ): void
131126 {
132127 $ schema = $ class ::schema ();
@@ -168,9 +163,7 @@ public static function defaultValue_dataProvider(): array
168163 ];
169164 }
170165
171- /**
172- * @dataProvider defaultValue_dataProvider
173- */
166+ #[DataProvider('defaultValue_dataProvider ' )]
174167 public function test_defaultValue (AbstractEntity $ entity , array $ expected ): void
175168 {
176169 $ schema = $ entity ::schema ();
@@ -214,9 +207,7 @@ public function __construct(
214207 ];
215208 }
216209
217- /**
218- * @dataProvider isNullable_dataProvider
219- */
210+ #[DataProvider('isNullable_dataProvider ' )]
220211 public function test_isNullable (AbstractEntity $ class , array $ expected ): void
221212 {
222213 $ schema = $ class ::schema ();
@@ -226,29 +217,6 @@ public function test_isNullable(AbstractEntity $class, array $expected): void
226217 }
227218 }
228219
229- public static function isReadOnly_dataProvider (): array
230- {
231- return [
232- [
233- 'class ' => new class extends AbstractEntity {
234- public string $ foo2 = 'foo ' ;
235- public readonly ?string $ bar2 ;
236-
237- public function __construct (
238- public string $ foo1 = 'foo ' ,
239- public readonly ?string $ bar1 = null ,
240- ) {}
241- },
242- 'expected ' => [
243- 'foo1 ' => false ,
244- 'bar1 ' => true ,
245- 'foo2 ' => false ,
246- 'bar2 ' => true ,
247- ]
248- ],
249- ];
250- }
251-
252220 public static function isConstructorPromoted_dataProvider (): array
253221 {
254222 return [
@@ -272,9 +240,7 @@ public function __construct(
272240 ];
273241 }
274242
275- /**
276- * @dataProvider isConstructorPromoted_dataProvider
277- */
243+ #[DataProvider('isConstructorPromoted_dataProvider ' )]
278244 public function test_isConstructorPromoted (AbstractEntity $ entity , array $ expected ): void
279245 {
280246 $ schema = $ entity ::schema ();
@@ -284,11 +250,26 @@ public function test_isConstructorPromoted(AbstractEntity $entity, array $expect
284250 }
285251 }
286252
287- /**
288- * @dataProvider isReadOnly_dataProvider
289- */
290- public function test_isReadOnly (AbstractEntity $ entity , array $ expected ): void
253+ public function test_isReadOnly (): void
291254 {
255+ $ entity = new class extends AbstractEntity {
256+ public string $ foo2 = 'foo ' ;
257+ public readonly ?string $ bar2 ;
258+
259+ public function __construct (
260+ public string $ foo1 = 'foo ' ,
261+ public readonly ?string $ bar1 = null ,
262+ ) {
263+ }
264+ };
265+
266+ $ expected = [
267+ 'foo1 ' => false ,
268+ 'bar1 ' => true ,
269+ 'foo2 ' => false ,
270+ 'bar2 ' => true ,
271+ ];
272+
292273 $ schema = $ entity ::schema ();
293274 foreach ($ expected as $ name => $ expectedIsReadOnly ) {
294275 $ this ->assertNotNull ($ schema ->getColumn ($ name ));
@@ -321,9 +302,7 @@ public static function notSupported_dataProvider(): array
321302 ];
322303 }
323304
324- /**
325- * @dataProvider notSupported_dataProvider
326- */
305+ #[DataProvider('notSupported_dataProvider ' )]
327306 public function test_notSupported (AbstractEntity $ entity ): void
328307 {
329308 try {
0 commit comments