24
24
use Zenstruck \Foundry \Tests \Fixture \Entity \EdgeCases \IndexedOneToMany ;
25
25
use Zenstruck \Foundry \Tests \Fixture \Entity \EdgeCases \InversedOneToOneWithManyToOne ;
26
26
use Zenstruck \Foundry \Tests \Fixture \Entity \EdgeCases \InversedOneToOneWithNonNullableOwning ;
27
+ use Zenstruck \Foundry \Tests \Fixture \Entity \EdgeCases \InversedOneToOneWithoutAutoGeneratedId ;
27
28
use Zenstruck \Foundry \Tests \Fixture \Entity \EdgeCases \InversedOneToOneWithOneToMany ;
28
29
use Zenstruck \Foundry \Tests \Fixture \Entity \EdgeCases \InversedOneToOneWithSetter ;
29
30
use Zenstruck \Foundry \Tests \Fixture \Entity \EdgeCases \ManyToOneToSelfReferencing ;
@@ -100,7 +101,7 @@ public function inverse_one_to_one_with_both_nullable(): void
100
101
#[DataProvider('provideCascadeRelationshipsCombinations ' )]
101
102
#[UsingRelationships(InversedOneToOneWithOneToMany \OwningSide::class, ['inverseSide ' ])]
102
103
#[UsingRelationships(InversedOneToOneWithOneToMany \Item::class, ['owningSide ' ])]
103
- #[RequiresPhpunit('^ 11.4 ' )]
104
+ #[RequiresPhpunit('>= 11.4 ' )]
104
105
public function inverse_one_to_one_with_one_to_many (): void
105
106
{
106
107
$ inverseSideFactory = persistent_factory (InversedOneToOneWithOneToMany \InverseSide::class);
@@ -141,7 +142,7 @@ public function many_to_many_to_self_referencing_inverse_side(): void
141
142
#[Test]
142
143
#[DataProvider('provideCascadeRelationshipsCombinations ' )]
143
144
#[UsingRelationships(IndexedOneToMany \ParentEntity::class, ['items ' ])]
144
- #[RequiresPhpunit('^ 11.4 ' )]
145
+ #[RequiresPhpunit('>= 11.4 ' )]
145
146
public function indexed_one_to_many (): void
146
147
{
147
148
$ parentFactory = persistent_factory (IndexedOneToMany \ParentEntity::class);
@@ -163,7 +164,7 @@ public function indexed_one_to_many(): void
163
164
#[Test]
164
165
#[DataProvider('provideCascadeRelationshipsCombinations ' )]
165
166
#[UsingRelationships(InversedOneToOneWithManyToOne \InverseSide::class, ['owningSide ' , 'item ' ])]
166
- #[RequiresPhpunit('^ 11.4 ' )]
167
+ #[RequiresPhpunit('>= 11.4 ' )]
167
168
public function inversed_one_to_one_can_be_used_after_other_relationship (): void
168
169
{
169
170
$ inverseSideFactory = persistent_factory (InversedOneToOneWithManyToOne \InverseSide::class);
@@ -187,6 +188,24 @@ public function inversed_one_to_one_can_be_used_after_other_relationship(): void
187
188
self ::assertNotNull ($ inverseSide ->item );
188
189
}
189
190
191
+ /** @test */
192
+ #[Test]
193
+ #[DataProvider('provideCascadeRelationshipsCombinations ' )]
194
+ #[UsingRelationships(InversedOneToOneWithoutAutoGeneratedId \OwningSide::class, ['inverseSide ' ])]
195
+ #[RequiresPhpunit('>=11.4 ' )]
196
+ public function inverse_one_to_one_with_custom_id (): void
197
+ {
198
+ $ owningSideFactory = persistent_factory (InversedOneToOneWithoutAutoGeneratedId \OwningSide::class);
199
+ $ inverseSideFactory = persistent_factory (InversedOneToOneWithoutAutoGeneratedId \InverseSide::class);
200
+
201
+ $ inverseSide = $ inverseSideFactory ->create (['owningSide ' => $ owningSideFactory ]);
202
+
203
+ $ owningSideFactory ::assert ()->count (1 );
204
+ $ inverseSideFactory ::assert ()->count (1 );
205
+
206
+ self ::assertSame ($ inverseSide , $ inverseSide ->owningSide ->inverseSide );
207
+ }
208
+
190
209
/**
191
210
* @test
192
211
*/
0 commit comments