finished default parser
This commit is contained in:
112
tests/unit/AbcParser/Domain/Core/SettingTest.php
Normal file
112
tests/unit/AbcParser/Domain/Core/SettingTest.php
Normal file
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: richard
|
||||
* Date: 11/26/17
|
||||
* Time: 9:21 PM
|
||||
*/
|
||||
|
||||
namespace Tests\Unit\AbcParser\Domain\Core;
|
||||
|
||||
use Enzyme\Axiom\Atoms\StringAtom;
|
||||
use XaiCorp\AbcParser\Domain\Atoms\EmailAtom;
|
||||
use XaiCorp\AbcParser\Domain\Core\Setting;
|
||||
use XaiCorp\AbcParser\Domain\Core\Transcriber;
|
||||
|
||||
class SettingTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testCreate()
|
||||
{
|
||||
$params = [];
|
||||
|
||||
$setting = new Setting();
|
||||
|
||||
$this->assertInstanceOf(Setting::class, $setting);
|
||||
}
|
||||
|
||||
public function testAddTranscriber()
|
||||
{
|
||||
$name = new StringAtom('me');
|
||||
$email = new EmailAtom('me@example.com');
|
||||
$transcriber = new Transcriber($name, $email);
|
||||
$setting = new Setting();
|
||||
$setting->addTranscriber($transcriber);
|
||||
|
||||
$result = $setting->getTranscribers();
|
||||
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals($transcriber, $result[0]);
|
||||
}
|
||||
|
||||
public function testAddNote()
|
||||
{
|
||||
$note = 'a note';
|
||||
$setting = new Setting();
|
||||
$setting->addNote($note);
|
||||
|
||||
$result = $setting->getNotes();
|
||||
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals($note, $result[0]);
|
||||
}
|
||||
|
||||
public function testAddRecording()
|
||||
{
|
||||
$recording = 'cd recording number';
|
||||
$setting = new Setting();
|
||||
$setting->addRecording($recording);
|
||||
|
||||
$result = $setting->getDiscography();
|
||||
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals($recording, $result[0]);
|
||||
}
|
||||
|
||||
public function testAddSource()
|
||||
{
|
||||
$source = 'thesession.org';
|
||||
$setting = new Setting();
|
||||
$setting->addSource($source);
|
||||
|
||||
$result = $setting->getSources();
|
||||
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals($source, $result[0]);
|
||||
}
|
||||
|
||||
public function testAddWords()
|
||||
{
|
||||
$words = 'sing along with me';
|
||||
$setting = new Setting();
|
||||
$setting->addWords($words);
|
||||
|
||||
$result = $setting->getWords();
|
||||
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals($words, $result[0]);
|
||||
}
|
||||
|
||||
public function testAddBook()
|
||||
{
|
||||
$book = 'sing along with me';
|
||||
$setting = new Setting();
|
||||
$setting->addBook($book);
|
||||
|
||||
$result = $setting->getBooks();
|
||||
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals($book, $result[0]);
|
||||
}
|
||||
|
||||
public function testAddFilename()
|
||||
{
|
||||
$filename = 'test.abc';
|
||||
$setting = new Setting();
|
||||
$setting->addFilename($filename);
|
||||
|
||||
$result = $setting->getFilenames();
|
||||
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals($filename, $result[0]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user