diff --git a/.gitignore b/.gitignore index 9f11b75..029f7c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .idea/ +composer.lock diff --git a/.travis.yml b/.travis.yml index b9e6c0b..79f743f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,46 @@ language: php + +cache: + directories: + - $HOME/.composer/cache + - $HOME/phpcs-cache + php: - - 7.1 - - 7.2 + - 7.1 + - 7.2 + - 7.3 + +services: + - elasticsearch + +env: + matrix: + - RUN_TESTS=1 COMPOSER_EXTRA_ARGS="" + - RUN_TESTS=1 COMPOSER_EXTRA_ARGS="--prefer-lowest" -before_script: - - composer self-update - - composer install --no-interaction --prefer-dist +matrix: + fast_finish: true + include: + - php: 7.3 + env: COMPOSER_EXTRA_ARGS="" COVERAGE="--coverage ./coverage.xml --coverage-src ./src" + - php: 7.3 + env: COMPOSER_EXTRA_ARGS="" PHPSTAN=1 RUN_TESTS=0 + - php: 7.3 + env: COMPOSER_EXTRA_ARGS="" CODING_STANDARD=1 RUN_TESTS=0 + +before_install: + - travis_retry composer self-update + +install: + - travis_retry composer update --no-interaction --no-suggest --no-progress --prefer-dist --prefer-stable $COMPOSER_EXTRA_ARGS # update because we may need --prefer-lowest option script: - - vendor/bin/phpstan analyse -l 7 -c phpstan.neon src tests - - vendor/bin/phpcs --standard=vendor/spameri/coding-standard/src/ruleset.xml src tests + - if [ "$PHPSTAN" = "1" ]; then vendor/bin/phpstan analyse -l 7 -c phpstan.neon src tests; fi + - if [ "$CODING_STANDARD" = "1" ]; then vendor/bin/phpcs --standard=vendor/spameri/coding-standard/src/ruleset.xml --cache=$HOME/phpcs-cache/.phpcs-cache src tests; fi + - if [ "$RUN_TESTS" = "1" ]; then vendor/bin/tester $COVERAGE -s -c ./tests/php.ini-unix ./tests; fi + +after_script: + - if [ "$COVERAGE" != "" ]; then vendor/bin/php-coveralls --verbose --config tests/.coveralls.yml || true; fi + +after_failure: + - 'for i in $(find ./tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done' diff --git a/composer.json b/composer.json index 55a83c6..a3c3cde 100644 --- a/composer.json +++ b/composer.json @@ -1,47 +1,56 @@ { "name": "spameri/elastic", - "type": "library", - "description": "ElasticSearch for Nette Framework", - "keywords": [ - "nette", - "spameri", - "elastic", - "elasticsearch" - ], - "homepage": "http://github.com/spameri", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "support": { - "issues": "https://github.com/spameri/elastic/issues" - }, + "type": "library", + "description": "ElasticSearch for Nette Framework", + "keywords": [ + "nette", + "spameri", + "elastic", + "elasticsearch" + ], + "homepage": "http://github.com/spameri", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "support": { + "issues": "https://github.com/spameri/elastic/issues" + }, "authors": [ { "name": "VBoss", "email": "vcevela@gmail.com" } ], + "require": { + "php": ">=7.1", + "nette/di": "^2.4.10", + "nette/security": "^2.4.3", + "spameri/elastic-query": "^0.3.0", + "elasticsearch/elasticsearch": "^6.0", + "kdyby/console": "^2.7.1", + "kdyby/datetime-provider": "v1.0.0", + "kdyby/monolog": "^1.3.2", + "tracy/tracy": "^2.5.3" + }, + "require-dev": { + "spameri/coding-standard": "dev-master", + "nette/tester": "^2.2.0", + "phpstan/phpstan-shim": "^0.11.5", + "php-coveralls/php-coveralls": "^2.1", + "nette/bootstrap": "2.4", + "nette/http": "^2.4", + "mockery/mockery": "^1.2" + }, "autoload": { "psr-4": { "Spameri\\Elastic\\": "src/" } }, - "require": { - "php": ">=7.1", - "nette/di": "v2.4.14", - "nette/security": "v2.4.3", - "spameri/elastic-query": "v0.3.0", - "elasticsearch/elasticsearch": "^6.0", - "kdyby/console": "v2.7.1", - "kdyby/datetime-provider": "v1.0.0", - "kdyby/monolog": "v1.3.2", - "tracy/tracy": "v2.5.3" - }, - "require-dev": { - "nette/tester": "2.1.0", - "phpstan/phpstan-shim": "0.11.2", - "spameri/coding-standard": "dev-master" + "autoload-dev": { + "psr-4": { + "SpameriTests\\": "tests/SpameriTests" + } } } diff --git a/composer.lock b/composer.lock deleted file mode 100644 index 9322e86..0000000 --- a/composer.lock +++ /dev/null @@ -1,1472 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "content-hash": "fcddf42974252d332d720a0bb25e7274", - "packages": [ - { - "name": "elasticsearch/elasticsearch", - "version": "v6.0.1", - "source": { - "type": "git", - "url": "https://github.com/elastic/elasticsearch-php.git", - "reference": "b8e3bc9d1fc54d6a18692df0b74956efe7fe241a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/b8e3bc9d1fc54d6a18692df0b74956efe7fe241a", - "reference": "b8e3bc9d1fc54d6a18692df0b74956efe7fe241a", - "shasum": "" - }, - "require": { - "ext-json": ">=1.3.7", - "guzzlehttp/ringphp": "~1.0", - "php": "^7.0", - "psr/log": "~1.0" - }, - "require-dev": { - "cpliakas/git-wrapper": "~1.0", - "doctrine/inflector": "^1.1", - "mockery/mockery": "0.9.4", - "phpstan/phpstan-shim": "0.8.3", - "phpunit/phpunit": "6.3.0", - "squizlabs/php_codesniffer": "3.0.2", - "symfony/finder": "^2.8", - "symfony/yaml": "^2.8" - }, - "suggest": { - "ext-curl": "*", - "monolog/monolog": "Allows for client-level logging and tracing" - }, - "type": "library", - "autoload": { - "psr-4": { - "Elasticsearch\\": "src/Elasticsearch/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Zachary Tong" - } - ], - "description": "PHP Client for Elasticsearch", - "keywords": [ - "client", - "elasticsearch", - "search" - ], - "time": "2017-12-05T14:15:58+00:00" - }, - { - "name": "guzzlehttp/ringphp", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/guzzle/RingPHP.git", - "reference": "5e2a174052995663dd68e6b5ad838afd47dd615b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/RingPHP/zipball/5e2a174052995663dd68e6b5ad838afd47dd615b", - "reference": "5e2a174052995663dd68e6b5ad838afd47dd615b", - "shasum": "" - }, - "require": { - "guzzlehttp/streams": "~3.0", - "php": ">=5.4.0", - "react/promise": "~2.0" - }, - "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "~4.0" - }, - "suggest": { - "ext-curl": "Guzzle will use specific adapters if cURL is present" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Ring\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.", - "time": "2018-07-31T13:22:33+00:00" - }, - { - "name": "guzzlehttp/streams", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/streams.git", - "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/streams/zipball/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5", - "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Stream\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Provides a simple abstraction over streams of data", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "Guzzle", - "stream" - ], - "time": "2014-10-12T19:18:40+00:00" - }, - { - "name": "kdyby/console", - "version": "v2.7.1", - "source": { - "type": "git", - "url": "https://github.com/Kdyby/Console.git", - "reference": "6e7fa6b2619b768a629fef332217497da36420d3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Kdyby/Console/zipball/6e7fa6b2619b768a629fef332217497da36420d3", - "reference": "6e7fa6b2619b768a629fef332217497da36420d3", - "shasum": "" - }, - "require": { - "kdyby/strict-objects": "^1.0", - "nette/di": "^2.4.8@dev", - "php": "^5.6 || ^7.0", - "symfony/console": "~2.3 || ^3.0 || ^4.0", - "tracy/tracy": "^2.4@dev" - }, - "require-dev": { - "kdyby/events": "^3.1.1@dev", - "nette/application": "^2.4.9@dev", - "nette/bootstrap": "^2.4.5@dev", - "nette/caching": "^2.5@dev", - "nette/http": "^2.4.7@dev", - "nette/tester": "^2.0", - "symfony/event-dispatcher": "~2.3 || ^3.0 || ^4.0" - }, - "suggest": { - "nette/http": "For faking the url of the request in cli" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Kdyby\\Console\\": "src/" - }, - "classmap": [ - "src/CliPresenter.php", - "src/exceptions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "Filip Procházka", - "email": "filip@prochazka.su", - "homepage": "http://filip-prochazka.com" - } - ], - "description": "Symfony Console integration for Kdyby components", - "homepage": "http://kdyby.org", - "keywords": [ - "console", - "kdyby", - "nette" - ], - "time": "2017-12-03T18:35:49+00:00" - }, - { - "name": "kdyby/datetime-provider", - "version": "v1.0.0", - "source": { - "type": "git", - "url": "https://github.com/Kdyby/DateTimeProvider.git", - "reference": "8ac808329edc3fe761a373544dc034a205ce2800" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Kdyby/DateTimeProvider/zipball/8ac808329edc3fe761a373544dc034a205ce2800", - "reference": "8ac808329edc3fe761a373544dc034a205ce2800", - "shasum": "" - }, - "require": { - "kdyby/strict-objects": "^1.0", - "php": "^7.1" - }, - "require-dev": { - "doctrine/coding-standard": "^3.0", - "nette/tester": "~1.7", - "phpstan/phpstan": "^0.9", - "phpstan/phpstan-strict-rules": "^0.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-4": { - "Kdyby\\DateTimeProvider\\": "src/" - }, - "classmap": [ - "src/exceptions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0-only", - "GPL-3.0-only" - ], - "authors": [ - { - "name": "Michael Moravec" - }, - { - "name": "Richard Ejem" - }, - { - "name": "Kdyby Community", - "homepage": "https://github.com/Kdyby/DateTimeProvider/graphs/contributors" - }, - { - "name": "Filip Procházka", - "homepage": "https://filip-prochazka.com" - } - ], - "description": "Time provider, providing consistent current date, time, datetime and timezone across the request.", - "homepage": "https://kdyby.org", - "keywords": [ - "clock", - "date", - "datetime", - "kdyby", - "microseconds", - "provider", - "time" - ], - "time": "2018-02-14T17:23:56+00:00" - }, - { - "name": "kdyby/monolog", - "version": "v1.3.2", - "source": { - "type": "git", - "url": "https://github.com/Kdyby/Monolog.git", - "reference": "9919e4be9eec16c9c2de74c85d6d926d06e621a7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Kdyby/Monolog/zipball/9919e4be9eec16c9c2de74c85d6d926d06e621a7", - "reference": "9919e4be9eec16c9c2de74c85d6d926d06e621a7", - "shasum": "" - }, - "require": { - "kdyby/strict-objects": "^1.0", - "monolog/monolog": "^1.10", - "nette/di": "^2.4@dev", - "php": "^5.6 || ^7.0", - "tracy/tracy": "^2.4@dev" - }, - "provide": { - "psr/log-implementation": "1.0.0" - }, - "require-dev": { - "nette/application": "^2.4@dev", - "nette/bootstrap": "^2.4@dev", - "nette/http": "^2.4@dev", - "nette/tester": "~1.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-4": { - "Kdyby\\Monolog\\": "src/" - }, - "classmap": [ - "src/exceptions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "Filip Procházka", - "email": "filip@prochazka.su", - "homepage": "http://filip-prochazka.com" - }, - { - "name": "Martin Bažík", - "email": "martin@bazo.sk", - "homepage": "http://bazo.sk" - } - ], - "description": "Integration of Monolog into Nette Framework", - "homepage": "http://kdyby.org", - "keywords": [ - "diagnostics", - "logging", - "monolog", - "nette" - ], - "time": "2017-05-22T18:16:52+00:00" - }, - { - "name": "kdyby/strict-objects", - "version": "v1.0.0", - "source": { - "type": "git", - "url": "https://github.com/Kdyby/StrictObjects.git", - "reference": "ff6c82b54d8bea0d3f43dc5fce890ebe126e95c7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Kdyby/StrictObjects/zipball/ff6c82b54d8bea0d3f43dc5fce890ebe126e95c7", - "reference": "ff6c82b54d8bea0d3f43dc5fce890ebe126e95c7", - "shasum": "" - }, - "require": { - "php": ">=5.4" - }, - "require-dev": { - "nette/tester": "~1.7" - }, - "type": "library", - "autoload": { - "psr-4": { - "Kdyby\\StrictObjects\\": "src/" - }, - "classmap": [ - "src/exceptions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "Filip Procházka", - "email": "filip@prochazka.su", - "homepage": "http://filip-prochazka.com" - } - ], - "description": "Simple trait to make your class strict, when calling or accessing undefined member (property or method).", - "homepage": "http://kdyby.org", - "keywords": [ - "accessors", - "exceptions", - "kdyby", - "magic", - "members", - "methods", - "object", - "properties", - "scream", - "strict" - ], - "time": "2016-08-26T06:34:41+00:00" - }, - { - "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-19T01:22:40+00:00" - }, - { - "name": "nette/di", - "version": "v2.4.14", - "source": { - "type": "git", - "url": "https://github.com/nette/di.git", - "reference": "923da3e2c0aa53162ef455472c0ac7787b096c5a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/di/zipball/923da3e2c0aa53162ef455472c0ac7787b096c5a", - "reference": "923da3e2c0aa53162ef455472c0ac7787b096c5a", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "nette/neon": "^2.3.3 || ~3.0.0", - "nette/php-generator": "^2.6.1 || ~3.0.0", - "nette/utils": "^2.4.3 || ~3.0.0", - "php": ">=5.6.0" - }, - "conflict": { - "nette/bootstrap": "<2.4", - "nette/nette": "<2.2" - }, - "require-dev": { - "nette/tester": "^2.0", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "💎 Nette Dependency Injection Container: Flexible, compiled and full-featured DIC with perfectly usable autowiring and support for all new PHP 7.1 features.", - "homepage": "https://nette.org", - "keywords": [ - "compiled", - "di", - "dic", - "factory", - "ioc", - "nette", - "static" - ], - "time": "2018-09-17T15:47:40+00:00" - }, - { - "name": "nette/neon", - "version": "v2.4.3", - "source": { - "type": "git", - "url": "https://github.com/nette/neon.git", - "reference": "5e72b1dd3e2d34f0863c5561139a19df6a1ef398" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/neon/zipball/5e72b1dd3e2d34f0863c5561139a19df6a1ef398", - "reference": "5e72b1dd3e2d34f0863c5561139a19df6a1ef398", - "shasum": "" - }, - "require": { - "ext-iconv": "*", - "ext-json": "*", - "php": ">=5.6.0" - }, - "require-dev": { - "nette/tester": "~2.0", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🍸 Nette NEON: encodes and decodes NEON file format.", - "homepage": "http://ne-on.org", - "keywords": [ - "export", - "import", - "neon", - "nette", - "yaml" - ], - "time": "2018-03-21T12:12:21+00:00" - }, - { - "name": "nette/php-generator", - "version": "v3.0.5", - "source": { - "type": "git", - "url": "https://github.com/nette/php-generator.git", - "reference": "ea90209c2e8a7cd087b2742ca553c047a8df5eff" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/php-generator/zipball/ea90209c2e8a7cd087b2742ca553c047a8df5eff", - "reference": "ea90209c2e8a7cd087b2742ca553c047a8df5eff", - "shasum": "" - }, - "require": { - "nette/utils": "^2.4.2 || ~3.0.0", - "php": ">=7.0" - }, - "conflict": { - "nette/nette": "<2.2" - }, - "require-dev": { - "nette/tester": "^2.0", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🐘 Nette PHP Generator: generates neat PHP code for you. Supports new PHP 7.2 features.", - "homepage": "https://nette.org", - "keywords": [ - "code", - "nette", - "php", - "scaffolding" - ], - "time": "2018-08-09T14:32:27+00:00" - }, - { - "name": "nette/security", - "version": "v2.4.3", - "source": { - "type": "git", - "url": "https://github.com/nette/security.git", - "reference": "9b60f156626394f859a42a04dfbdcbe59095a37c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/security/zipball/9b60f156626394f859a42a04dfbdcbe59095a37c", - "reference": "9b60f156626394f859a42a04dfbdcbe59095a37c", - "shasum": "" - }, - "require": { - "nette/utils": "~2.4", - "php": ">=5.6.0" - }, - "conflict": { - "nette/nette": "<2.2" - }, - "require-dev": { - "nette/di": "~2.4", - "nette/http": "~2.4", - "nette/tester": "~2.0", - "tracy/tracy": "^2.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🔑 Nette Security: provides authentication, authorization and a role-based access control management via ACL (Access Control List)", - "homepage": "https://nette.org", - "keywords": [ - "Authentication", - "acl", - "authorization", - "nette" - ], - "time": "2018-04-02T19:47:47+00:00" - }, - { - "name": "nette/utils", - "version": "v2.5.3", - "source": { - "type": "git", - "url": "https://github.com/nette/utils.git", - "reference": "17b9f76f2abd0c943adfb556e56f2165460b15ce" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/utils/zipball/17b9f76f2abd0c943adfb556e56f2165460b15ce", - "reference": "17b9f76f2abd0c943adfb556e56f2165460b15ce", - "shasum": "" - }, - "require": { - "php": ">=5.6.0" - }, - "conflict": { - "nette/nette": "<2.2" - }, - "require-dev": { - "nette/tester": "~2.0", - "tracy/tracy": "^2.3" - }, - "suggest": { - "ext-gd": "to use Image", - "ext-iconv": "to use Strings::webalize() and toAscii()", - "ext-intl": "for script transliteration in Strings::webalize() and toAscii()", - "ext-json": "to use Nette\\Utils\\Json", - "ext-mbstring": "to use Strings::lower() etc...", - "ext-xml": "to use Strings::length() etc. when mbstring is not available" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ], - "files": [ - "src/loader.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", - "homepage": "https://nette.org", - "keywords": [ - "array", - "core", - "datetime", - "images", - "json", - "nette", - "paginator", - "password", - "slugify", - "string", - "unicode", - "utf-8", - "utility", - "validation" - ], - "time": "2018-09-18T10:22:16+00:00" - }, - { - "name": "psr/log", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2016-10-10T12:19:37+00:00" - }, - { - "name": "react/promise", - "version": "v2.7.0", - "source": { - "type": "git", - "url": "https://github.com/reactphp/promise.git", - "reference": "f4edc2581617431aea50430749db55cc3fc031b3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise/zipball/f4edc2581617431aea50430749db55cc3fc031b3", - "reference": "f4edc2581617431aea50430749db55cc3fc031b3", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.8" - }, - "type": "library", - "autoload": { - "psr-4": { - "React\\Promise\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jan Sorgalla", - "email": "jsorgalla@gmail.com" - } - ], - "description": "A lightweight implementation of CommonJS Promises/A for PHP", - "keywords": [ - "promise", - "promises" - ], - "time": "2018-06-13T15:59:06+00:00" - }, - { - "name": "spameri/elastic-query", - "version": "v0.3.0", - "source": { - "type": "git", - "url": "https://github.com/Spameri/ElasticQuery.git", - "reference": "2188b9cd3652d12d18db53b16f0222696eb0e5e9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Spameri/ElasticQuery/zipball/2188b9cd3652d12d18db53b16f0222696eb0e5e9", - "reference": "2188b9cd3652d12d18db53b16f0222696eb0e5e9", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "nette/tester": "v2.1.0", - "phpstan/phpstan-shim": "v0.10.3" - }, - "type": "library", - "autoload": { - "psr-4": { - "Spameri\\ElasticQuery\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "authors": [ - { - "name": "Václav Čevela", - "email": "vcevela@gmail.com" - } - ], - "description": "Objects instead of arrays for querying to ElasticSearch.", - "time": "2019-02-14T01:27:15+00:00" - }, - { - "name": "symfony/console", - "version": "v4.1.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "dc7122fe5f6113cfaba3b3de575d31112c9aa60b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/dc7122fe5f6113cfaba3b3de575d31112c9aa60b", - "reference": "dc7122fe5f6113cfaba3b3de575d31112c9aa60b", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/process": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~3.4|~4.0", - "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.4|~4.0" - }, - "suggest": { - "psr/log-implementation": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "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 Console Component", - "homepage": "https://symfony.com", - "time": "2018-10-03T08:15:46+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.9.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8", - "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "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 polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2018-08-06T14:22:27+00:00" - }, - { - "name": "tracy/tracy", - "version": "v2.5.3", - "source": { - "type": "git", - "url": "https://github.com/nette/tracy.git", - "reference": "7f670b08a7f4ed0243373f9d003d139196273861" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/tracy/zipball/7f670b08a7f4ed0243373f9d003d139196273861", - "reference": "7f670b08a7f4ed0243373f9d003d139196273861", - "shasum": "" - }, - "require": { - "ext-json": "*", - "ext-session": "*", - "php": ">=5.4.4" - }, - "require-dev": { - "nette/di": "~2.3", - "nette/tester": "~1.7", - "nette/utils": "~2.3" - }, - "suggest": { - "https://nette.org/donate": "Please support Tracy via a donation" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev" - } - }, - "autoload": { - "classmap": [ - "src" - ], - "files": [ - "src/shortcuts.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "😎 Tracy: the addictive tool to ease debugging PHP code for cool developers. Friendly design, logging, profiler, advanced features like debugging AJAX calls or CLI support. You will love it.", - "homepage": "https://tracy.nette.org", - "keywords": [ - "Xdebug", - "debug", - "debugger", - "nette", - "profiler" - ], - "time": "2018-09-24T22:35:07+00:00" - } - ], - "packages-dev": [ - { - "name": "escapestudios/symfony2-coding-standard", - "version": "3.5.2", - "source": { - "type": "git", - "url": "https://github.com/djoos/Symfony-coding-standard.git", - "reference": "8214fd7167cd049a8077cf3bf7384c3a5e6f372a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/djoos/Symfony-coding-standard/zipball/8214fd7167cd049a8077cf3bf7384c3a5e6f372a", - "reference": "8214fd7167cd049a8077cf3bf7384c3a5e6f372a", - "shasum": "" - }, - "require": { - "squizlabs/php_codesniffer": "^3.3.1" - }, - "conflict": { - "squizlabs/php_codesniffer": "<3 || >=4" - }, - "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" - }, - "type": "phpcodesniffer-standard", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "David Joos", - "email": "iam@davidjoos.com" - }, - { - "name": "Community contributors", - "homepage": "https://github.com/djoos/Symfony-coding-standard/graphs/contributors" - } - ], - "description": "CodeSniffer ruleset for the Symfony 2+ coding standard", - "homepage": "https://github.com/djoos/Symfony-coding-standard", - "keywords": [ - "Coding Standard", - "Symfony2", - "phpcs", - "symfony" - ], - "time": "2019-01-17T14:37:49+00:00" - }, - { - "name": "nette/tester", - "version": "v2.1.0", - "source": { - "type": "git", - "url": "https://github.com/nette/tester.git", - "reference": "6b3e881e7c5ffb596a5dc25ab6e4efbbe27eb926" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/tester/zipball/6b3e881e7c5ffb596a5dc25ab6e4efbbe27eb926", - "reference": "6b3e881e7c5ffb596a5dc25ab6e4efbbe27eb926", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "bin": [ - "src/tester" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "Nette Tester: enjoyable unit testing in PHP with code coverage reporter. 🍏🍏🍎🍏", - "homepage": "https://tester.nette.org", - "keywords": [ - "Xdebug", - "assertions", - "clover", - "code coverage", - "nette", - "phpdbg", - "phpunit", - "testing", - "unit" - ], - "time": "2018-10-10T12:35:10+00:00" - }, - { - "name": "phpstan/phpstan-shim", - "version": "0.11.2", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpstan-shim.git", - "reference": "0c1e77bebf53f4734137483895ff3ff1c2cc82de" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-shim/zipball/0c1e77bebf53f4734137483895ff3ff1c2cc82de", - "reference": "0c1e77bebf53f4734137483895ff3ff1c2cc82de", - "shasum": "" - }, - "require": { - "php": "~7.1" - }, - "replace": { - "nikic/php-parser": "^4.0.2", - "phpstan/phpdoc-parser": "^0.3", - "phpstan/phpstan": "self.version" - }, - "bin": [ - "phpstan", - "phpstan.phar" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.11-dev" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHPStan Phar distribution", - "time": "2019-02-12T15:46:39+00:00" - }, - { - "name": "slevomat/coding-standard", - "version": "5.0.0", - "source": { - "type": "git", - "url": "https://github.com/slevomat/coding-standard.git", - "reference": "fdab228c1800db9e65a62dde306bfa856d98fcc3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/fdab228c1800db9e65a62dde306bfa856d98fcc3", - "reference": "fdab228c1800db9e65a62dde306bfa856d98fcc3", - "shasum": "" - }, - "require": { - "php": "^7.1", - "phpstan/phpdoc-parser": "^0.3.1", - "squizlabs/php_codesniffer": "^3.4.0" - }, - "require-dev": { - "jakub-onderka/php-parallel-lint": "1.0.0", - "phing/phing": "2.16.1", - "phpstan/phpstan": "0.11.1", - "phpstan/phpstan-phpunit": "0.11", - "phpstan/phpstan-strict-rules": "0.11", - "phpunit/phpunit": "8.0.0" - }, - "type": "phpcodesniffer-standard", - "autoload": { - "psr-4": { - "SlevomatCodingStandard\\": "SlevomatCodingStandard" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", - "time": "2019-02-03T20:31:35+00:00" - }, - { - "name": "spameri/coding-standard", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/Spameri/CodingStandard.git", - "reference": "bb067e6c68e16e8bb6aa571578e99ebd3b3e8ed1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Spameri/CodingStandard/zipball/bb067e6c68e16e8bb6aa571578e99ebd3b3e8ed1", - "reference": "bb067e6c68e16e8bb6aa571578e99ebd3b3e8ed1", - "shasum": "" - }, - "require": { - "escapestudios/symfony2-coding-standard": "^3.5", - "slevomat/coding-standard": "^5.0", - "squizlabs/php_codesniffer": "^3.4" - }, - "type": "library", - "notification-url": "https://packagist.org/downloads/", - "authors": [ - { - "name": "VBoss", - "email": "vcevela@gmail.com" - } - ], - "time": "2019-02-13 22:29:47" - }, - { - "name": "squizlabs/php_codesniffer", - "version": "3.4.0", - "source": { - "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "379deb987e26c7cd103a7b387aea178baec96e48" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/379deb987e26c7cd103a7b387aea178baec96e48", - "reference": "379deb987e26c7cd103a7b387aea178baec96e48", - "shasum": "" - }, - "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" - }, - "bin": [ - "bin/phpcs", - "bin/phpcbf" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "lead" - } - ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "http://www.squizlabs.com/php-codesniffer", - "keywords": [ - "phpcs", - "standards" - ], - "time": "2018-12-19T23:57:18+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": { - "spameri/coding-standard": 20 - }, - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=7.1" - }, - "platform-dev": [] -} diff --git a/src/Config/Elastic.neon b/src/Config/Elastic.neon index c608bf2..3098b40 100644 --- a/src/Config/Elastic.neon +++ b/src/Config/Elastic.neon @@ -38,9 +38,6 @@ services: mapping: class: Spameri\Elastic\Model\Mapping - entitySettingsProvider: - class: Spameri\Elastic\Controls\EntityEdit\EntitySettingsProvider(%entities%) - userProvider: class: Spameri\Elastic\Model\UserProvider @@ -107,3 +104,6 @@ services: dateTime: class: \DateTimeImmutable + + resultMapper: + class: Spameri\ElasticQuery\Response\ResultMapper diff --git a/src/DI/ElasticSearchExtension.php b/src/DI/ElasticSearchExtension.php index d596ef4..e601ac9 100644 --- a/src/DI/ElasticSearchExtension.php +++ b/src/DI/ElasticSearchExtension.php @@ -116,18 +116,6 @@ public function loadConfiguration() : void } - public static function register( - $config - ) : void - { - $config->onCompile[] = static function ( - \Nette\DI\Compiler $compiler - ) { - $compiler->addExtension('elasticSearch', new ElasticSearchExtension()); - }; - } - - public function toggleSynonymAnalyzer( array $config ) : array @@ -149,10 +137,6 @@ public function setConfigOptions( array $config ) : void { - /** @var \Nette\DI\Statement $entitySettingsProvider */ - $entitySettingsProvider = $services['services']['entitySettingsProvider']['class']; - $entitySettingsProvider->arguments[0] = $config['entities']; - $updateMapping = $services['services']['updateMapping']['class']; $updateMapping->arguments[0] = $config['entities']; diff --git a/src/Model/Insert.php b/src/Model/Insert.php index 0284158..b1fe375 100644 --- a/src/Model/Insert.php +++ b/src/Model/Insert.php @@ -56,7 +56,7 @@ public function execute( try { $this->clientProvider->client()->indices()->refresh( ( - new \Spameri\ElasticQuery\Document($index) + new \Spameri\ElasticQuery\Document($index) ) ->toArray() ); diff --git a/src/Model/ValidateMapping/Display.php b/src/Model/ValidateMapping/Display.php index 4de6b19..6234abd 100644 --- a/src/Model/ValidateMapping/Display.php +++ b/src/Model/ValidateMapping/Display.php @@ -16,32 +16,32 @@ class Display /** * @var array */ - private $blockNameIssue; + private $blockNameIssue = []; /** * @var array */ - private $tokenizerIssues; + private $tokenizerIssues = []; /** * @var array */ - private $analyzerIssue; + private $analyzerIssue = []; /** * @var array */ - private $conflictingNameIssue; + private $conflictingNameIssue = []; /** * @var array */ - private $uniqueFieldNames; + private $uniqueFieldNames = []; /** * @var array */ - private $typeIssue; + private $typeIssue = []; public function store( @@ -203,4 +203,40 @@ public function render( } } + + public function blockNameIssue() : array + { + return $this->blockNameIssue; + } + + + public function tokenizerIssues() : array + { + return $this->tokenizerIssues; + } + + + public function analyzerIssue() : array + { + return $this->analyzerIssue; + } + + + public function conflictingNameIssue() : array + { + return $this->conflictingNameIssue; + } + + + public function uniqueFieldNames() : array + { + return $this->uniqueFieldNames; + } + + + public function typeIssue() : array + { + return $this->typeIssue; + } + } diff --git a/tests/SpameriTests/.gitignore b/tests/SpameriTests/.gitignore new file mode 100644 index 0000000..45cff74 --- /dev/null +++ b/tests/SpameriTests/.gitignore @@ -0,0 +1,2 @@ +*.actual +*.expected diff --git a/tests/SpameriTests/DI/Extension.phpt b/tests/SpameriTests/DI/Extension.phpt new file mode 100644 index 0000000..6fc62fb --- /dev/null +++ b/tests/SpameriTests/DI/Extension.phpt @@ -0,0 +1,40 @@ +setTempDirectory(\TEMP_DIR); + $config->addConfig(__DIR__ . '/../Data/Config/Common.neon'); + + $this->config = $config; + } + + + public function testInitialize(): void + { + $container = $this->config->createContainer(); + + $search = $container->getByType(\Spameri\Elastic\Model\Search::class); + $resultMapper = $container->getByType(\Spameri\ElasticQuery\Response\ResultMapper::class); + + \Tester\Assert::true($search instanceof \Spameri\Elastic\Model\Search); + \Tester\Assert::true($resultMapper instanceof \Spameri\ElasticQuery\Response\ResultMapper); + } + +} +(new Extension())->run(); diff --git a/tests/SpameriTests/Data/Config/Common.neon b/tests/SpameriTests/Data/Config/Common.neon new file mode 100644 index 0000000..f68cf82 --- /dev/null +++ b/tests/SpameriTests/Data/Config/Common.neon @@ -0,0 +1,15 @@ +extensions: + elasticSearch: Spameri\Elastic\DI\ElasticSearchExtension + +elasticSearch: + host: 127.0.0.1 + port: 9200 + +php: + date.timezone: Europe/Prague + +services: + +includes: + - Video.neon + - Person.neon diff --git a/tests/SpameriTests/Data/Config/Person.neon b/tests/SpameriTests/Data/Config/Person.neon new file mode 100644 index 0000000..06e0701 --- /dev/null +++ b/tests/SpameriTests/Data/Config/Person.neon @@ -0,0 +1,78 @@ +elasticSearch: + entities: + Person: + index: spameri_person + dynamic: strict + + properties: + identification: + properties: + imdb: + type: text + + trakt: + type: long + + tmdb: + type: long + + csfd: + type: long + + name: + type: text + + description: + type: text + + birth: + type: date + format: "yyyy-MM-dd HH:mm:ss" + + death: + type: date + format: "yyyy-MM-dd HH:mm:ss" + + alias: + type: text + + characters: + properties: + id: + type: text + + video: + type: long + + episode: + type: long + + name: + type: text + + alias: + type: text + + identification: + properties: + imdb: + type: long + + biography: + type: text + + jobs: + properties: + id: + type: long + + episode: + type: long + + name: + type: text + + description: + type: text + + diff --git a/tests/SpameriTests/Data/Config/Video.neon b/tests/SpameriTests/Data/Config/Video.neon new file mode 100644 index 0000000..ae42129 --- /dev/null +++ b/tests/SpameriTests/Data/Config/Video.neon @@ -0,0 +1,300 @@ +elasticSearch: + entities: + Video: + index: spameri_video + dynamic: strict + + properties: + identification: + properties: + imdb: + type: text + + trakt: + type: long + + tmdb: + type: long + + csfd: + type: long + + name: + type: text + + year: + type: long + + technical: + properties: + camera: + type: text + + runtime: + type: long + + color: + type: text + + ratio: + type: text + + laboratory: + type: text + + filmLength: + type: text + + negativeFormat: + type: text + + cineProcess: + type: text + + printed: + type: text + + story: + properties: + description: + type: text + + tagLines: + type: text + + plots: + type: text + + synopsis: + type: text + + keyWords: + type: text + + details: + properties: + genres: + type: text + + alias: + properties: + name: + type: text + + country: + type: text + + release: + properties: + country: + type: text + + note: + type: text + + date: + type: date + format: "yyyy-MM-dd HH:mm:ss" + + ratings: + properties: + imdbRatings: + type: long + + imdbAverage: + type: long + + highLights: + properties: + trivia: + properties: + id: + type: text + + text: + type: text + + relevancy: + type: long + + goof: + properties: + id: + type: text + + text: + type: text + + relevancy: + type: long + + crazyCredit: + properties: + id: + type: text + + text: + type: text + + relevancy: + type: long + + quote: + properties: + id: + type: text + + text: + type: text + + relevancy: + type: long + + location: + properties: + name: + type: text + + note: + type: text + + alternateVersion: + properties: + text: + type: text + + companyCredit: + properties: + group: + type: text + + company: + properties: + id: + type: text + + name: + type: text + + note: + type: text + + connections: + properties: + followed: + properties: + id: + type: text + + note: + type: text + + remade: + properties: + id: + type: text + + note: + type: text + + spinOff: + properties: + id: + type: text + + note: + type: text + + editedInto: + properties: + id: + type: text + + note: + type: text + + reference: + properties: + id: + type: text + + note: + type: text + + referenced: + properties: + id: + type: text + + note: + type: text + + featured: + properties: + id: + type: text + + note: + type: text + + spoofed: + properties: + id: + type: text + + note: + type: text + + follows: + properties: + id: + type: text + + note: + type: text + + editedFrom: + properties: + id: + type: text + + note: + type: text + + spunOff: + properties: + id: + type: text + + note: + type: text + + versionOf: + properties: + id: + type: text + + note: + type: text + + season: + properties: + number: + type: long + + episodes: + properties: + id: + type: long + + number: + type: long + + name: + type: text + + description: + type: text + + people: + type: text diff --git a/tests/SpameriTests/Data/Entity/Person.php b/tests/SpameriTests/Data/Entity/Person.php new file mode 100644 index 0000000..10d00ec --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Person.php @@ -0,0 +1,166 @@ +id = $id; + $this->identification = $identification; + $this->name = $name; + $this->description = $description; + $this->birth = $birth; + $this->death = $death; + $this->alias = $alias; + $this->characters = $characters; + $this->jobs = $jobs; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function id() : \Spameri\Elastic\Entity\Property\IElasticId + { + return $this->id; + } + + + public function identification() : \SpameriTests\Data\Entity\Video\Identification + { + return $this->identification; + } + + + public function name() : \SpameriTests\Data\Entity\Property\Name + { + return $this->name; + } + + + public function rename(\SpameriTests\Data\Entity\Property\Name $name) : void + { + $this->name = $name; + } + + + public function description() : \SpameriTests\Data\Entity\Property\Description + { + return $this->description; + } + + public function changeDescription(\SpameriTests\Data\Entity\Property\Description $description) : void + { + $this->description = $description; + } + + public function birth() : ?\Spameri\Elastic\Entity\Property\Date + { + return $this->birth; + } + + + public function setBirth(?\Spameri\Elastic\Entity\Property\Date $birth) : void + { + $this->birth = $birth; + } + + + public function death() : ?\Spameri\Elastic\Entity\Property\Date + { + return $this->death; + } + + + public function setDeath(?\Spameri\Elastic\Entity\Property\Date $death) : void + { + $this->death = $death; + } + + + public function alias() : \SpameriTests\Data\Entity\Property\Name + { + return $this->alias; + } + + + public function setAlias(\SpameriTests\Data\Entity\Property\Name $alias) : void + { + $this->alias = $alias; + } + + + public function characters() : \SpameriTests\Data\Entity\Person\CharacterCollectionElastic + { + return $this->characters; + } + + + public function jobs() : \SpameriTests\Data\Entity\Person\JobCollectionElastic + { + return $this->jobs; + } + +} diff --git a/tests/SpameriTests/Data/Entity/Person/Character.php b/tests/SpameriTests/Data/Entity/Person/Character.php new file mode 100644 index 0000000..6ce4723 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Person/Character.php @@ -0,0 +1,122 @@ +id = $id; + $this->episode = $episode; + $this->name = $name; + $this->identification = $identification; + $this->biography = $biography; + $this->alias = $alias; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return (string) $this->id->value(); + } + + + public function id() : \SpameriTests\Data\Entity\Property\ImdbId + { + return $this->id; + } + + + public function episode() + { + return $this->episode; + } + + + public function setEpisode($episode) : void + { + $this->episode = $episode; + } + + + public function name() : \SpameriTests\Data\Entity\Property\Name + { + return $this->name; + } + + + public function setName(\SpameriTests\Data\Entity\Property\Name $name) : void + { + $this->name = $name; + } + + + public function alias() : \SpameriTests\Data\Entity\Property\Name + { + return $this->alias; + } + + + public function setAlias(\SpameriTests\Data\Entity\Property\Name $alias) + { + $this->alias = $alias; + } + + + public function identification() : \SpameriTests\Data\Entity\Video\Identification + { + return $this->identification; + } + + + public function biography() : \SpameriTests\Data\Entity\Property\Description + { + return $this->biography; + } +} diff --git a/tests/SpameriTests/Data/Entity/Person/CharacterCollectionElastic.php b/tests/SpameriTests/Data/Entity/Person/CharacterCollectionElastic.php new file mode 100644 index 0000000..2dd1cc4 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Person/CharacterCollectionElastic.php @@ -0,0 +1,36 @@ +collection() as $character) { + if ($episode) { + if ( + $character->id()->value() === $id->value() + && $character->episode() + && $character->episode()->value() === $episode->value() + ) { + return $character; + } + + } else { + if ($character->id()->value() === $id->value()) { + return $character; + } + } + } + + throw new \Nette\InvalidStateException( + 'Character in video: ' . $id->value() . ' not found.' + ); + } +} diff --git a/tests/SpameriTests/Data/Entity/Person/Job.php b/tests/SpameriTests/Data/Entity/Person/Job.php new file mode 100644 index 0000000..b63196b --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Person/Job.php @@ -0,0 +1,103 @@ +id = $id; + $this->name = $name; + $this->description = $description; + $this->episode = $episode; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return (string) $this->id->value(); + } + + + public function name() : \SpameriTests\Data\Entity\Property\Name + { + return $this->name; + } + + + public function rename(\SpameriTests\Data\Entity\Property\Name $name) : void + { + $this->name = $name; + } + + + public function description() : \SpameriTests\Data\Entity\Property\Description + { + return $this->description; + } + + + public function setDescription(\SpameriTests\Data\Entity\Property\Description $description) : void + { + $this->description = $description; + } + + + public function id() : \SpameriTests\Data\Entity\Property\ImdbId + { + return $this->id; + } + + + public function episode() : ?\SpameriTests\Data\Entity\Property\ImdbId + { + return $this->episode; + } + + + public function setEpisode(\SpameriTests\Data\Entity\Property\ImdbId $episode) : void + { + $this->episode = $episode; + } + +} diff --git a/tests/SpameriTests/Data/Entity/Person/JobCollectionElastic.php b/tests/SpameriTests/Data/Entity/Person/JobCollectionElastic.php new file mode 100644 index 0000000..9b301ee --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Person/JobCollectionElastic.php @@ -0,0 +1,37 @@ +collection() as $job) { + if ($episode) { + if ( + $job->id()->value() === $imdbId->value() + && $job->episode() + && $job->episode()->value() === $episode->value() + ) { + return $job; + } + + } else { + if ($job->id()->value() === $imdbId->value()) { + return $job; + } + } + } + + throw new \Nette\InvalidStateException( + 'Job in video: ' . $imdbId->value() . ' not found.' + ); + } + +} diff --git a/tests/SpameriTests/Data/Entity/Property/CountryShort.php b/tests/SpameriTests/Data/Entity/Property/CountryShort.php new file mode 100644 index 0000000..b910b0a --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Property/CountryShort.php @@ -0,0 +1,31 @@ +value = $value; + } + + + public function value() : string + { + return $this->value; + } +} diff --git a/tests/SpameriTests/Data/Entity/Property/Description.php b/tests/SpameriTests/Data/Entity/Property/Description.php new file mode 100644 index 0000000..157c3d0 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Property/Description.php @@ -0,0 +1,27 @@ +value = $description; + } + + + public function value() : ?string + { + return $this->value; + } +} diff --git a/tests/SpameriTests/Data/Entity/Property/ElasticIdCollection.php b/tests/SpameriTests/Data/Entity/Property/ElasticIdCollection.php new file mode 100644 index 0000000..a25a35c --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Property/ElasticIdCollection.php @@ -0,0 +1,33 @@ +collection = $collection; + } + + + public function add(\Spameri\Elastic\Entity\Property\IElasticId $featured) + { + $this->collection[] = $featured; + } + + + public function getIterator() : \ArrayIterator + { + return new \ArrayIterator($this->collection); + } +} diff --git a/tests/SpameriTests/Data/Entity/Property/ImdbId.php b/tests/SpameriTests/Data/Entity/Property/ImdbId.php new file mode 100644 index 0000000..e3f7c6d --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Property/ImdbId.php @@ -0,0 +1,34 @@ + 99999999) { + throw new \InvalidArgumentException(); + } + + $this->value = $value; + } + + + public function value() : int + { + return $this->value; + } +} diff --git a/tests/SpameriTests/Data/Entity/Property/ImdbIdCollection.php b/tests/SpameriTests/Data/Entity/Property/ImdbIdCollection.php new file mode 100644 index 0000000..0421e66 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Property/ImdbIdCollection.php @@ -0,0 +1,64 @@ +collection = []; + foreach ($collection as $imdbId) { + $this->add($imdbId); + } + } + + + public function add( + ImdbId $imdbId + ) : void + { + $this->collection[$imdbId->value()] = $imdbId; + } + + + public function find( + ImdbId $imdbId + ) : ?ImdbId + { + foreach ($this->collection as $value) { + if ($imdbId->value() === $value->value()) { + return $value; + } + } + + return NULL; + } + + + public function keys() : array + { + return \array_keys($this->collection); + } + + + public function first() : ?ImdbId + { + return \reset($this->collection); + } + + + public function getIterator() : \ArrayIterator + { + return new \ArrayIterator($this->collection); + } +} diff --git a/tests/SpameriTests/Data/Entity/Property/Name.php b/tests/SpameriTests/Data/Entity/Property/Name.php new file mode 100644 index 0000000..7cf22ec --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Property/Name.php @@ -0,0 +1,41 @@ + 255) { + $value = \substr($value, 0, 255); + } + + $this->value = $value; + } + + + public function value() : string + { + return $this->value; + } + + + public function __toString() : string + { + return $this->value; + } + +} diff --git a/tests/SpameriTests/Data/Entity/Property/Text.php b/tests/SpameriTests/Data/Entity/Property/Text.php new file mode 100644 index 0000000..8501f2d --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Property/Text.php @@ -0,0 +1,27 @@ +value = $value; + } + + + public function value() : string + { + return $this->value; + } +} diff --git a/tests/SpameriTests/Data/Entity/Property/Url.php b/tests/SpameriTests/Data/Entity/Property/Url.php new file mode 100644 index 0000000..d16755c --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Property/Url.php @@ -0,0 +1,32 @@ +value = $value; + } + + + public function value() : string + { + return $this->value; + } + +} diff --git a/tests/SpameriTests/Data/Entity/Property/Year.php b/tests/SpameriTests/Data/Entity/Property/Year.php new file mode 100644 index 0000000..c313ca1 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Property/Year.php @@ -0,0 +1,40 @@ + 2100) { + throw new \InvalidArgumentException(); + } + + $this->value = $year; + } + + + public function value() : int + { + return $this->value; + } + + + public function __toString() : string + { + return (string) $this->value; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video.php b/tests/SpameriTests/Data/Entity/Video.php new file mode 100644 index 0000000..64a4569 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video.php @@ -0,0 +1,181 @@ +id = $id; + $this->identification = $identification; + $this->name = $name; + $this->year = $year; + $this->technical = $technical; + $this->story = $story; + $this->details = $details; + $this->highLights = $highLights; + $this->connections = $connections; + $this->season = $season; + $this->people = $people; + } + + + public function entityVariables() : array + { + return \get_object_vars($this); + } + + + public function id() : \Spameri\Elastic\Entity\Property\IElasticId + { + return $this->id; + } + + + public function identification() : \SpameriTests\Data\Entity\Video\Identification + { + return $this->identification; + } + + + public function name() : \SpameriTests\Data\Entity\Property\Name + { + return $this->name; + } + + + public function rename(\SpameriTests\Data\Entity\Property\Name $name) : void + { + $this->name = $name; + } + + + public function year() : \SpameriTests\Data\Entity\Property\Year + { + return $this->year; + } + + + public function setYear(\SpameriTests\Data\Entity\Property\Year $year) : void + { + $this->year = $year; + } + + + public function technical() : \SpameriTests\Data\Entity\Video\Technical + { + return $this->technical; + } + + + public function setTechnicalFromImdb(\SpameriTests\Data\Entity\Video\Technical $technical) : void + { + $this->technical = $technical; + } + + + public function story() : \SpameriTests\Data\Entity\Video\Story + { + return $this->story; + } + + + public function details() : \SpameriTests\Data\Entity\Video\Details + { + return $this->details; + } + + + public function highLights() : \SpameriTests\Data\Entity\Video\HighLights + { + return $this->highLights; + } + + + public function connections() : \SpameriTests\Data\Entity\Video\Connections + { + return $this->connections; + } + + + public function season() : \SpameriTests\Data\Entity\Video\SeasonCollection + { + return $this->season; + } + + + public function people() : \SpameriTests\Data\Entity\Video\People + { + return $this->people; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Alias.php b/tests/SpameriTests/Data/Entity/Video/Alias.php new file mode 100644 index 0000000..aad8e5e --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Alias.php @@ -0,0 +1,40 @@ +name = $name; + $this->country = $country; + } + + + public function name() : \SpameriTests\Data\Entity\Property\Name + { + return $this->name; + } + + + public function country() : \SpameriTests\Data\Entity\Property\CountryShort + { + return $this->country; + } +} \ No newline at end of file diff --git a/tests/SpameriTests/Data/Entity/Video/Connections.php b/tests/SpameriTests/Data/Entity/Video/Connections.php new file mode 100644 index 0000000..e3e70b6 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Connections.php @@ -0,0 +1,170 @@ +followed = $followed; + $this->remade = $remade; + $this->spinOff = $spinOff; + $this->editedInto = $editedInto; + $this->reference = $reference; + $this->referenced = $referenced; + $this->featured = $featured; + $this->spoofed = $spoofed; + $this->follows = $follows; + $this->spunOff = $spunOff; + $this->versionOf = $versionOf; + $this->editedFrom = $editedFrom; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + + } + + + public function followed(): \SpameriTests\Data\Entity\Video\Connections\FollowedCollection + { + return $this->followed; + } + + + public function remade(): \SpameriTests\Data\Entity\Video\Connections\RemadeCollection + { + return $this->remade; + } + + + public function spinOff(): \SpameriTests\Data\Entity\Video\Connections\SpinOffCollection + { + return $this->spinOff; + } + + + public function editedInto(): \SpameriTests\Data\Entity\Video\Connections\EditedIntoCollection + { + return $this->editedInto; + } + + + public function reference(): \SpameriTests\Data\Entity\Video\Connections\ReferenceCollection + { + return $this->reference; + } + + + public function referenced(): \SpameriTests\Data\Entity\Video\Connections\ReferencedCollection + { + return $this->referenced; + } + + + public function featured(): \SpameriTests\Data\Entity\Video\Connections\FeaturedCollection + { + return $this->featured; + } + + + public function spoofed(): \SpameriTests\Data\Entity\Video\Connections\SpoofedCollection + { + return $this->spoofed; + } + + + public function follows() : \SpameriTests\Data\Entity\Video\Connections\FollowsCollection + { + return $this->follows; + } + + + public function spunOff() : \SpameriTests\Data\Entity\Video\Connections\SpunOffCollection + { + return $this->spunOff; + } + + + public function versionOf() : \SpameriTests\Data\Entity\Video\Connections\VersionOfCollection + { + return $this->versionOf; + } + + + public function editedFrom() : \SpameriTests\Data\Entity\Video\Connections\EditedFromCollection + { + return $this->editedFrom; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Connections/EditedFrom.php b/tests/SpameriTests/Data/Entity/Video/Connections/EditedFrom.php new file mode 100644 index 0000000..52a203c --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Connections/EditedFrom.php @@ -0,0 +1,51 @@ +id = $id; + $this->note = $note; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return (string) $this->id->value(); + } + + + public function id(): \SpameriTests\Data\Entity\Property\ImdbId + { + return $this->id; + } + + + public function note(): \SpameriTests\Data\Entity\Property\Text + { + return $this->note; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Connections/EditedFromCollection.php b/tests/SpameriTests/Data/Entity/Video/Connections/EditedFromCollection.php new file mode 100644 index 0000000..8bd5b53 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Connections/EditedFromCollection.php @@ -0,0 +1,9 @@ +id = $id; + $this->note = $note; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return (string) $this->id->value(); + } + + + public function id(): \SpameriTests\Data\Entity\Property\ImdbId + { + return $this->id; + } + + + public function note(): \SpameriTests\Data\Entity\Property\Text + { + return $this->note; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Connections/EditedIntoCollection.php b/tests/SpameriTests/Data/Entity/Video/Connections/EditedIntoCollection.php new file mode 100644 index 0000000..13885cc --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Connections/EditedIntoCollection.php @@ -0,0 +1,9 @@ +id = $id; + $this->note = $note; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return (string) $this->id->value(); + } + + + public function id(): \SpameriTests\Data\Entity\Property\ImdbId + { + return $this->id; + } + + + public function note(): \SpameriTests\Data\Entity\Property\Text + { + return $this->note; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Connections/FeaturedCollection.php b/tests/SpameriTests/Data/Entity/Video/Connections/FeaturedCollection.php new file mode 100644 index 0000000..3490950 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Connections/FeaturedCollection.php @@ -0,0 +1,9 @@ +id = $id; + $this->note = $note; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return (string) $this->id->value(); + } + + + public function id(): \SpameriTests\Data\Entity\Property\ImdbId + { + return $this->id; + } + + + public function note(): \SpameriTests\Data\Entity\Property\Text + { + return $this->note; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Connections/FollowedCollection.php b/tests/SpameriTests/Data/Entity/Video/Connections/FollowedCollection.php new file mode 100644 index 0000000..7f79066 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Connections/FollowedCollection.php @@ -0,0 +1,9 @@ +id = $id; + $this->note = $note; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return (string) $this->id->value(); + } + + + public function id(): \SpameriTests\Data\Entity\Property\ImdbId + { + return $this->id; + } + + + public function note(): \SpameriTests\Data\Entity\Property\Text + { + return $this->note; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Connections/FollowsCollection.php b/tests/SpameriTests/Data/Entity/Video/Connections/FollowsCollection.php new file mode 100644 index 0000000..670aa4a --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Connections/FollowsCollection.php @@ -0,0 +1,9 @@ +id = $id; + $this->note = $note; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return (string) $this->id->value(); + } + + + public function id(): \SpameriTests\Data\Entity\Property\ImdbId + { + return $this->id; + } + + + public function note(): \SpameriTests\Data\Entity\Property\Text + { + return $this->note; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Connections/ReferenceCollection.php b/tests/SpameriTests/Data/Entity/Video/Connections/ReferenceCollection.php new file mode 100644 index 0000000..42400db --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Connections/ReferenceCollection.php @@ -0,0 +1,9 @@ +id = $id; + $this->note = $note; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return (string) $this->id->value(); + } + + + public function id(): \SpameriTests\Data\Entity\Property\ImdbId + { + return $this->id; + } + + + public function note(): \SpameriTests\Data\Entity\Property\Text + { + return $this->note; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Connections/ReferencedCollection.php b/tests/SpameriTests/Data/Entity/Video/Connections/ReferencedCollection.php new file mode 100644 index 0000000..3c0f104 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Connections/ReferencedCollection.php @@ -0,0 +1,9 @@ +id = $id; + $this->note = $note; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return (string) $this->id->value(); + } + + + public function id(): \SpameriTests\Data\Entity\Property\ImdbId + { + return $this->id; + } + + + public function note(): \SpameriTests\Data\Entity\Property\Text + { + return $this->note; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Connections/RemadeCollection.php b/tests/SpameriTests/Data/Entity/Video/Connections/RemadeCollection.php new file mode 100644 index 0000000..f7d4108 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Connections/RemadeCollection.php @@ -0,0 +1,9 @@ +id = $id; + $this->note = $note; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return (string) $this->id->value(); + } + + + public function id(): \SpameriTests\Data\Entity\Property\ImdbId + { + return $this->id; + } + + + public function note(): \SpameriTests\Data\Entity\Property\Text + { + return $this->note; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Connections/SpinOffCollection.php b/tests/SpameriTests/Data/Entity/Video/Connections/SpinOffCollection.php new file mode 100644 index 0000000..ebc1cd5 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Connections/SpinOffCollection.php @@ -0,0 +1,9 @@ +id = $id; + $this->note = $note; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return (string) $this->id->value(); + } + + + public function id(): \SpameriTests\Data\Entity\Property\ImdbId + { + return $this->id; + } + + + public function note(): \SpameriTests\Data\Entity\Property\Text + { + return $this->note; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Connections/SpoofedCollection.php b/tests/SpameriTests/Data/Entity/Video/Connections/SpoofedCollection.php new file mode 100644 index 0000000..e4d0e02 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Connections/SpoofedCollection.php @@ -0,0 +1,9 @@ +id = $id; + $this->note = $note; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return (string) $this->id->value(); + } + + + public function id(): \SpameriTests\Data\Entity\Property\ImdbId + { + return $this->id; + } + + + public function note(): \SpameriTests\Data\Entity\Property\Text + { + return $this->note; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Connections/SpunOffCollection.php b/tests/SpameriTests/Data/Entity/Video/Connections/SpunOffCollection.php new file mode 100644 index 0000000..c987ce8 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Connections/SpunOffCollection.php @@ -0,0 +1,9 @@ +id = $id; + $this->note = $note; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return (string) $this->id->value(); + } + + + public function id(): \SpameriTests\Data\Entity\Property\ImdbId + { + return $this->id; + } + + + public function note(): \SpameriTests\Data\Entity\Property\Text + { + return $this->note; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Connections/VersionOfCollection.php b/tests/SpameriTests/Data/Entity/Video/Connections/VersionOfCollection.php new file mode 100644 index 0000000..9b91b7b --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Connections/VersionOfCollection.php @@ -0,0 +1,9 @@ +genres = $genres; + $this->alias = $aliases; + $this->release = $releases; + $this->ratings = $ratings; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + + } + + + public function genres(): Details\GenreCollection + { + return $this->genres; + } + + + public function alias(): Details\AliasCollectionElastic + { + return $this->alias; + } + + + public function release(): Details\ReleaseCollectionElastic + { + return $this->release; + } + + + public function ratings() : \SpameriTests\Data\Entity\Video\Details\Ratings + { + return $this->ratings; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Details/Alias.php b/tests/SpameriTests/Data/Entity/Video/Details/Alias.php new file mode 100644 index 0000000..652f1b0 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Details/Alias.php @@ -0,0 +1,57 @@ +country = $country; + $this->name = $name; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return $this->country->value(); + } + + + public function country(): \SpameriTests\Data\Entity\Property\CountryShort + { + return $this->country; + } + + + public function name(): \SpameriTests\Data\Entity\Property\Text + { + return $this->name; + } + + + public function rename(\SpameriTests\Data\Entity\Property\Text $name) + { + $this->name = $name; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Details/AliasCollectionElastic.php b/tests/SpameriTests/Data/Entity/Video/Details/AliasCollectionElastic.php new file mode 100644 index 0000000..4a0ed67 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Details/AliasCollectionElastic.php @@ -0,0 +1,9 @@ + 65) { + throw new \InvalidArgumentException(); + } + + $this->value = $value; + } + + + public function value() : string + { + return $this->value; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Details/GenreCollection.php b/tests/SpameriTests/Data/Entity/Video/Details/GenreCollection.php new file mode 100644 index 0000000..f8c6d84 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Details/GenreCollection.php @@ -0,0 +1,38 @@ +collection = []; + foreach ($collection as $genre) { + $this->add($genre); + } + } + + + public function getIterator() : \ArrayIterator + { + return new \ArrayIterator($this->collection); + } + + + public function add( + Genre $genre + ) : void + { + $this->collection[$genre->value()] = $genre; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Details/Ratings.php b/tests/SpameriTests/Data/Entity/Video/Details/Ratings.php new file mode 100644 index 0000000..77b1cb7 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Details/Ratings.php @@ -0,0 +1,46 @@ +imdbRatings = $imdbRatings; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + + } + + + public function imdbRatings() : \SpameriTests\Data\Entity\Video\Details\RatingsCount + { + return $this->imdbRatings; + } + + + public function setImdbRatings(\SpameriTests\Data\Entity\Video\Details\RatingsCount $imdbRatings) + { + $this->imdbRatings = $imdbRatings; + } + +} diff --git a/tests/SpameriTests/Data/Entity/Video/Details/RatingsCount.php b/tests/SpameriTests/Data/Entity/Video/Details/RatingsCount.php new file mode 100644 index 0000000..b27205e --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Details/RatingsCount.php @@ -0,0 +1,34 @@ +value = $value; + } + + + public function value() : int + { + return $this->value; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Details/Release.php b/tests/SpameriTests/Data/Entity/Video/Details/Release.php new file mode 100644 index 0000000..eb8aa8d --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Details/Release.php @@ -0,0 +1,77 @@ +country = $country; + $this->note = $note; + $this->date = $date; + } + + + public function key() : string + { + return $this->country->value(); + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function country() : \SpameriTests\Data\Entity\Property\CountryShort + { + return $this->country; + } + + + public function note() : \SpameriTests\Data\Entity\Property\Text + { + return $this->note; + } + + + public function setNote(\SpameriTests\Data\Entity\Property\Text $note) : void + { + $this->note = $note; + } + + + public function date() : \Spameri\Elastic\Entity\Property\Date + { + return $this->date; + } + + + public function setDate(\Spameri\Elastic\Entity\Property\Date $date) : void + { + $this->date = $date; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Details/ReleaseCollectionElastic.php b/tests/SpameriTests/Data/Entity/Video/Details/ReleaseCollectionElastic.php new file mode 100644 index 0000000..fe5af79 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Details/ReleaseCollectionElastic.php @@ -0,0 +1,9 @@ +trivia = $trivia; + $this->goof = $goofs; + $this->crazyCredit = $crazyCredits; + $this->quote = $quotes; + $this->location = $locations; + $this->alternateVersion = $alternateVersions; + $this->companyCredit = $companyCredit; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + + } + + + public function trivia(): \SpameriTests\Data\Entity\Video\HighLights\TriviaCollection + { + return $this->trivia; + } + + + public function goof(): \SpameriTests\Data\Entity\Video\HighLights\GoofCollection + { + return $this->goof; + } + + + public function crazyCredit(): \SpameriTests\Data\Entity\Video\HighLights\CrazyCreditCollection + { + return $this->crazyCredit; + } + + + public function quote(): \SpameriTests\Data\Entity\Video\HighLights\QuoteCollection + { + return $this->quote; + } + + + public function location() : \SpameriTests\Data\Entity\Video\HighLights\LocationCollection + { + return $this->location; + } + + + public function alternateVersion() : \SpameriTests\Data\Entity\Video\HighLights\AlternateVersionCollection + { + return $this->alternateVersion; + } + + + public function companyCredit() : \SpameriTests\Data\Entity\Video\HighLights\CompanyCreditCollection + { + return $this->companyCredit; + } + +} diff --git a/tests/SpameriTests/Data/Entity/Video/HighLights/AlternateVersion.php b/tests/SpameriTests/Data/Entity/Video/HighLights/AlternateVersion.php new file mode 100644 index 0000000..74ba8b9 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/HighLights/AlternateVersion.php @@ -0,0 +1,40 @@ +text = $text; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return $this->text->value(); + } + + + public function text(): \SpameriTests\Data\Entity\Property\Text + { + return $this->text; + } + +} diff --git a/tests/SpameriTests/Data/Entity/Video/HighLights/AlternateVersionCollection.php b/tests/SpameriTests/Data/Entity/Video/HighLights/AlternateVersionCollection.php new file mode 100644 index 0000000..c912bf0 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/HighLights/AlternateVersionCollection.php @@ -0,0 +1,9 @@ +group = $group; + $this->company = $company; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return $this->group->value(); + } + + + public function group() : \SpameriTests\Data\Entity\Property\Text + { + return $this->group; + } + + + public function company() : \SpameriTests\Data\Entity\Video\HighLights\CompanyCollection + { + return $this->company; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/HighLights/CompanyCredit/Company.php b/tests/SpameriTests/Data/Entity/Video/HighLights/CompanyCredit/Company.php new file mode 100644 index 0000000..344e75a --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/HighLights/CompanyCredit/Company.php @@ -0,0 +1,64 @@ +id = $id; + $this->name = $name; + $this->note = $note; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return (string) $this->id->value(); + } + + + public function id() : \SpameriTests\Data\Entity\Property\ImdbId + { + return $this->id; + } + + + public function name() : \SpameriTests\Data\Entity\Property\Text + { + return $this->name; + } + + + public function note() : \SpameriTests\Data\Entity\Property\Text + { + return $this->note; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/HighLights/CompanyCredit/CompanyCollection.php b/tests/SpameriTests/Data/Entity/Video/HighLights/CompanyCredit/CompanyCollection.php new file mode 100644 index 0000000..d53d631 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/HighLights/CompanyCredit/CompanyCollection.php @@ -0,0 +1,9 @@ +id = $id; + $this->text = $text; + $this->relevancy = $relevancy; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return (string) $this->id->value(); + } + + + public function id(): \SpameriTests\Data\Entity\Property\ImdbId + { + return $this->id; + } + + + public function text(): \SpameriTests\Data\Entity\Property\Text + { + return $this->text; + } + + + public function relevancy(): Relevancy + { + return $this->relevancy; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/HighLights/CrazyCreditCollection.php b/tests/SpameriTests/Data/Entity/Video/HighLights/CrazyCreditCollection.php new file mode 100644 index 0000000..d772c44 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/HighLights/CrazyCreditCollection.php @@ -0,0 +1,9 @@ +id = $id; + $this->text = $text; + $this->relevancy = $relevancy; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return $this->id->value(); + } + + + public function id(): \SpameriTests\Data\Entity\Property\ImdbId + { + return $this->id; + } + + + public function text(): \SpameriTests\Data\Entity\Property\Text + { + return $this->text; + } + + + public function relevancy(): Relevancy + { + return $this->relevancy; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/HighLights/GoofCollection.php b/tests/SpameriTests/Data/Entity/Video/HighLights/GoofCollection.php new file mode 100644 index 0000000..6618d1e --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/HighLights/GoofCollection.php @@ -0,0 +1,9 @@ +name = $name; + $this->note = $note; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return $this->name->value(); + } + + + public function getName(): \SpameriTests\Data\Entity\Property\Text + { + return $this->name; + } + + + public function getNote(): \SpameriTests\Data\Entity\Property\Text + { + return $this->note; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/HighLights/LocationCollection.php b/tests/SpameriTests/Data/Entity/Video/HighLights/LocationCollection.php new file mode 100644 index 0000000..70999c9 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/HighLights/LocationCollection.php @@ -0,0 +1,9 @@ +id = $id; + $this->text = $text; + $this->relevancy = $relevancy; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return (string) $this->id->value(); + } + + + public function id(): \SpameriTests\Data\Entity\Property\ImdbId + { + return $this->id; + } + + + public function text(): \SpameriTests\Data\Entity\Property\Text + { + return $this->text; + } + + + public function relevancy(): Relevancy + { + return $this->relevancy; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/HighLights/QuoteCollection.php b/tests/SpameriTests/Data/Entity/Video/HighLights/QuoteCollection.php new file mode 100644 index 0000000..8abc731 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/HighLights/QuoteCollection.php @@ -0,0 +1,9 @@ +value = $value; + } + + public function value() : int + { + return $this->value; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/HighLights/Trivia.php b/tests/SpameriTests/Data/Entity/Video/HighLights/Trivia.php new file mode 100644 index 0000000..0d30af1 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/HighLights/Trivia.php @@ -0,0 +1,63 @@ +id = $id; + $this->text = $text; + $this->relevancy = $relevancy; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return (string) $this->id->value(); + } + + + public function id(): \SpameriTests\Data\Entity\Property\ImdbId + { + return $this->id; + } + + + public function text(): \SpameriTests\Data\Entity\Property\Text + { + return $this->text; + } + + + public function relevancy(): Relevancy + { + return $this->relevancy; + } +} \ No newline at end of file diff --git a/tests/SpameriTests/Data/Entity/Video/HighLights/TriviaCollection.php b/tests/SpameriTests/Data/Entity/Video/HighLights/TriviaCollection.php new file mode 100644 index 0000000..e2dcb13 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/HighLights/TriviaCollection.php @@ -0,0 +1,9 @@ +imdb = $imdb; + } + + + public function key() : string + { + return (string) $this->imdb->value(); + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function imdb(): \SpameriTests\Data\Entity\Property\ImdbId + { + return $this->imdb; + } +} \ No newline at end of file diff --git a/tests/SpameriTests/Data/Entity/Video/People.php b/tests/SpameriTests/Data/Entity/Video/People.php new file mode 100644 index 0000000..3b6dd5c --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/People.php @@ -0,0 +1,22 @@ +collection() as $entity) { + if ($imdb->value() === $entity->identification()->imdb()->value()) { + return $entity; + } + } + + return NULL; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Season.php b/tests/SpameriTests/Data/Entity/Video/Season.php new file mode 100644 index 0000000..6b1453e --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Season.php @@ -0,0 +1,51 @@ +number = $number; + $this->episodes = $episodes; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return (string) $this->number->value(); + } + + + public function number(): \SpameriTests\Data\Entity\Property\ImdbId + { + return $this->number; + } + + + public function episodes(): \SpameriTests\Data\Entity\Video\Season\EpisodeCollection + { + return $this->episodes; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Season/Episode.php b/tests/SpameriTests/Data/Entity/Video/Season/Episode.php new file mode 100644 index 0000000..b0d5ccf --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Season/Episode.php @@ -0,0 +1,77 @@ +id = $id; + $this->number = $number; + $this->name = $name; + $this->description = $description; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + return (string) $this->id->value(); + } + + + public function id(): \SpameriTests\Data\Entity\Property\ImdbId + { + return $this->id; + } + + + public function number(): \SpameriTests\Data\Entity\Property\ImdbId + { + return $this->number; + } + + + public function name(): \SpameriTests\Data\Entity\Property\Name + { + return $this->name; + } + + + public function description(): \SpameriTests\Data\Entity\Property\Description + { + return $this->description; + } +} \ No newline at end of file diff --git a/tests/SpameriTests/Data/Entity/Video/Season/EpisodeCollection.php b/tests/SpameriTests/Data/Entity/Video/Season/EpisodeCollection.php new file mode 100644 index 0000000..73e69a5 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Season/EpisodeCollection.php @@ -0,0 +1,20 @@ +collection() as $episode) { + if ($episode->id()->value() === $id->value()) { + return $episode; + } + } + + return NULL; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/SeasonCollection.php b/tests/SpameriTests/Data/Entity/Video/SeasonCollection.php new file mode 100644 index 0000000..f3f4f4c --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/SeasonCollection.php @@ -0,0 +1,20 @@ +collection() as $season) { + if ($season->number()->value() === $id->value()) { + return $season; + } + } + + return NULL; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Story.php b/tests/SpameriTests/Data/Entity/Video/Story.php new file mode 100644 index 0000000..3d8f581 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Story.php @@ -0,0 +1,107 @@ +description = $description; + $this->tagLines = $tagLines; + $this->plots = $plots; + $this->synopsis = $synopsis; + $this->keyWords = $keyWord; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + + } + + + public function description() : \SpameriTests\Data\Entity\Property\Description + { + return $this->description; + } + + + public function changeDescription( + \SpameriTests\Data\Entity\Property\Description $description + ) : void + { + $this->description = $description; + } + + + public function tagLines() : \SpameriTests\Data\Entity\Video\Story\TagLineCollection + { + return $this->tagLines; + } + + + public function plots() : \SpameriTests\Data\Entity\Video\Story\PlotSummaryCollection + { + return $this->plots; + } + + + public function setSynopsis( + \SpameriTests\Data\Entity\Video\Story\Synopsis $synopsis + ) : void + { + $this->synopsis = $synopsis; + } + + + public function synopsis() : \SpameriTests\Data\Entity\Video\Story\Synopsis + { + return $this->synopsis; + } + + + public function keyWords() : \SpameriTests\Data\Entity\Video\Story\KeyWordCollection + { + return $this->keyWords; + } +} \ No newline at end of file diff --git a/tests/SpameriTests/Data/Entity/Video/Story/KeyWord.php b/tests/SpameriTests/Data/Entity/Video/Story/KeyWord.php new file mode 100644 index 0000000..e5a6568 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Story/KeyWord.php @@ -0,0 +1,34 @@ + 55) { + throw new \InvalidArgumentException(); + } + + $this->value = $value; + } + + + public function value() : string + { + return $this->value; + } +} \ No newline at end of file diff --git a/tests/SpameriTests/Data/Entity/Video/Story/KeyWordCollection.php b/tests/SpameriTests/Data/Entity/Video/Story/KeyWordCollection.php new file mode 100644 index 0000000..c775365 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Story/KeyWordCollection.php @@ -0,0 +1,38 @@ +collection = []; + foreach ($entities as $keyWord) { + $this->add($keyWord); + } + } + + + public function add( + KeyWord $keyWord + ) : void + { + $this->collection[$keyWord->value()] = $keyWord; + } + + + public function getIterator() : \ArrayIterator + { + return new \ArrayIterator($this->collection); + } +} \ No newline at end of file diff --git a/tests/SpameriTests/Data/Entity/Video/Story/PlotSummary.php b/tests/SpameriTests/Data/Entity/Video/Story/PlotSummary.php new file mode 100644 index 0000000..735dffb --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Story/PlotSummary.php @@ -0,0 +1,37 @@ +value = $plot; + } + + + public function value() : string + { + return $this->value; + } + + + public function __toString() : string + { + return $this->value; + } + +} diff --git a/tests/SpameriTests/Data/Entity/Video/Story/PlotSummaryCollection.php b/tests/SpameriTests/Data/Entity/Video/Story/PlotSummaryCollection.php new file mode 100644 index 0000000..67d17dd --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Story/PlotSummaryCollection.php @@ -0,0 +1,47 @@ +collection = []; + foreach ($collection as $plotSummary) { + $this->add($plotSummary); + } + } + + + public function add( + PlotSummary $plotSummary + ) : void + { + $this->collection[\md5($plotSummary->value())] = $plotSummary; + } + + + public function first() :? PlotSummary + { + $first = reset($this->collection); + + return $first ?: NULL; + } + + + public function getIterator() : \ArrayIterator + { + return new \ArrayIterator($this->collection); + } + +} diff --git a/tests/SpameriTests/Data/Entity/Video/Story/Synopsis.php b/tests/SpameriTests/Data/Entity/Video/Story/Synopsis.php new file mode 100644 index 0000000..22a3fe3 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Story/Synopsis.php @@ -0,0 +1,27 @@ +value = $value; + } + + + public function value() : ?string + { + return $this->value; + } +} \ No newline at end of file diff --git a/tests/SpameriTests/Data/Entity/Video/Story/TagLine.php b/tests/SpameriTests/Data/Entity/Video/Story/TagLine.php new file mode 100644 index 0000000..c45e73a --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Story/TagLine.php @@ -0,0 +1,31 @@ +value = $tagLine; + } + + + public function value() : string + { + return $this->value; + } +} \ No newline at end of file diff --git a/tests/SpameriTests/Data/Entity/Video/Story/TagLineCollection.php b/tests/SpameriTests/Data/Entity/Video/Story/TagLineCollection.php new file mode 100644 index 0000000..b78267b --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Story/TagLineCollection.php @@ -0,0 +1,38 @@ +collection = []; + foreach ($collection as $tagLine) { + $this->add($tagLine); + } + } + + + public function add( + \SpameriTests\Data\Entity\Video\Story\TagLine $tagLine + ) : void + { + $this->collection[\md5($tagLine->value())] = $tagLine; + } + + + public function getIterator() + { + return new \ArrayIterator($this->collection); + } +} \ No newline at end of file diff --git a/tests/SpameriTests/Data/Entity/Video/Technical.php b/tests/SpameriTests/Data/Entity/Video/Technical.php new file mode 100644 index 0000000..33f3a2e --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Technical.php @@ -0,0 +1,143 @@ +camera = $camera; + $this->runtime = $runtime; + $this->color = $color; + $this->ratio = $ratio; + $this->laboratory = $laboratory; + $this->filmLength = $filmLength; + $this->negativeFormat = $negativeFormat; + $this->cineProcess = $cineProcess; + $this->printed = $printed; + } + + + public function entityVariables() : array + { + return get_object_vars($this); + } + + + public function key() : string + { + + } + + + public function camera() : \SpameriTests\Data\Entity\Video\Technical\Camera + { + return $this->camera; + } + + + public function runtime() : \SpameriTests\Data\Entity\Video\Technical\Runtime + { + return $this->runtime; + } + + + public function color() : \SpameriTests\Data\Entity\Video\Technical\Color + { + return $this->color; + } + + + public function ratio() : \SpameriTests\Data\Entity\Video\Technical\Ratio + { + return $this->ratio; + } + + + public function laboratory() : \SpameriTests\Data\Entity\Video\Technical\Laboratory + { + return $this->laboratory; + } + + + public function filmLength() : \SpameriTests\Data\Entity\Video\Technical\FilmLength + { + return $this->filmLength; + } + + + public function negativeFormat() : \SpameriTests\Data\Entity\Video\Technical\NegativeFormat + { + return $this->negativeFormat; + } + + + public function cineProcess() : \SpameriTests\Data\Entity\Video\Technical\CineProcess + { + return $this->cineProcess; + } + + + public function printed() : \SpameriTests\Data\Entity\Video\Technical\Printed + { + return $this->printed; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Technical/Camera.php b/tests/SpameriTests/Data/Entity/Video/Technical/Camera.php new file mode 100644 index 0000000..923dff1 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Technical/Camera.php @@ -0,0 +1,31 @@ + 255) { + throw new \InvalidArgumentException(); + } + + $this->value = $value; + } + + + public function value() : ?string + { + return $this->value; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Technical/CineProcess.php b/tests/SpameriTests/Data/Entity/Video/Technical/CineProcess.php new file mode 100644 index 0000000..dc51d7c --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Technical/CineProcess.php @@ -0,0 +1,31 @@ + 255) { + throw new \InvalidArgumentException(); + } + + $this->value = $value; + } + + + public function value() : ?string + { + return $this->value; + } +} \ No newline at end of file diff --git a/tests/SpameriTests/Data/Entity/Video/Technical/Color.php b/tests/SpameriTests/Data/Entity/Video/Technical/Color.php new file mode 100644 index 0000000..1ccd8f4 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Technical/Color.php @@ -0,0 +1,31 @@ + 255) { + throw new \InvalidArgumentException(); + } + + $this->value = $value; + } + + + public function value() : ?string + { + return $this->value; + } +} \ No newline at end of file diff --git a/tests/SpameriTests/Data/Entity/Video/Technical/FilmLength.php b/tests/SpameriTests/Data/Entity/Video/Technical/FilmLength.php new file mode 100644 index 0000000..dd400a2 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Technical/FilmLength.php @@ -0,0 +1,31 @@ + 255) { + throw new \InvalidArgumentException(); + } + + $this->value = $value; + } + + + public function value() : ?string + { + return $this->value; + } +} \ No newline at end of file diff --git a/tests/SpameriTests/Data/Entity/Video/Technical/Laboratory.php b/tests/SpameriTests/Data/Entity/Video/Technical/Laboratory.php new file mode 100644 index 0000000..1096129 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Technical/Laboratory.php @@ -0,0 +1,31 @@ + 255) { + throw new \InvalidArgumentException(); + } + + $this->value = $value; + } + + + public function value() : ?string + { + return $this->value; + } +} diff --git a/tests/SpameriTests/Data/Entity/Video/Technical/NegativeFormat.php b/tests/SpameriTests/Data/Entity/Video/Technical/NegativeFormat.php new file mode 100644 index 0000000..e009aab --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Technical/NegativeFormat.php @@ -0,0 +1,31 @@ + 255) { + throw new \InvalidArgumentException(); + } + + $this->value = $value; + } + + + public function value() : ?string + { + return $this->value; + } +} \ No newline at end of file diff --git a/tests/SpameriTests/Data/Entity/Video/Technical/Printed.php b/tests/SpameriTests/Data/Entity/Video/Technical/Printed.php new file mode 100644 index 0000000..cbc2d19 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Technical/Printed.php @@ -0,0 +1,31 @@ + 255) { + throw new \InvalidArgumentException(); + } + + $this->value = $value; + } + + + public function value() : ?string + { + return $this->value; + } +} \ No newline at end of file diff --git a/tests/SpameriTests/Data/Entity/Video/Technical/Ratio.php b/tests/SpameriTests/Data/Entity/Video/Technical/Ratio.php new file mode 100644 index 0000000..f98511e --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Technical/Ratio.php @@ -0,0 +1,31 @@ + 255) { + throw new \InvalidArgumentException(); + } + + $this->value = $value; + } + + + public function value() : ?string + { + return $this->value; + } +} \ No newline at end of file diff --git a/tests/SpameriTests/Data/Entity/Video/Technical/Runtime.php b/tests/SpameriTests/Data/Entity/Video/Technical/Runtime.php new file mode 100644 index 0000000..1e02881 --- /dev/null +++ b/tests/SpameriTests/Data/Entity/Video/Technical/Runtime.php @@ -0,0 +1,34 @@ + 1200) { + throw new \InvalidArgumentException(); + } + + $this->value = $value; + } + + + public function value() : ?int + { + return $this->value; + } +} \ No newline at end of file diff --git a/tests/SpameriTests/Data/Model/PersonService.php b/tests/SpameriTests/Data/Model/PersonService.php new file mode 100644 index 0000000..847a030 --- /dev/null +++ b/tests/SpameriTests/Data/Model/PersonService.php @@ -0,0 +1,56 @@ +execute($video, 'spameri_video'); + + \Tester\Assert::same(20, \strlen($id)); + }); + } + +} +(new Insert())->run(); diff --git a/tests/SpameriTests/Model/ValidateMapping.phpt b/tests/SpameriTests/Model/ValidateMapping.phpt new file mode 100644 index 0000000..ea5c5e5 --- /dev/null +++ b/tests/SpameriTests/Model/ValidateMapping.phpt @@ -0,0 +1,78 @@ +validate(); + \Tester\Assert::count(0, $display->blockNameIssue()); + \Tester\Assert::count(0, $display->tokenizerIssues()); + \Tester\Assert::count(0, $display->analyzerIssue()); + \Tester\Assert::count(0, $display->conflictingNameIssue()); + \Tester\Assert::count(0, $display->uniqueFieldNames()); + \Tester\Assert::count(0, $display->typeIssue()); + } + + + public function testValidateFull(): void + { + $display = new \Spameri\Elastic\Model\ValidateMapping\Display(); + $entities = \Nette\Neon\Neon::decode(\file_get_contents(__DIR__ . '/../Data/Config/Video.neon')); + $validateMapping = new \Spameri\Elastic\Model\ValidateMapping( + $entities['elasticSearch']['entities'], + [], + $display + ); + + $validateMapping->validate(); + \Tester\Assert::count(0, $display->blockNameIssue()); + \Tester\Assert::count(0, $display->tokenizerIssues()); + \Tester\Assert::count(0, $display->analyzerIssue()); + \Tester\Assert::count(8, $display->conflictingNameIssue()['Video']); + \Tester\Assert::count(63, $display->uniqueFieldNames()['Video']); + \Tester\Assert::count(0, $display->typeIssue()); + } + + + public function testValidateFullWithError(): void + { + $display = new \Spameri\Elastic\Model\ValidateMapping\Display(); + $entities = \Nette\Neon\Neon::decode(\file_get_contents(__DIR__ . '/../Data/Config/Video.neon')); + $entities['elasticSearch']['entities']['Video']['properties']['extraField']['properties']['name']['type'] = 'string'; + $entities['elasticSearch']['entities']['Video']['properties']['name']['typ'] = 'string'; + $entities['elasticSearch']['entities']['Video']['properties']['year']['tokenizer'] = 'floatWell'; + $entities['elasticSearch']['entities']['Video']['properties']['month']['tokenizer'] = 'number'; + $entities['elasticSearch']['entities']['Video']['properties']['year']['analyzer'] = 'floatWell'; + + + $validateMapping = new \Spameri\Elastic\Model\ValidateMapping( + $entities['elasticSearch']['entities'], + [], + $display + ); + + $validateMapping->validate(); + \Tester\Assert::count(1, $display->blockNameIssue()['Video']); + \Tester\Assert::count(2, $display->tokenizerIssues()['Video']); + \Tester\Assert::count(1, $display->analyzerIssue()['Video']); + \Tester\Assert::count(8, $display->conflictingNameIssue()['Video']); + \Tester\Assert::count(65, $display->uniqueFieldNames()['Video']); + \Tester\Assert::count(1, $display->typeIssue()['Video']); + } + +} +(new ValidateMapping())->run(); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 3c6b265..196a1bf 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1 +1,27 @@