PagerTagTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 22
c 1
b 0
f 1
dl 0
loc 38
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testFromAmazonRequestPartial() 0 11 1
A testFromAmazonRequestFull() 0 13 1
A testFromAmazonRequestEmpty() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MaxBeckers\AmazonAlexa\Test\Request;
6
7
use MaxBeckers\AmazonAlexa\Request\PagerTag;
8
use PHPUnit\Framework\TestCase;
9
10
class PagerTagTest extends TestCase
11
{
12
    public function testFromAmazonRequestFull(): void
13
    {
14
        $tag = PagerTag::fromAmazonRequest([
15
            'index' => 3,
16
            'pageCount' => 10,
17
            'allowForward' => true,
18
            'allowBackwards' => false,
19
        ]);
20
21
        $this->assertSame(3, $tag->index);
22
        $this->assertSame(10, $tag->pageCount);
23
        $this->assertTrue($tag->allowForward);
24
        $this->assertFalse($tag->allowBackwards);
25
    }
26
27
    public function testFromAmazonRequestPartial(): void
28
    {
29
        $tag = PagerTag::fromAmazonRequest([
30
            'index' => 0,
31
            'allowForward' => true,
32
        ]);
33
34
        $this->assertSame(0, $tag->index);
35
        $this->assertNull($tag->pageCount);
36
        $this->assertTrue($tag->allowForward);
37
        $this->assertNull($tag->allowBackwards);
38
    }
39
40
    public function testFromAmazonRequestEmpty(): void
41
    {
42
        $tag = PagerTag::fromAmazonRequest([]);
43
44
        $this->assertNull($tag->index);
45
        $this->assertNull($tag->pageCount);
46
        $this->assertNull($tag->allowForward);
47
        $this->assertNull($tag->allowBackwards);
48
    }
49
}
50