ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
RequestProcessorIdentifyTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
25
26class RequestProcessorIdentifyTest extends RequestProcessorTestCase
27{
28 public function testGetResponseToRequestIdentify(): void
29 {
30 $processor = new RequestProcessor(
31 $this->getWriter(),
32 $this->getSettings('', 'name of repo', 'mail of contact'),
33 $this->getRepository('2021-10-20'),
34 $this->getTokenHandler()
35 );
36
37 $expected_response = <<<XML
38 <response>
39 <response_info>base url:Identify:</response_info>
40 <info>name of repo</info>
41 <info>base url</info>
42 <info>2021-10-20</info>
43 <info>mail of contact</info>
44 </response>
45 XML;
46
47 $response = $processor->getResponseToRequest($this->getRequest(
48 'base url',
49 Verb::IDENTIFY,
50 []
51 ));
52
53 $this->assertXmlStringEqualsXmlString($expected_response, $response->saveXML());
54 }
55
56 public function testGetResponseToRequestIdentifyAdditionalArgumentError(): void
57 {
58 $processor = new RequestProcessor(
59 $this->getWriter(),
60 $this->getSettings('', 'name of repo', 'mail of contact'),
61 $this->getRepository('2021-10-20'),
62 $this->getTokenHandler()
63 );
64
65 $expected_response = <<<XML
66 <error_response>
67 <response_info>base url:Identify:from=some date</response_info>
68 <error>badArgument</error>
69 </error_response>
70 XML;
71
72 $response = $processor->getResponseToRequest($this->getRequest(
73 'base url',
74 Verb::IDENTIFY,
75 [Argument::FROM_DATE->value => 'some date'],
76 false
77 ));
78
79 $this->assertXmlStringEqualsXmlString($expected_response, $response->saveXML());
80 }
81}
error(string $a_errmsg)
$response
Definition: xapitoken.php:93