88use PHPUnit \Framework \Attributes \CoversClass ;
99use PHPUnit \Framework \Attributes \Group ;
1010use PHPUnit \Framework \TestCase ;
11- use SimpleSAML \XML \Attribute as XMLAttribute ;
1211use SimpleSAML \XML \DOMDocumentFactory ;
1312use SimpleSAML \XML \TestUtils \SchemaValidationTestTrait ;
1413use SimpleSAML \XML \TestUtils \SerializableElementTestTrait ;
14+ use SimpleSAML \XML \TestUtils \TestContainerTestTrait ;
1515use SimpleSAML \XML \Type \LangValue ;
1616use SimpleSAML \XMLSchema \Type \AnyURIValue ;
1717use SimpleSAML \XMLSchema \Type \BooleanValue ;
@@ -68,6 +68,7 @@ final class AllTest extends TestCase
6868{
6969 use SchemaValidationTestTrait;
7070 use SerializableElementTestTrait;
71+ use TestContainerTestTrait;
7172
7273
7374 /**
@@ -79,6 +80,8 @@ public static function setUpBeforeClass(): void
7980 self ::$ xmlRepresentation = DOMDocumentFactory::fromFile (
8081 dirname (__FILE__ , 3 ) . '/resources/xml/xs/all.xml ' ,
8182 );
83+
84+ self ::instantiateTestContainer ();
8285 }
8386
8487
@@ -106,24 +109,20 @@ public function testMarshalling(): void
106109 $ attributeGroupText = new DOMText ('AttributeGroup ' );
107110 $ attributeGroupDocument ->appendChild ($ attributeGroupText );
108111
109- $ attr1 = new XMLAttribute ('urn:x-simplesamlphp:namespace ' , 'ssp ' , 'attr1 ' , StringValue::fromString ('value1 ' ));
110- $ attr2 = new XMLAttribute ('urn:x-simplesamlphp:namespace ' , 'ssp ' , 'attr2 ' , StringValue::fromString ('value2 ' ));
111- $ attr3 = new XMLAttribute ('urn:x-simplesamlphp:namespace ' , 'ssp ' , 'attr3 ' , StringValue::fromString ('value3 ' ));
112- $ attr4 = new XMLAttribute ('urn:x-simplesamlphp:namespace ' , 'ssp ' , 'attr4 ' , StringValue::fromString ('value4 ' ));
113112 $ lang = LangValue::fromString ('nl ' );
114113
115114 $ documentation1 = new Documentation (
116115 $ simpleTypeDocument ->childNodes ,
117116 $ lang ,
118117 AnyURIValue::fromString ('urn:x-simplesamlphp:source ' ),
119- [$ attr2 ],
118+ [self :: $ testContainer -> getXMLAttribute ( 2 ) ],
120119 );
121120
122121 $ annotation1 = new Annotation (
123122 [],
124123 [$ documentation1 ],
125124 IDValue::fromString ('phpunit_annotation1 ' ),
126- [$ attr1 ],
125+ [self :: $ testContainer -> getXMLAttribute ( 1 ) ],
127126 );
128127
129128 $ restriction = new Restriction (
@@ -149,7 +148,7 @@ public function testMarshalling(): void
149148 SimpleDerivationSetValue::fromString ('#all ' ),
150149 null ,
151150 IDValue::fromString ('phpunit_simpleType ' ),
152- [$ attr4 ],
151+ [self :: $ testContainer -> getXMLAttribute ( 4 ) ],
153152 );
154153
155154 // TopLevelComplexType
@@ -164,7 +163,7 @@ public function testMarshalling(): void
164163 QNameValue::fromString ("{http://www.w3.org/2001/XMLSchema}xs:nestedParticle " ),
165164 null ,
166165 IDValue::fromString ('phpunit_group1 ' ),
167- [$ attr4 ],
166+ [self :: $ testContainer -> getXMLAttribute ( 4 ) ],
168167 );
169168
170169 $ topLevelComplexType = new TopLevelComplexType (
@@ -187,22 +186,22 @@ public function testMarshalling(): void
187186 $ anyAttribute1 ,
188187 null ,
189188 IDValue::fromString ('phpunit_complexType ' ),
190- [$ attr4 ],
189+ [self :: $ testContainer -> getXMLAttribute ( 4 ) ],
191190 );
192191
193192 // Group
194193 $ selector = new Selector (
195194 StringValue::fromString ('.//annotation ' ),
196195 null ,
197196 IDValue::fromString ('phpunit_selector ' ),
198- [$ attr4 ],
197+ [self :: $ testContainer -> getXMLAttribute ( 4 ) ],
199198 );
200199
201200 $ field = new Field (
202201 StringValue::fromString ('@id ' ),
203202 null ,
204203 IDValue::fromString ('phpunit_field ' ),
205- [$ attr4 ],
204+ [self :: $ testContainer -> getXMLAttribute ( 4 ) ],
206205 );
207206
208207 $ keyref = new Keyref (
@@ -212,7 +211,7 @@ public function testMarshalling(): void
212211 [$ field ],
213212 null ,
214213 IDValue::fromString ('phpunit_keyref ' ),
215- [$ attr3 ],
214+ [self :: $ testContainer -> getXMLAttribute ( 3 ) ],
216215 );
217216
218217 $ narrowMaxMinElement = new NarrowMaxMinElement (
@@ -228,7 +227,7 @@ public function testMarshalling(): void
228227 form: FormChoiceValue::fromEnum (FormChoiceEnum::Qualified),
229228 annotation: null ,
230229 id: IDValue::fromString ('phpunit_localElement ' ),
231- namespacedAttributes: [$ attr4 ],
230+ namespacedAttributes: [self :: $ testContainer -> getXMLAttribute ( 4 ) ],
232231 );
233232
234233 $ all = new All (
@@ -237,7 +236,7 @@ public function testMarshalling(): void
237236 [$ narrowMaxMinElement ],
238237 $ annotation1 ,
239238 IDValue::fromString ('phpunit_all ' ),
240- [$ attr3 ],
239+ [self :: $ testContainer -> getXMLAttribute ( 3 ) ],
241240 );
242241
243242 $ this ->assertEquals (
0 commit comments