From 0cc836192955ae73600c1e383956653c7892d2bf Mon Sep 17 00:00:00 2001 From: richard Date: Tue, 17 Oct 2017 06:41:19 -0400 Subject: [PATCH] Fix the failing unit tests refactor the codestyle for the tests we wanted to keep --- composer.json | 6 +- composer.lock | 2216 +---------------- docker-compose.yml | 2 +- src/Factory.php | 23 - src/Interfaces/Repository.php | 17 + src/Models/Memory/Abc.php | 15 +- src/Parser.php | 14 +- tests/_support/AcceptanceTester.php | 26 - tests/_support/FunctionalTester.php | 26 - tests/_support/Helper/Acceptance.php | 10 - tests/_support/Helper/Functional.php | 10 - .../_generated/AcceptanceTesterActions.php | 441 ++-- .../_support/_generated/UnitTesterActions.php | 257 +- tests/acceptance.suite.yml | 12 - tests/acceptance/_bootstrap.php | 2 - tests/functional.suite.yml | 13 - tests/functional/_bootstrap.php | 2 - tests/functional/laravel5/AbcParserCest.php | 160 -- tests/functional/laravel5/CollectionCest.php | 20 - .../functional/laravel5/TuneAttributeCest.php | 28 - tests/unit/Laravel5/AbcParserDBTest.php | 63 - tests/unit/Laravel5/BaseDbTest.php | 53 - .../unit/Laravel5/CollectionAttributeTest.php | 116 - tests/unit/Laravel5/CollectionTest.php | 523 ---- tests/unit/Laravel5/PersonTest.php | 46 - tests/unit/Laravel5/TuneAttributeTest.php | 114 - .../Laravel5/TuneSettingAttributeTest.php | 114 - tests/unit/Laravel5/TuneSettingTest.php | 328 --- tests/unit/Laravel5/TuneTest.php | 270 -- .../unit/Laravel5/factories/ModelFactory.php | 56 - .../Laravel5/factories/TuneSettingFactory.php | 24 - .../{AbcParserCest.php => ParserCest.php} | 7 +- .../AbcParserCest.php => arr/AbcCest.php} | 91 +- tests/unit/arr/AbcParserCest.php | 154 -- tests/unit/memory/AbcParserTest.php | 180 +- tests/unit/memory/PabcTest.php | 104 - tests/unit/memory/PersonTest.php | 155 +- tests/unit/memory/SettingTest.php | 480 ++-- tests/unit/memory/TuneCollectionTest.php | 265 +- tests/unit/memory/TuneTest.php | 391 ++- 40 files changed, 1395 insertions(+), 5439 deletions(-) delete mode 100644 src/Factory.php create mode 100644 src/Interfaces/Repository.php delete mode 100644 tests/_support/AcceptanceTester.php delete mode 100644 tests/_support/FunctionalTester.php delete mode 100644 tests/_support/Helper/Acceptance.php delete mode 100644 tests/_support/Helper/Functional.php delete mode 100644 tests/acceptance.suite.yml delete mode 100644 tests/acceptance/_bootstrap.php delete mode 100644 tests/functional.suite.yml delete mode 100644 tests/functional/_bootstrap.php delete mode 100644 tests/functional/laravel5/AbcParserCest.php delete mode 100644 tests/functional/laravel5/CollectionCest.php delete mode 100644 tests/functional/laravel5/TuneAttributeCest.php delete mode 100644 tests/unit/Laravel5/AbcParserDBTest.php delete mode 100644 tests/unit/Laravel5/BaseDbTest.php delete mode 100644 tests/unit/Laravel5/CollectionAttributeTest.php delete mode 100644 tests/unit/Laravel5/CollectionTest.php delete mode 100644 tests/unit/Laravel5/PersonTest.php delete mode 100644 tests/unit/Laravel5/TuneAttributeTest.php delete mode 100644 tests/unit/Laravel5/TuneSettingAttributeTest.php delete mode 100644 tests/unit/Laravel5/TuneSettingTest.php delete mode 100644 tests/unit/Laravel5/TuneTest.php delete mode 100644 tests/unit/Laravel5/factories/ModelFactory.php delete mode 100644 tests/unit/Laravel5/factories/TuneSettingFactory.php rename tests/unit/{AbcParserCest.php => ParserCest.php} (94%) rename tests/unit/{Laravel5/AbcParserCest.php => arr/AbcCest.php} (58%) delete mode 100644 tests/unit/arr/AbcParserCest.php delete mode 100644 tests/unit/memory/PabcTest.php diff --git a/composer.json b/composer.json index 9649687..21c9bd4 100644 --- a/composer.json +++ b/composer.json @@ -11,8 +11,6 @@ ], "require": { "codeception/codeception": "^2.2", - "laravel/laravel": "^5.2", - "aedart/testing-laravel": "1.6.*", "zackkitzmiller/tiny": "^1.2", "webpatser/laravel-uuid": "^2.0" }, @@ -20,6 +18,8 @@ "psr-4": { "XaiCorp\\AbcParser\\": "src/" } + }, + "require-dev": { + "mockery/mockery": "^1.0" } - } diff --git a/composer.lock b/composer.lock index 2dd9c0c..24ce507 100644 --- a/composer.lock +++ b/composer.lock @@ -4,59 +4,9 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "2f65cd6c6685a3ff5455e03d85d6a25f", - "content-hash": "feda99e1891c0ad76bbd987247d121a3", + "hash": "23a46e0a07c4770e358d40e41f0013ce", + "content-hash": "cdced1eb71a445814db7193fbddd9637", "packages": [ - { - "name": "aedart/testing-laravel", - "version": "1.6.0", - "source": { - "type": "git", - "url": "https://github.com/aedart/testing-laravel.git", - "reference": "3613aabadd8ec9112607d9cb411741078958be22" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/aedart/testing-laravel/zipball/3613aabadd8ec9112607d9cb411741078958be22", - "reference": "3613aabadd8ec9112607d9cb411741078958be22", - "shasum": "" - }, - "require": { - "codeception/codeception": "~2.1", - "fzaninotto/faker": "~1.5", - "mockery/mockery": "~0.9", - "orchestra/testbench": "~3.2", - "php": ">=5.5.9" - }, - "require-dev": { - "aedart/license": "1.*", - "aedart/license-file-manager": "~1.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "Aedart\\Testing\\Laravel\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Alin Eugen Deac", - "email": "aedart@gmail.com" - } - ], - "description": "Utilities that allows you to test Laravel dependent packages. At its core, this package is a wrapper for the Orchestral Testbench. However, you can make use of this with whatever testing framework you wish; it does not impose you to use neither Orchestral's nor Laravel's TestCase classes.", - "homepage": "https://github.com/aedart/testing-laravel", - "keywords": [ - "laravel", - "orchestral", - "testing" - ], - "time": "2016-01-03 12:05:20" - }, { "name": "behat/gherkin", "version": "v4.4.5", @@ -210,106 +160,6 @@ ], "time": "2017-09-28 23:19:49" }, - { - "name": "dnoegel/php-xdg-base-dir", - "version": "0.1", - "source": { - "type": "git", - "url": "https://github.com/dnoegel/php-xdg-base-dir.git", - "reference": "265b8593498b997dc2d31e75b89f053b5cc9621a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dnoegel/php-xdg-base-dir/zipball/265b8593498b997dc2d31e75b89f053b5cc9621a", - "reference": "265b8593498b997dc2d31e75b89f053b5cc9621a", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "phpunit/phpunit": "@stable" - }, - "type": "project", - "autoload": { - "psr-4": { - "XdgBaseDir\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "implementation of xdg base directory specification for php", - "time": "2014-10-24 07:27:01" - }, - { - "name": "doctrine/inflector", - "version": "v1.2.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/inflector.git", - "reference": "e11d84c6e018beedd929cff5220969a3c6d1d462" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/e11d84c6e018beedd929cff5220969a3c6d1d462", - "reference": "e11d84c6e018beedd929cff5220969a3c6d1d462", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Common String Manipulations with regard to casing and singular/plural rules.", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "inflection", - "pluralize", - "singularize", - "string" - ], - "time": "2017-07-22 12:18:28" - }, { "name": "doctrine/instantiator", "version": "1.0.5", @@ -364,159 +214,6 @@ ], "time": "2015-06-14 21:17:01" }, - { - "name": "doctrine/lexer", - "version": "v1.0.1", - "source": { - "type": "git", - "url": "https://github.com/doctrine/lexer.git", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "Doctrine\\Common\\Lexer\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "lexer", - "parser" - ], - "time": "2014-09-09 13:34:57" - }, - { - "name": "egulias/email-validator", - "version": "2.1.2", - "source": { - "type": "git", - "url": "https://github.com/egulias/EmailValidator.git", - "reference": "bc31baa11ea2883e017f0a10d9722ef9d50eac1c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/bc31baa11ea2883e017f0a10d9722ef9d50eac1c", - "reference": "bc31baa11ea2883e017f0a10d9722ef9d50eac1c", - "shasum": "" - }, - "require": { - "doctrine/lexer": "^1.0.1", - "php": ">= 5.5" - }, - "require-dev": { - "dominicsayers/isemail": "dev-master", - "phpunit/phpunit": "^4.8.0", - "satooshi/php-coveralls": "dev-master" - }, - "suggest": { - "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Egulias\\EmailValidator\\": "EmailValidator" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Eduardo Gulias Davis" - } - ], - "description": "A library for validating emails against several RFCs", - "homepage": "https://github.com/egulias/EmailValidator", - "keywords": [ - "email", - "emailvalidation", - "emailvalidator", - "validation", - "validator" - ], - "time": "2017-01-30 22:07:36" - }, - { - "name": "erusev/parsedown", - "version": "1.6.3", - "source": { - "type": "git", - "url": "https://github.com/erusev/parsedown.git", - "reference": "728952b90a333b5c6f77f06ea9422b94b585878d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/erusev/parsedown/zipball/728952b90a333b5c6f77f06ea9422b94b585878d", - "reference": "728952b90a333b5c6f77f06ea9422b94b585878d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "autoload": { - "psr-0": { - "Parsedown": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Emanuil Rusev", - "email": "hello@erusev.com", - "homepage": "http://erusev.com" - } - ], - "description": "Parser for Markdown.", - "homepage": "http://parsedown.org", - "keywords": [ - "markdown", - "parser" - ], - "time": "2017-05-14 14:47:48" - }, { "name": "facebook/webdriver", "version": "1.4.1", @@ -569,113 +266,6 @@ ], "time": "2017-04-28 14:54:49" }, - { - "name": "fideloper/proxy", - "version": "3.3.4", - "source": { - "type": "git", - "url": "https://github.com/fideloper/TrustedProxy.git", - "reference": "9cdf6f118af58d89764249bbcc7bb260c132924f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/fideloper/TrustedProxy/zipball/9cdf6f118af58d89764249bbcc7bb260c132924f", - "reference": "9cdf6f118af58d89764249bbcc7bb260c132924f", - "shasum": "" - }, - "require": { - "illuminate/contracts": "~5.0", - "php": ">=5.4.0" - }, - "require-dev": { - "illuminate/http": "~5.0", - "mockery/mockery": "~0.9.3", - "phpunit/phpunit": "^5.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - }, - "laravel": { - "providers": [ - "Fideloper\\Proxy\\TrustedProxyServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "Fideloper\\Proxy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Chris Fidao", - "email": "fideloper@gmail.com" - } - ], - "description": "Set trusted proxies for Laravel", - "keywords": [ - "load balancing", - "proxy", - "trusted proxy" - ], - "time": "2017-06-15 17:19:42" - }, - { - "name": "fzaninotto/faker", - "version": "v1.7.1", - "source": { - "type": "git", - "url": "https://github.com/fzaninotto/Faker.git", - "reference": "d3ed4cc37051c1ca52d22d76b437d14809fc7e0d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/d3ed4cc37051c1ca52d22d76b437d14809fc7e0d", - "reference": "d3ed4cc37051c1ca52d22d76b437d14809fc7e0d", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "ext-intl": "*", - "phpunit/phpunit": "^4.0 || ^5.0", - "squizlabs/php_codesniffer": "^1.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.8-dev" - } - }, - "autoload": { - "psr-4": { - "Faker\\": "src/Faker/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "François Zaninotto" - } - ], - "description": "Faker is a PHP library that generates fake data for you.", - "keywords": [ - "data", - "faker", - "fixtures" - ], - "time": "2017-08-15 16:48:10" - }, { "name": "guzzlehttp/guzzle", "version": "6.3.0", @@ -857,655 +447,6 @@ ], "time": "2017-03-20 17:10:46" }, - { - "name": "hamcrest/hamcrest-php", - "version": "v1.2.2", - "source": { - "type": "git", - "url": "https://github.com/hamcrest/hamcrest-php.git", - "reference": "b37020aa976fa52d3de9aa904aa2522dc518f79c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/b37020aa976fa52d3de9aa904aa2522dc518f79c", - "reference": "b37020aa976fa52d3de9aa904aa2522dc518f79c", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "replace": { - "cordoval/hamcrest-php": "*", - "davedevelopment/hamcrest-php": "*", - "kodova/hamcrest-php": "*" - }, - "require-dev": { - "phpunit/php-file-iterator": "1.3.3", - "satooshi/php-coveralls": "dev-master" - }, - "type": "library", - "autoload": { - "classmap": [ - "hamcrest" - ], - "files": [ - "hamcrest/Hamcrest.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD" - ], - "description": "This is the PHP port of Hamcrest Matchers", - "keywords": [ - "test" - ], - "time": "2015-05-11 14:41:42" - }, - { - "name": "jakub-onderka/php-console-color", - "version": "0.1", - "source": { - "type": "git", - "url": "https://github.com/JakubOnderka/PHP-Console-Color.git", - "reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/e0b393dacf7703fc36a4efc3df1435485197e6c1", - "reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "jakub-onderka/php-code-style": "1.0", - "jakub-onderka/php-parallel-lint": "0.*", - "jakub-onderka/php-var-dump-check": "0.*", - "phpunit/phpunit": "3.7.*", - "squizlabs/php_codesniffer": "1.*" - }, - "type": "library", - "autoload": { - "psr-0": { - "JakubOnderka\\PhpConsoleColor": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-2-Clause" - ], - "authors": [ - { - "name": "Jakub Onderka", - "email": "jakub.onderka@gmail.com", - "homepage": "http://www.acci.cz" - } - ], - "time": "2014-04-08 15:00:19" - }, - { - "name": "jakub-onderka/php-console-highlighter", - "version": "v0.3.2", - "source": { - "type": "git", - "url": "https://github.com/JakubOnderka/PHP-Console-Highlighter.git", - "reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Highlighter/zipball/7daa75df45242c8d5b75a22c00a201e7954e4fb5", - "reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5", - "shasum": "" - }, - "require": { - "jakub-onderka/php-console-color": "~0.1", - "php": ">=5.3.0" - }, - "require-dev": { - "jakub-onderka/php-code-style": "~1.0", - "jakub-onderka/php-parallel-lint": "~0.5", - "jakub-onderka/php-var-dump-check": "~0.1", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~1.5" - }, - "type": "library", - "autoload": { - "psr-0": { - "JakubOnderka\\PhpConsoleHighlighter": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jakub Onderka", - "email": "acci@acci.cz", - "homepage": "http://www.acci.cz/" - } - ], - "time": "2015-04-20 18:58:01" - }, - { - "name": "laravel/framework", - "version": "v5.5.14", - "source": { - "type": "git", - "url": "https://github.com/laravel/framework.git", - "reference": "26c700eb79e5bb55b59df2c495c9c71f16f43302" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/26c700eb79e5bb55b59df2c495c9c71f16f43302", - "reference": "26c700eb79e5bb55b59df2c495c9c71f16f43302", - "shasum": "" - }, - "require": { - "doctrine/inflector": "~1.1", - "erusev/parsedown": "~1.6", - "ext-mbstring": "*", - "ext-openssl": "*", - "league/flysystem": "~1.0", - "monolog/monolog": "~1.12", - "mtdowling/cron-expression": "~1.0", - "nesbot/carbon": "~1.20", - "php": ">=7.0", - "psr/container": "~1.0", - "psr/simple-cache": "^1.0", - "ramsey/uuid": "~3.0", - "swiftmailer/swiftmailer": "~6.0", - "symfony/console": "~3.3", - "symfony/debug": "~3.3", - "symfony/finder": "~3.3", - "symfony/http-foundation": "~3.3", - "symfony/http-kernel": "~3.3", - "symfony/process": "~3.3", - "symfony/routing": "~3.3", - "symfony/var-dumper": "~3.3", - "tijsverkoyen/css-to-inline-styles": "~2.2", - "vlucas/phpdotenv": "~2.2" - }, - "replace": { - "illuminate/auth": "self.version", - "illuminate/broadcasting": "self.version", - "illuminate/bus": "self.version", - "illuminate/cache": "self.version", - "illuminate/config": "self.version", - "illuminate/console": "self.version", - "illuminate/container": "self.version", - "illuminate/contracts": "self.version", - "illuminate/cookie": "self.version", - "illuminate/database": "self.version", - "illuminate/encryption": "self.version", - "illuminate/events": "self.version", - "illuminate/exception": "self.version", - "illuminate/filesystem": "self.version", - "illuminate/hashing": "self.version", - "illuminate/http": "self.version", - "illuminate/log": "self.version", - "illuminate/mail": "self.version", - "illuminate/notifications": "self.version", - "illuminate/pagination": "self.version", - "illuminate/pipeline": "self.version", - "illuminate/queue": "self.version", - "illuminate/redis": "self.version", - "illuminate/routing": "self.version", - "illuminate/session": "self.version", - "illuminate/support": "self.version", - "illuminate/translation": "self.version", - "illuminate/validation": "self.version", - "illuminate/view": "self.version", - "tightenco/collect": "self.version" - }, - "require-dev": { - "aws/aws-sdk-php": "~3.0", - "doctrine/dbal": "~2.5", - "filp/whoops": "^2.1.4", - "mockery/mockery": "~1.0", - "orchestra/testbench-core": "3.5.*", - "pda/pheanstalk": "~3.0", - "phpunit/phpunit": "~6.0", - "predis/predis": "^1.1.1", - "symfony/css-selector": "~3.3", - "symfony/dom-crawler": "~3.3" - }, - "suggest": { - "aws/aws-sdk-php": "Required to use the SQS queue driver and SES mail driver (~3.0).", - "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.5).", - "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).", - "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers and the ping methods on schedules (~6.0).", - "laravel/tinker": "Required to use the tinker console command (~1.0).", - "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (~1.0).", - "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (~1.0).", - "nexmo/client": "Required to use the Nexmo transport (~1.0).", - "pda/pheanstalk": "Required to use the beanstalk queue driver (~3.0).", - "predis/predis": "Required to use the redis cache and queue drivers (~1.0).", - "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (~2.0).", - "symfony/css-selector": "Required to use some of the crawler integration testing tools (~3.3).", - "symfony/dom-crawler": "Required to use most of the crawler integration testing tools (~3.3).", - "symfony/psr-http-message-bridge": "Required to psr7 bridging features (~1.0)." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.5-dev" - } - }, - "autoload": { - "files": [ - "src/Illuminate/Foundation/helpers.php", - "src/Illuminate/Support/helpers.php" - ], - "psr-4": { - "Illuminate\\": "src/Illuminate/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "The Laravel Framework.", - "homepage": "https://laravel.com", - "keywords": [ - "framework", - "laravel" - ], - "time": "2017-10-03 17:41:03" - }, - { - "name": "laravel/laravel", - "version": "v5.5.0", - "source": { - "type": "git", - "url": "https://github.com/laravel/laravel.git", - "reference": "a6c68c24c9938beef0128c3288502b8fbdf8e93d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laravel/laravel/zipball/a6c68c24c9938beef0128c3288502b8fbdf8e93d", - "reference": "a6c68c24c9938beef0128c3288502b8fbdf8e93d", - "shasum": "" - }, - "require": { - "fideloper/proxy": "~3.3", - "laravel/framework": "5.5.*", - "laravel/tinker": "~1.0", - "php": ">=7.0.0" - }, - "require-dev": { - "filp/whoops": "~2.0", - "fzaninotto/faker": "~1.4", - "mockery/mockery": "0.9.*", - "phpunit/phpunit": "~6.0" - }, - "type": "project", - "extra": { - "laravel": { - "dont-discover": [] - } - }, - "autoload": { - "classmap": [ - "database/seeds", - "database/factories" - ], - "psr-4": { - "App\\": "app/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "The Laravel Framework.", - "keywords": [ - "framework", - "laravel" - ], - "time": "2017-08-30 09:55:27" - }, - { - "name": "laravel/tinker", - "version": "v1.0.2", - "source": { - "type": "git", - "url": "https://github.com/laravel/tinker.git", - "reference": "203978fd67f118902acff95925847e70b72e3daf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laravel/tinker/zipball/203978fd67f118902acff95925847e70b72e3daf", - "reference": "203978fd67f118902acff95925847e70b72e3daf", - "shasum": "" - }, - "require": { - "illuminate/console": "~5.1", - "illuminate/contracts": "~5.1", - "illuminate/support": "~5.1", - "php": ">=5.5.9", - "psy/psysh": "0.7.*|0.8.*", - "symfony/var-dumper": "~3.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" - }, - "suggest": { - "illuminate/database": "The Illuminate Database package (~5.1)." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - }, - "laravel": { - "providers": [ - "Laravel\\Tinker\\TinkerServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "Laravel\\Tinker\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "Powerful REPL for the Laravel framework.", - "keywords": [ - "REPL", - "Tinker", - "laravel", - "psysh" - ], - "time": "2017-07-13 13:11:05" - }, - { - "name": "league/flysystem", - "version": "1.0.41", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/flysystem.git", - "reference": "f400aa98912c561ba625ea4065031b7a41e5a155" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/f400aa98912c561ba625ea4065031b7a41e5a155", - "reference": "f400aa98912c561ba625ea4065031b7a41e5a155", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "conflict": { - "league/flysystem-sftp": "<1.0.6" - }, - "require-dev": { - "ext-fileinfo": "*", - "mockery/mockery": "~0.9", - "phpspec/phpspec": "^2.2", - "phpunit/phpunit": "~4.8" - }, - "suggest": { - "ext-fileinfo": "Required for MimeType", - "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", - "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", - "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", - "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", - "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", - "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", - "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", - "league/flysystem-webdav": "Allows you to use WebDAV storage", - "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", - "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", - "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "psr-4": { - "League\\Flysystem\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Frank de Jonge", - "email": "info@frenky.net" - } - ], - "description": "Filesystem abstraction: Many filesystems, one API.", - "keywords": [ - "Cloud Files", - "WebDAV", - "abstraction", - "aws", - "cloud", - "copy.com", - "dropbox", - "file systems", - "files", - "filesystem", - "filesystems", - "ftp", - "rackspace", - "remote", - "s3", - "sftp", - "storage" - ], - "time": "2017-08-06 17:41:04" - }, - { - "name": "mockery/mockery", - "version": "0.9.9", - "source": { - "type": "git", - "url": "https://github.com/mockery/mockery.git", - "reference": "6fdb61243844dc924071d3404bb23994ea0b6856" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/6fdb61243844dc924071d3404bb23994ea0b6856", - "reference": "6fdb61243844dc924071d3404bb23994ea0b6856", - "shasum": "" - }, - "require": { - "hamcrest/hamcrest-php": "~1.1", - "lib-pcre": ">=7.0", - "php": ">=5.3.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.9.x-dev" - } - }, - "autoload": { - "psr-0": { - "Mockery": "library/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Pádraic Brady", - "email": "padraic.brady@gmail.com", - "homepage": "http://blog.astrumfutura.com" - }, - { - "name": "Dave Marshall", - "email": "dave.marshall@atstsolutions.co.uk", - "homepage": "http://davedevelopment.co.uk" - } - ], - "description": "Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.", - "homepage": "http://github.com/padraic/mockery", - "keywords": [ - "BDD", - "TDD", - "library", - "mock", - "mock objects", - "mockery", - "stub", - "test", - "test double", - "testing" - ], - "time": "2017-02-28 12:52:32" - }, - { - "name": "monolog/monolog", - "version": "1.23.0", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/monolog.git", - "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4", - "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "psr/log": "~1.0" - }, - "provide": { - "psr/log-implementation": "1.0.0" - }, - "require-dev": { - "aws/aws-sdk-php": "^2.4.9 || ^3.0", - "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", - "ruflin/elastica": ">=0.90 <3.0", - "sentry/sentry": "^0.13", - "swiftmailer/swiftmailer": "^5.3|^6.0" - }, - "suggest": { - "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", - "doctrine/couchdb": "Allow sending log messages to a CouchDB server", - "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", - "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", - "rollbar/rollbar": "Allow sending log messages to Rollbar", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server", - "sentry/sentry": "Allow sending log messages to a Sentry server" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Monolog\\": "src/Monolog" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "Sends your logs to files, sockets, inboxes, databases and various web services", - "homepage": "http://github.com/Seldaek/monolog", - "keywords": [ - "log", - "logging", - "psr-3" - ], - "time": "2017-06-19 01:22:40" - }, - { - "name": "mtdowling/cron-expression", - "version": "v1.2.0", - "source": { - "type": "git", - "url": "https://github.com/mtdowling/cron-expression.git", - "reference": "9504fa9ea681b586028adaaa0877db4aecf32bad" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/mtdowling/cron-expression/zipball/9504fa9ea681b586028adaaa0877db4aecf32bad", - "reference": "9504fa9ea681b586028adaaa0877db4aecf32bad", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Cron\\": "src/Cron/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due", - "keywords": [ - "cron", - "schedule" - ], - "time": "2017-01-23 04:29:33" - }, { "name": "myclabs/deep-copy", "version": "1.6.1", @@ -1548,279 +489,6 @@ ], "time": "2017-04-12 18:52:22" }, - { - "name": "nesbot/carbon", - "version": "1.22.1", - "source": { - "type": "git", - "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc", - "reference": "7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "symfony/translation": "~2.6 || ~3.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "~2", - "phpunit/phpunit": "~4.0 || ~5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.23-dev" - } - }, - "autoload": { - "psr-4": { - "Carbon\\": "src/Carbon/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Brian Nesbitt", - "email": "brian@nesbot.com", - "homepage": "http://nesbot.com" - } - ], - "description": "A simple API extension for DateTime.", - "homepage": "http://carbon.nesbot.com", - "keywords": [ - "date", - "datetime", - "time" - ], - "time": "2017-01-16 07:55:07" - }, - { - "name": "nikic/php-parser", - "version": "v3.1.1", - "source": { - "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "a1e8e1a30e1352f118feff1a8481066ddc2f234a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a1e8e1a30e1352f118feff1a8481066ddc2f234a", - "reference": "a1e8e1a30e1352f118feff1a8481066ddc2f234a", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" - }, - "bin": [ - "bin/php-parse" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "PhpParser\\": "lib/PhpParser" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Nikita Popov" - } - ], - "description": "A PHP parser written in PHP", - "keywords": [ - "parser", - "php" - ], - "time": "2017-09-02 17:10:46" - }, - { - "name": "orchestra/testbench", - "version": "v3.5.1", - "source": { - "type": "git", - "url": "https://github.com/orchestral/testbench.git", - "reference": "2b2feb99e4254632cf301116a1de2231c0ec632c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/orchestral/testbench/zipball/2b2feb99e4254632cf301116a1de2231c0ec632c", - "reference": "2b2feb99e4254632cf301116a1de2231c0ec632c", - "shasum": "" - }, - "require": { - "laravel/framework": "~5.5.0", - "orchestra/testbench-core": "~3.5.2", - "php": ">=7.0", - "phpunit/phpunit": "~6.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "orchestra/database": "~3.5.0" - }, - "suggest": { - "orchestra/testbench-browser-kit": "Allow to use legacy BrowserKit for testing (~3.5)." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.5-dev" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mior Muhammad Zaki", - "email": "crynobone@gmail.com", - "homepage": "https://github.com/crynobone" - } - ], - "description": "Laravel Testing Helper for Packages Development", - "homepage": "http://orchestraplatform.com/docs/latest/components/testbench/", - "keywords": [ - "BDD", - "TDD", - "laravel", - "orchestra-platform", - "orchestral", - "testing" - ], - "time": "2017-10-02 11:53:09" - }, - { - "name": "orchestra/testbench-core", - "version": "v3.5.3", - "source": { - "type": "git", - "url": "https://github.com/orchestral/testbench-core.git", - "reference": "67502c4a5f2836681afa35e00ef1c91be5ff94f8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/67502c4a5f2836681afa35e00ef1c91be5ff94f8", - "reference": "67502c4a5f2836681afa35e00ef1c91be5ff94f8", - "shasum": "" - }, - "require": { - "fzaninotto/faker": "~1.4", - "php": ">=7.0" - }, - "require-dev": { - "laravel/framework": "~5.5.0", - "mockery/mockery": "^0.9.4", - "orchestra/database": "~3.5.0", - "phpunit/phpunit": "~6.0" - }, - "suggest": { - "laravel/framework": "Required for testing (~5.5.0).", - "mockery/mockery": "Allow to use Mockery for testing (^0.9.4).", - "orchestra/database": "Allow to use --realpath migration for testing (~3.5).", - "orchestra/testbench-browser-kit": "Allow to use legacy BrowserKit for testing (~3.5).", - "phpunit/phpunit": "Allow to use PHPUnit for testing (~6.0)." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.5-dev" - } - }, - "autoload": { - "psr-4": { - "Orchestra\\Testbench\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mior Muhammad Zaki", - "email": "crynobone@gmail.com", - "homepage": "https://github.com/crynobone" - } - ], - "description": "Testing Helper for Laravel Development", - "homepage": "http://orchestraplatform.com/docs/latest/components/testbench/", - "keywords": [ - "BDD", - "TDD", - "laravel", - "orchestra-platform", - "orchestral", - "testing" - ], - "time": "2017-10-07 12:09:21" - }, - { - "name": "paragonie/random_compat", - "version": "v2.0.11", - "source": { - "type": "git", - "url": "https://github.com/paragonie/random_compat.git", - "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8", - "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8", - "shasum": "" - }, - "require": { - "php": ">=5.2.0" - }, - "require-dev": { - "phpunit/phpunit": "4.*|5.*" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." - }, - "type": "library", - "autoload": { - "files": [ - "lib/random.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" - } - ], - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", - "keywords": [ - "csprng", - "pseudorandom", - "random" - ], - "time": "2017-09-27 21:40:39" - }, { "name": "phar-io/manifest", "version": "1.0.1", @@ -2384,16 +1052,16 @@ }, { "name": "phpunit/phpunit", - "version": "6.4.1", + "version": "6.4.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "b770d8ba7e60295ee91d69d5a5e01ae833cac220" + "reference": "ae6e2e062ff55263c7b04374c190aca45872b26a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b770d8ba7e60295ee91d69d5a5e01ae833cac220", - "reference": "b770d8ba7e60295ee91d69d5a5e01ae833cac220", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ae6e2e062ff55263c7b04374c190aca45872b26a", + "reference": "ae6e2e062ff55263c7b04374c190aca45872b26a", "shasum": "" }, "require": { @@ -2464,7 +1132,7 @@ "testing", "xunit" ], - "time": "2017-10-07 17:53:53" + "time": "2017-10-15 06:16:19" }, { "name": "phpunit/phpunit-mock-objects", @@ -2525,55 +1193,6 @@ ], "time": "2017-08-03 14:08:16" }, - { - "name": "psr/container", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "time": "2017-02-14 16:28:37" - }, { "name": "psr/http-message", "version": "1.0.1", @@ -2671,209 +1290,6 @@ ], "time": "2016-10-10 12:19:37" }, - { - "name": "psr/simple-cache", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/simple-cache.git", - "reference": "753fa598e8f3b9966c886fe13f370baa45ef0e24" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/753fa598e8f3b9966c886fe13f370baa45ef0e24", - "reference": "753fa598e8f3b9966c886fe13f370baa45ef0e24", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\SimpleCache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interfaces for simple caching", - "keywords": [ - "cache", - "caching", - "psr", - "psr-16", - "simple-cache" - ], - "time": "2017-01-02 13:31:39" - }, - { - "name": "psy/psysh", - "version": "v0.8.11", - "source": { - "type": "git", - "url": "https://github.com/bobthecow/psysh.git", - "reference": "b193cd020e8c6b66cea6457826ae005e94e6d2c0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/b193cd020e8c6b66cea6457826ae005e94e6d2c0", - "reference": "b193cd020e8c6b66cea6457826ae005e94e6d2c0", - "shasum": "" - }, - "require": { - "dnoegel/php-xdg-base-dir": "0.1", - "jakub-onderka/php-console-highlighter": "0.3.*", - "nikic/php-parser": "~1.3|~2.0|~3.0", - "php": ">=5.3.9", - "symfony/console": "~2.3.10|^2.4.2|~3.0", - "symfony/var-dumper": "~2.7|~3.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "~1.11", - "hoa/console": "~3.16|~1.14", - "phpunit/phpunit": "~4.4|~5.0", - "symfony/finder": "~2.1|~3.0" - }, - "suggest": { - "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", - "ext-pdo-sqlite": "The doc command requires SQLite to work.", - "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.", - "ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history.", - "hoa/console": "A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit." - }, - "bin": [ - "bin/psysh" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-develop": "0.8.x-dev" - } - }, - "autoload": { - "files": [ - "src/Psy/functions.php" - ], - "psr-4": { - "Psy\\": "src/Psy/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Justin Hileman", - "email": "justin@justinhileman.info", - "homepage": "http://justinhileman.com" - } - ], - "description": "An interactive shell for modern PHP.", - "homepage": "http://psysh.org", - "keywords": [ - "REPL", - "console", - "interactive", - "shell" - ], - "time": "2017-07-29 19:30:02" - }, - { - "name": "ramsey/uuid", - "version": "3.7.1", - "source": { - "type": "git", - "url": "https://github.com/ramsey/uuid.git", - "reference": "45cffe822057a09e05f7bd09ec5fb88eeecd2334" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/45cffe822057a09e05f7bd09ec5fb88eeecd2334", - "reference": "45cffe822057a09e05f7bd09ec5fb88eeecd2334", - "shasum": "" - }, - "require": { - "paragonie/random_compat": "^1.0|^2.0", - "php": "^5.4 || ^7.0" - }, - "replace": { - "rhumsaa/uuid": "self.version" - }, - "require-dev": { - "apigen/apigen": "^4.1", - "codeception/aspect-mock": "^1.0 | ^2.0", - "doctrine/annotations": "~1.2.0", - "goaop/framework": "1.0.0-alpha.2 | ^1.0 | ^2.1", - "ircmaxell/random-lib": "^1.1", - "jakub-onderka/php-parallel-lint": "^0.9.0", - "mockery/mockery": "^0.9.4", - "moontoast/math": "^1.1", - "php-mock/php-mock-phpunit": "^0.3|^1.1", - "phpunit/phpunit": "^4.7|>=5.0 <5.4", - "satooshi/php-coveralls": "^0.6.1", - "squizlabs/php_codesniffer": "^2.3" - }, - "suggest": { - "ext-libsodium": "Provides the PECL libsodium extension for use with the SodiumRandomGenerator", - "ext-uuid": "Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator", - "ircmaxell/random-lib": "Provides RandomLib for use with the RandomLibAdapter", - "moontoast/math": "Provides support for converting UUID to 128-bit integer (in string form).", - "ramsey/uuid-console": "A console application for generating UUIDs with ramsey/uuid", - "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Ramsey\\Uuid\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marijn Huizendveld", - "email": "marijn.huizendveld@gmail.com" - }, - { - "name": "Thibaud Fabre", - "email": "thibaud@aztech.io" - }, - { - "name": "Ben Ramsey", - "email": "ben@benramsey.com", - "homepage": "https://benramsey.com" - } - ], - "description": "Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).", - "homepage": "https://github.com/ramsey/uuid", - "keywords": [ - "guid", - "identifier", - "uuid" - ], - "time": "2017-09-22 20:46:04" - }, { "name": "sebastian/code-unit-reverse-lookup", "version": "1.0.1", @@ -3478,61 +1894,6 @@ "description": "Automatic BASH completion for Symfony Console Component based applications.", "time": "2016-02-24 05:08:54" }, - { - "name": "swiftmailer/swiftmailer", - "version": "v6.0.2", - "source": { - "type": "git", - "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "412333372fb6c8ffb65496a2bbd7321af75733fc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/412333372fb6c8ffb65496a2bbd7321af75733fc", - "reference": "412333372fb6c8ffb65496a2bbd7321af75733fc", - "shasum": "" - }, - "require": { - "egulias/email-validator": "~2.0", - "php": ">=7.0.0" - }, - "require-dev": { - "mockery/mockery": "~0.9.1", - "symfony/phpunit-bridge": "~3.3@dev" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.0-dev" - } - }, - "autoload": { - "files": [ - "lib/swift_required.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Chris Corbyn" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Swiftmailer, free feature-rich PHP mailer", - "homepage": "http://swiftmailer.symfony.com", - "keywords": [ - "email", - "mail", - "mailer" - ], - "time": "2017-09-30 22:39:41" - }, { "name": "symfony/browser-kit", "version": "v3.3.6", @@ -3936,145 +2297,6 @@ "homepage": "https://symfony.com", "time": "2017-06-01 21:01:25" }, - { - "name": "symfony/http-foundation", - "version": "v3.3.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-foundation.git", - "reference": "49e8cd2d59a7aa9bfab19e46de680c76e500a031" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/49e8cd2d59a7aa9bfab19e46de680c76e500a031", - "reference": "49e8cd2d59a7aa9bfab19e46de680c76e500a031", - "shasum": "" - }, - "require": { - "php": ">=5.5.9", - "symfony/polyfill-mbstring": "~1.1" - }, - "require-dev": { - "symfony/expression-language": "~2.8|~3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpFoundation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony HttpFoundation Component", - "homepage": "https://symfony.com", - "time": "2017-07-21 11:04:46" - }, - { - "name": "symfony/http-kernel", - "version": "v3.3.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-kernel.git", - "reference": "db10d05f1d95e4168e638db7a81c79616f568ea5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/db10d05f1d95e4168e638db7a81c79616f568ea5", - "reference": "db10d05f1d95e4168e638db7a81c79616f568ea5", - "shasum": "" - }, - "require": { - "php": ">=5.5.9", - "psr/log": "~1.0", - "symfony/debug": "~2.8|~3.0", - "symfony/event-dispatcher": "~2.8|~3.0", - "symfony/http-foundation": "~3.3" - }, - "conflict": { - "symfony/config": "<2.8", - "symfony/dependency-injection": "<3.3", - "symfony/var-dumper": "<3.3", - "twig/twig": "<1.34|<2.4,>=2" - }, - "require-dev": { - "psr/cache": "~1.0", - "symfony/browser-kit": "~2.8|~3.0", - "symfony/class-loader": "~2.8|~3.0", - "symfony/config": "~2.8|~3.0", - "symfony/console": "~2.8|~3.0", - "symfony/css-selector": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/dom-crawler": "~2.8|~3.0", - "symfony/expression-language": "~2.8|~3.0", - "symfony/finder": "~2.8|~3.0", - "symfony/process": "~2.8|~3.0", - "symfony/routing": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0", - "symfony/templating": "~2.8|~3.0", - "symfony/translation": "~2.8|~3.0", - "symfony/var-dumper": "~3.3" - }, - "suggest": { - "symfony/browser-kit": "", - "symfony/class-loader": "", - "symfony/config": "", - "symfony/console": "", - "symfony/dependency-injection": "", - "symfony/finder": "", - "symfony/var-dumper": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpKernel\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony HttpKernel Component", - "homepage": "https://symfony.com", - "time": "2017-08-01 10:25:59" - }, { "name": "symfony/polyfill-mbstring", "version": "v1.5.0", @@ -4183,217 +2405,6 @@ "homepage": "https://symfony.com", "time": "2017-07-13 13:05:09" }, - { - "name": "symfony/routing", - "version": "v3.3.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/routing.git", - "reference": "4aee1a917fd4859ff8b51b9fd1dfb790a5ecfa26" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/4aee1a917fd4859ff8b51b9fd1dfb790a5ecfa26", - "reference": "4aee1a917fd4859ff8b51b9fd1dfb790a5ecfa26", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "conflict": { - "symfony/config": "<2.8", - "symfony/dependency-injection": "<3.3", - "symfony/yaml": "<3.3" - }, - "require-dev": { - "doctrine/annotations": "~1.0", - "doctrine/common": "~2.2", - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/expression-language": "~2.8|~3.0", - "symfony/http-foundation": "~2.8|~3.0", - "symfony/yaml": "~3.3" - }, - "suggest": { - "doctrine/annotations": "For using the annotation loader", - "symfony/config": "For using the all-in-one router or any loader", - "symfony/dependency-injection": "For loading routes from a service", - "symfony/expression-language": "For using expression matching", - "symfony/http-foundation": "For using a Symfony Request object", - "symfony/yaml": "For using the YAML loader" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Routing\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Routing Component", - "homepage": "https://symfony.com", - "keywords": [ - "router", - "routing", - "uri", - "url" - ], - "time": "2017-07-21 17:43:13" - }, - { - "name": "symfony/translation", - "version": "v3.3.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/translation.git", - "reference": "35dd5fb003c90e8bd4d8cabdf94bf9c96d06fdc3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/35dd5fb003c90e8bd4d8cabdf94bf9c96d06fdc3", - "reference": "35dd5fb003c90e8bd4d8cabdf94bf9c96d06fdc3", - "shasum": "" - }, - "require": { - "php": ">=5.5.9", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/config": "<2.8", - "symfony/yaml": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/intl": "^2.8.18|^3.2.5", - "symfony/yaml": "~3.3" - }, - "suggest": { - "psr/log": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Translation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Translation Component", - "homepage": "https://symfony.com", - "time": "2017-06-24 16:45:30" - }, - { - "name": "symfony/var-dumper", - "version": "v3.3.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/var-dumper.git", - "reference": "b2623bccb969ad595c2090f9be498b74670d0663" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/b2623bccb969ad595c2090f9be498b74670d0663", - "reference": "b2623bccb969ad595c2090f9be498b74670d0663", - "shasum": "" - }, - "require": { - "php": ">=5.5.9", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" - }, - "require-dev": { - "ext-iconv": "*", - "twig/twig": "~1.34|~2.4" - }, - "suggest": { - "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", - "ext-symfony_debug": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "files": [ - "Resources/functions/dump.php" - ], - "psr-4": { - "Symfony\\Component\\VarDumper\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony mechanism for exploring and dumping PHP variables", - "homepage": "https://symfony.com", - "keywords": [ - "debug", - "dump" - ], - "time": "2017-07-28 06:06:09" - }, { "name": "symfony/yaml", "version": "v3.3.6", @@ -4489,103 +2500,6 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "time": "2017-04-07 12:08:54" }, - { - "name": "tijsverkoyen/css-to-inline-styles", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", - "reference": "ab03919dfd85a74ae0372f8baf9f3c7d5c03b04b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/ab03919dfd85a74ae0372f8baf9f3c7d5c03b04b", - "reference": "ab03919dfd85a74ae0372f8baf9f3c7d5c03b04b", - "shasum": "" - }, - "require": { - "php": "^5.5 || ^7", - "symfony/css-selector": "^2.7|~3.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.8|5.1.*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "TijsVerkoyen\\CssToInlineStyles\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Tijs Verkoyen", - "email": "css_to_inline_styles@verkoyen.eu", - "role": "Developer" - } - ], - "description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.", - "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", - "time": "2016-09-20 12:50:39" - }, - { - "name": "vlucas/phpdotenv", - "version": "v2.4.0", - "source": { - "type": "git", - "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c", - "reference": "3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "phpunit/phpunit": "^4.8 || ^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "psr-4": { - "Dotenv\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause-Attribution" - ], - "authors": [ - { - "name": "Vance Lucas", - "email": "vance@vancelucas.com", - "homepage": "http://www.vancelucas.com" - } - ], - "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", - "keywords": [ - "dotenv", - "env", - "environment" - ], - "time": "2016-09-01 10:05:43" - }, { "name": "webmozart/assert", "version": "1.2.0", @@ -4737,7 +2651,121 @@ "time": "2017-02-07 15:14:28" } ], - "packages-dev": [], + "packages-dev": [ + { + "name": "hamcrest/hamcrest-php", + "version": "v2.0.0", + "source": { + "type": "git", + "url": "https://github.com/hamcrest/hamcrest-php.git", + "reference": "776503d3a8e85d4f9a1148614f95b7a608b046ad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/776503d3a8e85d4f9a1148614f95b7a608b046ad", + "reference": "776503d3a8e85d4f9a1148614f95b7a608b046ad", + "shasum": "" + }, + "require": { + "php": "^5.3|^7.0" + }, + "replace": { + "cordoval/hamcrest-php": "*", + "davedevelopment/hamcrest-php": "*", + "kodova/hamcrest-php": "*" + }, + "require-dev": { + "phpunit/php-file-iterator": "1.3.3", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "hamcrest" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD" + ], + "description": "This is the PHP port of Hamcrest Matchers", + "keywords": [ + "test" + ], + "time": "2016-01-20 08:20:44" + }, + { + "name": "mockery/mockery", + "version": "1.0", + "source": { + "type": "git", + "url": "https://github.com/mockery/mockery.git", + "reference": "1bac8c362b12f522fdd1f1fa3556284c91affa38" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mockery/mockery/zipball/1bac8c362b12f522fdd1f1fa3556284c91affa38", + "reference": "1bac8c362b12f522fdd1f1fa3556284c91affa38", + "shasum": "" + }, + "require": { + "hamcrest/hamcrest-php": "~2.0", + "lib-pcre": ">=7.0", + "php": ">=5.6.0" + }, + "require-dev": { + "phpunit/phpunit": "~5.7|~6.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Mockery": "library/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Pádraic Brady", + "email": "padraic.brady@gmail.com", + "homepage": "http://blog.astrumfutura.com" + }, + { + "name": "Dave Marshall", + "email": "dave.marshall@atstsolutions.co.uk", + "homepage": "http://davedevelopment.co.uk" + } + ], + "description": "Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.", + "homepage": "http://github.com/mockery/mockery", + "keywords": [ + "BDD", + "TDD", + "library", + "mock", + "mock objects", + "mockery", + "stub", + "test", + "test double", + "testing" + ], + "time": "2017-10-06 16:20:43" + } + ], "aliases": [], "minimum-stability": "stable", "stability-flags": [], diff --git a/docker-compose.yml b/docker-compose.yml index e04187b..ba58965 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: image: abc-api/api:latest volumes: - .:/var/www - - ./:/opt/project + - .:/opt/project parser-composer: image: composer/composer:alpine diff --git a/src/Factory.php b/src/Factory.php deleted file mode 100644 index 863c1cc..0000000 --- a/src/Factory.php +++ /dev/null @@ -1,23 +0,0 @@ - null, - ]; - - public function __construct(array $config = []) - { - } - - public static function create($type) - { - return call_user_func([self, 'createInstance']); - } - - public function createInstance($type) - { - return isset($this->classMap[$type])? new $this->classMap[$type]() : null; - } -} \ No newline at end of file diff --git a/src/Interfaces/Repository.php b/src/Interfaces/Repository.php new file mode 100644 index 0000000..47d0d8e --- /dev/null +++ b/src/Interfaces/Repository.php @@ -0,0 +1,17 @@ +collection->append($key, $data); } + public function setOnCollection($key, $data) + { + $this->collection->set($key, $data); + } + public function getCollection() { - return count($this->collection) ? $this->collection : FALSE; + return count($this->collection) ? $this->collection : false; } public function newTune() @@ -53,6 +58,11 @@ class Abc implements Builder $this->currentSetting->append($key, $data); } + public function setOnSetting($key, $data) + { + $this->currentSetting->set($key, $data); + } + public function newPerson(array $data) { return new Person($data); @@ -63,5 +73,6 @@ 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 } -} \ No newline at end of file +} diff --git a/src/Parser.php b/src/Parser.php index 4f2f8f2..519f584 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -62,12 +62,12 @@ class Parser { } $mode = self::MODE_NO_DATA; - } else if ($mode === self::MODE_TUNE_BODY) { + } elseif ($mode === self::MODE_TUNE_BODY) { $music .= $line . PHP_EOL; - } else if (preg_match(self::LN_VERSION, $line)) { + } elseif (preg_match(self::LN_VERSION, $line)) { //this line might contain the abc version. //What do we want to do with it? - } else if (preg_match(self::LN_FIELD, $line) || $inHistory) { + } elseif (preg_match(self::LN_FIELD, $line) || $inHistory) { if (preg_match(self::LN_FIELD, $line)) { $inHistory = FALSE; } //split the line "key:data" if($inHistory) { @@ -87,7 +87,7 @@ class Parser { $this->builder->setOnTune('X', $data); - } else if (preg_match($keys_for_Tunes, $key)) { + } elseif (preg_match($keys_for_Tunes, $key)) { if ($key === 'H') { $inHistory = TRUE; } else { @@ -102,7 +102,7 @@ class Parser { } else { $this->builder->appendToCollection($key, $data); } - } else if($inTunes) { + } elseif($inTunes) { if (in_array($key, self::SINGLE_VALUE_KEYS)) { $this->builder->setOnTune($key, $data); } else { @@ -110,7 +110,7 @@ class Parser { } } - } else if (preg_match($keys_for_Settings, $key)) { + } elseif (preg_match($keys_for_Settings, $key)) { if ($key === 'K' && $mode === self::MODE_TUNE_HEADER) { $mode = self::MODE_TUNE_BODY; } @@ -126,7 +126,7 @@ class Parser { } else { $this->builder->appendToCollection($key, $data); } - } else if($inTunes){ + } elseif($inTunes){ if (in_array($key, self::SINGLE_VALUE_KEYS)) { $this->builder->setOnSetting($key, $data); } else { diff --git a/tests/_support/AcceptanceTester.php b/tests/_support/AcceptanceTester.php deleted file mode 100644 index 4c7dcbb..0000000 --- a/tests/_support/AcceptanceTester.php +++ /dev/null @@ -1,26 +0,0 @@ -setHeader('X-Requested-With', 'Codeception'); - * $I->amOnPage('test-headers.php'); - * ?> - * ``` - * - * @param string $name the name of the request header - * @param string $value the value to set it to for subsequent - * requests + * @param $name + * @param $value * @see \Codeception\Module\PhpBrowser::setHeader() */ public function setHeader($name, $value) { @@ -40,31 +30,6 @@ trait AcceptanceTesterActions } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Deletes the header with the passed name. Subsequent requests - * will not have the deleted header in its request. - * - * Example: - * ```php - * setHeader('X-Requested-With', 'Codeception'); - * $I->amOnPage('test-headers.php'); - * // ... - * $I->deleteHeader('X-Requested-With'); - * $I->amOnPage('some-other-page.php'); - * ?> - * ``` - * - * @param string $name the name of the header to delete. - * @see \Codeception\Module\PhpBrowser::deleteHeader() - */ - public function deleteHeader($name) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('deleteHeader', func_get_args())); - } - - /** * [!] Method is generated. Documentation taken from corresponding module. * @@ -152,6 +117,66 @@ trait AcceptanceTesterActions } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Sets the HTTP header to the passed value - which is used on + * subsequent HTTP requests through PhpBrowser. + * + * Example: + * ```php + * haveHttpHeader('X-Requested-With', 'Codeception'); + * $I->amOnPage('test-headers.php'); + * ?> + * ``` + * + * To use special chars in Header Key use HTML Character Entities: + * Example: + * Header with underscore - 'Client_Id' + * should be represented as - 'Client_Id' or 'Client_Id' + * + * ```php + * haveHttpHeader('Client_Id', 'Codeception'); + * ?> + * ``` + * + * @param string $name the name of the request header + * @param string $value the value to set it to for subsequent + * requests + * @see \Codeception\Lib\InnerBrowser::haveHttpHeader() + */ + public function haveHttpHeader($name, $value) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('haveHttpHeader', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Deletes the header with the passed name. Subsequent requests + * will not have the deleted header in its request. + * + * Example: + * ```php + * haveHttpHeader('X-Requested-With', 'Codeception'); + * $I->amOnPage('test-headers.php'); + * // ... + * $I->deleteHeader('X-Requested-With'); + * $I->amOnPage('some-other-page.php'); + * ?> + * ``` + * + * @param string $name the name of the header to delete. + * @see \Codeception\Lib\InnerBrowser::deleteHeader() + */ + public function deleteHeader($name) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('deleteHeader', func_get_args())); + } + + /** * [!] Method is generated. Documentation taken from corresponding module. * @@ -165,7 +190,7 @@ trait AcceptanceTesterActions * $I->amOnPage('/register'); * ``` * - * @param $page + * @param string $page * @see \Codeception\Lib\InnerBrowser::amOnPage() */ public function amOnPage($page) { @@ -216,33 +241,34 @@ trait AcceptanceTesterActions * [!] Method is generated. Documentation taken from corresponding module. * * Checks that the current page contains the given string (case insensitive). - * - * You can specify a specific HTML element (via CSS or XPath) as the second + * + * You can specify a specific HTML element (via CSS or XPath) as the second * parameter to only search within that element. * * ``` php * see('Logout'); // I can suppose user is logged in - * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page - * $I->see('Sign Up', '//body/h1'); // with XPath + * $I->see('Logout'); // I can suppose user is logged in + * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page + * $I->see('Sign Up', '//body/h1'); // with XPath + * $I->see('Sign Up', ['css' => 'body h1']); // with strict CSS locator * ``` - * + * * Note that the search is done after stripping all HTML tags from the body, * so `$I->see('strong')` will return true for strings like: - * + * * - `

I am Stronger than thou

` * - `` - * + * * But will *not* be true for strings like: - * + * * - `Home` * - `
Home` * - `` - * + * * For checking the raw source code, use `seeInSource()`. * - * @param $text - * @param null $selector + * @param string $text + * @param string $selector optional * Conditional Assertion: Test won't be stopped on fail * @see \Codeception\Lib\InnerBrowser::see() */ @@ -253,33 +279,34 @@ trait AcceptanceTesterActions * [!] Method is generated. Documentation taken from corresponding module. * * Checks that the current page contains the given string (case insensitive). - * - * You can specify a specific HTML element (via CSS or XPath) as the second + * + * You can specify a specific HTML element (via CSS or XPath) as the second * parameter to only search within that element. * * ``` php * see('Logout'); // I can suppose user is logged in - * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page - * $I->see('Sign Up', '//body/h1'); // with XPath + * $I->see('Logout'); // I can suppose user is logged in + * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page + * $I->see('Sign Up', '//body/h1'); // with XPath + * $I->see('Sign Up', ['css' => 'body h1']); // with strict CSS locator * ``` - * + * * Note that the search is done after stripping all HTML tags from the body, * so `$I->see('strong')` will return true for strings like: - * + * * - `

I am Stronger than thou

` * - `` - * + * * But will *not* be true for strings like: - * + * * - `Home` * - `
Home` * - `` - * + * * For checking the raw source code, use `seeInSource()`. * - * @param $text - * @param null $selector + * @param string $text + * @param string $selector optional * @see \Codeception\Lib\InnerBrowser::see() */ public function see($text, $selector = null) { @@ -295,27 +322,28 @@ trait AcceptanceTesterActions * * ```php * dontSee('Login'); // I can suppose user is already logged in - * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page - * $I->dontSee('Sign Up','//body/h1'); // with XPath + * $I->dontSee('Login'); // I can suppose user is already logged in + * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page + * $I->dontSee('Sign Up','//body/h1'); // with XPath + * $I->dontSee('Sign Up', ['css' => 'body h1']); // with strict CSS locator * ``` - * + * * Note that the search is done after stripping all HTML tags from the body, * so `$I->dontSee('strong')` will fail on strings like: - * + * * - `

I am Stronger than thou

` * - `` - * + * * But will ignore strings like: - * + * * - `Home` * - `
Home` * - `` - * + * * For checking the raw source code, use `seeInSource()`. * - * @param $text - * @param null $selector + * @param string $text + * @param string $selector optional * Conditional Assertion: Test won't be stopped on fail * @see \Codeception\Lib\InnerBrowser::dontSee() */ @@ -330,27 +358,28 @@ trait AcceptanceTesterActions * * ```php * dontSee('Login'); // I can suppose user is already logged in - * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page - * $I->dontSee('Sign Up','//body/h1'); // with XPath + * $I->dontSee('Login'); // I can suppose user is already logged in + * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page + * $I->dontSee('Sign Up','//body/h1'); // with XPath + * $I->dontSee('Sign Up', ['css' => 'body h1']); // with strict CSS locator * ``` - * + * * Note that the search is done after stripping all HTML tags from the body, * so `$I->dontSee('strong')` will fail on strings like: - * + * * - `

I am Stronger than thou

` * - `` - * + * * But will ignore strings like: - * + * * - `Home` * - `
Home` * - `` - * + * * For checking the raw source code, use `seeInSource()`. * - * @param $text - * @param null $selector + * @param string $text + * @param string $selector optional * @see \Codeception\Lib\InnerBrowser::dontSee() */ public function dontSee($text, $selector = null) { @@ -445,8 +474,8 @@ trait AcceptanceTesterActions * ?> * ``` * - * @param $text - * @param null $url + * @param string $text + * @param string $url optional * Conditional Assertion: Test won't be stopped on fail * @see \Codeception\Lib\InnerBrowser::seeLink() */ @@ -466,8 +495,8 @@ trait AcceptanceTesterActions * ?> * ``` * - * @param $text - * @param null $url + * @param string $text + * @param string $url optional * @see \Codeception\Lib\InnerBrowser::seeLink() */ public function seeLink($text, $url = null) { @@ -488,8 +517,8 @@ trait AcceptanceTesterActions * ?> * ``` * - * @param $text - * @param null $url + * @param string $text + * @param string $url optional * Conditional Assertion: Test won't be stopped on fail * @see \Codeception\Lib\InnerBrowser::dontSeeLink() */ @@ -509,8 +538,8 @@ trait AcceptanceTesterActions * ?> * ``` * - * @param $text - * @param null $url + * @param string $text + * @param string $url optional * @see \Codeception\Lib\InnerBrowser::dontSeeLink() */ public function dontSeeLink($text, $url = null) { @@ -532,7 +561,7 @@ trait AcceptanceTesterActions * ?> * ``` * - * @param $uri + * @param string $uri * Conditional Assertion: Test won't be stopped on fail * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl() */ @@ -553,7 +582,7 @@ trait AcceptanceTesterActions * ?> * ``` * - * @param $uri + * @param string $uri * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl() */ public function seeInCurrentUrl($uri) { @@ -572,7 +601,7 @@ trait AcceptanceTesterActions * ?> * ``` * - * @param $uri + * @param string $uri * Conditional Assertion: Test won't be stopped on fail * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl() */ @@ -590,7 +619,7 @@ trait AcceptanceTesterActions * ?> * ``` * - * @param $uri + * @param string $uri * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl() */ public function dontSeeInCurrentUrl($uri) { @@ -611,7 +640,7 @@ trait AcceptanceTesterActions * ?> * ``` * - * @param $uri + * @param string $uri * Conditional Assertion: Test won't be stopped on fail * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals() */ @@ -631,7 +660,7 @@ trait AcceptanceTesterActions * ?> * ``` * - * @param $uri + * @param string $uri * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals() */ public function seeCurrentUrlEquals($uri) { @@ -652,7 +681,7 @@ trait AcceptanceTesterActions * ?> * ``` * - * @param $uri + * @param string $uri * Conditional Assertion: Test won't be stopped on fail * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals() */ @@ -672,7 +701,7 @@ trait AcceptanceTesterActions * ?> * ``` * - * @param $uri + * @param string $uri * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals() */ public function dontSeeCurrentUrlEquals($uri) { @@ -692,7 +721,7 @@ trait AcceptanceTesterActions * ?> * ``` * - * @param $uri + * @param string $uri * Conditional Assertion: Test won't be stopped on fail * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches() */ @@ -711,7 +740,7 @@ trait AcceptanceTesterActions * ?> * ``` * - * @param $uri + * @param string $uri * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches() */ public function seeCurrentUrlMatches($uri) { @@ -731,7 +760,7 @@ trait AcceptanceTesterActions * ?> * ``` * - * @param $uri + * @param string $uri * Conditional Assertion: Test won't be stopped on fail * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches() */ @@ -750,7 +779,7 @@ trait AcceptanceTesterActions * ?> * ``` * - * @param $uri + * @param string $uri * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches() */ public function dontSeeCurrentUrlMatches($uri) { @@ -761,7 +790,7 @@ trait AcceptanceTesterActions /** * [!] Method is generated. Documentation taken from corresponding module. * - * Executes the given regular expression against the current URI and returns the first match. + * Executes the given regular expression against the current URI and returns the first capturing group. * If no parameters are provided, the full URI is returned. * * ``` php @@ -771,7 +800,7 @@ trait AcceptanceTesterActions * ?> * ``` * - * @param null $uri + * @param string $uri optional * * @return mixed * @see \Codeception\Lib\InnerBrowser::grabFromCurrentUrl() @@ -864,8 +893,8 @@ trait AcceptanceTesterActions /** * [!] Method is generated. Documentation taken from corresponding module. * - * Checks that the given input field or textarea contains the given value. - * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath. + * Checks that the given input field or textarea *equals* (i.e. not just contains) the given value. + * Fields are matched by label text, the "name" attribute, CSS, or XPath. * * ``` php * value) are set on the form matched with the * passed selector. - * + * * ``` php * seeInFormFields('form[name=myform]', [ @@ -977,10 +1006,10 @@ trait AcceptanceTesterActions * ]); * ?> * ``` - * + * * For multi-select elements, or to check values of multiple elements with the same name, an * array may be passed: - * + * * ``` php * seeInFormFields('.form-class', [ @@ -997,7 +1026,7 @@ trait AcceptanceTesterActions * ``` * * Additionally, checkbox values can be checked with a boolean. - * + * * ``` php * seeInFormFields('#form-id', [ @@ -1006,9 +1035,9 @@ trait AcceptanceTesterActions * ]); * ?> * ``` - * + * * Pair this with submitForm for quick testing magic. - * + * * ``` php * seeInFormFields('//form[@id=my-form]', $form); * ?> * ``` - * + * * @param $formSelector * @param $params * Conditional Assertion: Test won't be stopped on fail @@ -1036,7 +1065,7 @@ trait AcceptanceTesterActions * * Checks if the array of form parameters (name => value) are set on the form matched with the * passed selector. - * + * * ``` php * seeInFormFields('form[name=myform]', [ @@ -1045,10 +1074,10 @@ trait AcceptanceTesterActions * ]); * ?> * ``` - * + * * For multi-select elements, or to check values of multiple elements with the same name, an * array may be passed: - * + * * ``` php * seeInFormFields('.form-class', [ @@ -1065,7 +1094,7 @@ trait AcceptanceTesterActions * ``` * * Additionally, checkbox values can be checked with a boolean. - * + * * ``` php * seeInFormFields('#form-id', [ @@ -1074,9 +1103,9 @@ trait AcceptanceTesterActions * ]); * ?> * ``` - * + * * Pair this with submitForm for quick testing magic. - * + * * ``` php * seeInFormFields('//form[@id=my-form]', $form); * ?> * ``` - * + * * @param $formSelector * @param $params * @see \Codeception\Lib\InnerBrowser::seeInFormFields() @@ -1105,7 +1134,7 @@ trait AcceptanceTesterActions * * Checks if the array of form parameters (name => value) are not set on the form matched with * the passed selector. - * + * * ``` php * dontSeeInFormFields('form[name=myform]', [ @@ -1114,10 +1143,10 @@ trait AcceptanceTesterActions * ]); * ?> * ``` - * + * * To check that an element hasn't been assigned any one of many values, an array can be passed * as the value: - * + * * ``` php * dontSeeInFormFields('.form-class', [ @@ -1130,7 +1159,7 @@ trait AcceptanceTesterActions * ``` * * Additionally, checkbox values can be checked with a boolean. - * + * * ``` php * dontSeeInFormFields('#form-id', [ @@ -1139,7 +1168,7 @@ trait AcceptanceTesterActions * ]); * ?> * ``` - * + * * @param $formSelector * @param $params * Conditional Assertion: Test won't be stopped on fail @@ -1153,7 +1182,7 @@ trait AcceptanceTesterActions * * Checks if the array of form parameters (name => value) are not set on the form matched with * the passed selector. - * + * * ``` php * dontSeeInFormFields('form[name=myform]', [ @@ -1162,10 +1191,10 @@ trait AcceptanceTesterActions * ]); * ?> * ``` - * + * * To check that an element hasn't been assigned any one of many values, an array can be passed * as the value: - * + * * ``` php * dontSeeInFormFields('.form-class', [ @@ -1178,7 +1207,7 @@ trait AcceptanceTesterActions * ``` * * Additionally, checkbox values can be checked with a boolean. - * + * * ``` php * dontSeeInFormFields('#form-id', [ @@ -1187,7 +1216,7 @@ trait AcceptanceTesterActions * ]); * ?> * ``` - * + * * @param $formSelector * @param $params * @see \Codeception\Lib\InnerBrowser::dontSeeInFormFields() @@ -1200,22 +1229,22 @@ trait AcceptanceTesterActions /** * [!] Method is generated. Documentation taken from corresponding module. * - * Submits the given form on the page, optionally with the given form + * Submits the given form on the page, with the given form * values. Pass the form field's values as an array in the second * parameter. * - * Although this function can be used as a short-hand version of - * `fillField()`, `selectOption()`, `click()` etc. it has some important + * Although this function can be used as a short-hand version of + * `fillField()`, `selectOption()`, `click()` etc. it has some important * differences: - * + * * * Only field *names* may be used, not CSS/XPath selectors nor field labels * * If a field is sent to this function that does *not* exist on the page, * it will silently be added to the HTTP request. This is helpful for testing * some types of forms, but be aware that you will *not* get an exception * like you would if you called `fillField()` or `selectOption()` with * a missing field. - * - * Fields that are not provided will be filled by their values from the page, + * + * Fields that are not provided will be filled by their values from the page, * or from any previous calls to `fillField()`, `selectOption()` etc. * You don't need to click the 'Submit' button afterwards. * This command itself triggers the request to form's action. @@ -1278,10 +1307,10 @@ trait AcceptanceTesterActions * ``` * Note that "2" will be the submitted value for the "plan" field, as it is * the selected option. - * + * * You can also emulate a JavaScript submission by not specifying any * buttons in the third parameter to submitForm. - * + * * ```php * submitForm( @@ -1295,10 +1324,10 @@ trait AcceptanceTesterActions * ] * ); * ``` - * - * This function works well when paired with `seeInFormFields()` + * + * This function works well when paired with `seeInFormFields()` * for quickly testing CRUD interfaces and form validation logic. - * + * * ``` php * 'another value', // 'field[]' is already a defined key * ]); * ``` - * + * * The solution is to pass an array value: - * + * * ```php * * ``` * + * Or provide an associative array for the second argument to specifically define which selection method should be used: + * + * ``` php + * selectOption('Which OS do you use?', array('text' => 'Windows')); // Only search by text 'Windows' + * $I->selectOption('Which OS do you use?', array('value' => 'windows')); // Only search by value 'windows' + * ?> + * ``` + * * @param $select * @param $option * @see \Codeception\Lib\InnerBrowser::selectOption() @@ -1468,7 +1506,7 @@ trait AcceptanceTesterActions /** * [!] Method is generated. Documentation taken from corresponding module. * - * Attaches a file relative to the Codeception data directory to the given file upload field. + * Attaches a file relative to the Codeception `_data` directory to the given file upload field. * * ``` php * First * Second * Third * ``` - * + * * ```php * grabMultiple('a'); - * + * * // would return ['#first', '#second', '#third'] * $aLinks = $I->grabMultiple('a', 'href'); * ?> * ``` - * + * * @param $cssOrXpath * @param $attribute * @return string[] @@ -1691,6 +1730,21 @@ trait AcceptanceTesterActions } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Grabs current page source code. + * + * @throws ModuleException if no page was opened. + * + * @return string Current page source code. + * @see \Codeception\Lib\InnerBrowser::grabPageSource() + */ + public function grabPageSource() { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabPageSource', func_get_args())); + } + + /** * [!] Method is generated. Documentation taken from corresponding module. * @@ -1894,13 +1948,11 @@ trait AcceptanceTesterActions * ``` php * seeNumberOfElements('tr', 10); - * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements + * $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements * ?> * ``` * @param $selector - * @param mixed $expected : - * - string: strict number - * - array: range of numbers [0,10] + * @param mixed $expected int or int[] * Conditional Assertion: Test won't be stopped on fail * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements() */ @@ -1915,13 +1967,11 @@ trait AcceptanceTesterActions * ``` php * seeNumberOfElements('tr', 10); - * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements + * $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements * ?> * ``` * @param $selector - * @param mixed $expected : - * - string: strict number - * - array: range of numbers [0,10] + * @param mixed $expected int or int[] * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements() */ public function seeNumberOfElements($selector, $expected) { @@ -2041,9 +2091,15 @@ trait AcceptanceTesterActions * * Checks that response code is equal to value provided. * - * @param $code + * ```php + * seeResponseCodeIs(200); * - * @return mixed + * // recommended \Codeception\Util\HttpCode + * $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); + * ``` + * + * @param $code * Conditional Assertion: Test won't be stopped on fail * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIs() */ @@ -2055,9 +2111,15 @@ trait AcceptanceTesterActions * * Checks that response code is equal to value provided. * - * @param $code + * ```php + * seeResponseCodeIs(200); * - * @return mixed + * // recommended \Codeception\Util\HttpCode + * $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); + * ``` + * + * @param $code * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIs() */ public function seeResponseCodeIs($code) { @@ -2065,6 +2127,45 @@ trait AcceptanceTesterActions } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that response code is equal to value provided. + * + * ```php + * dontSeeResponseCodeIs(200); + * + * // recommended \Codeception\Util\HttpCode + * $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK); + * ``` + * @param $code + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeResponseCodeIs() + */ + public function cantSeeResponseCodeIs($code) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseCodeIs', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that response code is equal to value provided. + * + * ```php + * dontSeeResponseCodeIs(200); + * + * // recommended \Codeception\Util\HttpCode + * $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK); + * ``` + * @param $code + * @see \Codeception\Lib\InnerBrowser::dontSeeResponseCodeIs() + */ + public function dontSeeResponseCodeIs($code) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeResponseCodeIs', func_get_args())); + } + + /** * [!] Method is generated. Documentation taken from corresponding module. * @@ -2163,7 +2264,7 @@ trait AcceptanceTesterActions * [!] Method is generated. Documentation taken from corresponding module. * * Moves back in history. - * + * * @param int $numberOfSteps (default value 1) * @see \Codeception\Lib\InnerBrowser::moveBack() */ diff --git a/tests/_support/_generated/UnitTesterActions.php b/tests/_support/_generated/UnitTesterActions.php index edbc21a..3462387 100644 --- a/tests/_support/_generated/UnitTesterActions.php +++ b/tests/_support/_generated/UnitTesterActions.php @@ -1,4 +1,4 @@ -assertEquals($element->getChildrenCount(), 5); + * ``` + * + * Floating-point example: + * ```php + * assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); + * ``` * * @param $expected * @param $actual * @param string $message + * @param float $delta * @see \Codeception\Module\Asserts::assertEquals() */ - public function assertEquals($expected, $actual, $message = null) { + public function assertEquals($expected, $actual, $message = null, $delta = null) { return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); } @@ -35,14 +50,29 @@ trait UnitTesterActions /** * [!] Method is generated. Documentation taken from corresponding module. * - * Checks that two variables are not equal + * Checks that two variables are not equal. If you're comparing floating-point values, + * you can specify the optional "delta" parameter which dictates how great of a precision + * error are you willing to tolerate in order to consider the two values not equal. + * + * Regular example: + * ```php + * assertNotEquals($element->getChildrenCount(), 0); + * ``` + * + * Floating-point example: + * ```php + * assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); + * ``` * * @param $expected * @param $actual * @param string $message + * @param float $delta * @see \Codeception\Module\Asserts::assertNotEquals() */ - public function assertNotEquals($expected, $actual, $message = null) { + public function assertNotEquals($expected, $actual, $message = null, $delta = null) { return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); } @@ -92,17 +122,6 @@ trait UnitTesterActions } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * @deprecated - * @see \Codeception\Module\Asserts::assertGreaterThen() - */ - public function assertGreaterThen($expected, $actual, $message = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThen', func_get_args())); - } - - /** * [!] Method is generated. Documentation taken from corresponding module. * @@ -118,17 +137,6 @@ trait UnitTesterActions } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * @deprecated - * @see \Codeception\Module\Asserts::assertGreaterThenOrEqual() - */ - public function assertGreaterThenOrEqual($expected, $actual, $message = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThenOrEqual', func_get_args())); - } - - /** * [!] Method is generated. Documentation taken from corresponding module. * @@ -219,6 +227,36 @@ trait UnitTesterActions } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a string starts with the given prefix. + * + * @param string $prefix + * @param string $string + * @param string $message + * @see \Codeception\Module\Asserts::assertStringStartsWith() + */ + public function assertStringStartsWith($prefix, $string, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a string doesn't start with the given prefix. + * + * @param string $prefix + * @param string $string + * @param string $message + * @see \Codeception\Module\Asserts::assertStringStartsNotWith() + */ + public function assertStringStartsNotWith($prefix, $string, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); + } + + /** * [!] Method is generated. Documentation taken from corresponding module. * @@ -334,13 +372,93 @@ trait UnitTesterActions /** * [!] Method is generated. Documentation taken from corresponding module. * - * Fails the test with message. - * - * @param $message - * @see \Codeception\Module\Asserts::fail() + * @param $expected + * @param $actual + * @param $description + * @see \Codeception\Module\Asserts::assertGreaterOrEquals() */ - public function fail($message) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); + public function assertGreaterOrEquals($expected, $actual, $description = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @param $expected + * @param $actual + * @param $description + * @see \Codeception\Module\Asserts::assertLessOrEquals() + */ + public function assertLessOrEquals($expected, $actual, $description = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @param $actual + * @param $description + * @see \Codeception\Module\Asserts::assertIsEmpty() + */ + public function assertIsEmpty($actual, $description = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @param $key + * @param $actual + * @param $description + * @see \Codeception\Module\Asserts::assertArrayHasKey() + */ + public function assertArrayHasKey($key, $actual, $description = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @param $key + * @param $actual + * @param $description + * @see \Codeception\Module\Asserts::assertArrayNotHasKey() + */ + public function assertArrayNotHasKey($key, $actual, $description = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that array contains subset. + * + * @param array $subset + * @param array $array + * @param bool $strict + * @param string $message + * @see \Codeception\Module\Asserts::assertArraySubset() + */ + public function assertArraySubset($subset, $array, $strict = null, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @param $expectedCount + * @param $actual + * @param $description + * @see \Codeception\Module\Asserts::assertCount() + */ + public function assertCount($expectedCount, $actual, $description = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); } @@ -357,6 +475,79 @@ trait UnitTesterActions } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @param $class + * @param $actual + * @param $description + * @see \Codeception\Module\Asserts::assertNotInstanceOf() + */ + public function assertNotInstanceOf($class, $actual, $description = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @param $type + * @param $actual + * @param $description + * @see \Codeception\Module\Asserts::assertInternalType() + */ + public function assertInternalType($type, $actual, $description = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Fails the test with message. + * + * @param $message + * @see \Codeception\Module\Asserts::fail() + */ + public function fail($message) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Handles and checks exception called inside callback function. + * Either exception class name or exception instance should be provided. + * + * ```php + * expectException(MyException::class, function() { + * $this->doSomethingBad(); + * }); + * + * $I->expectException(new MyException(), function() { + * $this->doSomethingBad(); + * }); + * ``` + * If you want to check message or exception code, you can pass them with exception instance: + * ```php + * expectException(new MyException("Don't do bad things"), function() { + * $this->doSomethingBad(); + * }); + * ``` + * + * @param $exception string or \Exception + * @param $callback + * @see \Codeception\Module\Asserts::expectException() + */ + public function expectException($exception, $callback) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); + } + + /** * [!] Method is generated. Documentation taken from corresponding module. * diff --git a/tests/acceptance.suite.yml b/tests/acceptance.suite.yml deleted file mode 100644 index 2269e0c..0000000 --- a/tests/acceptance.suite.yml +++ /dev/null @@ -1,12 +0,0 @@ -# Codeception Test Suite Configuration -# -# Suite for acceptance tests. -# Perform tests in browser using the WebDriver or PhpBrowser. -# If you need both WebDriver and PHPBrowser tests - create a separate suite. - -class_name: AcceptanceTester -modules: - enabled: - - PhpBrowser: - url: http://localhost/myapp - - \Helper\Acceptance \ No newline at end of file diff --git a/tests/acceptance/_bootstrap.php b/tests/acceptance/_bootstrap.php deleted file mode 100644 index 8a88555..0000000 --- a/tests/acceptance/_bootstrap.php +++ /dev/null @@ -1,2 +0,0 @@ -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); - } -} diff --git a/tests/functional/laravel5/CollectionCest.php b/tests/functional/laravel5/CollectionCest.php deleted file mode 100644 index bd9fb0e..0000000 --- a/tests/functional/laravel5/CollectionCest.php +++ /dev/null @@ -1,20 +0,0 @@ -tune_id = 1; - $model->type = 'Title'; - $model->string = 'a title'; - $model->ordering = 1; - $I->assertCanSave($model); - } -} diff --git a/tests/unit/Laravel5/AbcParserDBTest.php b/tests/unit/Laravel5/AbcParserDBTest.php deleted file mode 100644 index f27b99f..0000000 --- a/tests/unit/Laravel5/AbcParserDBTest.php +++ /dev/null @@ -1,63 +0,0 @@ -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 deleted file mode 100644 index 2e540de..0000000 --- a/tests/unit/Laravel5/BaseDbTest.php +++ /dev/null @@ -1,53 +0,0 @@ -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 deleted file mode 100644 index 45355d1..0000000 --- a/tests/unit/Laravel5/CollectionAttributeTest.php +++ /dev/null @@ -1,116 +0,0 @@ -create(); - $type = 'Note'; - $value = 'a title'; - $ordering = 1; - $model = new CollectionAttribute(); - $model->collection_id = $collection->id; - $model->type = $type; - $model->string = $value; - $model->ordering = $ordering; - - $this->assertInstanceOf(CollectionAttribute::class, $model); - $this->assertEquals($collection->id, $model->collection_id); - $this->assertEquals($type, $model->type); - $this->assertEquals($value, $model->string); - $this->assertEquals($ordering, $model->ordering); - } - - public function testMassAssignable() - { - $collection = factory(Collection::class)->create(); - $type = 'Note'; - $value = 'a title'; - $ordering = 1; - $model = CollectionAttribute::create([ - 'collection_id' => $collection->id, - 'type' => $type, - 'string' => $value, - 'ordering' => $ordering - ]); - - $this->assertInstanceOf(CollectionAttribute::class, $model); - $this->assertEquals($collection->id, $model->collection_id); - $this->assertEquals($type, $model->type); - $this->assertEquals($value, $model->string); - $this->assertEquals($ordering, $model->ordering); - } - - public function testFactory() - { - $model = factory(CollectionAttribute::class)->make([]); - - $this->assertInstanceOf(CollectionAttribute::class, $model); - $this->assertNotNull($model->collection_id); - $this->assertNotNull($model->type); - $this->assertNotNull($model->string); - $this->assertNotNull($model->ordering); - $this->assertTrue($model->save(), json_encode($model->getMessages())); - } - - public function testValidationAppliedOnSave() - { - $model = factory(CollectionAttribute::class)->make([]); - $model->type = 'NotType'; - - $this->assertFalse($model->save()); - } - - public function testTypeValidation() - { - $model = factory(CollectionAttribute::class)->make([]); - $model->type = 'NotType'; - - $this->assertFalse($model->validate()); - } - - public function testTuneIdValidation() - { - $model = factory(CollectionAttribute::class)->make([]); - $model->collection_id = Uuid::generate(4); - - $this->assertFalse($model->validate()); - } - - public function testStringValidation() - { - $longString = ''; - for ($i=0; $i < 300; $i++) { - $longString .= 's'; - } - $model = factory(CollectionAttribute::class)->make([]); - $model->string = $longString; - - $this->assertFalse($model->validate()); - } - - public function testOrderingValidation() - { - $model = factory(CollectionAttribute::class)->make([]); - $model->ordering = "fourth"; - - $this->assertFalse($model->validate()); - } -} diff --git a/tests/unit/Laravel5/CollectionTest.php b/tests/unit/Laravel5/CollectionTest.php deleted file mode 100644 index 774cadf..0000000 --- a/tests/unit/Laravel5/CollectionTest.php +++ /dev/null @@ -1,523 +0,0 @@ -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() - { - $name = "test1"; - $model = new Collection(); - $model->name = $name; - - $this->assertInstanceOf(Collection::class, $model); - $this->assertEquals($name, $model->name); - } - - public function testNameIsMassAssignable() - { - $name = "test1"; - $model = Collection::create(['name'=>$name]); - - $this->assertInstanceOf(Collection::class, $model); - $this->assertEquals($name, $model->name); - } - - public function testFactorySetsName() - { - $model = factory(Collection::class)->make([]); - - $this->assertInstanceOf(Collection::class, $model); - $this->assertNotEmpty($model->name); - } - - public function testAppendToCollection() - { - $setting = new \stdClass(); - - $model = factory(Collection::class)->make([]); - - $result = $model->appendSetting($setting); - - $this->assertInstanceOf(\Illuminate\Support\Collection::class, $result); - $this->assertContains($setting, $result); - } - - public function testCanGetAuthorAttribute() - { - $string = 'Arthur'; - $model = factory(Collection::class)->create([]); - $attr = factory(CollectionAttribute::class)->create([ - 'collection_id' => $model->id, - 'type' => 'Author', - 'string' => $string, - ]); - $model = $model->fresh(); - - $this->assertInstanceOf(Collection::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertEquals($string, $model->A[0]); - } - - public function testSetAuthorAttribute() - { - $values = ['England', 'Scotland']; - $model = factory(Collection::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->A = $values; - - $this->assertEquals($values[0], $model->A[0]); - $this->assertEquals($values[1], $model->A[1]); - } - - public function testAuthorAttributeSaves() - { - $values = ['England', 'Scotland']; - $model = factory(Collection::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->A = $values; - $model->save(); - $model = $model->fresh(); - - $this->assertEquals($values[0], $model->A[0]); - $this->assertEquals($values[1], $model->A[1]); - } - - public function testCanGetComposerAttribute() - { - $string = 'Arthur'; - $model = factory(Collection::class)->create([]); - $attr = factory(CollectionAttribute::class)->create([ - 'collection_id' => $model->id, - 'type' => 'Composer', - 'string' => $string, - ]); - $model = $model->fresh(); - - $this->assertInstanceOf(Collection::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertEquals($string, $model->C[0]); - } - - public function testSetComposerAttribute() - { - $values = ['England', 'Scotland']; - $model = factory(Collection::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->C = $values; - - $this->assertEquals($values[0], $model->C[0]); - $this->assertEquals($values[1], $model->C[1]); - } - - public function testComposerAttributeSaves() - { - $values = ['England', 'Scotland']; - $model = factory(Collection::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->C = $values; - $model->save(); - $model = $model->fresh(); - - $this->assertEquals($values[0], $model->C[0]); - $this->assertEquals($values[1], $model->C[1]); - } - - public function testCanGetDiscographyAttribute() - { - $string = 'Arthur'; - $model = factory(Collection::class)->create([]); - $attr = factory(CollectionAttribute::class)->create([ - 'collection_id' => $model->id, - 'type' => 'Discography', - 'string' => $string, - ]); - $model = $model->fresh(); - - $this->assertInstanceOf(Collection::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertEquals($string, $model->D[0]); - } - - public function testSetDiscographyAttribute() - { - $values = ['England', 'Scotland']; - $model = factory(Collection::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->D = $values; - - $this->assertEquals($values[0], $model->D[0]); - $this->assertEquals($values[1], $model->D[1]); - } - - public function testDiscographyAttributeSaves() - { - $values = ['England', 'Scotland']; - $model = factory(Collection::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->D = $values; - $model->save(); - $model = $model->fresh(); - - $this->assertEquals($values[0], $model->D[0]); - $this->assertEquals($values[1], $model->D[1]); - } - - - public function testCanGetRhythmAttribute() - { - $string = 'Arthur'; - $model = factory(Collection::class)->create([]); - $attr = factory(CollectionAttribute::class)->create([ - 'collection_id' => $model->id, - 'type' => 'Rhythm', - 'string' => $string, - ]); - $model = $model->fresh(); - - $this->assertInstanceOf(Collection::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertEquals($string, $model->R[0]); - } - - public function testSetRhythmAttribute() - { - $values = ['England', 'Scotland']; - $model = factory(Collection::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->R = $values; - - $this->assertEquals($values[0], $model->R[0]); - $this->assertEquals($values[1], $model->R[1]); - } - - public function testRhythmAttributeSaves() - { - $values = ['England', 'Scotland']; - $model = factory(Collection::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->R = $values; - $model->save(); - $model = $model->fresh(); - - $this->assertEquals($values[0], $model->R[0]); - $this->assertEquals($values[1], $model->R[1]); - } - - - public function testCanGetHistoryAttribute() - { - $string = 'Arthur'; - $model = factory(Collection::class)->create([]); - $attr = factory(CollectionAttribute::class)->create([ - 'collection_id' => $model->id, - 'type' => 'History', - 'string' => $string, - ]); - $model = $model->fresh(); - - $this->assertInstanceOf(Collection::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertEquals($string, $model->H[0]); - } - - public function testSetHistoryAttribute() - { - $values = ['England', 'Scotland']; - $model = factory(Collection::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->H = $values; - - $this->assertEquals($values[0], $model->H[0]); - $this->assertEquals($values[1], $model->H[1]); - } - - public function testHistoryAttributeSaves() - { - $values = ['England', 'Scotland']; - $model = factory(Collection::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->A = $values; - $model->save(); - $model = $model->fresh(); - - $this->assertEquals($values[0], $model->A[0]); - $this->assertEquals($values[1], $model->A[1]); - } - - - public function testCanGetFileAttribute() - { - $string = 'Arthur'; - $model = factory(Collection::class)->create([]); - $attr = factory(CollectionAttribute::class)->create([ - 'collection_id' => $model->id, - 'type' => 'File', - 'string' => $string, - ]); - $model = $model->fresh(); - - $this->assertInstanceOf(Collection::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertEquals($string, $model->F[0]); - } - - public function testSetFileAttribute() - { - $values = ['England', 'Scotland']; - $model = factory(Collection::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->F = $values; - - $this->assertEquals($values[0], $model->F[0]); - $this->assertEquals($values[1], $model->F[1]); - } - - public function testFileAttributeSaves() - { - $values = ['England', 'Scotland']; - $model = factory(Collection::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->F = $values; - $model->save(); - $model = $model->fresh(); - - $this->assertEquals($values[0], $model->F[0]); - $this->assertEquals($values[1], $model->F[1]); - } - - - public function testCanGetBookAttribute() - { - $string = 'Arthur'; - $model = factory(Collection::class)->create([]); - $attr = factory(CollectionAttribute::class)->create([ - 'collection_id' => $model->id, - 'type' => 'Book', - 'string' => $string, - ]); - $model = $model->fresh(); - - $this->assertInstanceOf(Collection::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertEquals($string, $model->B[0]); - } - - public function testSetBookAttribute() - { - $values = ['England', 'Scotland']; - $model = factory(Collection::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->B = $values; - - $this->assertEquals($values[0], $model->B[0]); - $this->assertEquals($values[1], $model->B[1]); - } - - public function testBookAttributeSaves() - { - $values = ['England', 'Scotland']; - $model = factory(Collection::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->B = $values; - $model->save(); - $model = $model->fresh(); - - $this->assertEquals($values[0], $model->B[0]); - $this->assertEquals($values[1], $model->B[1]); - } - - - public function testCanGetNoteAttribute() - { - $string = 'Arthur'; - $model = factory(Collection::class)->create([]); - $attr = factory(CollectionAttribute::class)->create([ - 'collection_id' => $model->id, - 'type' => 'Note', - 'string' => $string, - ]); - $model = $model->fresh(); - - $this->assertInstanceOf(Collection::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertEquals($string, $model->N[0]); - } - - public function testSetNoteAttribute() - { - $values = ['England', 'Scotland']; - $model = factory(Collection::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->N = $values; - - $this->assertEquals($values[0], $model->N[0]); - $this->assertEquals($values[1], $model->N[1]); - } - - public function testNoteAttributeSaves() - { - $values = ['England', 'Scotland']; - $model = factory(Collection::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->N = $values; - $model->save(); - $model = $model->fresh(); - - $this->assertEquals($values[0], $model->N[0]); - $this->assertEquals($values[1], $model->N[1]); - } - - - public function testCanGetSourceAttribute() - { - $string = 'Arthur'; - $model = factory(Collection::class)->create([]); - $attr = factory(CollectionAttribute::class)->create([ - 'collection_id' => $model->id, - 'type' => 'Source', - 'string' => $string, - ]); - $model = $model->fresh(); - - $this->assertInstanceOf(Collection::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertEquals($string, $model->S[0]); - } - - public function testSetSourceAttribute() - { - $values = ['England', 'Scotland']; - $model = factory(Collection::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->S = $values; - - $this->assertEquals($values[0], $model->S[0]); - $this->assertEquals($values[1], $model->S[1]); - } - - public function testSourceAttributeSaves() - { - $values = ['England', 'Scotland']; - $model = factory(Collection::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->S = $values; - $model->save(); - $model = $model->fresh(); - - $this->assertEquals($values[0], $model->S[0]); - $this->assertEquals($values[1], $model->S[1]); - } - - - public function testCanGetTranscriberAttribute() - { - $string = 'Arthur'; - $model = factory(Collection::class)->create([]); - $attr = factory(CollectionAttribute::class)->create([ - 'collection_id' => $model->id, - 'type' => 'Transcriber', - 'string' => $string, - ]); - $model = $model->fresh(); - - $this->assertInstanceOf(Collection::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertEquals($string, $model->Z[0]); - } - - public function testSetTranscriberAttribute() - { - $values = ['England', 'Scotland']; - $model = factory(Collection::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->Z = $values; - - $this->assertEquals($values[0], $model->Z[0]); - $this->assertEquals($values[1], $model->Z[1]); - } - - public function testTranscriberAttributeSaves() - { - $values = ['England', 'Scotland']; - $model = factory(Collection::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->Z = $values; - $model->save(); - $model = $model->fresh(); - - $this->assertEquals($values[0], $model->Z[0]); - $this->assertEquals($values[1], $model->Z[1]); - } -} diff --git a/tests/unit/Laravel5/PersonTest.php b/tests/unit/Laravel5/PersonTest.php deleted file mode 100644 index 844fbfd..0000000 --- a/tests/unit/Laravel5/PersonTest.php +++ /dev/null @@ -1,46 +0,0 @@ -name = $name; - - $this->assertInstanceOf(Person::class, $model); - $this->assertEquals($name, $model->name); - } - - public function testNameIsMassAssignable() - { - $name = "test1"; - $model = Person::create([ - 'name' =>$name, - 'email' => 'me@example.com', - ]); - - $this->assertInstanceOf(Person::class, $model); - $this->assertEquals($name, $model->name); - } - - public function testFactorySetsName() - { - $model = factory(Person::class)->make([]); - - $this->assertInstanceOf(Person::class, $model); - $this->assertNotEmpty($model->name); - } -} diff --git a/tests/unit/Laravel5/TuneAttributeTest.php b/tests/unit/Laravel5/TuneAttributeTest.php deleted file mode 100644 index 22043fb..0000000 --- a/tests/unit/Laravel5/TuneAttributeTest.php +++ /dev/null @@ -1,114 +0,0 @@ -create(); - $type = 'Title'; - $title = 'a title'; - $ordering = 1; - $model = new TuneAttribute(); - $model->tune_id = $tune->id; - $model->type = $type; - $model->string = $title; - $model->ordering = $ordering; - - $this->assertInstanceOf(TuneAttribute::class, $model); - $this->assertEquals($tune->id, $model->tune_id); - $this->assertEquals($type, $model->type); - $this->assertEquals($title, $model->string); - $this->assertEquals($ordering, $model->ordering); - } - - public function testMassAssignable() - { - $tune = factory(Tune::class)->create(); - $type = 'Title'; - $title = 'a title'; - $ordering = 1; - $model = TuneAttribute::create([ - 'tune_id' => $tune->id, - 'type' => $type, - 'string' => $title, - 'ordering' => $ordering - ]); - - $this->assertInstanceOf(TuneAttribute::class, $model); - $this->assertEquals($tune->id, $model->tune_id); - $this->assertEquals($type, $model->type); - $this->assertEquals($title, $model->string); - $this->assertEquals($ordering, $model->ordering); - } - - public function testFactory() - { - $model = factory(TuneAttribute::class)->make([]); - - $this->assertInstanceOf(TuneAttribute::class, $model); - $this->assertNotNull($model->tune_id); - $this->assertNotNull($model->type); - $this->assertNotNull($model->string); - $this->assertNotNull($model->ordering); - $this->assertTrue($model->save(), json_encode($model->getMessages())); - } - - public function testValidationAppliedOnSave() - { - $model = factory(TuneAttribute::class)->make([]); - $model->type = 'NotType'; - - $this->assertFalse($model->save()); - } - - public function testTypeValidation() - { - $model = factory(TuneAttribute::class)->make([]); - $model->type = 'NotType'; - - $this->assertFalse($model->validate()); - } - - public function testTuneIdValidation() - { - $model = factory(TuneAttribute::class)->make([]); - $model->tune_id = Uuid::generate(4); - - $this->assertFalse($model->validate()); - } - - public function testStringValidation() - { - $longString = ''; - for ($i=0; $i < 300; $i++) { - $longString .= 's'; - } - $model = factory(TuneAttribute::class)->make([]); - $model->string = $longString; - - $this->assertFalse($model->validate()); - } - - public function testOrderingValidation() - { - $model = factory(TuneAttribute::class)->make([]); - $model->ordering = "fourth"; - - $this->assertFalse($model->validate()); - } -} diff --git a/tests/unit/Laravel5/TuneSettingAttributeTest.php b/tests/unit/Laravel5/TuneSettingAttributeTest.php deleted file mode 100644 index a172dff..0000000 --- a/tests/unit/Laravel5/TuneSettingAttributeTest.php +++ /dev/null @@ -1,114 +0,0 @@ -create(); - $type = 'Title'; - $title = 'a title'; - $ordering = 1; - $model = new TuneSettingAttribute(); - $model->tune_id = $tune->id; - $model->type = $type; - $model->string = $title; - $model->ordering = $ordering; - - $this->assertInstanceOf(TuneSettingAttribute::class, $model); - $this->assertEquals($tune->id, $model->tune_id); - $this->assertEquals($type, $model->type); - $this->assertEquals($title, $model->string); - $this->assertEquals($ordering, $model->ordering); - } - - public function testMassAssignable() - { - $setting = factory(TuneSetting::class)->create(); - $type = 'Notes'; - $value = 'a little note'; - $ordering = 1; - $model = TuneSettingAttribute::create([ - 'setting_id' => $setting->id, - 'type' => $type, - 'string' => $value, - 'ordering' => $ordering - ]); - - $this->assertInstanceOf(TuneSettingAttribute::class, $model); - $this->assertEquals($setting->id, $model->setting_id); - $this->assertEquals($type, $model->type); - $this->assertEquals($value, $model->string); - $this->assertEquals($ordering, $model->ordering); - } - - public function testFactory() - { - $model = factory(TuneSettingAttribute::class)->make([]); - - $this->assertInstanceOf(TuneSettingAttribute::class, $model); - $this->assertNotNull($model->setting_id); - $this->assertNotNull($model->type); - $this->assertNotNull($model->string); - $this->assertNotNull($model->ordering); - $this->assertTrue($model->save(), json_encode($model->getMessages())); - } - - public function testValidationAppliedOnSave() - { - $model = factory(TuneSettingAttribute::class)->make([]); - $model->type = 'NotType'; - - $this->assertFalse($model->save()); - } - - public function testTypeValidation() - { - $model = factory(TuneSettingAttribute::class)->make([]); - $model->type = 'NotType'; - - $this->assertFalse($model->validate()); - } - - public function testTuneSettingIdValidation() - { - $model = factory(TuneSettingAttribute::class)->make([]); - $model->setting_id = Uuid::generate(4); - - $this->assertFalse($model->validate()); - } - - public function testStringValidation() - { - $longString = ''; - for ($i=0; $i < 300; $i++) { - $longString .= 's'; - } - $model = factory(TuneSettingAttribute::class)->make([]); - $model->string = $longString; - - $this->assertFalse($model->validate()); - } - - public function testOrderingValidation() - { - $model = factory(TuneSettingAttribute::class)->make([]); - $model->ordering = "fourth"; - - $this->assertFalse($model->validate()); - } -} diff --git a/tests/unit/Laravel5/TuneSettingTest.php b/tests/unit/Laravel5/TuneSettingTest.php deleted file mode 100644 index d3ed62f..0000000 --- a/tests/unit/Laravel5/TuneSettingTest.php +++ /dev/null @@ -1,328 +0,0 @@ -assertInstanceOf(TuneSetting::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - } - - public function testMassAssignable() - { - $tune = factory(Tune::class)->create(); - $data = [ - 'tune_id' => $tune->id, - 'meter' => 'C', - 'keysig' => 'C', - 'filename' => 'filename', - 'tempo' => '1/8=200', - 'L' => '1/8', - 'music' => '', - 'parts' => 'abcbc' - ]; - $model = TuneSetting::create($data); - - $this->assertInstanceOf(TuneSetting::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertEquals($data['meter'], $model->meter); - $this->assertEquals($data['keysig'], $model->keysig); - $this->assertEquals($data['filename'], $model->filename); - $this->assertEquals($data['tempo'], $model->tempo); - $this->assertEquals($data['L'], $model->L); - $this->assertEquals($data['music'], $model->music); - $this->assertEquals($data['parts'], $model->parts); - } - - - public function testFactory() - { - $model = factory(TuneSetting::class)->make([]); - - $this->assertInstanceOf(TuneSetting::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertNotNull($model->tune_id); - $this->assertNotNull($model->meter); - $this->assertNotNull($model->keysig); - } - - public function testValidationAppliedOnSave() - { - $model = factory(TuneSetting::class)->make([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $model->meter = 'NotType'; - - $this->assertFalse($model->save()); - } - - public function testCanGetTranscriberAttribute() - { - $value = 'C'; - $model = factory(TuneSetting::class)->create([]); - $attr = factory(TuneSettingAttribute::class)->create([ - 'setting_id' => $model->id, - 'type' => 'Transcriber', - 'string' => $value, - ]); - $model = $model->fresh(); - - $this->assertInstanceOf(TuneSetting::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertEquals($value, $model->Z[0]); - } - - public function testSetTranscriberAttribute() - { - $values = ['Me', 'Womble2']; - $model = factory(TuneSetting::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->Z = $values; - - $this->assertEquals($values[0], $model->Z[0]); - $this->assertEquals($values[1], $model->Z[1]); - } - - public function testTranscriberAttributeSaves() - { - $values = ['Me', 'Womble2']; - $model = factory(TuneSetting::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->Z = $values; - $model->save(); - $model = $model->fresh(); - - $this->assertEquals($values[0], $model->Z[0]); - $this->assertEquals($values[1], $model->Z[1]); - } - - public function testCanGetNoteAttribute() - { - $value = 'A note'; - $model = factory(TuneSetting::class)->create([]); - $attr = factory(TuneSettingAttribute::class)->create([ - 'setting_id' => $model->id, - 'type' => 'Note', - 'string' => $value, - ]); - $model = $model->fresh(); - - $this->assertInstanceOf(TuneSetting::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertEquals($value, $model->N[0]); - } - - public function testSetNoteAttribute() - { - $values = ['Me', 'Womble2']; - $model = factory(TuneSetting::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->N = $values; - - $this->assertEquals($values[0], $model->N[0]); - $this->assertEquals($values[1], $model->N[1]); - } - - public function testNoteAttributeSaves() - { - $values = ['Me', 'Womble2']; - $model = factory(TuneSetting::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->N = $values; - $model->save(); - $model = $model->fresh(); - - $this->assertEquals($values[0], $model->N[0]); - $this->assertEquals($values[1], $model->N[1]); - } - - public function testCanGetDiscographyAttribute() - { - $value = 'A recording'; - $model = factory(TuneSetting::class)->create([]); - $attr = factory(TuneSettingAttribute::class)->create([ - 'setting_id' => $model->id, - 'type' => 'Discography', - 'string' => $value, - ]); - $model = $model->fresh(); - - $this->assertInstanceOf(TuneSetting::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertEquals($value, $model->D[0]); - } - - public function testSetDiscographyAttribute() - { - $values = ['Me', 'Womble2']; - $model = factory(TuneSetting::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->D = $values; - - $this->assertEquals($values[0], $model->D[0]); - $this->assertEquals($values[1], $model->D[1]); - } - - public function testDiscographyAttributeSaves() - { - $values = ['Me', 'Womble2']; - $model = factory(TuneSetting::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->D = $values; - $model->save(); - $model = $model->fresh(); - - $this->assertEquals($values[0], $model->D[0]); - $this->assertEquals($values[1], $model->D[1]); - } - - public function testCanGetSourceAttribute() - { - $value = 'A feel'; - $model = factory(TuneSetting::class)->create([]); - $attr = factory(TuneSettingAttribute::class)->create([ - 'setting_id' => $model->id, - 'type' => 'Source', - 'string' => $value, - ]); - $model = $model->fresh(); - - $this->assertInstanceOf(TuneSetting::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertEquals($value, $model->S[0]); - } - - public function testSetSourceAttribute() - { - $values = ['Me', 'Womble2']; - $model = factory(TuneSetting::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->S = $values; - - $this->assertEquals($values[0], $model->S[0]); - $this->assertEquals($values[1], $model->S[1]); - } - - public function testSourceAttributeSaves() - { - $values = ['Me', 'Womble2']; - $model = factory(TuneSetting::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->S = $values; - $model->save(); - $model = $model->fresh(); - - $this->assertEquals($values[0], $model->S[0]); - $this->assertEquals($values[1], $model->S[1]); - } - - public function testCanGetWordAttribute() - { - $value = 'A feel'; - $model = factory(TuneSetting::class)->create([]); - $attr = factory(TuneSettingAttribute::class)->create([ - 'setting_id' => $model->id, - 'type' => 'Word', - 'string' => $value, - ]); - $model = $model->fresh(); - - $this->assertInstanceOf(TuneSetting::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertEquals($value, $model->W[0]); - } - - public function testSetWordAttribute() - { - $values = ['Me', 'Womble2']; - $model = factory(TuneSetting::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->W = $values; - - $this->assertEquals($values[0], $model->W[0]); - $this->assertEquals($values[1], $model->W[1]); - } - - public function testWordAttributeSaves() - { - $values = ['Me', 'Womble2']; - $model = factory(TuneSetting::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->W = $values; - $model->save(); - $model = $model->fresh(); - - $this->assertEquals($values[0], $model->W[0]); - $this->assertEquals($values[1], $model->W[1]); - } - - public function testCanGetBookAttribute() - { - $value = 'A feel'; - $model = factory(TuneSetting::class)->create([]); - $attr = factory(TuneSettingAttribute::class)->create([ - 'setting_id' => $model->id, - 'type' => 'Book', - 'string' => $value, - ]); - $model = $model->fresh(); - - $this->assertInstanceOf(TuneSetting::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertEquals($value, $model->B[0]); - } - - public function testSetBookAttribute() - { - $values = ['Me', 'Womble2']; - $model = factory(TuneSetting::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->B = $values; - - $this->assertEquals($values[0], $model->B[0]); - $this->assertEquals($values[1], $model->B[1]); - } - - public function testBookAttributeSaves() - { - $values = ['Me', 'Womble2']; - $model = factory(TuneSetting::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->B = $values; - $model->save(); - $model = $model->fresh(); - - $this->assertEquals($values[0], $model->B[0]); - $this->assertEquals($values[1], $model->B[1]); - } - -} diff --git a/tests/unit/Laravel5/TuneTest.php b/tests/unit/Laravel5/TuneTest.php deleted file mode 100644 index d5989a7..0000000 --- a/tests/unit/Laravel5/TuneTest.php +++ /dev/null @@ -1,270 +0,0 @@ -assertInstanceOf(Tune::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - } - - public function testMassAssignable() - { - $xId = 44; - $model = Tune::create([ - 'x_id' => $xId, - ]); - - $this->assertInstanceOf(Tune::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertEquals($xId, $model->x_id); - } - - - public function testFactory() - { - $model = factory(Tune::class)->make([]); - - $this->assertInstanceOf(Tune::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertNotNull($model->x_id); - } - - public function testCanGetTitleAttribute() - { - $title = 'Wombles Forever'; - $model = factory(Tune::class)->create([]); - $attr = factory(TuneAttribute::class)->create([ - 'tune_id' => $model->id, - 'type' => 'Title', - 'string' => $title, - ]); - - $model = $model->fresh(); - $this->assertInstanceOf(Tune::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertEquals($title, $model->T[0]); - } - - public function testSetTitleAttribute() - { - $titles = ['Title1', 'Womble2']; - $model = factory(Tune::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->T = $titles; - - $this->assertEquals($titles[0], $model->T[0]); - $this->assertEquals($titles[1], $model->T[1]); - } - - public function testTitleAttributeSaves() - { - $titles = ['Title1', 'Womble2']; - $model = factory(Tune::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->T = $titles; - $model->save(); - $model = $model->fresh(); - - $this->assertEquals($titles[0], $model->T[0]); - $this->assertEquals($titles[1], $model->T[1]); - } - - public function testCanGetGroupAttribute() - { - $group = 'Flute'; - $model = factory(Tune::class)->create([]); - $attr = factory(TuneAttribute::class)->create([ - 'tune_id' => $model->id, - 'type' => 'Group', - 'string' => $group, - ]); - $model = $model->fresh(); - - $this->assertInstanceOf(Tune::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertEquals($group, $model->G[0]); - } - - public function testSetGroupAttribute() - { - $groups = ['Flute', 'Oboe']; - $model = factory(Tune::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->G = $groups; - - $this->assertEquals($groups[0], $model->G[0]); - $this->assertEquals($groups[1], $model->G[1]); - } - - public function testGroupAttributeSaves() - { - $groups = ['Flute', 'Oboe']; - $model = factory(Tune::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->G = $groups; - $model->save(); - $model = $model->fresh(); - - $this->assertEquals($groups[0], $model->G[0]); - $this->assertEquals($groups[1], $model->G[1]); - } - - public function testCanGetOriginAttribute() - { - $origin = 'England'; - $model = factory(Tune::class)->create([]); - $attr = factory(TuneAttribute::class)->create([ - 'tune_id' => $model->id, - 'type' => 'Origin', - 'string' => $origin, - ]); - $model = $model->fresh(); - - $this->assertInstanceOf(Tune::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertEquals($origin, $model->O[0]); - } - - public function testSetOriginAttribute() - { - $origins = ['England', 'Scotland']; - $model = factory(Tune::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->O = $origins; - - $this->assertEquals($origins[0], $model->O[0]); - $this->assertEquals($origins[1], $model->O[1]); - } - - public function testOriginAttributeSaves() - { - $origins = ['England', 'Scotland']; - $model = factory(Tune::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->O = $origins; - $model->save(); - $model = $model->fresh(); - - $this->assertEquals($origins[0], $model->O[0]); - $this->assertEquals($origins[1], $model->O[1]); - } - - public function testCanGetRhythmAttribute() - { - $rhythm = 'Reel'; - $model = factory(Tune::class)->create([]); - $attr = factory(TuneAttribute::class)->create([ - 'tune_id' => $model->id, - 'type' => 'Rhythm', - 'string' => $rhythm, - ]); - $model = $model->fresh(); - - $this->assertInstanceOf(Tune::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertEquals($rhythm, $model->R[0]); - } - - public function testSetRhythmAttribute() - { - $rhythms = ['Reel', 'March']; - $model = factory(Tune::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->R = $rhythms; - - $this->assertEquals($rhythms[0], $model->R[0]); - $this->assertEquals($rhythms[1], $model->R[1]); - } - - public function testRhythmAttributeSaves() - { - $rhythms = ['England', 'Scotland']; - $model = factory(Tune::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->R = $rhythms; - $model->save(); - $model = $model->fresh(); - - $this->assertEquals($rhythms[0], $model->R[0]); - $this->assertEquals($rhythms[1], $model->R[1]); - } - - public function testCanGetHistoryAttribute() - { - $history = 'England'; - $model = factory(Tune::class)->create([]); - $attr = factory(TuneAttribute::class)->create([ - 'tune_id' => $model->id, - 'type' => 'History', - 'string' => $history, - ]); - $model = $model->fresh(); - - $this->assertInstanceOf(Tune::class, $model); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $this->assertEquals($history, $model->H[0]); - } - - public function testSetHistoryAttribute() - { - $history = ['some ', 'lines']; - $model = factory(Tune::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->H = $history; - - $this->assertEquals($history[0], $model->H[0]); - $this->assertEquals($history[1], $model->H[1]); - } - - - public function testHistoryAttributeSaved() - { - $history = ['some ', 'lines']; - $model = factory(Tune::class)->create([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - - $model->H = $history; - $model->save(); - $model = $model->fresh(); - - $this->assertEquals($history[0], $model->H[0]); - $this->assertEquals($history[1], $model->H[1]); - } - - public function testValidationAppliedOnSave() - { - $model = factory(Tune::class)->make([]); - $this->assertEmpty($model->getMessages(), json_encode($model->getMessages())); - $model->x_id = 'NotType'; - - $this->assertFalse($model->save()); - } - -} diff --git a/tests/unit/Laravel5/factories/ModelFactory.php b/tests/unit/Laravel5/factories/ModelFactory.php deleted file mode 100644 index 63caa6d..0000000 --- a/tests/unit/Laravel5/factories/ModelFactory.php +++ /dev/null @@ -1,56 +0,0 @@ -define(\XaiCorp\AbcParser\Models\Laravel5\Collection::class, function (Faker\Generator $faker) { - return [ - 'name' => $faker->name, - ]; -}); - -$factory->define(\XaiCorp\AbcParser\Models\Laravel5\Tune::class, function (Faker\Generator $faker) { - return [ - 'x_id' => $faker->numberBetween(1, 10), - ]; -}); - -$factory->define(\XaiCorp\AbcParser\Models\Laravel5\Person::class, function (Faker\Generator $faker) { - return [ - 'name' => $faker->name, - 'email'=> $faker->safeEmail, - ]; -}); - -$factory->define(\XaiCorp\AbcParser\Models\Laravel5\TuneAttribute::class, function (Faker\Generator $faker) { - $types = \XaiCorp\AbcParser\Models\Laravel5\TuneAttribute::getTypes(); - return [ - 'tune_id' => function () { - return factory(\XaiCorp\AbcParser\Models\Laravel5\Tune::class)->create()->id; - }, - 'type' => $types[random_int(0, count($types)-1)], - 'string' => $faker->words(3, true), - 'ordering' => $faker->numberBetween(1, 5), - ]; -}); - - -$factory->define(\XaiCorp\AbcParser\Models\Laravel5\CollectionAttribute::class, function (Faker\Generator $faker) { - $types = \XaiCorp\AbcParser\Models\Laravel5\CollectionAttribute::getTypes(); - return [ - 'collection_id' => function () { - return factory(\XaiCorp\AbcParser\Models\Laravel5\Collection::class)->create()->id; - }, - 'type' => $types[random_int(0, count($types)-1)], - 'string' => $faker->words(3, true), - 'ordering' => $faker->numberBetween(1, 5), - ]; -}); diff --git a/tests/unit/Laravel5/factories/TuneSettingFactory.php b/tests/unit/Laravel5/factories/TuneSettingFactory.php deleted file mode 100644 index 2682e8f..0000000 --- a/tests/unit/Laravel5/factories/TuneSettingFactory.php +++ /dev/null @@ -1,24 +0,0 @@ -define(\XaiCorp\AbcParser\Models\Laravel5\TuneSetting::class, function (Faker\Generator $faker) { - return [ - 'tune_id' => function () { - return factory(\XaiCorp\AbcParser\Models\Laravel5\Tune::class)->create()->id; - }, - 'meter' => 'C', - 'keysig' => '6/8', - ]; -}); - -$factory->define(\XaiCorp\AbcParser\Models\Laravel5\TuneSettingAttribute::class, function (Faker\Generator $faker) { - $types = \XaiCorp\AbcParser\Models\Laravel5\TuneSettingAttribute::getTypes(); - return [ - 'setting_id' => function () { - return factory(\XaiCorp\AbcParser\Models\Laravel5\TuneSetting::class)->create()->id; - }, - 'type' => $types[random_int(0, count($types)-1)], - 'string' => $faker->words(3, true), - 'ordering' => $faker->numberBetween(1, 5), - ]; -}); diff --git a/tests/unit/AbcParserCest.php b/tests/unit/ParserCest.php similarity index 94% rename from tests/unit/AbcParserCest.php rename to tests/unit/ParserCest.php index 64e6dea..4f4f423 100644 --- a/tests/unit/AbcParserCest.php +++ b/tests/unit/ParserCest.php @@ -1,10 +1,12 @@ mock(); $parser = new Parser($builder); - + $I->assertInstanceOf(Parser::class, $parser); } @@ -62,6 +64,7 @@ class AbcParserCest ->shouldReceive('newTune')->once() ->shouldReceive('newSetting')->once() ->shouldReceive('appendToSetting')->once() + ->shouldReceive('setOnSetting')->once() ->shouldReceive('storeTune')->once() ->shouldreceive('getCollection')->once()->andreturn(true); $builder->shouldReceive('setOnTune') diff --git a/tests/unit/Laravel5/AbcParserCest.php b/tests/unit/arr/AbcCest.php similarity index 58% rename from tests/unit/Laravel5/AbcParserCest.php rename to tests/unit/arr/AbcCest.php index fd02d23..1be0e26 100644 --- a/tests/unit/Laravel5/AbcParserCest.php +++ b/tests/unit/arr/AbcCest.php @@ -1,11 +1,12 @@ dataDir.'/abc/valid_abc_1.abc'); + $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 :|' + 'X' => '3', + 'M' => '4/4', + 'K' => 'C', + 'music' => 'gaab babc :|', ], ]; $result = $parser->parseABC($abc); $I->assertNotEmpty($result); - $resultArray = $result->toArray(); - $I->assertEquals($expected, $resultArray); + $I->assertEquals($expected, $result); } public function seeParseABCExample2(UnitTester $I) { - $abc = file_get_contents($this->dataDir.'/abc/valid_abc_2.abc'); + $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' => [ + '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' + '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', + '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|]' +|:A|BcB e3|BcB f3|BcB AGF|1G2F G2:|2E3-E2|]', ], ]; $result = $parser->parseABC($abc); $I->assertNotEmpty($result); - $resultArray = $result->toArray(); - $I->assertEquals($expected, $resultArray); + $I->assertEquals($expected, $result); } public function seeParseABCExample3(UnitTester $I) { - $abc = file_get_contents($this->dataDir.'/abc/valid_abc_3.abc'); + $abc = file_get_contents($this->dataDir . '/abc/valid_abc_3.abc'); $parser = new Parser($this->builder); $expected = [ 'A' => ['trad'], @@ -128,7 +127,7 @@ e2g efg|c2e cde|dcB AGF|E3E2 'D' => ['None'], 'H' => [ 'Thousand year old tradition', - 'The Horns live in the church and are removed for the dance once a year' + 'The Horns live in the church and are removed for the dance once a year', ], 'R' => ['Jig'], 'F' => ['none.abc'], @@ -141,17 +140,17 @@ e2g efg|c2e cde|dcB AGF|E3E2 'Z' => ['Andy Hornby'], 1 => [ - 'X' => '3', - 'T' => ['Short and Sweet'], - 'M' => '4/4', - 'K' => 'C', - 'music' => 'gaab babc :|' - ] + 'X' => '3', + 'M' => '4/4', + 'K' => 'C', + 'music' => 'gaab babc :|', + 'T' => ['Short and Sweet'] + ], ]; $result = $parser->parseABC($abc); - $I->assertNotEmpty($result->toArray()); + $I->assertNotEmpty($result); - $I->assertEquals($expected, $result->toArray()); + $I->assertEquals($expected, $result); } } diff --git a/tests/unit/arr/AbcParserCest.php b/tests/unit/arr/AbcParserCest.php deleted file mode 100644 index 8159f76..0000000 --- a/tests/unit/arr/AbcParserCest.php +++ /dev/null @@ -1,154 +0,0 @@ -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); - } -} diff --git a/tests/unit/memory/AbcParserTest.php b/tests/unit/memory/AbcParserTest.php index da20ed8..5ccf6a0 100644 --- a/tests/unit/memory/AbcParserTest.php +++ b/tests/unit/memory/AbcParserTest.php @@ -1,158 +1,100 @@ _facade = new AbcParser(); + $this->facade = new AbcParser(new Abc()); } - public function test_not_header_data_no_crash() + private function getValidAbc($filename = '/abc/valid_abc_1.abc') { - $result = $this->_facade->parseABC($this->valid_abc_1); - $this->assertTrue(is_a($result, 'App\Libraries\abcParse\TuneCollection')); + return file_get_contents(codecept_data_dir($filename)); + } + + public function testNotHeaderDataNoCrash() + { + $result = $this->facade->parseABC($this->getValidAbc()); + $this->assertInstanceOf(\XaiCorp\AbcParser\Models\Memory\TuneCollection::class, $result); } - public function test_all_parameters_for_tune() + public function testAllParametersForTune() { - $result = $this->_facade->parseABC($this->valid_abc_2); - $this->assertTrue(is_a($result, 'App\Libraries\abcParse\TuneCollection')); + $result = $this->facade->parseABC($this->getValidAbc('/abc/valid_abc_2.abc')); - // Tune details + // Tune details $tune = $result[0]; - // var_dump($tune); die(); $this->assertEquals('40', $result[0]->get('X')); - $this->assertEquals('Abbotts Bromley Horn Dance', array_shift($tune->get('T')) ); - $this->assertEquals('England', array_shift($tune->get('O')) ); - $this->assertEquals(new App\Libraries\abcParse\Person(array('name'=>'trad')), array_shift($tune->get('A')) ); - $this->assertEquals(new App\Libraries\abcParse\Person(array('name'=>'trad.')), array_shift($tune->get('C')) ); - $this->assertEquals('England', array_shift($tune->get('O')) ); - $this->assertEquals('lute', array_shift($tune->get('G')) ); + $this->assertEquals('Abbotts Bromley Horn Dance', current($tune->get('T'))); + $this->assertEquals('England', current($tune->get('O'))); + $this->assertEquals(new Person(['name' => 'trad']), current($tune->get('A'))); + $this->assertEquals(new Person(['name' => 'trad.']), current($tune->get('C'))); + $this->assertEquals('England', current($tune->get('O'))); + $this->assertEquals('lute', current($tune->get('G'))); $history = $tune->get('H'); $this->assertEquals(2, count($history)); - $this->assertEquals('Thousand year old tradition', $history[0] ); - $this->assertEquals('The Horns live in the church and are removed for the dance once a year', $history[1] ); - $this->assertEquals('Jig', array_shift($tune->get('R')) ); + $this->assertEquals('Thousand year old tradition', $history[0]); + $this->assertEquals('The Horns live in the church and are removed for the dance once a year', $history[1]); + $this->assertEquals('Jig', current($tune->get('R'))); // setting details $setting = $tune[0]; - // var_dump($setting);die; - $this->assertEquals('Traditional English', array_shift($setting->get('N')) ); - $this->assertEquals('1/8', $setting->get('L') ); - $this->assertEquals('6/8', $setting->get('M') ); - $this->assertEquals('G', $setting->get('K') ); + $this->assertEquals('Traditional English', current($setting->get('N'))); + $this->assertEquals('1/8', $setting->get('L')); + $this->assertEquals('6/8', $setting->get('M')); + $this->assertEquals('G', $setting->get('K')); $expectedMusic = " 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|] "; - $this->assertEquals(trim($expectedMusic), $setting->get('music'), "music strings should match" ); + $this->assertEquals(trim($expectedMusic), $setting->get('music'), "music strings should match"); - $Z = new App\Libraries\abcParse\Person(array('name'=>'Andy Hornby')); - $this->assertEquals($Z, array_shift($setting->get('Z')) ); + $Z = new Person(['name' => 'Andy Hornby']); + $this->assertEquals($Z, current($setting->get('Z'))); - $this->assertEquals('None', array_shift($setting->get('D')) ); - $this->assertEquals('http://www.leeds.ac.uk/music/Info/RRTuneBk/gettune/00000dab.html', array_shift($setting->get('S')) ); - $this->assertEquals('None', array_shift($setting->get('W')) ); - $this->assertEquals('Traditional English tunes', array_shift($setting->get('B')) ); - $this->assertEquals('none.abc', array_shift($setting->get('F')) ); - $this->assertEquals('ABC', $setting->get('P') ); - $this->assertEquals('1/8=80', $setting->get('Q') ); + $this->assertEquals('None', current($setting->get('D'))); + $this->assertEquals( + 'http://www.leeds.ac.uk/music/Info/RRTuneBk/gettune/00000dab.html', + current($setting->get('S')) + ); + $this->assertEquals('None', current($setting->get('W'))); + $this->assertEquals('Traditional English tunes', current($setting->get('B'))); + $this->assertEquals('none.abc', current($setting->get('F'))); + $this->assertEquals('ABC', $setting->get('P')); + $this->assertEquals('1/8=80', $setting->get('Q')); } - public function test_all_parameters_for_collection() + public function testAllParametersForCollection() { - $collection = $this->_facade->parseABC($this->valid_abc_3); - $this->assertTrue(is_a($collection, 'App\Libraries\abcParse\TuneCollection')); + $collection = $this->facade->parseABC($this->getValidAbc('/abc/valid_abc_3.abc')); - $this->assertEquals(new App\Libraries\abcParse\Person(array('name'=>'trad')), array_shift($collection->get('A')) ); - $this->assertEquals('Traditional English tunes', array_shift($collection->get('B')) ); - $this->assertEquals(new App\Libraries\abcParse\Person(array('name'=>'trad.')), array_shift($collection->get('C')) ); - $this->assertEquals('None', array_shift($collection->get('D')) ); - $this->assertEquals('none.abc', array_shift($collection->get('F')) ); - $this->assertEquals('Thousand year old tradition', array_shift($collection->get('H')) ); - $this->assertEquals('1/8', $collection->get('L') ); - $this->assertEquals('6/8', $collection->get('M') ); - $this->assertEquals('Traditional English', array_shift($collection->get('N')) ); - $this->assertEquals('England', array_shift($collection->get('O')) ); - $this->assertEquals('Jig', $collection->get('R') ); - $this->assertEquals('http://www.leeds.ac.uk/music/Info/RRTuneBk/gettune/00000dab.html', array_shift($collection->get('S')) ); - $this->assertEquals(new App\Libraries\abcParse\Person(array('name'=>'Andy Hornby')), array_shift($collection->get('Z')) ); + $this->assertEquals(new Person(['name' => 'trad']), current($collection->get('A'))); + $this->assertEquals('Traditional English tunes', current($collection->get('B'))); + $this->assertEquals(new Person(['name' => 'trad.']), current($collection->get('C'))); + $this->assertEquals('None', current($collection->get('D'))); + $this->assertEquals('none.abc', current($collection->get('F'))); + $this->assertEquals('Thousand year old tradition', current($collection->get('H'))); + $this->assertEquals('1/8', $collection->get('L')); + $this->assertEquals('6/8', $collection->get('M')); + $this->assertEquals('Traditional English', current($collection->get('N'))); + $this->assertEquals('England', current($collection->get('O'))); + $this->assertEquals('Jig', $collection->get('R')); + $this->assertEquals( + 'http://www.leeds.ac.uk/music/Info/RRTuneBk/gettune/00000dab.html', + current($collection->get('S')) + ); + $this->assertEquals(new Person(['name' => 'Andy Hornby']), current($collection->get('Z'))); } } diff --git a/tests/unit/memory/PabcTest.php b/tests/unit/memory/PabcTest.php deleted file mode 100644 index 72799d9..0000000 --- a/tests/unit/memory/PabcTest.php +++ /dev/null @@ -1,104 +0,0 @@ -_facade = new Pabc(); - } - - private $valid_abc_1 = " -X:1 -M:C -K:C -gaab babc :| - "; - - - /** - * test the parse_abc function - * - * This method receives abc in a string - * and converts it into a Tune object. - * If the string is not valid abc no Tune object is created - * and the method returns false. - * - * @dataProvider provider_parse_abc - */ - public function test_parse_abc($string, $isValid) - { - $result = $this->_facade->parse_abc($string); - $this->assertEquals($isValid, is_a($result, TuneCollection::class)); - } - - public function provider_parse_abc() - { - return array( - array('not an abc', FALSE), - array($this->valid_abc_1, TRUE), - ); - } - - - public function test_load_models() - { - $params = array( - 'tuneModel' => new Tune(), - 'settingModel' => new Setting(), - 'personModel' => new Person(), - ); - - $this->_facade = new Pabc($params); - - $this->assertInstanceOf(Tune::class, $this->_facade->tuneModel); - $this->assertInstanceOf(Setting::class, $this->_facade->settingModel); - $this->assertInstanceOf(Person::class, $this->_facade->personModel); - } - - - public function test_save_no_models() - { - $this->assertNull($this->_facade->tuneModel); - - $result = $this->_facade->parse_abc($this->valid_abc_1); - $this->assertInstanceOf(TuneCollection::class, $result); - - $this->assertFalse($result->get('change_hash')); - $saved = $this->_facade->save_collection($result); - $this->assertFalse($saved); - $this->assertFalse($result->get('change_hash')); - } - - public function test_save() - { - $params = array( - 'tuneModel' => Mockery::mock(Tune::Class, ['store'=>true]), - 'settingModel' => Mockery::mock(Setting::class, ['store'=>true]), - 'personModel' => Mockery::mock(Person::class, ['store'=>true]), - ); - - $this->_facade = new Pabc($params); - - $result = $this->_facade->parse_abc($this->valid_abc_1); - $this->assertInstanceOf(TuneCollection::class, $result); - - $this->assertFalse($result->get('change_hash')); - $saved = $this->_facade->save_collection($result); - $this->assertTrue($saved); - $this->assertNotNull($result->get('change_hash')); - } - -} \ No newline at end of file diff --git a/tests/unit/memory/PersonTest.php b/tests/unit/memory/PersonTest.php index 0ccb41b..ffd6b34 100644 --- a/tests/unit/memory/PersonTest.php +++ b/tests/unit/memory/PersonTest.php @@ -1,40 +1,44 @@ _person = new Person(); + $this->person = new Person(); } /** * test the model contains the correct attributes */ - public function test_model_definition() + public function testModelDefinition() { $this->assertClassHasAttribute('person_id', Person::class); $this->assertClassHasAttribute('name', Person::class); $this->assertClassHasAttribute('email', Person::class); } - public function test_construct() + public function testConstruct() { - $params = array('person_id' => 5); - $this->_person = new Person($params); + $params = ['person_id' => 5]; + $this->person = new Person($params); - $this->assertEquals(5, $this->_person->get('person_id')); + $this->assertEquals(5, $this->person->get('person_id')); } + /** + * @dataProvider providerSet + */ + public function testMagicSet($property, $value, $expected) + { + $this->testSet($property, $value, $expected); + } /** * test the set property method @@ -43,74 +47,65 @@ class PersonTest extends Test * @param (mixed) value to set * @param (Boolean) expected value for return value of set method * - * @dataProvider provider_set + * @dataProvider providerSet */ - public function test_set($property, $value, $expected) + public function testSet($property, $value, $expected) { - $success = $this->_person->set($property, $value); + $success = $this->person->set($property, $value); $this->assertEquals($expected, $success); - if($success) - { - $this->assertEquals($value, $this->_person->get($property)); + if ($success) { + $this->assertEquals($value, $this->person->get($property)); } } - /** - * @dataProvider provider_set - */ - public function test_magic_set($property, $value, $expected) + public function providerSet() { - $this->test_set($property, $value, $expected); - } - - public function provider_set() - { - return array( - array('Y', 'anything', FALSE), - array('person_id', 'not', FALSE), - array('person_id', 11, TRUE), - array('person_id', '11', TRUE), - array('name', null, FALSE), - array('name', 1, FALSE), - array('name', 'anything', TRUE), - array('email', 'anything', FALSE), - array('email', 1, FALSE), - array('email', 'mail@example.com', TRUE), - ); + return [ + ['Y', 'anything', false], + ['person_id', 'not', false], + ['person_id', 11, true], + ['person_id', '11', true], + ['name', null, false], + ['name', 1, false], + ['name', 'anything', true], + ['email', 'anything', false], + ['email', 1, false], + ['email', 'mail@example.com', true], + ]; } /** - * @dataProvider provider_person_get + * @dataProvider providerPersonGet */ - public function test_person_get($key, $expected) + public function testPersonGet($key, $expected) { - $result = $this->_person->set($key, $expected); - $result = $this->_person->get($key); + $result = $this->person->set($key, $expected); + $result = $this->person->get($key); $this->assertEquals($expected, $result); } - public function provider_person_get() + public function providerPersonGet() { - return array( - array('', FALSE), - array('me', FALSE), - array(array('of','me'), FALSE), - array(new Person(), FALSE), - array('name', 'Richard Morgan'), - array('email', 'r_morgan@sympatico.ca'), - array('person_id', 0) - ); + return [ + ['', false], + ['me', false], + [['of', 'me'], false], + [new Person(), false], + ['name', 'Richard Morgan'], + ['email', 'r_morgan@sympatico.ca'], + ['person_id', 0], + ]; } - public function test_is_changed() + public function testIsChanged() { - $person = new Person(array('name'=>'Richard Morgan')); + $person = new Person(['name' => 'Richard Morgan']); $this->assertInstanceOf(Person::class, $person); $this->assertFalse($person->is_changed(), 'after load should be no changes'); - $person->set('name','Richard Armitage'); + $person->set('name', 'Richard Armitage'); $this->assertTrue($person->is_changed(), 'updating the name changes the data'); } @@ -122,23 +117,18 @@ class PersonTest extends Test * @param (array) $params list of properties to set on the objects * @param (boolean) $expected result of running equals * - * @dataProvider provider_equals + * @dataProvider providerEquals */ - public function test_equals($params) + public function testEquals($params) { - // $this->markTestIncomplete(); - $ob1 = new Person(); $ob2 = new Person(); - foreach($params as $key => $val) - { - if(is_array($ob1->get($key))) - { + foreach ($params as $key => $val) { + if (is_array($ob1->get($key))) { $ob1->append($key, $val); $ob2->append($key, $val); - } - else { + } else { $ob1->set($key, $val); $ob2->set($key, $val); } @@ -146,6 +136,7 @@ class PersonTest extends Test $this->assertTrue(Person::equals($ob1, $ob2)); } + /** * test the static function equals * returns true if the data properties of 2 Person objects @@ -154,36 +145,32 @@ class PersonTest extends Test * @param (array) $params list of properties to set on the objects * @param (boolean) $expected result of running equals * - * @dataProvider provider_equals + * @dataProvider providerEquals */ - public function test_equals_fails($params) + public function testEqualsFails($params) { $ob1 = new Person(); $ob2 = new Person(); - foreach($params as $key => $val) - { - if(is_array($ob1->get($key))) - { + foreach ($params as $key => $val) { + if (is_array($ob1->get($key))) { $ob1->append($key, $val); - $ob2->append($key, $val." hello"); - } - else { + $ob2->append($key, $val . " hello"); + } else { $ob1->set($key, $val); - $ob2->set($key, $val+1); + $ob2->set($key, $val + 1); } } // print_r($ob1); print_r($ob2); die; $this->assertFalse(Person::equals($ob1, $ob2)); } - public function provider_equals() + + public function providerEquals() { - return array( + return [ // array( array('person_id'=>'2') ), - array( array('name'=>'a title') ), - array( array('email'=>'mail@example.com') ), - ); + [['name' => 'a title']], + [['email' => 'mail@example.com']], + ]; } - - } diff --git a/tests/unit/memory/SettingTest.php b/tests/unit/memory/SettingTest.php index 33cdf86..6ea796a 100644 --- a/tests/unit/memory/SettingTest.php +++ b/tests/unit/memory/SettingTest.php @@ -1,30 +1,30 @@ _setting = new Setting(); - } - + private $setting; + + public function setUp() + { + $this->setting = new Setting(); + } + /** * test the model contains the correct attributes */ - public function test_model_definition() - { + public function testModelDefinition() + { $this->assertClassHasAttribute('settingID', Setting::class); $this->assertClassHasAttribute('tuneID', Setting::class); - + $this->assertClassHasAttribute('Z', Setting::class); $this->assertClassHasAttribute('N', Setting::class); $this->assertClassHasAttribute('D', Setting::class); @@ -42,323 +42,313 @@ class SettingTest extends TestCase // $this->assertClassHasAttribute('music_hash', Setting::class); $this->assertClassHasAttribute('propertyNames', Setting::class); - } + } /** * test the set property method - * + * * also tests the validate_line protected method - * + * * @param (string) $property, the name of the property to set * @param (mixed) value to set * @param (Boolean) expected value for return value of set method - * - * @dataProvider provider_set + * + * @dataProvider providerSet */ - public function test_set($property, $value, $expected_success, $expected_value = FALSE) + public function testSet($property, $value, $expected_success, $expected_value = false) { - $success = $this->_setting->set($property, $value); + $success = $this->setting->set($property, $value); $this->assertEquals($expected_success, $success); - if($success) - { - if(! $expected_value ) { $expected_value = $value; } - $this->assertEquals($expected_value, $this->_setting->get($property)); + if ($success) { + if (!$expected_value) { + $expected_value = $value; + } + $this->assertEquals($expected_value, $this->setting->get($property)); } } - /** - * @dataProvider provider_set - */ - public function test_magic_set($property, $value, $expected_success, $expected_value = FALSE) - { - $this->_setting->$property = $value; - if($expected_success) - { - $this->assertEquals($value, $this->_setting->get($property)); - } - } - - public function provider_set() - { - return array( - array('Y', 'anything', FALSE), - array('settingID', 1, TRUE), - array('tuneID', array('alpha'), FALSE), - array('tuneID', 'alpha', FALSE), - array('tuneID', '1', TRUE), - array('tuneID', 1, TRUE), - array('f', 1, FALSE), - array('F', 1, FALSE), - array('F', '1',FALSE), - array('F', array('aplha'), TRUE), - array('P', array('string'), FALSE), - array('P', 10, FALSE), - array('P', 'string', TRUE), - array('Q', array('string'), FALSE), - array('Q', 10, FALSE), - array('Q', 'string', FALSE), - array('Q', '1/8=200', TRUE), - array('L', array('string'), FALSE), - array('L', 10, FALSE), - array('L', 'string', FALSE), - array('L', '1/8', TRUE), - array('M', array('string'), FALSE), - array('M', 10, FALSE), - array('M', 'string', FALSE), - array('M', '6/8', TRUE), - array('M', 'C', TRUE), - array('M', 'c', TRUE), - array('M', 'C|', TRUE), - array('K', array('string'), FALSE), - array('K', 10, FALSE), - array('K', 'C', TRUE), - array('K', 'Am', TRUE), - array('K', 'A minor', TRUE), - array('K', 'E dorian', TRUE), - array('music', 'GABc:|\\', TRUE), - array('Z', new Person(), FALSE), - array('Z', array(new Person(), 'not a person'), FALSE), - array('Z', array(new Person()), TRUE), - array('Z', 111, FALSE), - array('N', array('a string'), TRUE), - array('D', array('a string'), TRUE), - array('S', array('a string'), TRUE), - array('W', array('a string'), TRUE), - array('B', array('a string'), TRUE), - ); + /** + * @dataProvider providerSet + */ + public function testMagicSet($property, $value, $expected_success, $expected_value = false) + { + $this->setting->$property = $value; + if ($expected_success) { + $this->assertEquals($value, $this->setting->get($property)); + } } - + + public function providerSet() + { + return [ + ['Y', 'anything', false], + ['settingID', 1, true], + ['tuneID', ['alpha'], false], + ['tuneID', 'alpha', false], + ['tuneID', '1', true], + ['tuneID', 1, true], + ['f', 1, false], + ['F', 1, false], + ['F', '1', false], + ['F', ['aplha'], true], + ['P', ['string'], false], + ['P', 10, false], + ['P', 'string', true], + ['Q', ['string'], false], + ['Q', 10, false], + ['Q', 'string', false], + ['Q', '1/8=200', true], + ['L', ['string'], false], + ['L', 10, false], + ['L', 'string', false], + ['L', '1/8', true], + ['M', ['string'], false], + ['M', 10, false], + ['M', 'string', false], + ['M', '6/8', true], + ['M', 'C', true], + ['M', 'c', true], + ['M', 'C|', true], + ['K', ['string'], false], + ['K', 10, false], + ['K', 'C', true], + ['K', 'Am', true], + ['K', 'A minor', true], + ['K', 'E dorian', true], + ['music', 'GABc:|\\', true], + ['Z', new Person(), false], + ['Z', [new Person(), 'not a person'], false], + ['Z', [new Person()], true], + ['Z', 111, false], + ['N', ['a string'], true], + ['D', ['a string'], true], + ['S', ['a string'], true], + ['W', ['a string'], true], + ['B', ['a string'], true], + ]; + } + /** * the settingID can only be set if it's value is currently 0 * this ensures that we can't change a setting's id once it's set. * the default, unset value for settingID is 0 */ - public function test_set_settingID() + public function testSetSettingID() { - $success = $this->_setting->set('settingID', 1); + $success = $this->setting->set('settingID', 1); $this->assertTrue($success, 'first attempt should succeed'); - - $success = $this->_setting->set('settingID', 2); + + $success = $this->setting->set('settingID', 2); $this->assertFalse($success, 'second attempt should fail'); } - - + + /** * test the append value method - * + * * @param (string) $property, the name of the property to set * @param (mixed) value to append * @param (Boolean) expected value for return value of append method - * - * @dataProvider provider_append + * + * @dataProvider providerAppend */ - public function test_append($property, $value, $expected) + public function testAppend($property, $value, $expected) { - $success = $this->_setting->append($property, $value); + $success = $this->setting->append($property, $value); $this->assertEquals($expected, $success); - if($success) - { - $this->assertContains($value, $this->_setting->get($property)); + if ($success) { + $this->assertContains($value, $this->setting->get($property)); } } - - public function provider_append() - { - return array( - array('Y', 'anything', FALSE), - array('settingID', 1, FALSE), - array('tuneID', array('alpha'), FALSE), - array('tuneID', 'alpha', FALSE), - array('tuneID', '1', FALSE), - array('tuneID', 1, FALSE), - array('f', 1, FALSE), - array('F', 1, TRUE), - array('F', '1', TRUE), - array('F', array('aplha'), FALSE), - array('P', array('string'), FALSE), - array('P', 10, FALSE), - array('P', 'string', FALSE), - array('Q', array('string'), FALSE), - array('Q', 10, FALSE), - array('Q', 'string', FALSE), - array('Q', '1/8=200', FALSE), - array('L', array('string'), FALSE), - array('L', 10, FALSE), - array('L', 'string', FALSE), - array('L', '1/8', FALSE), - array('M', array('string'), FALSE), - array('M', 10, FALSE), - array('M', 'string', FALSE), - array('M', '6/8', FALSE), - array('M', 'C', FALSE), - array('M', 'c', FALSE), - array('M', 'C|', FALSE), - array('K', array('string'), FALSE), - array('K', 10, FALSE), - array('K', 'C', FALSE), - array('K', 'Am', FALSE), - array('K', 'A minor', FALSE), - array('K', 'E dorian', FALSE), - array('music', 'GABc:|\\', FALSE), - array('Z', new Person(), TRUE), - array('Z', array(new Person()), FALSE), - array('Z', 111, FALSE), - array('N', array('a string'), FALSE), - array('D', array('a string'), FALSE), - array('S', array('a string'), FALSE), - array('W', array('a string'), FALSE), - array('B', array('a string'), FALSE), - array('N', 'more notes', TRUE), - array('D', 'another record', TRUE), - array('S', 'another source', TRUE), - array('W', 'words', TRUE), - array('B', 'another book', TRUE), - ); - } - - /** - * @dataProvider provider_get - */ - public function test_get($key, $expected) + public function providerAppend() { - $result = $this->_setting->set($key, $expected); - $result = $this->_setting->get($key); + return [ + ['Y', 'anything', false], + ['settingID', 1, false], + ['tuneID', ['alpha'], false], + ['tuneID', 'alpha', false], + ['tuneID', '1', false], + ['tuneID', 1, false], + ['f', 1, false], + ['F', 1, true], + ['F', '1', true], + ['F', ['aplha'], false], + ['P', ['string'], false], + ['P', 10, false], + ['P', 'string', false], + ['Q', ['string'], false], + ['Q', 10, false], + ['Q', 'string', false], + ['Q', '1/8=200', false], + ['L', ['string'], false], + ['L', 10, false], + ['L', 'string', false], + ['L', '1/8', false], + ['M', ['string'], false], + ['M', 10, false], + ['M', 'string', false], + ['M', '6/8', false], + ['M', 'C', false], + ['M', 'c', false], + ['M', 'C|', false], + ['K', ['string'], false], + ['K', 10, false], + ['K', 'C', false], + ['K', 'Am', false], + ['K', 'A minor', false], + ['K', 'E dorian', false], + ['music', 'GABc:|\\', false], + + ['Z', new Person(), true], + ['Z', [new Person()], false], + ['Z', 111, false], + ['N', ['a string'], false], + ['D', ['a string'], false], + ['S', ['a string'], false], + ['W', ['a string'], false], + ['B', ['a string'], false], + ['N', 'more notes', true], + ['D', 'another record', true], + ['S', 'another source', true], + ['W', 'words', true], + ['B', 'another book', true], + ]; + } + + /** + * @dataProvider providerGet + */ + public function testGet($key, $expected) + { + $result = $this->setting->set($key, $expected); + $result = $this->setting->get($key); $this->assertEquals($expected, $result); } - public function provider_get() + public function providerGet() { - return array( - array('', FALSE), - array('me', FALSE), - array('settingID', 1), - array('tuneID', 2), - array('Q', '1/8=100'), - array('L', '1/8'), - array('M', '6/8'), - array('K', 'Am'), - array('music', 'GABc:|\\'), + return [ + ['', false], + ['me', false], + ['settingID', 1], + ['tuneID', 2], + ['Q', '1/8=100'], + ['L', '1/8'], + ['M', '6/8'], + ['K', 'Am'], + ['music', 'GABc:|\\'], + + ['Z', [new Person()]], + ['N', ['a string']], + ['D', ['a string']], + ['S', ['a string']], + ['W', ['a string']], + ['B', ['a string']], + ]; + } - array('Z', array(new Person())), - array('N', array('a string')), - array('D', array('a string')), - array('S', array('a string')), - array('W', array('a string')), - array('B', array('a string')), - ); - } - /** * test the static function equals * returns true if the data properties of 2 Setting Objects * are identical - * + * * @param (array) $params list of properties to set on the objects * @param (boolean) $expected result of running equals - * - * @dataProvider provider_equals + * + * @dataProvider providerEquals */ - public function test_equals($params) + public function testEquals($params) { - // $this->markTestIncomplete(); - $ob1 = new Setting(); $ob2 = new Setting(); - - foreach($params as $key => $val) - { - if(is_array($ob1->get($key))) - { + + foreach ($params as $key => $val) { + if (is_array($ob1->get($key))) { $ob1->append($key, $val); $ob2->append($key, $val); - } - else { + } else { $ob1->set($key, $val); $ob2->set($key, $val); } } - + $this->assertTrue(Setting::equals($ob1, $ob2)); } - + /** * test the static function equals * returns true if the data properties of 2 Abc_Tunes * are identical - * + * * @param (array) $params list of properties to set on the objects * @param (boolean) $expected result of running equals - * - * @dataProvider provider_equals + * + * @dataProvider providerEquals */ - public function test_equals_fails($params) + public function testEqualsFails($params) { $ob1 = new Setting(); $ob2 = new Setting(); - - foreach($params as $key => $val) - { - if(is_array($ob1->get($key))) - { + + foreach ($params as $key => $val) { + if (is_array($ob1->get($key))) { $ob1->append($key, $val); // $ob2->append($key, $val); - } - else { + } else { $ob1->set($key, $val); - $ob2->set($key, $val+1); + $ob2->set($key, $val + 1); } } $this->assertFalse(Setting::equals($ob1, $ob2)); } - public function provider_equals() + + public function providerEquals() { - return array( - array( array('settingID'=>'2') ), - array( array('tuneID'=>'2') ), - array( array('Z'=> new Person()) ), - array( array('N'=>'an author') ), - array( array('D'=>'a composer') ), - array( array('S'=>'a group') ), - array( array('W'=>'some history') ), - array( array('B'=>'Plymouth') ), - array( array('F'=>'Jig') ), - array( array('P'=>'ABB') ), - array( array('Q'=>'1/8=100') ), - array( array('L'=>'1/4') ), - array( array('M'=>'2/4') ), - array( array('K'=>'G') ), - array( array('music'=>'a|cab|') ), - ); + return [ + [['settingID' => '2']], + [['tuneID' => '2']], + [['Z' => new Person()]], + [['N' => 'an author']], + [['D' => 'a composer']], + [['S' => 'a group']], + [['W' => 'some history']], + [['B' => 'Plymouth']], + [['F' => 'Jig']], + [['P' => 'ABB']], + [['Q' => '1/8=100']], + [['L' => '1/4']], + [['M' => '2/4']], + [['K' => 'G']], + [['music' => 'a|cab|']], + ]; } - - public function test_isChanged() + + public function testIsChanged() { $setting = new Setting(); $this->assertInstanceOf(Setting::class, $setting); - + $this->assertFalse($setting->is_changed(), 'after load should be no changes'); - - $setting->set('K','G'); + + $setting->set('K', 'G'); $this->assertTrue($setting->is_changed(), 'updating the name changes the data'); } - - - public function test_construct() + + + public function testConstruct() { - $params = array( + $params = [ 'settingID' => 3, - 'Z' => array(new Person()), - 'P' => 'ABC' - ); - - $this->_setting = new Setting ($params); - - foreach($params as $key => $val) - { - $this->assertEquals($val, $this->_setting->get($key)); + 'Z' => [new Person()], + 'P' => 'ABC', + ]; + + $this->setting = new Setting($params); + + foreach ($params as $key => $val) { + $this->assertEquals($val, $this->setting->get($key)); } } - } diff --git a/tests/unit/memory/TuneCollectionTest.php b/tests/unit/memory/TuneCollectionTest.php index 2aac228..3f688ac 100644 --- a/tests/unit/memory/TuneCollectionTest.php +++ b/tests/unit/memory/TuneCollectionTest.php @@ -1,210 +1,203 @@ _tunes = new TuneCollection(); + $this->tunes = new TuneCollection(); } - - + + /** * test the implementation of the Iterator interface * 100% coverage! ;) */ - public function test_iterator() + public function testIterator() { $t = new Tune(); - $this->assertEquals(0, count($this->_tunes)); - $this->_tunes[] = $t; - $this->_tunes->push($t); - $this->assertEquals(2, count($this->_tunes)); - - $this->assertInstanceOf(Tune::class, $this->_tunes[0], 'first tune'); - $this->assertInstanceOf(Tune::class, $this->_tunes[1], 'second tune'); - - foreach($this->_tunes as $key=>$val) - { + $this->assertEquals(0, count($this->tunes)); + $this->tunes[] = $t; + $this->tunes->push($t); + $this->assertEquals(2, count($this->tunes)); + + $this->assertInstanceOf(Tune::class, $this->tunes[0], 'first tune'); + $this->assertInstanceOf(Tune::class, $this->tunes[1], 'second tune'); + + foreach ($this->tunes as $key => $val) { $this->assertInternalType('scalar', $key); $this->assertInstanceOf(Tune::class, $val); - $this->assertTrue(isset($this->_tunes[$key]), 'key is set'); - - unset($this->_tunes[$key]); - $this->assertFalse(isset($this->_tunes[$key]), 'key should have been unset'); + $this->assertTrue(isset($this->tunes[$key]), 'key is set'); + + unset($this->tunes[$key]); + $this->assertFalse(isset($this->tunes[$key]), 'key should have been unset'); } } - + /** * test the ability to remove the last tune from collection - * + * * tests the implementation of the Countable interface */ - public function test_pop() + public function testPop() { - $this->assertEquals(0, count($this->_tunes), 'no tunes in collection to begin with'); - + $this->assertEquals(0, count($this->tunes), 'no tunes in collection to begin with'); + $t = new Tune(); - $this->_tunes->push($t); - - $this->assertEquals(1, count($this->_tunes), '1 tune added to collection'); - - $result = $this->_tunes->pop(); - $this->assertEquals(0, count($this->_tunes), 'no tunes left in collection'); + $this->tunes->push($t); + + $this->assertEquals(1, count($this->tunes), '1 tune added to collection'); + + $result = $this->tunes->pop(); + $this->assertEquals(0, count($this->tunes), 'no tunes left in collection'); $this->assertInstanceOf(Tune::class, $result); } - + // public function test_construct() // { - // $params = array( - // 'tc_id' => 5, - // 'cOwner' => 'me', - // 'B' => array('my tune book'), - // 'R' => 'reel' - // ); -// - // $this->_tunes = new TuneCollection($params); -// - // foreach($params as $key => $val) - // { - // $this->assertEquals($val, $this->_tunes->get($key)); - // } + // $params = array( + // 'tc_id' => 5, + // 'cOwner' => 'me', + // 'B' => array('my tune book'), + // 'R' => 'reel' + // ); +// + // $this->_tunes = new TuneCollection($params); +// + // foreach($params as $key => $val) + // { + // $this->assertEquals($val, $this->_tunes->get($key)); // } - + // } + /** * test the set property method - * + * * @param (string) $property, the name of the property to set * @param (mixed) value to set * @param (Boolean) expected value for return value of set method - * - * @dataProvider provider_set + * + * @dataProvider providerSet */ - public function test_set($property, $value, $expected) + public function testSet($property, $value, $expected) { - $success = $this->_tunes->set($property, $value); + $success = $this->tunes->set($property, $value); $this->assertEquals($expected, $success); - if($success) - { - $this->assertEquals($value, $this->_tunes->get($property)); + if ($success) { + $this->assertEquals($value, $this->tunes->get($property)); } } + /** * test the set property method - * + * * @param (string) $property, the name of the property to set * @param (mixed) value to set * @param (Boolean) expected value for return value of set method - * - * @dataProvider provider_set + * + * @dataProvider providerSet */ - public function test_magic_setter($property, $value, $expected) + public function testMagicSetter($property, $value, $expected) { - $this->_tunes->$property = $value; - if($expected) - { - $this->assertEquals($value, $this->_tunes->get($property)); + $this->tunes->$property = $value; + if ($expected) { + $this->assertEquals($value, $this->tunes->get($property)); } } - - public function provider_set() + + public function providerSet() { - return array( - array('Y', 'anything', FALSE), - array('A', 10, FALSE), - array('A', array('1','2'), FALSE), - array('A', array(new Person(),new Person()), TRUE), - array('C', 10, FALSE), - array('C', array('1','2'), FALSE), - array('C', array(new Person(),new Person()), TRUE), - array('H', 10, FALSE), - array('H', array('1','2'), TRUE), - array('O', 10, FALSE), - array('O', array('1','2'), TRUE), - array('R', 10, FALSE), - array('R', 'reel', TRUE), - array('collection', 10, FALSE), - array('collection', '10', FALSE), - array('collection', array(), FALSE), - array('collection', array('1','2'), FALSE), - array('collection', array(new Tune(), 'not a tune'), FALSE), - array('collection', array(new Tune()), TRUE), - array('tc_id', 'abc', FALSE), - array('tc_id', '11', TRUE), - array('tc_id', 15, TRUE), - array('cOwner', 'me', TRUE), - ); + return [ + ['Y', 'anything', false], + ['A', 10, false], + ['A', ['1', '2'], false], + ['A', [new Person(), new Person()], true], + ['C', 10, false], + ['C', ['1', '2'], false], + ['C', [new Person(), new Person()], true], + ['H', 10, false], + ['H', ['1', '2'], true], + ['O', 10, false], + ['O', ['1', '2'], true], + ['R', 10, false], + ['R', 'reel', true], + ['collection', 10, false], + ['collection', '10', false], + ['collection', [], false], + ['collection', ['1', '2'], false], + ['collection', [new Tune(), 'not a tune'], false], + ['collection', [new Tune()], true], + ['tc_id', 'abc', false], + ['tc_id', '11', true], + ['tc_id', 15, true], + ['cOwner', 'me', true], + ]; } - - public function test_set_tc_id() + + public function testSetTcId() { //we should start with tc_id = 0 - $this->assertEquals(0, $this->_tunes->get('tc_id'), 'should start at 0'); - + $this->assertEquals(0, $this->tunes->get('tc_id'), 'should start at 0'); + //because tc_id == 0 we can change value - $this->_tunes->set('tc_id', 4); - $this->assertEquals(4, $this->_tunes->get('tc_id'), 'should have changed to 4'); - + $this->tunes->set('tc_id', 4); + $this->assertEquals(4, $this->tunes->get('tc_id'), 'should have changed to 4'); + //tc_id is not 0 so we cannot change value - $this->_tunes->set('tc_id', 11); - $this->assertEquals(4, $this->_tunes->get('tc_id'), 'should not have changed from 4'); + $this->tunes->set('tc_id', 11); + $this->assertEquals(4, $this->tunes->get('tc_id'), 'should not have changed from 4'); } - - + + /** * test the append value method - * + * * @param (string) $property, the name of the property to set * @param (mixed) value to append * @param (Boolean) expected value for return value of append method - * - * @dataProvider provider_append + * + * @dataProvider providerAppend */ - public function test_append($property, $value, $expected) + public function testAppend($property, $value, $expected) { - $success = $this->_tunes->append($property, $value); + $success = $this->tunes->append($property, $value); $this->assertEquals($expected, $success); - if($success) - { - $this->assertContains($value, $this->_tunes->get($property)); + if ($success) { + $this->assertContains($value, $this->tunes->get($property)); } } - - public function provider_append() + + public function providerAppend() { - return array( - array('Y', 1, FALSE), - array('H', 'history', TRUE), - array('R', 'reel', TRUE), - array('r', 'reel', FALSE), - array('collection', 'setting', FALSE), - array('collection', new Tune(), TRUE), - array('collection', array(new Tune()), FALSE), - ); + return [ + ['Y', 1, false], + ['H', 'history', true], + ['R', 'reel', true], + ['r', 'reel', false], + ['collection', 'setting', false], + ['collection', new Tune(), true], + ['collection', [new Tune()], false], + ]; } - - - - public function test_get() + + + public function testGet() { //R is a valid property so we should get it's value - $this->_tunes->set('R', 'reel'); - $this->assertEquals('reel', $this->_tunes->get('R')); - + $this->tunes->set('R', 'reel'); + $this->assertEquals('reel', $this->tunes->get('R')); + //X is not a property, so we should get FALSE - $this->assertFalse($this->_tunes->get('X')); + $this->assertFalse($this->tunes->get('X')); } - } diff --git a/tests/unit/memory/TuneTest.php b/tests/unit/memory/TuneTest.php index 125b0de..e455619 100644 --- a/tests/unit/memory/TuneTest.php +++ b/tests/unit/memory/TuneTest.php @@ -1,9 +1,11 @@ _tune = new Tune(); - } - + private $tune; + + public function setUp() + { + $this->tune = new Tune(); + } + /** * test the model contains the correct attributes */ - public function test_model_definition() + public function testModelDefinition() { //Private attributes, probably shouldn't be tested $this->assertClassHasAttribute('tuneID', Tune::class); @@ -35,276 +37,265 @@ class TuneTest extends TestCase $this->assertClassHasAttribute('X', Tune::class); $this->assertClassHasAttribute('propertyNames', Tune::class); } - - + + /** * test the set property method - * + * * @param (string) $property, the name of the property to set * @param (mixed) value to set * @param (Boolean) expected value for return value of set method - * - * @dataProvider provider_set + * + * @dataProvider providerSet */ - public function test_set($property, $value, $expected) + public function testSet($property, $value, $expected) { - $success = $this->_tune->set($property, $value); + $success = $this->tune->set($property, $value); $this->assertEquals($expected, $success); - if($success) - { - $this->assertEquals($value, $this->_tune->get($property)); + if ($success) { + $this->assertEquals($value, $this->tune->get($property)); } } - /** - * test the set property method - * - * @param (string) $property, the name of the property to set - * @param (mixed) value to set - * @param (Boolean) expected value for return value of set method - * - * @dataProvider provider_set - */ - public function test_magic_setter($property, $value, $expected) - { - $this->_tune->$property = $value; - // $this->assertEquals($expected, $success); - if($expected) - { - $this->assertEquals($value, $this->_tune->get($property)); - } - } - - /** - * @dataProvider provider_set - */ - public function test_construct($property, $value, $expected) - { - $params = array($property => $value); - $this->_tune = new Tune($params); - - if($expected) - { - $this->assertEquals($value, $this->_tune->get($property)); - } - } - - public function provider_set() - { - return array( - array('Y', 'anything', FALSE), - array('x', 1, FALSE), - array('X', 1, TRUE), - array('X', 'aplha', FALSE), - array('X', '2', TRUE), - array('T', 'string', FALSE), - array('T', 10, FALSE), - array('T', array('1','2'), TRUE), - array('A', 10, FALSE), - array('A', array('1','2'), FALSE), - array('A', array(new Person(),new Person()), TRUE), - array('C', 10, FALSE), - array('C', array('1','2'), FALSE), - array('C', array(new Person(),new Person()), TRUE), - array('G', 10, FALSE), - array('G', array('1','2'), TRUE), - array('H', 10, FALSE), - array('H', array('1','2'), TRUE), - array('O', 10, FALSE), - array('O', array('1','2'), TRUE), - array('R', 10, FALSE), - array('R', array('1','2'), TRUE), - array('collection', 10, FALSE), - array('collection', '10', FALSE), - array('collection', array(), FALSE), - array('collection', array('1','2'), FALSE), - array('collection', array(new Setting()), TRUE), - array('tuneHash', 10, FALSE), - array('tuneHash', '10', FALSE), - array('tuneHash', array(), FALSE), - array('tuneHash', array('1','2'), FALSE), - array('tuneID', 'abc', FALSE), - array('tuneID', '11', TRUE), - array('tuneID', 15, TRUE), - ); - } - public function test_set_tuneID() + /** + * test the set property method + * + * @param (string) $property, the name of the property to set + * @param (mixed) value to set + * @param (Boolean) expected value for return value of set method + * + * @dataProvider providerSet + */ + public function testMagicSetter($property, $value, $expected) + { + $this->tune->$property = $value; + // $this->assertEquals($expected, $success); + if ($expected) { + $this->assertEquals($value, $this->tune->get($property)); + } + } + + /** + * @dataProvider providerSet + */ + public function testConstruct($property, $value, $expected) + { + $params = [$property => $value]; + $this->tune = new Tune($params); + + if ($expected) { + $this->assertEquals($value, $this->tune->get($property)); + } + } + + public function providerSet() + { + return [ + ['Y', 'anything', false], + ['x', 1, false], + ['X', 1, true], + ['X', 'aplha', false], + ['X', '2', true], + ['T', 'string', false], + ['T', 10, false], + ['T', ['1', '2'], true], + ['A', 10, false], + ['A', ['1', '2'], false], + ['A', [new Person(), new Person()], true], + ['C', 10, false], + ['C', ['1', '2'], false], + ['C', [new Person(), new Person()], true], + ['G', 10, false], + ['G', ['1', '2'], true], + ['H', 10, false], + ['H', ['1', '2'], true], + ['O', 10, false], + ['O', ['1', '2'], true], + ['R', 10, false], + ['R', ['1', '2'], true], + ['collection', 10, false], + ['collection', '10', false], + ['collection', [], false], + ['collection', ['1', '2'], false], + ['collection', [new Setting()], true], + ['tuneHash', 10, false], + ['tuneHash', '10', false], + ['tuneHash', [], false], + ['tuneHash', ['1', '2'], false], + ['tuneID', 'abc', false], + ['tuneID', '11', true], + ['tuneID', 15, true], + ]; + } + + public function testSetTuneID() { //we should start with tuneID = 0 - $this->assertEquals(0, $this->_tune->get('tuneID'), 'should start at 0'); + $this->assertEquals(0, $this->tune->get('tuneID'), 'should start at 0'); //because tuneID == 0 we can change value - $this->_tune->set('tuneID', 4); - $this->assertEquals(4, $this->_tune->get('tuneID'), 'should have changed to 4'); + $this->tune->set('tuneID', 4); + $this->assertEquals(4, $this->tune->get('tuneID'), 'should have changed to 4'); //tuneID is not 0 so we cannot change value - $this->_tune->set('tuneID', 11); - $this->assertEquals(4, $this->_tune->get('tuneID'), 'should not have changed from 4'); + $this->tune->set('tuneID', 11); + $this->assertEquals(4, $this->tune->get('tuneID'), 'should not have changed from 4'); } - - + + /** * test the append value method - * + * * @param (string) $property, the name of the property to set * @param (mixed) value to append * @param (Boolean) expected value for return value of append method - * - * @dataProvider provider_append + * + * @dataProvider providerAppend */ - public function test_append($property, $value, $expected) + public function testAppend($property, $value, $expected) { - $success = $this->_tune->append($property, $value); + $success = $this->tune->append($property, $value); $this->assertEquals($expected, $success); - if($success) - { - $this->assertContains($value, $this->_tune->get($property)); + if ($success) { + $this->assertContains($value, $this->tune->get($property)); } } - - public function provider_append() + + public function providerAppend() { - return array( - array('Y', 1, FALSE), - array('X', 1, FALSE), - array('T','title', TRUE), - array('T', array('of','titles'), FALSE), - array('A', 'author', TRUE), - array('C', 'composer', TRUE), - array('G', 'Group', TRUE), - array('H', 'history', TRUE), - array('O', 'Origin', TRUE), - array('R', 'Rhythm', TRUE), - array('collection', 'setting', FALSE), - array('collection', new Setting(), TRUE), - array('collection', array(new Setting()), FALSE), - array('tuneHash', 'tuneHash', FALSE), - array('tuneHash', new Setting(), FALSE), - array('tuneHash', array(new Setting()), FALSE), - ); + return [ + ['Y', 1, false], + ['X', 1, false], + ['T', 'title', true], + ['T', ['of', 'titles'], false], + ['A', 'author', true], + ['C', 'composer', true], + ['G', 'Group', true], + ['H', 'history', true], + ['O', 'Origin', true], + ['R', 'Rhythm', true], + ['collection', 'setting', false], + ['collection', new Setting(), true], + ['collection', [new Setting()], false], + ['tuneHash', 'tuneHash', false], + ['tuneHash', new Setting(), false], + ['tuneHash', [new Setting()], false], + ]; } - - + + /** * test the static function equals * returns true if the data properties of 2 Abc_Tunes * are identical - * + * * @param (array) $params list of properties to set on the objects * @param (boolean) $expected result of running equals - * - * @dataProvider provider_equals + * + * @dataProvider providerEquals */ - public function test_equals($params) + public function testEquals($params) { // $this->markTestIncomplete(); - + $ob1 = new Tune(); $ob2 = new Tune(); - - foreach($params as $key => $val) - { - if(is_array($ob1->get($key))) - { + + foreach ($params as $key => $val) { + if (is_array($ob1->get($key))) { $ob1->append($key, $val); $ob2->append($key, $val); - } - else { + } else { $ob1->set($key, $val); $ob2->set($key, $val); } } - + $this->assertTrue(Tune::equals($ob1, $ob2)); } - + /** * test the static function equals * returns true if the data properties of 2 Abc_Tunes * are identical - * + * * @param (array) $params list of properties to set on the objects * @param (boolean) $expected result of running equals - * - * @dataProvider provider_equals + * + * @dataProvider providerEquals */ - public function test_equals_fails($params) + public function testEqualsFails($params) { $ob1 = new Tune(); $ob2 = new Tune(); - - foreach($params as $key => $val) - { - if($key === 'collection') - { + + foreach ($params as $key => $val) { + if ($key === 'collection') { $ob1->set($key, $val); - } - else if(is_array($ob1->get($key))) - { + } elseif (is_array($ob1->get($key))) { $ob1->append($key, $val); - } - else { + } else { $ob1->set($key, $val); } } $this->assertFalse(Tune::equals($ob1, $ob2)); } - public function provider_equals() + + public function providerEquals() { - $setting1 = new Setting(array('settingID'=>5, 'tuneID'=>444)); - $setting2 = new Setting(array('settingID'=>3, 'tuneID'=>2244)); - return array( - array( array('X'=>'2') ), - array( array('T'=>'a title') ), - array( array('A'=>'an author') ), - array( array('C'=>'a composer') ), - array( array('G'=>'a group') ), - array( array('H'=>'some history') ), - array( array('O'=>'Plymouth') ), - array( array('R'=>'Jig') ), - array( array('collection' => array($setting1, $setting2) )) - ); + $setting1 = new Setting(['settingID' => 5, 'tuneID' => 444]); + $setting2 = new Setting(['settingID' => 3, 'tuneID' => 2244]); + return [ + [['X' => '2']], + [['T' => 'a title']], + [['A' => 'an author']], + [['C' => 'a composer']], + [['G' => 'a group']], + [['H' => 'some history']], + [['O' => 'Plymouth']], + [['R' => 'Jig']], + [['collection' => [$setting1, $setting2]]], + ]; } - - - public function test_isChanged() + + + public function testIsChanged() { $tune = new Tune(); $this->assertInstanceOf(Tune::class, $tune); - + $this->assertFalse($tune->is_changed(), 'after load should be no changes'); - - $tune->set('X','5'); + + $tune->set('X', '5'); $this->assertTrue($tune->is_changed(), 'updating the name changes the data'); } /** - * @dataProvider provider_get + * @dataProvider providerGet */ - public function test_get($key, $expected) + public function testGet($key, $expected) { - $result = $this->_tune->set($key, $expected); - $result = $this->_tune->get($key); + $result = $this->tune->set($key, $expected); + $result = $this->tune->get($key); $this->assertEquals($expected, $result); } - public function provider_get() + public function providerGet() { - return array( - array('', FALSE), - array('me', FALSE), - array('tuneID', 2), - array('X', '2'), - array('T', array('1','2')), - array('A', array(new Person(),new Person())), - array('C', array(new Person(),new Person())), - array('G', array('1','2')), - array('H', array('1','2')), - array('O', array('1','2')), - array('R', array('1','2')), - array('collection', array(new Setting())), - ); + return [ + ['', false], + ['me', false], + ['tuneID', 2], + ['X', '2'], + ['T', ['1', '2']], + ['A', [new Person(), new Person()]], + ['C', [new Person(), new Person()]], + ['G', ['1', '2']], + ['H', ['1', '2']], + ['O', ['1', '2']], + ['R', ['1', '2']], + ['collection', [new Setting()]], + ]; } - }