Some checks failed
abc-api/abcParser/pipeline/head There was a failure building this commit
44 lines
1.1 KiB
PHP
Executable File
44 lines
1.1 KiB
PHP
Executable File
<?php
|
|
|
|
use Codeception\Test\Unit;
|
|
use XaiCorp\AbcParser\Application\UseCases\ExtractTuneFromCollection;
|
|
use XaiCorp\AbcParser\Application\UseCases\ImportAbcFile;
|
|
|
|
class ExtractTuneFromCollectionTest extends Unit
|
|
{
|
|
/**
|
|
* @param string $filename
|
|
* @return bool|string
|
|
*/
|
|
private function getAbc($filename = '/abc/valid_abc_1.abc')
|
|
{
|
|
return file_get_contents(codecept_data_dir($filename));
|
|
}
|
|
|
|
public function testCreate()
|
|
{
|
|
$abc = $this->getAbc();
|
|
$tunes = ImportAbcFile::create()->import($abc);
|
|
|
|
$extractor = ExtractTuneFromCollection::create($tunes);
|
|
|
|
$this->assertInstanceOf(ExtractTuneFromCollection::class, $extractor);
|
|
}
|
|
|
|
public function testExtractTuneByTitle()
|
|
{
|
|
$title = "Emmett's Hedgehog";
|
|
|
|
$abc = $this->getAbc('/abc/jigs.abc');
|
|
$tunes = ImportAbcFile::create()->import($abc);
|
|
|
|
$extractor = ExtractTuneFromCollection::create($tunes);
|
|
|
|
$result = $extractor->extractTuneByTitle($title);
|
|
|
|
foreach ($tunes as $tune) {
|
|
$this->assertNotEquals($tune, $result);
|
|
}
|
|
}
|
|
}
|