initial commit
This commit is contained in:
160
tests/functional/laravel5/AbcParserCest.php
Normal file
160
tests/functional/laravel5/AbcParserCest.php
Normal file
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
namespace laravel5;
|
||||
|
||||
use \UnitTester;
|
||||
use \Codeception\Util\Stub;
|
||||
use XaiCorp\AbcParser\Models\Laravel5\Abc;
|
||||
use XaiCorp\AbcParser\Parser;
|
||||
use XaiCorp\AbcParser\Interfaces\Builder;
|
||||
//use Aedart\Testing\Laravel\Traits\TestHelperTrait;
|
||||
|
||||
|
||||
class AbcParserCest
|
||||
{
|
||||
// use TestHelperTrait;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $dataDir;
|
||||
|
||||
/**
|
||||
* @var \XaiCorp\AbcParser\Interfaces\Builder
|
||||
*/
|
||||
protected $builder;
|
||||
|
||||
/**
|
||||
* @var Parser;
|
||||
*/
|
||||
protected $parser;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->dataDir = codecept_data_dir();
|
||||
}
|
||||
|
||||
public function _before(UnitTester $I)
|
||||
{
|
||||
$this->builder = new Abc();
|
||||
}
|
||||
|
||||
public function _after(UnitTester $I)
|
||||
{
|
||||
unset($builder);
|
||||
}
|
||||
|
||||
// tests: trying to...
|
||||
public function createParser(UnitTester $I)
|
||||
{
|
||||
$parser = new Parser($this->builder);
|
||||
|
||||
$I->assertInstanceOf(Parser::class, $parser);
|
||||
}
|
||||
|
||||
public function seeParseEmptyAbcWithoutErrors(UnitTester $I)
|
||||
{
|
||||
$abc = '';
|
||||
$parser = new Parser($this->builder);
|
||||
|
||||
$result = $parser->parseABC($abc);
|
||||
$I->assertEmpty($result);
|
||||
}
|
||||
|
||||
public function seeParseABCExample1(UnitTester $I)
|
||||
{
|
||||
$abc = file_get_contents($this->dataDir.'/abc/valid_abc_1.abc');
|
||||
$parser = new Parser($this->builder);
|
||||
$expected = [
|
||||
1 => [
|
||||
'X' => '3',
|
||||
'M' => '4/4',
|
||||
'K' => 'C',
|
||||
'music' => 'gaab babc :|'
|
||||
],
|
||||
];
|
||||
|
||||
$result = $parser->parseABC($abc);
|
||||
$I->assertNotEmpty($result);
|
||||
|
||||
$I->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
public function seeParseABCExample2(UnitTester $I)
|
||||
{
|
||||
$abc = file_get_contents($this->dataDir.'/abc/valid_abc_2.abc');
|
||||
$parser = new Parser($this->builder);
|
||||
$expected = [
|
||||
1 => [
|
||||
'X' => '40',
|
||||
'T' => ['Abbotts Bromley Horn Dance'],
|
||||
'A' => ['trad'],
|
||||
'C' => ['trad.'],
|
||||
'D' => ['None'],
|
||||
'G' => ['lute'],
|
||||
'H' => [
|
||||
'Thousand year old tradition',
|
||||
'The Horns live in the church and are removed for the dance once a year'
|
||||
],
|
||||
'R' => ['Jig'],
|
||||
'F' => ['none.abc'],
|
||||
'B' => ['Traditional English tunes'],
|
||||
'W' => ['None'],
|
||||
'Q' => '1/8=80',
|
||||
'L' => '1/8',
|
||||
'M' => '6/8',
|
||||
'N' => ['Traditional English'],
|
||||
'O' => ['England'],
|
||||
'Z' => ['Andy Hornby'],
|
||||
'S' => ['http://www.leeds.ac.uk/music/Info/RRTuneBk/gettune/00000dab.html'],
|
||||
'P' => 'ABC',
|
||||
'K' => 'G',
|
||||
'music' => 'e|B2e G2e|B2e E2G|FGA GAB|1AGF G2:|2AGF E2|
|
||||
|e|c2e cde|A2c ABc|FGA GFE|_E=EF B,2g|
|
||||
e2g efg|c2e cde|dcB AGF|E3E2
|
||||
|:A|BcB e3|BcB f3|BcB AGF|1G2F G2:|2E3-E2|]'
|
||||
],
|
||||
];
|
||||
|
||||
$result = $parser->parseABC($abc);
|
||||
$I->assertNotEmpty($result);
|
||||
|
||||
$I->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
|
||||
public function seeParseABCExample3(UnitTester $I)
|
||||
{
|
||||
$abc = file_get_contents($this->dataDir.'/abc/valid_abc_3.abc');
|
||||
$parser = new Parser($this->builder);
|
||||
$expected = [
|
||||
'A' => ['trad'],
|
||||
'C' => ['trad.'],
|
||||
'D' => ['None'],
|
||||
'H' => [
|
||||
'Thousand year old tradition',
|
||||
'The Horns live in the church and are removed for the dance once a year'
|
||||
],
|
||||
'R' => ['Jig'],
|
||||
'F' => ['none.abc'],
|
||||
'B' => ['Traditional English tunes'],
|
||||
'L' => '1/8',
|
||||
'M' => '6/8',
|
||||
'N' => ['Traditional English'],
|
||||
'O' => ['England'],
|
||||
'S' => ['http://www.leeds.ac.uk/music/Info/RRTuneBk/gettune/00000dab.html'],
|
||||
'Z' => ['Andy Hornby'],
|
||||
|
||||
1 => [
|
||||
'X' => '3',
|
||||
'M' => '4/4',
|
||||
'K' => 'C',
|
||||
'music' => 'gaab babc :|'
|
||||
]
|
||||
];
|
||||
|
||||
$result = $parser->parseABC($abc);
|
||||
$I->assertNotEmpty($result);
|
||||
|
||||
$I->assertEquals($expected, $result);
|
||||
}
|
||||
}
|
||||
20
tests/functional/laravel5/CollectionCest.php
Normal file
20
tests/functional/laravel5/CollectionCest.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace laravel5;
|
||||
|
||||
use \FunctionalTester;
|
||||
|
||||
class CollectionCest
|
||||
{
|
||||
public function _before(FunctionalTester $I)
|
||||
{
|
||||
}
|
||||
|
||||
public function _after(FunctionalTester $I)
|
||||
{
|
||||
}
|
||||
|
||||
// tests
|
||||
public function tryToTest(FunctionalTester $I)
|
||||
{
|
||||
}
|
||||
}
|
||||
28
tests/functional/laravel5/TuneAttributeCest.php
Normal file
28
tests/functional/laravel5/TuneAttributeCest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
namespace laravel5;
|
||||
|
||||
use \FunctionalTester;
|
||||
use XaiCorp\AbcParser\Models\Laravel5\TuneAttribute;
|
||||
|
||||
class TuneAttributeCest
|
||||
{
|
||||
public function _before(FunctionalTester $I)
|
||||
{
|
||||
}
|
||||
|
||||
public function _after(FunctionalTester $I)
|
||||
{
|
||||
}
|
||||
|
||||
// tests: trying to...
|
||||
public function saveModel(FunctionalTester $I)
|
||||
{
|
||||
$model = new TuneAttribute();
|
||||
|
||||
$model->tune_id = 1;
|
||||
$model->type = 'Title';
|
||||
$model->string = 'a title';
|
||||
$model->ordering = 1;
|
||||
$I->assertCanSave($model);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user