ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
RequestProcessorListSetsTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
25 
26 class RequestProcessorListSetsTest extends RequestProcessorTestCase
27 {
28  public function testGetResponseToRequestListSetsNoSetsError(): void
29  {
30  $processor = new RequestProcessor(
31  $this->getWriter(),
32  $this->getSettings(),
33  $this->getRepository(),
34  $this->getTokenHandler()
35  );
36 
37  $expected_response = <<<XML
38  <response>
39  <response_info>base url:ListSets:</response_info>
40  <set>default:default</set>
41  </response>
42  XML;
43 
44  $response = $processor->getResponseToRequest($this->getRequest('base url', Verb::LIST_SETS, []));
45 
46  $this->assertXmlStringEqualsXmlString($expected_response, $response->saveXML());
47  }
48 
49  public function testGetResponseToRequestListSetsAdditionalArgumentError(): void
50  {
51  $processor = new RequestProcessor(
52  $this->getWriter(),
53  $this->getSettings(),
54  $this->getRepository(),
55  $this->getTokenHandler()
56  );
57 
58  $expected_response = <<<XML
59  <error_response>
60  <response_info>base url:ListSets:identifier=some id</response_info>
61  <error>badArgument</error>
62  </error_response>
63  XML;
64 
65  $response = $processor->getResponseToRequest($this->getRequest(
66  'base url',
68  [Argument::IDENTIFIER->value => 'some id'],
69  false
70  ));
71 
72  $this->assertXmlStringEqualsXmlString($expected_response, $response->saveXML());
73  }
74 
75  public function testGetResponseToRequestListSetsWithTokenBadResumptionTokenError(): void
76  {
77  $processor = new RequestProcessor(
78  $this->getWriter(),
79  $this->getSettings(),
80  $this->getRepository(),
81  $this->getTokenHandler()
82  );
83 
84  $expected_response = <<<XML
85  <error_response>
86  <response_info>base url:ListSets:resumptionToken=token</response_info>
87  <error>badResumptionToken</error>
88  </error_response>
89  XML;
90 
91  $response = $processor->getResponseToRequest($this->getRequest(
92  'base url',
94  [Argument::RESUMPTION_TOKEN->value => 'token']
95  ));
96 
97  $this->assertXmlStringEqualsXmlString($expected_response, $response->saveXML());
98  }
99 }
$response
Definition: xapitoken.php:93
base()
description: > Example for rendering a bulky button.
Definition: base.php:35