@@ -18,6 +18,33 @@ require_once __DIR__ . '/../bootstrap.php';
1818
1919class DispatcherTest extends TestCase
2020{
21+ public function testService (): void
22+ {
23+ $ certificate = new Certificate (__DIR__ . '/../Data/EET_CA1_Playground-CZ00000019.p12 ' , 'eet ' );
24+
25+ $ dispatcher = new Dispatcher ($ certificate , 'Personal/MySchema/MyService.wsdl ' );
26+
27+ Assert::contains ('Personal/MySchema/MyService.wsdl ' , $ dispatcher ->getService ());
28+
29+ $ schemaPath = 'FilipSedivy/EET/Schema ' ;
30+
31+ $ dispatcher ->setProductionService ();
32+
33+ Assert::contains ($ schemaPath . '/ProductionService.wsdl ' , $ dispatcher ->getService ());
34+
35+ $ dispatcher ->setPlaygroundService ();
36+
37+ Assert::contains ($ schemaPath . '/PlaygroundService.wsdl ' , $ dispatcher ->getService ());
38+
39+ $ dispatcher ->setService ('Personal/MySchema/MyService.wsdl ' );
40+
41+ Assert::contains ('Personal/MySchema/MyService.wsdl ' , $ dispatcher ->getService ());
42+
43+ $ dispatcher = new Dispatcher ($ certificate , Dispatcher::PRODUCTION_SERVICE );
44+
45+ Assert::contains ($ schemaPath . '/ProductionService.wsdl ' , $ dispatcher ->getService ());
46+ }
47+
2148 public function testSendReceipt (): void
2249 {
2350 $ certificate = new Certificate (__DIR__ . '/../Data/EET_CA1_Playground-CZ00000019.p12 ' , 'eet ' );
@@ -53,6 +80,33 @@ class DispatcherTest extends TestCase
5380 }
5481 }
5582
83+ public function testCheck (): void
84+ {
85+ $ certificate = new Certificate (__DIR__ . '/../Data/EET_CA1_Playground-CZ00000019.p12 ' , 'eet ' );
86+ $ dispatcher = new Dispatcher ($ certificate , Dispatcher::PLAYGROUND_SERVICE );
87+
88+ $ receipt = $ this ->getValidReceipt ();
89+ Assert::true ($ dispatcher ->check ($ receipt ));
90+
91+ $ receipt ->dic_popl = 'CZ00000018 ' ;
92+ Assert::false ($ dispatcher ->check ($ receipt ));
93+ }
94+
95+ public function testGetCheckCodes (): void
96+ {
97+ $ certificate = new Certificate (__DIR__ . '/../Data/EET_CA1_Playground-CZ00000019.p12 ' , 'eet ' );
98+ $ dispatcher = new Dispatcher ($ certificate , Dispatcher::PLAYGROUND_SERVICE );
99+
100+ $ receipt = $ this ->getValidReceipt ();
101+
102+ Assert::type ('array ' , $ dispatcher ->getCheckCodes ($ receipt ));
103+
104+ $ receipt ->bkp = $ dispatcher ->getBkp ();
105+ $ receipt ->pkp = $ dispatcher ->getPkp (false );
106+
107+ Assert::type ('array ' , $ dispatcher ->getCheckCodes ($ receipt ));
108+ }
109+
56110 private function getValidReceipt (): Receipt
57111 {
58112 $ receipt = new Receipt ();
0 commit comments