You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
809 B
26 lines
809 B
<?php
|
|
|
|
namespace App\Tests\Adapter;
|
|
|
|
use App\Adapter\ScannedSong;
|
|
use App\Adapter\SongScanner;
|
|
use PHPUnit\Framework\TestCase;
|
|
use function Lambdish\Phunctional\map;
|
|
|
|
class SongScannerTest extends TestCase
|
|
{
|
|
|
|
function testDefaultBehaviourFunctional() {
|
|
$scanner = new SongScanner(__DIR__);
|
|
$songs = $scanner->scan();
|
|
|
|
$this->assertCount(5, $songs);
|
|
|
|
$combinations = map(fn(ScannedSong $song) => [$song->artist, $song->album, $song->title], $songs);
|
|
$this->assertContains(['Band A', 'Album A', 'Song 1'], $combinations);
|
|
$this->assertContains(['Band A', 'Album A', 'Song 2'], $combinations);
|
|
$this->assertContains(['Band A', 'Album B', 'Song 1'], $combinations);
|
|
$this->assertContains(['Band B', 'Album A', 'Song 1'], $combinations);
|
|
}
|
|
}
|