8
8
use Soap \Wsdl \Loader \StreamWrapperLoader ;
9
9
use Soap \Wsdl \Xml \Configurator \FlattenXsdImports ;
10
10
use VeeWee \Xml \Dom \Document ;
11
+ use function VeeWee \Xml \Dom \Configurator \canonicalize ;
11
12
use function VeeWee \Xml \Dom \Configurator \comparable ;
12
13
13
14
final class FlattenXsdImportsTest extends TestCase
@@ -16,47 +17,59 @@ final class FlattenXsdImportsTest extends TestCase
16
17
*
17
18
* @dataProvider provideTestCases
18
19
*/
19
- public function test_it_can_flatten_xsd_imports (string $ wsdlUri , Document $ expected ): void
20
+ public function test_it_can_flatten_xsd_imports (string $ wsdlUri , Document $ expected, callable $ xmlConfigurator ): void
20
21
{
21
22
$ wsdl = Document::fromXmlFile ($ wsdlUri );
22
23
$ configurator = new FlattenXsdImports (
23
24
$ wsdlUri ,
24
25
FlatteningContext::forWsdl ($ wsdlUri , $ wsdl , new StreamWrapperLoader ())
25
26
);
26
- $ flattened = Document::fromUnsafeDocument ($ wsdl ->toUnsafeDocument (), $ configurator , comparable () );
27
+ $ flattened = Document::fromUnsafeDocument ($ wsdl ->toUnsafeDocument (), $ configurator , $ xmlConfigurator );
27
28
28
- static ::assertSame ($ expected ->toXmlString (), $ flattened ->toXmlString ());
29
+ static ::assertSame ($ expected ->reconfigure ( $ xmlConfigurator )-> toXmlString (), $ flattened ->toXmlString ());
29
30
}
30
31
31
32
public function provideTestCases ()
32
33
{
33
34
yield 'single-xsd ' => [
34
35
'wsdl ' => FIXTURE_DIR .'/flattening/single-xsd.wsdl ' ,
35
- 'expected ' => Document::fromXmlFile (FIXTURE_DIR .'/flattening/result/single-xsd-result.wsdl ' , comparable ()),
36
+ 'expected ' => Document::fromXmlFile (FIXTURE_DIR .'/flattening/result/single-xsd-result.wsdl ' ),
37
+ comparable (),
36
38
];
37
39
yield 'once-xsd ' => [
38
40
'wsdl ' => FIXTURE_DIR .'/flattening/once-xsd.wsdl ' ,
39
- 'expected ' => Document::fromXmlFile (FIXTURE_DIR .'/flattening/result/once-xsd-result.wsdl ' , comparable ()),
41
+ 'expected ' => Document::fromXmlFile (FIXTURE_DIR .'/flattening/result/once-xsd-result.wsdl ' ),
42
+ comparable (),
40
43
];
41
44
yield 'multi-xsd ' => [
42
45
'wsdl ' => FIXTURE_DIR .'/flattening/multi-xsd.wsdl ' ,
43
- 'expected ' => Document::fromXmlFile (FIXTURE_DIR .'/flattening/result/multi-xsd-result.wsdl ' , comparable ()),
46
+ 'expected ' => Document::fromXmlFile (FIXTURE_DIR .'/flattening/result/multi-xsd-result.wsdl ' ),
47
+ comparable (),
44
48
];
45
49
yield 'circular-xsd ' => [
46
50
'wsdl ' => FIXTURE_DIR .'/flattening/circular-xsd.wsdl ' ,
47
- 'expected ' => Document::fromXmlFile (FIXTURE_DIR .'/flattening/result/circular-xsd-result.wsdl ' , comparable ()),
51
+ 'expected ' => Document::fromXmlFile (FIXTURE_DIR .'/flattening/result/circular-xsd-result.wsdl ' ),
52
+ comparable (),
48
53
];
49
54
yield 'redefine-xsd ' => [
50
55
'wsdl ' => FIXTURE_DIR .'/flattening/redefine-xsd.wsdl ' ,
51
- 'expected ' => Document::fromXmlFile (FIXTURE_DIR .'/flattening/result/redefine-xsd-result.wsdl ' , comparable ()),
56
+ 'expected ' => Document::fromXmlFile (FIXTURE_DIR .'/flattening/result/redefine-xsd-result.wsdl ' ),
57
+ comparable (),
52
58
];
53
59
yield 'tnsless-xsd ' => [
54
60
'wsdl ' => FIXTURE_DIR .'/flattening/tnsless-xsd.wsdl ' ,
55
- 'expected ' => Document::fromXmlFile (FIXTURE_DIR .'/flattening/result/tnsless-xsd-result.wsdl ' , comparable ()),
61
+ 'expected ' => Document::fromXmlFile (FIXTURE_DIR .'/flattening/result/tnsless-xsd-result.wsdl ' ),
62
+ comparable (),
56
63
];
57
64
yield 'grouped-xsd ' => [
58
65
'wsdl ' => FIXTURE_DIR .'/flattening/grouped-xsd.wsdl ' ,
59
- 'expected ' => Document::fromXmlFile (FIXTURE_DIR .'/flattening/result/grouped-xsd-result.wsdl ' , comparable ()),
66
+ 'expected ' => Document::fromXmlFile (FIXTURE_DIR .'/flattening/result/grouped-xsd-result.wsdl ' ),
67
+ comparable (),
68
+ ];
69
+ yield 'root-xmlns-import-issue ' => [
70
+ 'wsdl ' => FIXTURE_DIR .'/flattening/root-xmlns-import-issue.wsdl ' ,
71
+ 'expected ' => Document::fromXmlFile (FIXTURE_DIR .'/flattening/result/root-xmlns-import-issue-result.wsdl ' ),
72
+ canonicalize (),
60
73
];
61
74
}
62
75
}
0 commit comments