From 4ac97071847fc25245f231789990f79d5b4f18b6 Mon Sep 17 00:00:00 2001 From: richard Date: Tue, 17 Oct 2017 21:56:05 -0400 Subject: [PATCH] add enzyme/axiom interfaces use axiom/RepositoryInterface in tests and store music add axiom/Models/ModelInterface to TuneCollection --- README.md | 13 +- composer.json | 4 +- composer.lock | 221 ++++++++++++++++++++++++++- src/Interfaces/Repository.php | 17 --- src/Models/Memory/Abc.php | 21 ++- src/Models/Memory/TuneCollection.php | 49 +++++- tests/unit/memory/AbcParserTest.php | 8 +- 7 files changed, 308 insertions(+), 25 deletions(-) delete mode 100644 src/Interfaces/Repository.php diff --git a/README.md b/README.md index 6809f17..ad4bb50 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,14 @@ AbcParser Library -convert abc music to and from php objects \ No newline at end of file +convert abc music to and from php objects + + +###Libraries + +####Axiom +https://github.com/enzyme/axiom +Interfaces to help with Hexagonal/Domain based design + +####Freckle +https://github.com/enzyme/freckle +Interpret arrays using dot notation diff --git a/composer.json b/composer.json index 21c9bd4..0c0a426 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,9 @@ "require": { "codeception/codeception": "^2.2", "zackkitzmiller/tiny": "^1.2", - "webpatser/laravel-uuid": "^2.0" + "webpatser/laravel-uuid": "^2.0", + "enzyme/axiom": "^4.2", + "enzyme/freckle": "^0.3.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 24ce507..4897580 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": "23a46e0a07c4770e358d40e41f0013ce", - "content-hash": "cdced1eb71a445814db7193fbddd9637", + "hash": "7d6809dba18aa5191491dfbec9e760f9", + "content-hash": "36e1db11be4cb4e02b3b1a2d09c869ee", "packages": [ { "name": "behat/gherkin", @@ -214,6 +214,171 @@ ], "time": "2015-06-14 21:17:01" }, + { + "name": "enzyme/axiom", + "version": "v4.2.0", + "source": { + "type": "git", + "url": "https://github.com/enzyme/axiom.git", + "reference": "81ba8efa3b27cf9ad277d4f5fb244fdfe160692f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/enzyme/axiom/zipball/81ba8efa3b27cf9ad277d4f5fb244fdfe160692f", + "reference": "81ba8efa3b27cf9ad277d4f5fb244fdfe160692f", + "shasum": "" + }, + "require": { + "enzyme/freckle": "^0.3.0", + "enzyme/parrot": "^0.0.1", + "icanboogie/inflector": "^1.4", + "php": ">=5.5.0", + "symfony/console": "^3.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.8", + "satooshi/php-coveralls": "^0.6.1" + }, + "bin": [ + "bin/axiom" + ], + "type": "library", + "autoload": { + "psr-4": { + "Enzyme\\Axiom\\": "src/", + "Enzyme\\Axiom\\Console\\": "console/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Tristan Strathearn", + "email": "r3oath@gmail.com", + "homepage": "https://github.com/r3oath", + "role": "Senior Web Developer" + } + ], + "description": "A set of interfaces & classes for creating domain driven projects.", + "homepage": "https://github.com/enzyme/axiom", + "keywords": [ + "axiom", + "ddd", + "enzyme", + "hex", + "interfaces", + "php" + ], + "time": "2016-04-03 08:03:32" + }, + { + "name": "enzyme/freckle", + "version": "v0.3.0", + "source": { + "type": "git", + "url": "https://github.com/enzyme/freckle.git", + "reference": "c4782eada4217349a26da2ec277717437a92e39b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/enzyme/freckle/zipball/c4782eada4217349a26da2ec277717437a92e39b", + "reference": "c4782eada4217349a26da2ec277717437a92e39b", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.8", + "satooshi/php-coveralls": "^0.6.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Enzyme\\Freckle\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Tristan Strathearn", + "email": "r3oath@gmail.com", + "homepage": "https://github.com/r3oath", + "role": "Senior Web Developer" + } + ], + "description": "A collection of dot-based information retrieval helpers... wuh?", + "homepage": "https://github.com/enzyme/freckle", + "keywords": [ + "collections", + "dot", + "enzyme", + "freckle", + "information", + "path", + "retrieval" + ], + "time": "2016-04-03 05:46:18" + }, + { + "name": "enzyme/parrot", + "version": "v0.0.1", + "source": { + "type": "git", + "url": "https://github.com/enzyme/parrot.git", + "reference": "e20973c6c48ed88eadbbe382e6f039728b4a9282" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/enzyme/parrot/zipball/e20973c6c48ed88eadbbe382e6f039728b4a9282", + "reference": "e20973c6c48ed88eadbbe382e6f039728b4a9282", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Enzyme\\Parrot\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Tristan Strathearn", + "email": "r3oath@protonmail.ccom", + "homepage": "https://github.com/r3oath", + "role": "Full Stack Developer" + } + ], + "description": "Mockable native static functions for PHP.", + "homepage": "https://github.com/enzyme/parrot", + "keywords": [ + "enzyme", + "functions", + "mockable", + "parrot", + "php", + "primitives", + "static" + ], + "time": "2015-12-14 01:16:37" + }, { "name": "facebook/webdriver", "version": "1.4.1", @@ -447,6 +612,58 @@ ], "time": "2017-03-20 17:10:46" }, + { + "name": "icanboogie/inflector", + "version": "v1.4.4", + "source": { + "type": "git", + "url": "https://github.com/ICanBoogie/Inflector.git", + "reference": "a875d3c16215327e1a2555592b167ae2591c5c2f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ICanBoogie/Inflector/zipball/a875d3c16215327e1a2555592b167ae2591c5c2f", + "reference": "a875d3c16215327e1a2555592b167ae2591c5c2f", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=5.3.4" + }, + "type": "library", + "autoload": { + "classmap": [ + "lib/" + ], + "files": [ + "lib/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Olivier Laviale", + "email": "olivier.laviale@gmail.com", + "homepage": "http://www.weirdog.com/", + "role": "Developer" + } + ], + "description": "Multilingual inflector that transforms words from singular to plural, underscore to camel case, and more.", + "homepage": "http://icanboogie.org/", + "keywords": [ + "camelize", + "hyphenate", + "inflect", + "multilingual", + "pluralize", + "singularize", + "underscore" + ], + "time": "2017-06-30 13:16:14" + }, { "name": "myclabs/deep-copy", "version": "1.6.1", diff --git a/src/Interfaces/Repository.php b/src/Interfaces/Repository.php deleted file mode 100644 index 47d0d8e..0000000 --- a/src/Interfaces/Repository.php +++ /dev/null @@ -1,17 +0,0 @@ -collectionRepository = $collectionRepository; + } + public function newCollection() { $this->collection = new TuneCollection(); @@ -73,6 +90,8 @@ class Abc implements Builder $this->currentSetting->set('music', trim($music)); $this->currentTune->append('collection', $this->currentSetting); $this->collection->append('collection', $this->currentTune); - //TODO: save to repositories + + // save to repositories + $this->collectionRepository->add($this->collection); } } diff --git a/src/Models/Memory/TuneCollection.php b/src/Models/Memory/TuneCollection.php index e8be1b9..4a32210 100644 --- a/src/Models/Memory/TuneCollection.php +++ b/src/Models/Memory/TuneCollection.php @@ -1,6 +1,8 @@ facade = new AbcParser(new Abc()); + + $repository = \Mockery::mock(RepositoryInterface::class) + ->shouldReceive('add')->once() + ->getMock(); + $this->facade = new AbcParser(new Abc($repository)); } private function getValidAbc($filename = '/abc/valid_abc_1.abc')