started refactoring tune builders to use string type hint instead of StringAtom
38 lines
998 B
PHP
38 lines
998 B
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: richard
|
|
* Date: 06/05/18
|
|
* Time: 8:28 AM
|
|
*/
|
|
|
|
use XaiCorp\AbcParser\Domain\Core\TuneAttributeArrayBuilder;
|
|
use XaiCorp\AbcParser\Domain\Atoms\UnsignedIntegerAtom;
|
|
use XaiCorp\AbcParser\Domain\Core\Tune;
|
|
|
|
class TuneAttributeArrayBuilderTest extends \Codeception\Test\Unit
|
|
{
|
|
|
|
public function testSetIndex()
|
|
{
|
|
$index = new UnsignedIntegerAtom('14');
|
|
$builder = new TuneAttributeArrayBuilder();
|
|
|
|
$tune = $builder->setIndex($index)->getTune();
|
|
|
|
$this->assertInstanceOf(Tune::class, $tune);
|
|
$this->assertEquals($index->getValue(), $tune->getIndex());
|
|
}
|
|
|
|
public function testAppendMusic()
|
|
{
|
|
$music = new \Enzyme\Axiom\Atoms\StringAtom('Abcd|');
|
|
$builder = new TuneAttributeArrayBuilder();
|
|
|
|
$tune = $builder->appendMusic($music)->getTune();
|
|
|
|
$this->assertInstanceOf(Tune::class, $tune);
|
|
$this->assertEquals($music->getValue(), trim($tune->getMusic()));
|
|
}
|
|
}
|