mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
cf27ed713d
Koel can now integrate and use the rich information from Last.fm. Now whenever a song is played, its album and artist information will be queried from Last.fm and cached for later use. What's better, if an album has no cover, Koel will try to update its cover if one is found on Last.fm. In order to use this feature, users only need to provide valid Last.fm API credentials (namely LASTFM_API_KEY and LASTFM_API_SECRET) in .env. A npm and gulp rebuild is also required - just like with every update.
45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
<?php
|
|
|
|
use App\Models\Artist;
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
|
|
class ArtistTest extends TestCase
|
|
{
|
|
use DatabaseTransactions;
|
|
|
|
public function setUp()
|
|
{
|
|
parent::setUp();
|
|
}
|
|
|
|
public function testShouldBeCreatedWithUniqueNames()
|
|
{
|
|
$name = 'Foo Fighters';
|
|
$artist = Artist::get($name);
|
|
|
|
$this->assertEquals($name, $artist->name);
|
|
|
|
// Should be only 2 records: UNKNOWN_ARTIST, and our Dave Grohl's band
|
|
$this->assertEquals(2, Artist::all()->count());
|
|
|
|
Artist::get($name);
|
|
|
|
// Should still be 2.
|
|
$this->assertEquals(2, Artist::all()->count());
|
|
}
|
|
|
|
public function testArtistWithEmptyNameShouldBeUnknown()
|
|
{
|
|
$this->assertEquals(Artist::UNKNOWN_NAME, Artist::get('')->name);
|
|
}
|
|
|
|
public function testUtf16Names()
|
|
{
|
|
$name = file_get_contents(dirname(__FILE__).'/blobs/utf16');
|
|
|
|
$artist = Artist::get($name);
|
|
$artist = Artist::get($name); // to make sure there's no constraint exception
|
|
|
|
$this->assertEquals($artist->id, Artist::get($name)->id);
|
|
}
|
|
}
|