19declare(strict_types=1);
23use PHPUnit\Framework\TestCase;
32 $url = $this->createMock(URI::class);
33 $url->method(
'__toString')->willReturn($string);
42 array $arguments_with_values
46 protected array $arguments_with_values
50 public function requestHasArgument(
Argument $argument): bool
54 array_keys($this->arguments_with_values)
58 public function retrieveArgumentFromRequest(
Argument $argument): string
60 if (!$this->requestHasArgument($argument)) {
63 return $this->arguments_with_values[$argument->value];
72 protected function getEmptyRequest(
77 public array $exposed_arguments = [];
80 public Verb $exposed_verb,
81 public URI $exposed_base_url
85 public function withArgument(
90 $clone->exposed_arguments[$key->value] = $value;
100 $parser = $this->getParser($this->getHTTPWrapper(
102 Argument::IDENTIFIER->value =>
'some identifier',
103 Argument::VERB->value => Verb::LIST_IDENTIFIERS->value,
104 Argument::FROM_DATE->value =>
'some date'
108 $request = $parser->parseFromHTTP($this->
getURI(
'some url'));
110 $this->assertSame(
'some url', (
string) $request->exposed_base_url);
111 $this->assertSame(Verb::LIST_IDENTIFIERS, $request->exposed_verb);
114 Argument::IDENTIFIER->value =>
'some identifier',
115 Argument::FROM_DATE->value =>
'some date'
117 $request->exposed_arguments
123 $string_with_reserved_chars =
':/?#[]@!$&' .
"'" .
' ()*+,;=';
124 $parser = $this->getParser($this->getHTTPWrapper(
126 Argument::IDENTIFIER->value => rawurlencode($string_with_reserved_chars)
130 $request = $parser->parseFromHTTP($this->
getURI(
'some url'));
133 [Argument::IDENTIFIER->value => $string_with_reserved_chars],
134 $request->exposed_arguments
140 $parser = $this->getParser($this->getHTTPWrapper([]));
142 $request = $parser->parseFromHTTP($this->
getURI(
'some url'));
144 $this->assertSame(
Verb::NULL, $request->exposed_verb);
145 $this->assertEmpty($request->exposed_arguments);
150 $parser = $this->getParser($this->getHTTPWrapper(
151 [Argument::VERB->value => Verb::LIST_IDENTIFIERS->value,]
154 $request = $parser->parseFromHTTP($this->
getURI(
'some url'));
156 $this->assertEmpty($request->exposed_arguments);
161 $parser = $this->getParser($this->getHTTPWrapper(
162 [Argument::IDENTIFIER->value =>
'some identifier']
165 $request = $parser->parseFromHTTP($this->
getURI(
'some url'));
167 $this->assertSame(
Verb::NULL, $request->exposed_verb);
172 $parser = $this->getParser($this->getHTTPWrapper(
173 [Argument::VERB->value =>
'nonsense verb']
176 $request = $parser->parseFromHTTP($this->
getURI(
'some url'));
178 $this->assertSame(
Verb::NULL, $request->exposed_verb);
179 $this->assertEmpty($request->exposed_arguments);
184 $parser = $this->getParser($this->getHTTPWrapper(
185 [
'nonsense argument' =>
'nonsense verb']
188 $request = $parser->parseFromHTTP($this->
getURI(
'some url'));
190 $this->assertSame(
Verb::NULL, $request->exposed_verb);
191 $this->assertEmpty($request->exposed_arguments);
The scope of this class is split ilias-conform URI's into components.
__construct()
Constructor setup ILIAS global object @access public.
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
if( $request_wrapper->has( 'ui_mainbar')) getURI()