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