1515
1616use Doctrine \Common \Collections \Collection ;
1717use PHPUnit \Framework \Attributes \DataProvider ;
18+ use PHPUnit \Framework \Attributes \IgnorePhpunitWarnings ;
1819use PHPUnit \Framework \Attributes \RequiresPhpunit ;
1920use PHPUnit \Framework \Attributes \Test ;
2021use Symfony \Bundle \FrameworkBundle \Test \KernelTestCase ;
@@ -44,11 +45,16 @@ final class EdgeCasesRelationshipTest extends KernelTestCase
4445{
4546 use ChangesEntityRelationshipCascadePersist, Factories, RequiresORM, ResetDatabase;
4647
48+ // Because we're handling the provided data manually in a #[Before] method,
49+ // PHPUnit triggers a warning, which we ignore with #[IgnorePhpunitWarnings]
50+ public const DATA_PROVIDER_WARNING_REGEX = 'Data set "(.)*" provided by Zenstruck(.)*::provideCascadeRelationshipsCombinations has more arguments \(\d\) than the test method accepts \(0\) ' ;
51+
4752 /** @test */
4853 #[Test]
4954 #[DataProvider('provideCascadeRelationshipsCombinations ' )]
5055 #[UsingRelationships(RichDomainMandatoryRelationship \OwningSide::class, ['main ' ])]
5156 #[RequiresPhpunit('>=11.4 ' )]
57+ #[IgnorePhpunitWarnings(self ::DATA_PROVIDER_WARNING_REGEX )]
5258 public function inversed_relationship_mandatory (): void
5359 {
5460 $ owningSideEntityFactory = persistent_factory (RichDomainMandatoryRelationship \OwningSide::class);
@@ -68,6 +74,7 @@ public function inversed_relationship_mandatory(): void
6874 #[DataProvider('provideCascadeRelationshipsCombinations ' )]
6975 #[UsingRelationships(InversedOneToOneWithNonNullableOwning \OwningSide::class, ['inverseSide ' ])]
7076 #[RequiresPhpunit('>=11.4 ' )]
77+ #[IgnorePhpunitWarnings(self ::DATA_PROVIDER_WARNING_REGEX )]
7178 public function inverse_one_to_one_with_non_nullable_inverse_side (): void
7279 {
7380 $ owningSideFactory = persistent_factory (InversedOneToOneWithNonNullableOwning \OwningSide::class);
@@ -86,6 +93,7 @@ public function inverse_one_to_one_with_non_nullable_inverse_side(): void
8693 #[DataProvider('provideCascadeRelationshipsCombinations ' )]
8794 #[UsingRelationships(InversedOneToOneWithSetter \OwningSide::class, ['inverseSide ' ])]
8895 #[RequiresPhpunit('>=11.4 ' )]
96+ #[IgnorePhpunitWarnings(self ::DATA_PROVIDER_WARNING_REGEX )]
8997 public function inverse_one_to_one_with_both_nullable (): void
9098 {
9199 $ owningSideFactory = persistent_factory (InversedOneToOneWithSetter \OwningSide::class);
@@ -105,6 +113,7 @@ public function inverse_one_to_one_with_both_nullable(): void
105113 #[UsingRelationships(InversedOneToOneWithOneToMany \OwningSide::class, ['inverseSide ' ])]
106114 #[UsingRelationships(InversedOneToOneWithOneToMany \Item::class, ['owningSide ' ])]
107115 #[RequiresPhpunit('>=11.4 ' )]
116+ #[IgnorePhpunitWarnings(self ::DATA_PROVIDER_WARNING_REGEX )]
108117 public function inverse_one_to_one_with_one_to_many (): void
109118 {
110119 $ inverseSideFactory = persistent_factory (InversedOneToOneWithOneToMany \InverseSide::class);
@@ -145,6 +154,7 @@ public function many_to_many_to_self_referencing_inverse_side(): void
145154 #[DataProvider('provideCascadeRelationshipsCombinations ' )]
146155 #[UsingRelationships(IndexedOneToMany \ParentEntity::class, ['items ' ])]
147156 #[RequiresPhpunit('>=11.4 ' )]
157+ #[IgnorePhpunitWarnings(self ::DATA_PROVIDER_WARNING_REGEX )]
148158 public function indexed_one_to_many (): void
149159 {
150160 $ parentFactory = persistent_factory (IndexedOneToMany \ParentEntity::class);
@@ -167,6 +177,7 @@ public function indexed_one_to_many(): void
167177 #[DataProvider('provideCascadeRelationshipsCombinations ' )]
168178 #[UsingRelationships(InversedOneToOneWithManyToOne \InverseSide::class, ['owningSide ' , 'item ' ])]
169179 #[RequiresPhpunit('>=11.4 ' )]
180+ #[IgnorePhpunitWarnings(self ::DATA_PROVIDER_WARNING_REGEX )]
170181 public function inversed_one_to_one_can_be_used_after_other_relationship (): void
171182 {
172183 $ inverseSideFactory = persistent_factory (InversedOneToOneWithManyToOne \InverseSide::class);
@@ -195,6 +206,7 @@ public function inversed_one_to_one_can_be_used_after_other_relationship(): void
195206 #[DataProvider('provideCascadeRelationshipsCombinations ' )]
196207 #[UsingRelationships(InversedOneToOneWithoutAutoGeneratedId \OwningSide::class, ['inverseSide ' ])]
197208 #[RequiresPhpunit('>=11.4 ' )]
209+ #[IgnorePhpunitWarnings(self ::DATA_PROVIDER_WARNING_REGEX )]
198210 public function inverse_one_to_one_with_custom_id (): void
199211 {
200212 $ owningSideFactory = persistent_factory (InversedOneToOneWithoutAutoGeneratedId \OwningSide::class);
@@ -213,6 +225,7 @@ public function inverse_one_to_one_with_custom_id(): void
213225 #[DataProvider('provideCascadeRelationshipsCombinations ' )]
214226 #[UsingRelationships(OneToManyWithUnionType \OwningSideEntity::class, ['item ' ])]
215227 #[RequiresPhpunit('>=11.4 ' )]
228+ #[IgnorePhpunitWarnings(self ::DATA_PROVIDER_WARNING_REGEX )]
216229 public function after_instantiate_flushing_using_current_object_in_relationship_one_to_one (): void
217230 {
218231 $ owningSideFactory = persistent_factory (OneToManyWithUnionType \OwningSideEntity::class);
@@ -270,6 +283,7 @@ public function inverse_one_to_one_without_types_throws(): void
270283 #[DataProvider('provideCascadeRelationshipsCombinations ' )]
271284 #[UsingRelationships(InversedOneToOneWithNonNullableOwning \OwningSide::class, ['inverseSide ' ])]
272285 #[RequiresPhpunit('>=11.4 ' )]
286+ #[IgnorePhpunitWarnings(self ::DATA_PROVIDER_WARNING_REGEX )]
273287 public function after_instantiate_flushing_using_current_object_in_relationship_inverse_one_to_one (): void
274288 {
275289 $ owningSideFactory = persistent_factory (InversedOneToOneWithNonNullableOwning \OwningSide::class);
0 commit comments