From 81e40d304ee23aa97e30087cd1c13c29827e546d Mon Sep 17 00:00:00 2001 From: richard Date: Fri, 6 Oct 2017 22:32:31 -0400 Subject: [PATCH] tests and laravel models --- .gitignore | 1 + composer.json | 4 +- composer.lock | 285 ++++++++++++------ ...15_11_07_012716_create_parseabc_tables.php | 32 +- src/Models/Laravel5/Abc.php | 13 +- src/Models/Laravel5/AttributesTrait.php | 2 +- src/Models/Laravel5/Collection.php | 25 +- src/Models/Laravel5/CollectionAttribute.php | 2 +- src/Models/Laravel5/Person.php | 13 +- src/Models/Laravel5/Tune.php | 25 +- src/Models/Laravel5/TuneAttribute.php | 2 +- src/Models/Laravel5/TuneSetting.php | 11 +- src/Models/Laravel5/TuneSettingAttribute.php | 2 +- src/Models/Laravel5/UuidTrait.php | 32 ++ src/Parser.php | 5 +- tests/_bootstrap.php | 3 +- tests/_data/abc/valid_abc_3.abc | 1 + tests/unit/Laravel5/AbcParserCest.php | 3 +- tests/unit/Laravel5/AbcParserDBTest.php | 63 ++++ tests/unit/Laravel5/BaseDbTest.php | 53 ++++ .../unit/Laravel5/CollectionAttributeTest.php | 47 +-- tests/unit/Laravel5/CollectionTest.php | 75 ++--- tests/unit/Laravel5/PersonTest.php | 52 +--- tests/unit/Laravel5/TuneAttributeTest.php | 50 +-- .../Laravel5/TuneSettingAttributeTest.php | 50 +-- tests/unit/Laravel5/TuneSettingTest.php | 54 +--- tests/unit/Laravel5/TuneTest.php | 53 +--- 27 files changed, 495 insertions(+), 463 deletions(-) create mode 100644 src/Models/Laravel5/UuidTrait.php create mode 100644 tests/unit/Laravel5/AbcParserDBTest.php create mode 100644 tests/unit/Laravel5/BaseDbTest.php diff --git a/.gitignore b/.gitignore index f417e74..13377d7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /.idea /vendor +/tests/_output diff --git a/composer.json b/composer.json index 1c08e6f..136b69a 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,9 @@ "require": { "codeception/codeception": "2.1.6", "laravel/laravel": "^5.2", - "aedart/testing-laravel": "1.6.*" + "aedart/testing-laravel": "1.6.*", + "zackkitzmiller/tiny": "^1.2", + "webpatser/laravel-uuid": "^2.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 2f7025e..d3e7694 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "595334937903fee0b5963d39ace649c5", - "content-hash": "c085143f5b8abf98dc7f105acef9b0bb", + "hash": "91d812f35482386e00984e8520bc154d", + "content-hash": "147f347d5d9056262af66ddad147c5ed", "packages": [ { "name": "aedart/testing-laravel", @@ -555,16 +555,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.2.3", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "2e89629ff057ebb49492ba08e6995d3a6a80021b" + "reference": "31382fef2889136415751badebbd1cb022a4ed72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/2e89629ff057ebb49492ba08e6995d3a6a80021b", - "reference": "2e89629ff057ebb49492ba08e6995d3a6a80021b", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/31382fef2889136415751badebbd1cb022a4ed72", + "reference": "31382fef2889136415751badebbd1cb022a4ed72", "shasum": "" }, "require": { @@ -609,7 +609,7 @@ "stream", "uri" ], - "time": "2016-02-18 21:54:00" + "time": "2016-04-13 19:56:01" }, { "name": "hamcrest/hamcrest-php", @@ -803,16 +803,16 @@ }, { "name": "laravel/framework", - "version": "v5.2.26", + "version": "v5.2.29", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "b73ac62506c5c2bd49d87fcb1089f7759431e173" + "reference": "e3d644eb131f18c5f3d28ff7bc678bc797091f20" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/b73ac62506c5c2bd49d87fcb1089f7759431e173", - "reference": "b73ac62506c5c2bd49d87fcb1089f7759431e173", + "url": "https://api.github.com/repos/laravel/framework/zipball/e3d644eb131f18c5f3d28ff7bc678bc797091f20", + "reference": "e3d644eb131f18c5f3d28ff7bc678bc797091f20", "shasum": "" }, "require": { @@ -927,20 +927,20 @@ "framework", "laravel" ], - "time": "2016-03-25 17:12:52" + "time": "2016-04-03 01:43:55" }, { "name": "laravel/laravel", - "version": "v5.2.24", + "version": "v5.2.29", "source": { "type": "git", "url": "https://github.com/laravel/laravel.git", - "reference": "1d5e88d0fb687d8ea57a85f9e5d11e7e63685ae2" + "reference": "9fa63f8ce856ec4b5c7869cd5cd597b66590ea38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/laravel/zipball/1d5e88d0fb687d8ea57a85f9e5d11e7e63685ae2", - "reference": "1d5e88d0fb687d8ea57a85f9e5d11e7e63685ae2", + "url": "https://api.github.com/repos/laravel/laravel/zipball/9fa63f8ce856ec4b5c7869cd5cd597b66590ea38", + "reference": "9fa63f8ce856ec4b5c7869cd5cd597b66590ea38", "shasum": "" }, "require": { @@ -972,7 +972,7 @@ "framework", "laravel" ], - "time": "2016-03-22 18:49:35" + "time": "2016-04-01 21:06:45" }, { "name": "league/flysystem", @@ -1124,16 +1124,16 @@ }, { "name": "monolog/monolog", - "version": "1.18.1", + "version": "1.19.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "a5f2734e8c16f3aa21b3da09715d10e15b4d2d45" + "reference": "5f56ed5212dc509c8dc8caeba2715732abb32dbf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/a5f2734e8c16f3aa21b3da09715d10e15b4d2d45", - "reference": "a5f2734e8c16f3aa21b3da09715d10e15b4d2d45", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/5f56ed5212dc509c8dc8caeba2715732abb32dbf", + "reference": "5f56ed5212dc509c8dc8caeba2715732abb32dbf", "shasum": "" }, "require": { @@ -1148,13 +1148,13 @@ "doctrine/couchdb": "~1.0@dev", "graylog2/gelf-php": "~1.0", "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", "php-console/php-console": "^3.1.3", "phpunit/phpunit": "~4.5", "phpunit/phpunit-mock-objects": "2.3.0", "raven/raven": "^0.13", "ruflin/elastica": ">=0.90 <3.0", - "swiftmailer/swiftmailer": "~5.3", - "videlalvaro/php-amqplib": "~2.4" + "swiftmailer/swiftmailer": "~5.3" }, "suggest": { "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", @@ -1163,11 +1163,11 @@ "ext-mongo": "Allow sending log messages to a MongoDB server", "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", "php-console/php-console": "Allow sending log messages to Google Chrome", "raven/raven": "Allow sending log messages to a Sentry server", "rollbar/rollbar": "Allow sending log messages to Rollbar", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server", - "videlalvaro/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib" + "ruflin/elastica": "Allow sending log messages to an Elastic Search server" }, "type": "library", "extra": { @@ -1198,7 +1198,7 @@ "logging", "psr-3" ], - "time": "2016-03-13 16:08:35" + "time": "2016-04-12 18:29:35" }, { "name": "mtdowling/cron-expression", @@ -2571,16 +2571,16 @@ }, { "name": "symfony/browser-kit", - "version": "v3.0.3", + "version": "v3.0.4", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "dde849a0485b70a24b36f826ed3fb95b904d80c3" + "reference": "e07127ac31230b30887c2dddf3708d883d239b14" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/dde849a0485b70a24b36f826ed3fb95b904d80c3", - "reference": "dde849a0485b70a24b36f826ed3fb95b904d80c3", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/e07127ac31230b30887c2dddf3708d883d239b14", + "reference": "e07127ac31230b30887c2dddf3708d883d239b14", "shasum": "" }, "require": { @@ -2624,20 +2624,20 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2016-01-27 11:34:55" + "time": "2016-03-04 07:55:57" }, { "name": "symfony/console", - "version": "v3.0.3", + "version": "v3.0.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "2ed5e2706ce92313d120b8fe50d1063bcfd12e04" + "reference": "6b1175135bc2a74c08a28d89761272de8beed8cd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/2ed5e2706ce92313d120b8fe50d1063bcfd12e04", - "reference": "2ed5e2706ce92313d120b8fe50d1063bcfd12e04", + "url": "https://api.github.com/repos/symfony/console/zipball/6b1175135bc2a74c08a28d89761272de8beed8cd", + "reference": "6b1175135bc2a74c08a28d89761272de8beed8cd", "shasum": "" }, "require": { @@ -2684,20 +2684,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-02-28 16:24:34" + "time": "2016-03-16 17:00:50" }, { "name": "symfony/css-selector", - "version": "v3.0.3", + "version": "v3.0.4", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "6605602690578496091ac20ec7a5cbd160d4dff4" + "reference": "65e764f404685f2dc20c057e889b3ad04b2e2db0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/6605602690578496091ac20ec7a5cbd160d4dff4", - "reference": "6605602690578496091ac20ec7a5cbd160d4dff4", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/65e764f404685f2dc20c057e889b3ad04b2e2db0", + "reference": "65e764f404685f2dc20c057e889b3ad04b2e2db0", "shasum": "" }, "require": { @@ -2737,20 +2737,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2016-01-27 05:14:46" + "time": "2016-03-04 07:55:57" }, { "name": "symfony/debug", - "version": "v3.0.3", + "version": "v3.0.4", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "29606049ced1ec715475f88d1bbe587252a3476e" + "reference": "a06d10888a45afd97534506afb058ec38d9ba35b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/29606049ced1ec715475f88d1bbe587252a3476e", - "reference": "29606049ced1ec715475f88d1bbe587252a3476e", + "url": "https://api.github.com/repos/symfony/debug/zipball/a06d10888a45afd97534506afb058ec38d9ba35b", + "reference": "a06d10888a45afd97534506afb058ec38d9ba35b", "shasum": "" }, "require": { @@ -2794,20 +2794,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2016-01-27 05:14:46" + "time": "2016-03-30 10:41:14" }, { "name": "symfony/dom-crawler", - "version": "v3.0.3", + "version": "v3.0.4", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "981c8edb4538f88ba976ed44bdcaa683fce3d6c6" + "reference": "18a06d7a9af41718c20764a674a0ebba3bc40d1f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/981c8edb4538f88ba976ed44bdcaa683fce3d6c6", - "reference": "981c8edb4538f88ba976ed44bdcaa683fce3d6c6", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/18a06d7a9af41718c20764a674a0ebba3bc40d1f", + "reference": "18a06d7a9af41718c20764a674a0ebba3bc40d1f", "shasum": "" }, "require": { @@ -2850,20 +2850,20 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2016-02-28 16:24:34" + "time": "2016-03-23 13:23:25" }, { "name": "symfony/event-dispatcher", - "version": "v3.0.3", + "version": "v3.0.4", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "4dd5df31a28c0f82b41cb1e1599b74b5dcdbdafa" + "reference": "9002dcf018d884d294b1ef20a6f968efc1128f39" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/4dd5df31a28c0f82b41cb1e1599b74b5dcdbdafa", - "reference": "4dd5df31a28c0f82b41cb1e1599b74b5dcdbdafa", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/9002dcf018d884d294b1ef20a6f968efc1128f39", + "reference": "9002dcf018d884d294b1ef20a6f968efc1128f39", "shasum": "" }, "require": { @@ -2910,20 +2910,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2016-01-27 05:14:46" + "time": "2016-03-10 10:34:12" }, { "name": "symfony/finder", - "version": "v3.0.3", + "version": "v3.0.4", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "623bda0abd9aa29e529c8e9c08b3b84171914723" + "reference": "c54e407b35bc098916704e9fd090da21da4c4f52" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/623bda0abd9aa29e529c8e9c08b3b84171914723", - "reference": "623bda0abd9aa29e529c8e9c08b3b84171914723", + "url": "https://api.github.com/repos/symfony/finder/zipball/c54e407b35bc098916704e9fd090da21da4c4f52", + "reference": "c54e407b35bc098916704e9fd090da21da4c4f52", "shasum": "" }, "require": { @@ -2959,24 +2959,25 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2016-01-27 05:14:46" + "time": "2016-03-10 11:13:05" }, { "name": "symfony/http-foundation", - "version": "v3.0.3", + "version": "v3.0.4", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "52065702c71743c05d415a8facfcad6d4257e8d7" + "reference": "99f38445a874e7becb8afc4b4a79ee181cf6ec3f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/52065702c71743c05d415a8facfcad6d4257e8d7", - "reference": "52065702c71743c05d415a8facfcad6d4257e8d7", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/99f38445a874e7becb8afc4b4a79ee181cf6ec3f", + "reference": "99f38445a874e7becb8afc4b4a79ee181cf6ec3f", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": ">=5.5.9", + "symfony/polyfill-mbstring": "~1.1" }, "require-dev": { "symfony/expression-language": "~2.8|~3.0" @@ -3011,20 +3012,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2016-02-28 16:24:34" + "time": "2016-03-27 14:50:32" }, { "name": "symfony/http-kernel", - "version": "v3.0.3", + "version": "v3.0.4", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "59c0a1972e9aad87b7a56bbe1ccee26b7535a0db" + "reference": "579f828489659d7b3430f4bd9b67b4618b387dea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/59c0a1972e9aad87b7a56bbe1ccee26b7535a0db", - "reference": "59c0a1972e9aad87b7a56bbe1ccee26b7535a0db", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/579f828489659d7b3430f4bd9b67b4618b387dea", + "reference": "579f828489659d7b3430f4bd9b67b4618b387dea", "shasum": "" }, "require": { @@ -3093,7 +3094,7 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2016-02-28 21:33:13" + "time": "2016-03-25 01:41:20" }, { "name": "symfony/polyfill-mbstring", @@ -3264,16 +3265,16 @@ }, { "name": "symfony/process", - "version": "v3.0.3", + "version": "v3.0.4", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "dfecef47506179db2501430e732adbf3793099c8" + "reference": "e6f1f98bbd355d209a992bfff45e7edfbd4a0776" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/dfecef47506179db2501430e732adbf3793099c8", - "reference": "dfecef47506179db2501430e732adbf3793099c8", + "url": "https://api.github.com/repos/symfony/process/zipball/e6f1f98bbd355d209a992bfff45e7edfbd4a0776", + "reference": "e6f1f98bbd355d209a992bfff45e7edfbd4a0776", "shasum": "" }, "require": { @@ -3309,20 +3310,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2016-02-02 13:44:19" + "time": "2016-03-30 10:41:14" }, { "name": "symfony/routing", - "version": "v3.0.3", + "version": "v3.0.4", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "fa1e9a8173cf0077dd995205da453eacd758fdf6" + "reference": "d061b609f2d0769494c381ec92f5c5cc5e4a20aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/fa1e9a8173cf0077dd995205da453eacd758fdf6", - "reference": "fa1e9a8173cf0077dd995205da453eacd758fdf6", + "url": "https://api.github.com/repos/symfony/routing/zipball/d061b609f2d0769494c381ec92f5c5cc5e4a20aa", + "reference": "d061b609f2d0769494c381ec92f5c5cc5e4a20aa", "shasum": "" }, "require": { @@ -3384,20 +3385,20 @@ "uri", "url" ], - "time": "2016-02-04 13:53:13" + "time": "2016-03-23 13:23:25" }, { "name": "symfony/translation", - "version": "v3.0.3", + "version": "v3.0.4", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "2de0b6f7ebe43cffd8a06996ebec6aab79ea9e91" + "reference": "f7a07af51ea067745a521dab1e3152044a2fb1f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/2de0b6f7ebe43cffd8a06996ebec6aab79ea9e91", - "reference": "2de0b6f7ebe43cffd8a06996ebec6aab79ea9e91", + "url": "https://api.github.com/repos/symfony/translation/zipball/f7a07af51ea067745a521dab1e3152044a2fb1f2", + "reference": "f7a07af51ea067745a521dab1e3152044a2fb1f2", "shasum": "" }, "require": { @@ -3448,20 +3449,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2016-02-02 13:44:19" + "time": "2016-03-25 01:41:20" }, { "name": "symfony/var-dumper", - "version": "v3.0.3", + "version": "v3.0.4", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "9a6a883c48acb215d4825ce9de61dccf93d62074" + "reference": "3841ed86527d18ee2c35fe4afb1b2fc60f8fae79" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/9a6a883c48acb215d4825ce9de61dccf93d62074", - "reference": "9a6a883c48acb215d4825ce9de61dccf93d62074", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/3841ed86527d18ee2c35fe4afb1b2fc60f8fae79", + "reference": "3841ed86527d18ee2c35fe4afb1b2fc60f8fae79", "shasum": "" }, "require": { @@ -3511,20 +3512,20 @@ "debug", "dump" ], - "time": "2016-02-13 09:23:44" + "time": "2016-03-10 10:34:12" }, { "name": "symfony/yaml", - "version": "v3.0.3", + "version": "v3.0.4", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "b5ba64cd67ecd6887f63868fa781ca094bd1377c" + "reference": "0047c8366744a16de7516622c5b7355336afae96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/b5ba64cd67ecd6887f63868fa781ca094bd1377c", - "reference": "b5ba64cd67ecd6887f63868fa781ca094bd1377c", + "url": "https://api.github.com/repos/symfony/yaml/zipball/0047c8366744a16de7516622c5b7355336afae96", + "reference": "0047c8366744a16de7516622c5b7355336afae96", "shasum": "" }, "require": { @@ -3560,7 +3561,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-02-23 15:16:06" + "time": "2016-03-04 07:55:57" }, { "name": "vlucas/phpdotenv", @@ -3612,6 +3613,96 @@ "environment" ], "time": "2015-12-29 15:10:30" + }, + { + "name": "webpatser/laravel-uuid", + "version": "2.0", + "source": { + "type": "git", + "url": "https://github.com/webpatser/laravel-uuid.git", + "reference": "7c0a65be9367b99b7f4c13119c0c6514701de40b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webpatser/laravel-uuid/zipball/7c0a65be9367b99b7f4c13119c0c6514701de40b", + "reference": "7c0a65be9367b99b7f4c13119c0c6514701de40b", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "fzaninotto/faker": "1.5.*", + "phpunit/phpunit": "4.7.*" + }, + "type": "library", + "autoload": { + "psr-0": { + "Webpatser\\Uuid": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christoph Kempen", + "email": "christoph@downsized.nl" + } + ], + "description": "Class to generate a UUID according to the RFC 4122 standard. Support for version 1, 3, 4 and 5 UUID are built-in.", + "homepage": "https://github.com/webpatser/uuid", + "keywords": [ + "UUID RFC4122" + ], + "time": "2015-06-15 21:48:27" + }, + { + "name": "zackkitzmiller/tiny", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/zackkitzmiller/tiny-php.git", + "reference": "25e5cdf77e7966ac11b7ed62bc6647d209c41b26" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zackkitzmiller/tiny-php/zipball/25e5cdf77e7966ac11b7ed62bc6647d209c41b26", + "reference": "25e5cdf77e7966ac11b7ed62bc6647d209c41b26", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "league/phpunit-coverage-listener": "~1.1", + "phpunit/phpunit": "~3.7.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "ZackKitzmiller": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jacob DeHart" + }, + { + "name": "Kyle Bragger" + }, + { + "name": "Zack Kitzmiller", + "email": "zack@inrpce.com" + } + ], + "homepage": "http://github.com/zackkitzmiller/tiny-php", + "time": "2014-06-21 13:09:30" } ], "packages-dev": [], diff --git a/database/migrations/2015_11_07_012716_create_parseabc_tables.php b/database/migrations/2015_11_07_012716_create_parseabc_tables.php index eea6de2..50a9a2f 100644 --- a/database/migrations/2015_11_07_012716_create_parseabc_tables.php +++ b/database/migrations/2015_11_07_012716_create_parseabc_tables.php @@ -13,12 +13,14 @@ class CreateParseabcTables extends Migration public function up() { Schema::create('collections', function (Blueprint $table) { - $table->bigIncrements('id'); - $table->string('name', 255)->unique(); + $table->binary('id'); + $table->string('name', 255)->nullable(); + $table->string('L', 5)->nullable(); + $table->string('meter', 3)->nullable(); $table->timestamps(); }); Schema::create('collection_attributes', function (Blueprint $table) { - $table->bigInteger('collection_id')->unsigned(); + $table->binary('collection_id'); $table->enum('type', ['Author','Composer','Discography','Rhythm','History','File','Book','Note','Source','Transcriber']); $table->string('string', 255); $table->tinyInteger('ordering')->unsigned()->default(0); @@ -36,22 +38,22 @@ class CreateParseabcTables extends Migration // }); Schema::create('persons', function (Blueprint $table) { - $table->bigIncrements('id'); + $table->binary('id'); $table->string('name', 63); $table->string('email', 255); $table->timestamps(); }); Schema::create('tunes', function (Blueprint $table) { - $table->bigIncrements('id'); + $table->binary('id'); $table->tinyInteger('x_id')->default('1'); $table->timestamps(); }); Schema::create('tune_settings', function (Blueprint $table) { - $table->bigIncrements('id'); - $table->bigInteger('tune_id')->unsigned(); + $table->binary('id'); + $table->binary('tune_id'); $table->string('meter', 3)->default('C'); $table->string('keysig',5)->default('C'); $table->string('filename', 255)->nullable(); @@ -63,7 +65,7 @@ class CreateParseabcTables extends Migration $table->foreign('tune_id')->references('id')->on('tunes')->onUpdate('cascade')->onDelete('cascade'); }); Schema::create('tune_attributes', function (Blueprint $table) { - $table->bigInteger('tune_id')->unsigned(); + $table->binary('tune_id'); $table->enum('type', ['Title','Group','Origin','Rhythm','History']); $table->string('string', 255); $table->tinyInteger('ordering')->unsigned()->default(0); @@ -73,8 +75,8 @@ class CreateParseabcTables extends Migration }); Schema::create('tune_books', function (Blueprint $table) { - $table->bigInteger('collection_id')->unsigned(); - $table->bigInteger('setting_id')->unsigned(); + $table->binary('collection_id'); + $table->binary('setting_id'); $table->timestamps(); $table->primary(['collection_id','setting_id']); $table->foreign('collection_id')->references('id')->on('collections')->onUpdate('cascade')->onDelete('cascade'); @@ -82,8 +84,8 @@ class CreateParseabcTables extends Migration }); Schema::create('tune_persons', function (Blueprint $table) { - $table->bigInteger('tune_id')->unsigned(); - $table->bigInteger('person_id')->unsigned(); + $table->binary('tune_id'); + $table->binary('person_id'); $table->enum('type', ['Author','Composer','Transcriber','']); $table->tinyInteger('ordering')->unsigned()->default(0); $table->timestamps(); @@ -93,7 +95,7 @@ class CreateParseabcTables extends Migration }); Schema::create('tune_setting_attributes', function (Blueprint $table) { - $table->bigInteger('setting_id')->unsigned(); + $table->binary('setting_id'); $table->enum('type', ['Transcriber','Note','Discography','Source','Word','Book']); $table->string('string', 255); $table->tinyInteger('ordering')->unsigned()->default(0); @@ -103,8 +105,8 @@ class CreateParseabcTables extends Migration }); Schema::create('tune_setting_persons', function (Blueprint $table) { - $table->bigInteger('setting_id')->unsigned(); - $table->bigInteger('person_id')->unsigned(); + $table->binary('setting_id'); + $table->binary('person_id'); $table->tinyInteger('ordering')->unsigned()->default(0); $table->timestamps(); $table->primary(['setting_id','person_id','ordering']); diff --git a/src/Models/Laravel5/Abc.php b/src/Models/Laravel5/Abc.php index 604c172..e8fe98e 100644 --- a/src/Models/Laravel5/Abc.php +++ b/src/Models/Laravel5/Abc.php @@ -13,11 +13,6 @@ class Abc implements Builder, Manipulator, Exporter */ public $collection; - /** - * @var Tune - */ - public $tune; - /** * @var TuneSetting */ @@ -65,20 +60,24 @@ class Abc implements Builder, Manipulator, Exporter public function appendToTune($key, $data) { - $array = $this->tune->$key; + $array = $this->setting->tune->$key; $array[] = $data; $this->setOnTune($key, $array); } public function setOnTune($key, $data) { - $this->tune->$key = $data; + if ($key == 'X') { + $key = 'x_id'; + } + $this->setting->tune->$key = $data; } public function newSetting() { $this->setting = new TuneSetting(); + $this->setting->tune = $this->tune; } public function appendToSetting($key, $data) diff --git a/src/Models/Laravel5/AttributesTrait.php b/src/Models/Laravel5/AttributesTrait.php index de104b3..ee09000 100644 --- a/src/Models/Laravel5/AttributesTrait.php +++ b/src/Models/Laravel5/AttributesTrait.php @@ -62,7 +62,7 @@ trait AttributesTrait return $model; } - public function save(array $options = []) + public function saveAttributes(array $options = []) { $class = new \ReflectionClass($this->attributesClass); foreach ($class->getStaticPropertyValue('types') as $attribute) { diff --git a/src/Models/Laravel5/Collection.php b/src/Models/Laravel5/Collection.php index c55e667..d2d2324 100644 --- a/src/Models/Laravel5/Collection.php +++ b/src/Models/Laravel5/Collection.php @@ -4,7 +4,7 @@ namespace XaiCorp\AbcParser\Models\Laravel5; class Collection extends ValidatingModel implements \Countable { - use AttributesTrait; + use AttributesTrait, UuidTrait; /** * for AttributesTrait @@ -28,6 +28,7 @@ class Collection extends ValidatingModel implements \Countable protected $fillable = ['name']; protected $hidden = [ + 'id', 'Author', 'Composer', 'Discography', @@ -35,6 +36,7 @@ class Collection extends ValidatingModel implements \Countable 'History', 'File', 'Book', + 'meter', 'Note', 'Origin', 'Source', @@ -63,11 +65,31 @@ class Collection extends ValidatingModel implements \Countable return $this->settings; } + public function save(array $options = []) + { + if (! empty($this->settings)) { + foreach ($this->settings as $setting) { + $saved = $setting->save(); + } + } + return $this->saveAttributes($options); + } + /************************************************************** * mutators and accessors */ + public function getMAttribute() + { + return $this->attributes['meter']; + } + + public function setMAttribute($value) + { + return $this->attributes['meter'] = $value; + } + protected $Author; public function getAAttribute() { @@ -216,6 +238,7 @@ class Collection extends ValidatingModel implements \Countable } } + $arr['M'] = $this->meter; foreach ($arr as $key => $val) { if (empty($val)) { unset($arr[$key]); diff --git a/src/Models/Laravel5/CollectionAttribute.php b/src/Models/Laravel5/CollectionAttribute.php index 2f07975..e6309cd 100644 --- a/src/Models/Laravel5/CollectionAttribute.php +++ b/src/Models/Laravel5/CollectionAttribute.php @@ -16,7 +16,7 @@ class CollectionAttribute extends ValidatingModel * @var array */ protected $validationRules = [ - 'collection_id' => 'required|integer|exists:collections,id', + 'collection_id' => 'required|exists:collections,id', 'type' => 'required|string|in:Author,Composer,Discography,Rhythm,History,File,Book,Note,Source,Transcriber', 'string' => 'required|string|max:255', 'ordering' => 'required|integer' diff --git a/src/Models/Laravel5/Person.php b/src/Models/Laravel5/Person.php index 3707673..570a0bf 100644 --- a/src/Models/Laravel5/Person.php +++ b/src/Models/Laravel5/Person.php @@ -1,12 +1,9 @@ 'required', + 'name' => 'required|string|max:63', + 'email' => 'required|email|max:255' + ]; + protected $hidden = ['email']; //Relationships diff --git a/src/Models/Laravel5/Tune.php b/src/Models/Laravel5/Tune.php index f03f598..ba2f8f8 100644 --- a/src/Models/Laravel5/Tune.php +++ b/src/Models/Laravel5/Tune.php @@ -1,12 +1,9 @@ beginTransaction(); + $savedAttr = $this->saveAttributes($options); + if (isset($this->tune)) { + $savedTune = $this->tune->save(); + } + + if ($savedAttr && $savedTune) { + app('db')->commit(); + return true; + } else { + app('db')->rollBack(); + return false; + } + } /************************************************************** * mutators and accessors diff --git a/src/Models/Laravel5/TuneAttribute.php b/src/Models/Laravel5/TuneAttribute.php index d7dc32d..35e990f 100644 --- a/src/Models/Laravel5/TuneAttribute.php +++ b/src/Models/Laravel5/TuneAttribute.php @@ -16,7 +16,7 @@ class TuneAttribute extends ValidatingModel * @var array */ protected $validationRules = [ - 'tune_id' => 'required|integer|exists:tunes,id', + 'tune_id' => 'required|exists:tunes,id', 'type' => 'required|string|in:Title,Group,Origin,Rhythm,History', 'string' => 'required|string|max:255', 'ordering' => 'required|integer' diff --git a/src/Models/Laravel5/TuneSetting.php b/src/Models/Laravel5/TuneSetting.php index 670a7c6..659ff8e 100644 --- a/src/Models/Laravel5/TuneSetting.php +++ b/src/Models/Laravel5/TuneSetting.php @@ -6,7 +6,7 @@ use XaiCorp\AbcParser\Traits\ValidationTrait; class TuneSetting extends ValidatingModel { - use AttributesTrait; + use AttributesTrait, UuidTrait; /** * for AttributesTrait @@ -25,7 +25,7 @@ class TuneSetting extends ValidatingModel * @var array */ protected $validationRules = [ - 'tune_id' => 'required|integer|min:1|exists:tunes,id', + 'tune_id' => 'required|exists:tunes,id', 'meter' => 'string|max:3', 'keysig' => 'string|max:5', 'filename' => 'string|max:255', @@ -47,10 +47,15 @@ class TuneSetting extends ValidatingModel */ protected $fillable = ['tune_id', 'meter', 'keysig', 'filename', 'tempo', 'L', 'music', 'parts']; - protected $hidden = ['Transcriber', 'Note', 'Discography', 'Source', 'Word', 'Book']; + protected $hidden = ['id', 'tune_id', 'Transcriber', 'Note', 'Discography', 'Source', 'Word', 'Book']; protected $appends = ['Z', 'N', 'D', 'S', 'W', 'B']; + public function save(array $options = []) + { + return $this->saveAttributes($options); + } + /************************************************************** * mutators and accessors diff --git a/src/Models/Laravel5/TuneSettingAttribute.php b/src/Models/Laravel5/TuneSettingAttribute.php index 5eb67b0..00686fd 100644 --- a/src/Models/Laravel5/TuneSettingAttribute.php +++ b/src/Models/Laravel5/TuneSettingAttribute.php @@ -16,7 +16,7 @@ class TuneSettingAttribute extends ValidatingModel * @var array */ protected $validationRules = [ - 'setting_id' => 'required|integer|exists:tune_settings,id', + 'setting_id' => 'required|exists:tune_settings,id', 'type' => 'required|string|in:Transcriber,Note,Discography,Source,Word,Book', 'string' => 'required|string|max:255', 'ordering' => 'required|integer' diff --git a/src/Models/Laravel5/UuidTrait.php b/src/Models/Laravel5/UuidTrait.php new file mode 100644 index 0000000..958f202 --- /dev/null +++ b/src/Models/Laravel5/UuidTrait.php @@ -0,0 +1,32 @@ +attributes['id'] = $uuid; + } + + public function getIdAttribute() + { + if (empty($this->attributes['id'])) { + $uuid = Uuid::generate(4); + $this->attributes['id'] = $uuid; + } + return Uuid::import($this->attributes['id']); + } + + public function setIdAttribute($value) + { + if (empty($this->attributes['id'])) { + $uuid = Uuid::generate(4); + $this->attributes['id'] = $uuid; + } + } +} diff --git a/src/Parser.php b/src/Parser.php index 07b7dd6..4f2f8f2 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -34,12 +34,13 @@ class Parser { } /** - * extract the attibutes from the raw abc + * extract the attributes from the raw abc * @param $abc string containing the raw abc * * @return */ - public function parseABC($abc) { + public function parseABC($abc) + { //tune is either new or existing data has been loaded //create new setting $mode = self::MODE_FILE_HEADER; diff --git a/tests/_bootstrap.php b/tests/_bootstrap.php index 1f234e0..8b0149a 100644 --- a/tests/_bootstrap.php +++ b/tests/_bootstrap.php @@ -1,4 +1,5 @@ [ 'X' => '3', + 'T' => ['Short and Sweet'], 'M' => '4/4', 'K' => 'C', 'music' => 'gaab babc :|' diff --git a/tests/unit/Laravel5/AbcParserDBTest.php b/tests/unit/Laravel5/AbcParserDBTest.php new file mode 100644 index 0000000..f27b99f --- /dev/null +++ b/tests/unit/Laravel5/AbcParserDBTest.php @@ -0,0 +1,63 @@ +dataDir = codecept_data_dir(); + } + + // tests: trying to... + public function testSaveAbcFromExample1() + { + $abc = file_get_contents($this->dataDir.'/abc/valid_abc_1.abc'); + $parser = new Parser($this->builder); + + $result = $parser->parseABC($abc); + $this->assertTrue($result->save()); + } + + public function testSaveAbcFromExample2() + { + $abc = file_get_contents($this->dataDir.'/abc/valid_abc_2.abc'); + $parser = new Parser($this->builder); + + $result = $parser->parseABC($abc); + $this->assertTrue($result->save()); + } + + public function testSaveAbcFromExample3() + { + $abc = file_get_contents($this->dataDir.'/abc/valid_abc_3.abc'); + $parser = new Parser($this->builder); + + $result = $parser->parseABC($abc); + $this->assertTrue($result->save()); + + $this->seeInDatabase('tune_settings', []); + $this->seeInDatabase('tunes', []); + } +} diff --git a/tests/unit/Laravel5/BaseDbTest.php b/tests/unit/Laravel5/BaseDbTest.php new file mode 100644 index 0000000..2e540de --- /dev/null +++ b/tests/unit/Laravel5/BaseDbTest.php @@ -0,0 +1,53 @@ +set('database.default', 'testbench'); + $app['config']->set('database.connections.testbench', [ + 'driver' => 'sqlite', + 'database' => ':memory:', + 'prefix' => '', + ]); + $app->setBasePath(dirname(dirname(dirname(__DIR__)))); + $Artisan = $app->make('Artisan'); + $Artisan::call('migrate'); + } + + protected function _before() + { + $this->startApplication(); + $db = app()->make('db'); + $db->beginTransaction(); + + $this->withFactories(__DIR__ . '/factories'); + $this->builder = new Abc(); + } + + protected function _after() + { + $db = app()->make('db'); + $db->rollBack(); + $this->stopApplication(); + } +} diff --git a/tests/unit/Laravel5/CollectionAttributeTest.php b/tests/unit/Laravel5/CollectionAttributeTest.php index 40fa00e..45355d1 100644 --- a/tests/unit/Laravel5/CollectionAttributeTest.php +++ b/tests/unit/Laravel5/CollectionAttributeTest.php @@ -1,61 +1,22 @@ set('database.default', 'testbench'); - $app['config']->set('database.connections.testbench', [ - 'driver' => 'sqlite', - 'database' => ':memory:', - 'prefix' => '', - ]); - $app->setBasePath(dirname(dirname(dirname(__DIR__)))); - $Artisan = $app->make('Artisan'); - $Artisan::call('migrate'); - - } - - - protected function _before() - { - $this->startApplication(); - $db = app()->make('db'); - $db->beginTransaction(); - - $this->withFactories(__DIR__.'/factories'); - } - - protected function _after() - { - $db = app()->make('db'); - $db->rollBack(); - $this->stopApplication(); - } - // tests: trying to... public function testMakeModel() @@ -128,7 +89,7 @@ class CollectionAttributeTest extends Test public function testTuneIdValidation() { $model = factory(CollectionAttribute::class)->make([]); - $model->collection_id += 1; + $model->collection_id = Uuid::generate(4); $this->assertFalse($model->validate()); } diff --git a/tests/unit/Laravel5/CollectionTest.php b/tests/unit/Laravel5/CollectionTest.php index a6b4451..774cadf 100644 --- a/tests/unit/Laravel5/CollectionTest.php +++ b/tests/unit/Laravel5/CollectionTest.php @@ -1,19 +1,20 @@ set('database.default', 'testbench'); - $app['config']->set('database.connections.testbench', [ - 'driver' => 'sqlite', - 'database' => ':memory:', - 'prefix' => '', - ]); - $app->setBasePath(dirname(dirname(dirname(__DIR__)))); - $Artisan = $app->make('Artisan'); - $Artisan::call('migrate'); - } - - - protected function _before() - { - $this->startApplication(); - $db = app()->make('db'); - $db->beginTransaction(); - - $this->withFactories(__DIR__.'/factories'); - } - - protected function _after() - { - $db = app()->make('db'); - $db->rollBack(); - $this->stopApplication(); - } +// protected function getEnvironmentSetUp($app) +// { +// // Setup default database to use sqlite :memory: +// $app['config']->set('database.default', 'testbench'); +// $app['config']->set('database.connections.testbench', [ +// 'driver' => 'sqlite', +// 'database' => ':memory:', +// 'prefix' => '', +// ]); +// $app->setBasePath(dirname(dirname(dirname(__DIR__)))); +// $Artisan = $app->make('Artisan'); +// $Artisan::call('migrate'); +// } +// +// +// protected function _before() +// { +// $this->startApplication(); +// $db = app()->make('db'); +// $db->beginTransaction(); +// +// $this->withFactories(__DIR__.'/factories'); +// } +// +// protected function _after() +// { +// $db = app()->make('db'); +// $db->rollBack(); +// $this->stopApplication(); +// } // tests: trying to... diff --git a/tests/unit/Laravel5/PersonTest.php b/tests/unit/Laravel5/PersonTest.php index 968f720..844fbfd 100644 --- a/tests/unit/Laravel5/PersonTest.php +++ b/tests/unit/Laravel5/PersonTest.php @@ -1,60 +1,17 @@ set('database.default', 'testbench'); - $app['config']->set('database.connections.testbench', [ - 'driver' => 'mysql', - 'host' => 'localhost', - 'database' => 'abc-api-testing', - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - 'username' => 'abc-api', - 'password' => 'sio2nf0d' - ]); - - } - - - protected function _before() - { - $this->startApplication(); - $db = app()->make('db'); - $db->beginTransaction(); - - $this->withFactories(__DIR__.'/factories'); - } - - protected function _after() - { - $db = app()->make('db'); - $db->rollBack(); - $this->stopApplication(); - } - // tests: trying to... public function testMakeModel() @@ -70,7 +27,10 @@ class PersonTest extends Test public function testNameIsMassAssignable() { $name = "test1"; - $model = Person::create(['name'=>$name]); + $model = Person::create([ + 'name' =>$name, + 'email' => 'me@example.com', + ]); $this->assertInstanceOf(Person::class, $model); $this->assertEquals($name, $model->name); diff --git a/tests/unit/Laravel5/TuneAttributeTest.php b/tests/unit/Laravel5/TuneAttributeTest.php index b85e5fc..22043fb 100644 --- a/tests/unit/Laravel5/TuneAttributeTest.php +++ b/tests/unit/Laravel5/TuneAttributeTest.php @@ -1,62 +1,20 @@ set('database.default', 'testbench'); - $app['config']->set('database.connections.testbench', [ - 'driver' => 'mysql', - 'host' => 'localhost', - 'database' => 'abc-api-testing', - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - 'username' => 'abc-api', - 'password' => 'sio2nf0d' - ]); - - } - - - protected function _before() - { - $this->startApplication(); - $db = app()->make('db'); - $db->beginTransaction(); - - $this->withFactories(__DIR__.'/factories'); - } - - protected function _after() - { - $db = app()->make('db'); - $db->rollBack(); - $this->stopApplication(); - } - // tests: trying to... public function testMakeModel() @@ -129,7 +87,7 @@ class TuneAttributeTest extends Test public function testTuneIdValidation() { $model = factory(TuneAttribute::class)->make([]); - $model->tune_id += 1; + $model->tune_id = Uuid::generate(4); $this->assertFalse($model->validate()); } diff --git a/tests/unit/Laravel5/TuneSettingAttributeTest.php b/tests/unit/Laravel5/TuneSettingAttributeTest.php index 93b4f6b..a172dff 100644 --- a/tests/unit/Laravel5/TuneSettingAttributeTest.php +++ b/tests/unit/Laravel5/TuneSettingAttributeTest.php @@ -1,62 +1,20 @@ set('database.default', 'testbench'); - $app['config']->set('database.connections.testbench', [ - 'driver' => 'mysql', - 'host' => 'localhost', - 'database' => 'abc-api-testing', - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - 'username' => 'abc-api', - 'password' => 'sio2nf0d' - ]); - - } - - - protected function _before() - { - $this->startApplication(); - $db = app()->make('db'); - $db->beginTransaction(); - - $this->withFactories(__DIR__.'/factories'); - } - - protected function _after() - { - $db = app()->make('db'); - $db->rollBack(); - $this->stopApplication(); - } - // tests: trying to... public function testMakeModel() @@ -129,7 +87,7 @@ class TuneSettingAttributeTest extends Test public function testTuneSettingIdValidation() { $model = factory(TuneSettingAttribute::class)->make([]); - $model->setting_id += 1; + $model->setting_id = Uuid::generate(4); $this->assertFalse($model->validate()); } diff --git a/tests/unit/Laravel5/TuneSettingTest.php b/tests/unit/Laravel5/TuneSettingTest.php index ebbc220..d3ed62f 100644 --- a/tests/unit/Laravel5/TuneSettingTest.php +++ b/tests/unit/Laravel5/TuneSettingTest.php @@ -1,5 +1,5 @@ set('database.default', 'testbench'); -// $app['config']->set('database.connections.testbench', [ -// 'driver' => 'mysql', -// 'host' => 'localhost', -// 'database' => 'abc-api-testing', -// 'charset' => 'utf8', -// 'collation' => 'utf8_unicode_ci', -// 'prefix' => '', -// 'strict' => true, -// 'username' => 'abc-api', -// 'password' => 'sio2nf0d' -// ]); - $app['config']->set('database.connections.testbench', [ - 'driver' => 'sqlite', - 'database' => ':memory:', - 'prefix' => '', - ]); - $app->setBasePath(dirname(dirname(dirname(__DIR__)))); - $Artisan = $app->make('Artisan'); - $Artisan::call('migrate'); - } - - - protected function _before() - { - $this->startApplication(); - $db = app()->make('db'); - $db->beginTransaction(); - - $this->withFactories(__DIR__.'/factories'); - } - - protected function _after() - { - $db = app()->make('db'); - $db->rollBack(); - $this->stopApplication(); - } - // tests: trying to... public function testMakeModel() diff --git a/tests/unit/Laravel5/TuneTest.php b/tests/unit/Laravel5/TuneTest.php index 509afd4..d5989a7 100644 --- a/tests/unit/Laravel5/TuneTest.php +++ b/tests/unit/Laravel5/TuneTest.php @@ -1,5 +1,5 @@ set('database.default', 'testbench'); -// $app['config']->set('database.connections.testbench', [ -// 'driver' => 'mysql', -// 'host' => 'localhost', -// 'database' => 'abc-api-testing', -// 'charset' => 'utf8', -// 'collation' => 'utf8_unicode_ci', -// 'prefix' => '', -// 'strict' => true, -// 'username' => 'abc-api', -// 'password' => 'sio2nf0d' -// ]); - $app['config']->set('database.connections.testbench', [ - 'driver' => 'sqlite', - 'database' => ':memory:', - 'prefix' => '', - ]); - $app->setBasePath(dirname(dirname(dirname(__DIR__)))); - $Artisan = $app->make('Artisan'); - $Artisan::call('migrate'); - } - - - protected function _before() - { - $this->startApplication(); - $db = app()->make('db'); - $db->beginTransaction(); - - $this->withFactories(__DIR__.'/factories'); - } - - protected function _after() - { - $db = app()->make('db'); - $db->rollBack(); - $this->stopApplication(); - } // tests: trying to...