mirror of
https://github.com/elyby/accounts.git
synced 2024-11-18 03:03:03 +05:30
21 lines
680 B
PHP
21 lines
680 B
PHP
<?php
|
|
namespace api\tests\unit\request;
|
|
|
|
use api\request\RequestParser;
|
|
use api\tests\unit\TestCase;
|
|
|
|
class RequestParserTest extends TestCase {
|
|
|
|
public function testParse() {
|
|
$parser = new RequestParser();
|
|
$_POST = ['from' => 'post'];
|
|
$this->assertSame(['from' => 'post'], $parser->parse('from=post', ''));
|
|
$this->assertSame(['from' => 'post'], $parser->parse('', ''));
|
|
$_POST = [];
|
|
$this->assertSame(['from' => 'json'], $parser->parse('{"from":"json"}', ''));
|
|
$this->assertSame(['from' => 'body'], $parser->parse('from=body', ''));
|
|
$this->assertSame(['onlykey' => ''], $parser->parse('onlykey', ''));
|
|
}
|
|
|
|
}
|