@@ -172,6 +172,84 @@ public function testManyManyRelationship(): void
172172 $ this ->assertSame ($ expected , $ parsed );
173173 }
174174
175+ public function testManyManyTagExcludeFromFixtureRelationships (): void
176+ {
177+ MockTag::config ()->set ('exclude_from_fixture_relationships ' , true );
178+
179+ $ page = MockPage::create ();
180+ $ page ->Title = 'Page Excluding Tags ' ;
181+ $ page ->write ();
182+
183+ $ tag = MockTag::create ();
184+ $ tag ->Title = 'Excluded Tag ' ;
185+ $ tag ->write ();
186+
187+ $ page ->Tags ()->add ($ tag );
188+
189+ $ service = new FixtureService ();
190+ $ service ->addDataObject ($ page );
191+
192+ $ expected = [
193+ MockPage::class => [
194+ $ page ->ID => ['Title ' => 'Page Excluding Tags ' ],
195+ ],
196+ ];
197+
198+ $ this ->assertSame ($ expected , Yaml::parse ($ service ->outputFixture ()));
199+ }
200+
201+ public function testManyManyPageExcludedFromFixtureRelationships (): void
202+ {
203+ MockPage::config ()->set ('excluded_fixture_relationships ' , ['Tags ' ]);
204+
205+ $ page = MockPage::create ();
206+ $ page ->Title = 'Page Excluding Tags Relation ' ;
207+ $ page ->write ();
208+
209+ $ tag = MockTag::create ();
210+ $ tag ->Title = 'Excluded Via Relation ' ;
211+ $ tag ->write ();
212+
213+ $ page ->Tags ()->add ($ tag );
214+
215+ $ service = new FixtureService ();
216+ $ service ->addDataObject ($ page );
217+
218+ $ expected = [
219+ MockPage::class => [
220+ $ page ->ID => ['Title ' => 'Page Excluding Tags Relation ' ],
221+ ],
222+ ];
223+
224+ $ this ->assertSame ($ expected , Yaml::parse ($ service ->outputFixture ()));
225+ }
226+
227+ public function testManyManyThroughExcludedFixtureRelationships (): void
228+ {
229+ MockPage::config ()->set ('excluded_fixture_relationships ' , ['ThroughTargets ' ]);
230+
231+ $ page = MockPage::create ();
232+ $ page ->Title = 'Page Excluding Through ' ;
233+ $ page ->write ();
234+
235+ $ target = MockThroughTarget::create ();
236+ $ target ->Title = 'Excluded Through Target ' ;
237+ $ target ->write ();
238+
239+ $ page ->ThroughTargets ()->add ($ target );
240+
241+ $ service = new FixtureService ();
242+ $ service ->addDataObject ($ page );
243+
244+ $ expected = [
245+ MockPage::class => [
246+ $ page ->ID => ['Title ' => 'Page Excluding Through ' ],
247+ ],
248+ ];
249+
250+ $ this ->assertSame ($ expected , Yaml::parse ($ service ->outputFixture ()));
251+ }
252+
175253 public function testManyManyThroughRelationship (): void
176254 {
177255 $ page = MockPage::create ();
0 commit comments