QueryTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testConstruct() 0 4 1
A testToString() 0 4 1
A testGetSetData() 0 6 1
A testGetSetQuery() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Purl\Test;
6
7
use PHPUnit\Framework\TestCase;
8
use Purl\Query;
9
10
class QueryTest extends TestCase
11
{
12
    public function testConstruct() : void
13
    {
14
        $query = new Query('param=value');
15
        $this->assertEquals('param=value', $query->getQuery());
16
    }
17
18
    public function testGetSetQuery() : void
19
    {
20
        $query = new Query();
21
        $this->assertEquals('', $query->getQuery());
22
        $query->setQuery('param1=value1&param2=value2');
23
        $this->assertEquals('param1=value1&param2=value2', $query->getQuery());
24
    }
25
26
    public function testToString() : void
27
    {
28
        $query = new Query('param1=value1&param2=value2');
29
        $this->assertEquals('param1=value1&param2=value2', (string) $query);
30
    }
31
32
    public function testGetSetData() : void
33
    {
34
        $query = new Query('param1=value1&param2=value2');
35
        $this->assertEquals(['param1' => 'value1', 'param2' => 'value2'], $query->getData());
36
        $query->setData(['param' => 'value']);
37
        $this->assertEquals('param=value', $query->getQuery());
38
    }
39
}
40