<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2023, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
self::assertEquals($assert['command'], $arguments->getCommand());
self::assertEquals($assert['argv'], $arguments->getArgv());
self::assertEquals($assert['argc'], $arguments->getArgc());
+ self::assertEquals($assert['method'], $arguments->getMethod());
self::assertCount($assert['argc'], $arguments->getArgv());
}
'command' => '',
'argv' => [],
'argc' => 0,
+ 'method' => App\Router::GET
],
$arguments);
}
'command' => 'profile/test/it',
'argv' => ['profile', 'test', 'it'],
'argc' => 3,
+ 'method' => App\Router::GET,
],
'server' => [
'QUERY_STRING' => 'pagename=profile/test/it&arg1=value1&arg2=value2',
'command' => '~test/it',
'argv' => ['~test', 'it'],
'argc' => 2,
+ 'method' => App\Router::GET,
],
'server' => [
'QUERY_STRING' => 'pagename=~test/it&arg1=value1&arg2=value2',
'command' => 'u/test/it',
'argv' => ['u', 'test', 'it'],
'argc' => 3,
+ 'method' => App\Router::GET,
],
'server' => [
'QUERY_STRING' => 'pagename=u/test/it&arg1=value1&arg2=value2',
'command' => 'profile/test/it',
'argv' => ['profile', 'test', 'it'],
'argc' => 3,
+ 'method' => App\Router::GET,
],
'server' => [
'QUERY_STRING' => 'pagename=profile/test/it&arg1=value1&arg2=value2/',
'command' => 'profile/test/it',
'argv' => ['profile', 'test', 'it'],
'argc' => 3,
+ 'method' => App\Router::GET,
],
'server' => [
'QUERY_STRING' => 'wrong=profile/test/it&arg1=value1&arg2=value2/',
'command' => 'notvalid/it',
'argv' => ['notvalid', 'it'],
'argc' => 2,
+ 'method' => App\Router::GET,
],
'server' => [
'QUERY_STRING' => 'pagename=notvalid/it&arg1=value1&arg2=value2/',
'command' => '',
'argv' => [],
'argc' => 0,
+ 'method' => App\Router::GET,
],
'server' => [
'QUERY_STRING' => 'arg1=value1&arg2=value2/',
'command' => 'api/call.json',
'argv' => ['api', 'call.json'],
'argc' => 2,
+ 'method' => App\Router::GET,
],
'server' => [
'QUERY_STRING' => 'pagename=api/call.json',
'pagename' => 'api/call.json'
],
],
+ 'withHTTPMethod' => [
+ 'assert' => [
+ 'queryString' => 'api/call.json',
+ 'command' => 'api/call.json',
+ 'argv' => ['api', 'call.json'],
+ 'argc' => 2,
+ 'method' => App\Router::POST,
+ ],
+ 'server' => [
+ 'QUERY_STRING' => 'pagename=api/call.json',
+ 'REQUEST_METHOD' => App\Router::POST,
+ ],
+ 'get' => [
+ 'pagename' => 'api/call.json'
+ ],
+ ],
];
}