GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ArtistSearchBuilderTest   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 113
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 9
lcom 0
cbo 1
dl 0
loc 113
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A testCreate() 0 9 1
A testWithTmbid() 0 12 1
A testWithMbid() 0 12 1
A testWithName() 0 12 1
A testWithNameOverride() 0 13 1
A testSortByRelevance() 0 12 1
A testSortWithInvalidType() 0 9 1
A testSortByName() 0 12 1
A testPage() 0 11 1
1
<?php
2
3
/*
4
 * (c) Christian Gripp <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Core23\SetlistFm\Tests\Builder;
11
12
use Core23\SetlistFm\Builder\ArtistSearchBuilder;
13
use InvalidArgumentException;
14
use PHPUnit\Framework\TestCase;
15
16
final class ArtistSearchBuilderTest extends TestCase
17
{
18
    public function testCreate(): void
19
    {
20
        $builder = ArtistSearchBuilder::create();
21
22
        $expected = [
23
            'p' => 1,
24
        ];
25
        static::assertSame($expected, $builder->getQuery());
26
    }
27
28
    public function testWithTmbid(): void
29
    {
30
        $builder = ArtistSearchBuilder::create()
31
            ->withTmbid(123)
32
        ;
33
34
        $expected = [
35
            'p'          => 1,
36
            'artistTmid' => 123,
37
        ];
38
        static::assertSame($expected, $builder->getQuery());
39
    }
40
41
    public function testWithMbid(): void
42
    {
43
        $builder = ArtistSearchBuilder::create()
44
            ->withMbid('a466c2a2-6517-42fb-a160-1087c3bafd9f')
45
        ;
46
47
        $expected = [
48
            'p'          => 1,
49
            'artistMbid' => 'a466c2a2-6517-42fb-a160-1087c3bafd9f',
50
        ];
51
        static::assertSame($expected, $builder->getQuery());
52
    }
53
54
    public function testWithName(): void
55
    {
56
        $builder = ArtistSearchBuilder::create()
57
            ->withName('FooBar')
58
        ;
59
60
        $expected = [
61
            'p'          => 1,
62
            'artistName' => 'FooBar',
63
        ];
64
        static::assertSame($expected, $builder->getQuery());
65
    }
66
67
    public function testWithNameOverride(): void
68
    {
69
        $builder = ArtistSearchBuilder::create()
70
            ->withName('FooBar')
71
            ->withName('BarBaz')
72
        ;
73
74
        $expected = [
75
            'p'          => 1,
76
            'artistName' => 'BarBaz',
77
        ];
78
        static::assertSame($expected, $builder->getQuery());
79
    }
80
81
    public function testSortByRelevance(): void
82
    {
83
        $builder = ArtistSearchBuilder::create()
84
            ->sort('relevance')
85
        ;
86
87
        $expected = [
88
            'p'    => 1,
89
            'sort' => 'relevance',
90
        ];
91
        static::assertSame($expected, $builder->getQuery());
92
    }
93
94
    public function testSortWithInvalidType(): void
95
    {
96
        $this->expectException(InvalidArgumentException::class);
97
        $this->expectExceptionMessage('Invalid sort mode given: foo');
98
99
        ArtistSearchBuilder::create()
100
            ->sort('foo')
101
        ;
102
    }
103
104
    public function testSortByName(): void
105
    {
106
        $builder = ArtistSearchBuilder::create()
107
            ->sort('sortName')
108
        ;
109
110
        $expected = [
111
            'p'    => 1,
112
            'sort' => 'sortName',
113
        ];
114
        static::assertSame($expected, $builder->getQuery());
115
    }
116
117
    public function testPage(): void
118
    {
119
        $builder = ArtistSearchBuilder::create()
120
            ->page(42)
121
        ;
122
123
        $expected = [
124
            'p' => 42,
125
        ];
126
        static::assertSame($expected, $builder->getQuery());
127
    }
128
}
129