19 declare(strict_types=1);
32 return $this->createMock(URI::class);
43 $request =
new Request(
$url, Verb::LIST_IDENTIFIERS);
45 $this->assertSame(
$url, $request->baseURL());
46 $this->assertSame(Verb::LIST_IDENTIFIERS, $request->verb());
53 foreach (Argument::cases() as $argument) {
54 $this->assertFalse($request->hasArgument($argument));
55 $this->assertSame(
'', $request->argumentValue($argument));
62 ->withArgument(Argument::FROM_DATE,
'today');
64 foreach (Argument::cases() as $argument) {
65 if ($argument === Argument::FROM_DATE) {
68 $this->assertFalse($request->hasArgument($argument));
69 $this->assertSame(
'', $request->argumentValue($argument));
72 $this->assertTrue($request->hasArgument(Argument::FROM_DATE));
73 $this->assertSame(
'today', $request->argumentValue(Argument::FROM_DATE));
79 ->withArgument(Argument::FROM_DATE,
'today')
80 ->withArgument(Argument::RESUMPTION_TOKEN,
'resume!');
82 foreach (Argument::cases() as $argument) {
84 $argument === Argument::FROM_DATE ||
85 $argument === Argument::RESUMPTION_TOKEN
89 $this->assertFalse($request->hasArgument($argument));
90 $this->assertSame(
'', $request->argumentValue($argument));
93 $this->assertTrue($request->hasArgument(Argument::FROM_DATE));
94 $this->assertSame(
'today', $request->argumentValue(Argument::FROM_DATE));
95 $this->assertTrue($request->hasArgument(Argument::RESUMPTION_TOKEN));
96 $this->assertSame(
'resume!', $request->argumentValue(Argument::RESUMPTION_TOKEN));
103 $this->assertNull($request->argumentKeys()->current());
110 $request = $request->withArgument(Argument::IDENTIFIER,
'some identifier');
111 $request = $request->withArgument(Argument::UNTIL_DATE,
'some date');
113 $argument_keys = iterator_to_array($request->argumentKeys());
114 $this->assertCount(2, $argument_keys);
115 $this->assertContains(Argument::IDENTIFIER, $argument_keys);
116 $this->assertContains(Argument::UNTIL_DATE, $argument_keys);
125 ->withArgument(Argument::IDENTIFIER,
'some identifier');
128 ->withArgument(Argument::IDENTIFIER,
'some identifier')
129 ->withArgument(Argument::RESUMPTION_TOKEN,
'token');
132 ->withArgument(Argument::IDENTIFIER,
'some identifier')
133 ->withArgument(Argument::RESUMPTION_TOKEN,
'token')
134 ->withArgument(Argument::FROM_DATE,
'date');
137 ->withArgument(Argument::MD_PREFIX,
'prefix');
142 ->withArgument(Argument::UNTIL_DATE,
'date');
145 ->withArgument(Argument::FROM_DATE,
'date');
148 ->withArgument(Argument::IDENTIFIER,
'some identifier')
149 ->withArgument(Argument::UNTIL_DATE,
'date');
152 ->withArgument(Argument::IDENTIFIER,
'some identifier')
153 ->withArgument(Argument::MD_PREFIX,
'prefix');
156 ->withArgument(Argument::FROM_DATE,
'date')
157 ->withArgument(Argument::MD_PREFIX,
'prefix');
159 foreach ($expect_true as $request) {
160 $this->assertTrue($request->hasCorrectArguments(
161 [Argument::IDENTIFIER],
162 [Argument::RESUMPTION_TOKEN, Argument::FROM_DATE],
163 [Argument::MD_PREFIX]
166 foreach ($expect_false as $request) {
167 $this->assertFalse($request->hasCorrectArguments(
168 [Argument::IDENTIFIER],
169 [Argument::RESUMPTION_TOKEN, Argument::FROM_DATE],
170 [Argument::MD_PREFIX]
180 ->withArgument(Argument::IDENTIFIER,
'some identifier');
183 ->withArgument(Argument::IDENTIFIER,
'some identifier')
184 ->withArgument(Argument::UNTIL_DATE,
'some date');
186 $this->assertTrue($request_no_arguments->hasCorrectArguments([], [], []));
187 $this->assertFalse($request_one_argument->hasCorrectArguments([], [], []));
188 $this->assertFalse($request_two_arguments->hasCorrectArguments([], [], []));
196 ->withArgument(Argument::IDENTIFIER,
'some identifier');
199 ->withArgument(Argument::IDENTIFIER,
'some identifier')
200 ->withArgument(Argument::UNTIL_DATE,
'some date');
202 $this->assertFalse($request_no_arguments->hasCorrectArguments([Argument::IDENTIFIER], [], []));
203 $this->assertTrue($request_one_argument->hasCorrectArguments([Argument::IDENTIFIER], [], []));
204 $this->assertFalse($request_two_arguments->hasCorrectArguments([Argument::IDENTIFIER], [], []));
212 ->withArgument(Argument::IDENTIFIER,
'some identifier');
215 ->withArgument(Argument::IDENTIFIER,
'some identifier')
216 ->withArgument(Argument::UNTIL_DATE,
'some date');
218 $this->assertTrue($request_no_arguments->hasCorrectArguments([], [Argument::IDENTIFIER], []));
219 $this->assertTrue($request_one_argument->hasCorrectArguments([], [Argument::IDENTIFIER], []));
220 $this->assertFalse($request_two_arguments->hasCorrectArguments([], [Argument::IDENTIFIER], []));
231 ->withArgument(Argument::IDENTIFIER,
'some identifier');
234 ->withArgument(Argument::UNTIL_DATE,
'some date');
237 ->withArgument(Argument::FROM_DATE,
'some date');
240 ->withArgument(Argument::IDENTIFIER,
'some identifier')
241 ->withArgument(Argument::UNTIL_DATE,
'some date');
244 ->withArgument(Argument::FROM_DATE,
'some date')
245 ->withArgument(Argument::UNTIL_DATE,
'some date');
247 foreach ($expect_true as $request) {
248 $this->assertTrue($request->hasCorrectArguments(
249 [Argument::UNTIL_DATE],
251 [Argument::IDENTIFIER]
254 foreach ($expect_false as $request) {
255 $this->assertFalse($request->hasCorrectArguments(
256 [Argument::UNTIL_DATE],
258 [Argument::IDENTIFIER]