JsonRequestParserTest::testEmptyData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
rs 10
1
<?php declare(strict_types = 1);
2
3
namespace Portiny\GraphQL\Tests\Http\Request;
4
5
use PHPUnit\Framework\TestCase;
6
use Portiny\GraphQL\Http\Request\JsonRequestParser;
7
8
final class JsonRequestParserTest extends TestCase
9
{
10
11
	public function testGetQuery(): void
12
	{
13
		$jsonRequestParser = new JsonRequestParser('{"query": "some query", "variables": {}}');
14
15
		self::assertSame('some query', $jsonRequestParser->getQuery());
16
	}
17
18
19
	public function testGetVariables(): void
20
	{
21
		$jsonRequestParser = new JsonRequestParser('{"query": "some query", "variables": {"key": "value"}}');
22
23
		self::assertSame(['key' => 'value'], $jsonRequestParser->getVariables());
24
	}
25
26
27
	public function testEmptyData(): void
28
	{
29
		$jsonRequestParser = new JsonRequestParser('');
30
31
		self::assertSame('', $jsonRequestParser->getQuery());
32
		self::assertSame([], $jsonRequestParser->getVariables());
33
	}
34
35
}
36