|
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\LastFm\Tests\Builder; |
|
11
|
|
|
|
|
12
|
|
|
use Core23\LastFm\Builder\ArtistTopTracksBuilder; |
|
13
|
|
|
use PHPUnit\Framework\TestCase; |
|
14
|
|
|
|
|
15
|
|
|
final class ArtistTopTracksBuilderTest extends TestCase |
|
16
|
|
|
{ |
|
17
|
|
|
public function testForMbid(): void |
|
18
|
|
|
{ |
|
19
|
|
|
$builder = ArtistTopTracksBuilder::forMbid('a466c2a2-6517-42fb-a160-1087c3bafd9f'); |
|
20
|
|
|
|
|
21
|
|
|
$expected = [ |
|
22
|
|
|
'mbid' => 'a466c2a2-6517-42fb-a160-1087c3bafd9f', |
|
23
|
|
|
]; |
|
24
|
|
|
static::assertSame($expected, $builder->getQuery()); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
public function testForArtist(): void |
|
28
|
|
|
{ |
|
29
|
|
|
$builder = ArtistTopTracksBuilder::forArtist('Slipknot'); |
|
30
|
|
|
|
|
31
|
|
|
$expected = [ |
|
32
|
|
|
'artist' => 'Slipknot', |
|
33
|
|
|
]; |
|
34
|
|
|
static::assertSame($expected, $builder->getQuery()); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
public function testAutocorrect(): void |
|
38
|
|
|
{ |
|
39
|
|
|
$builder = ArtistTopTracksBuilder::forMbid('a466c2a2-6517-42fb-a160-1087c3bafd9f') |
|
40
|
|
|
->autocorrect(true) |
|
41
|
|
|
; |
|
42
|
|
|
|
|
43
|
|
|
$expected = [ |
|
44
|
|
|
'mbid' => 'a466c2a2-6517-42fb-a160-1087c3bafd9f', |
|
45
|
|
|
'autocorrect' => 1, |
|
46
|
|
|
]; |
|
47
|
|
|
static::assertSame($expected, $builder->getQuery()); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function testNoAutocorrect(): void |
|
51
|
|
|
{ |
|
52
|
|
|
$builder = ArtistTopTracksBuilder::forMbid('a466c2a2-6517-42fb-a160-1087c3bafd9f') |
|
53
|
|
|
->autocorrect(false) |
|
54
|
|
|
; |
|
55
|
|
|
|
|
56
|
|
|
$expected = [ |
|
57
|
|
|
'mbid' => 'a466c2a2-6517-42fb-a160-1087c3bafd9f', |
|
58
|
|
|
'autocorrect' => 0, |
|
59
|
|
|
]; |
|
60
|
|
|
static::assertSame($expected, $builder->getQuery()); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function testLimit(): void |
|
64
|
|
|
{ |
|
65
|
|
|
$builder = ArtistTopTracksBuilder::forMbid('a466c2a2-6517-42fb-a160-1087c3bafd9f') |
|
66
|
|
|
->limit(20) |
|
67
|
|
|
; |
|
68
|
|
|
|
|
69
|
|
|
$expected = [ |
|
70
|
|
|
'mbid' => 'a466c2a2-6517-42fb-a160-1087c3bafd9f', |
|
71
|
|
|
'limit' => 20, |
|
72
|
|
|
]; |
|
73
|
|
|
static::assertSame($expected, $builder->getQuery()); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
public function testPage(): void |
|
77
|
|
|
{ |
|
78
|
|
|
$builder = ArtistTopTracksBuilder::forMbid('a466c2a2-6517-42fb-a160-1087c3bafd9f') |
|
79
|
|
|
->page(13) |
|
80
|
|
|
; |
|
81
|
|
|
|
|
82
|
|
|
$expected = [ |
|
83
|
|
|
'mbid' => 'a466c2a2-6517-42fb-a160-1087c3bafd9f', |
|
84
|
|
|
'page' => 13, |
|
85
|
|
|
]; |
|
86
|
|
|
static::assertSame($expected, $builder->getQuery()); |
|
87
|
|
|
} |
|
88
|
|
|
} |
|
89
|
|
|
|