From 6379c89891126590a23fac2b5f31fd1808d57d33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20L=C3=BCckers?= Date: Wed, 29 Apr 2020 15:15:03 +0200 Subject: [PATCH] Public release --- .github/ISSUE_TEMPLATE/bug_report.md | 25 + .github/ISSUE_TEMPLATE/feature_request.md | 20 + .gitignore | 72 + LICENSE | 21 + README.md | 32 + composer.json | 47 + composer.lock | 1612 +++++++++++++++++ phpunit.xml.dist | 12 + src/Faker/ORM/xPDO/ColumnTypeGuesser.php | 86 + src/Faker/ORM/xPDO/EntityPopulator.php | 210 +++ src/Faker/ORM/xPDO/Populator.php | 88 + .../Faker/ORM/xPDO/ColumnTypeGuesserTest.php | 141 ++ tests/Faker/ORM/xPDO/EntityPopulatorTest.php | 81 + tests/Faker/ORM/xPDO/PopulatorTest.php | 47 + tests/PHPUnit/Framework/DatabaseTestCase.php | 72 + tests/properties.sample.inc.php | 10 + tests/test_package/_build/build.schema.php | 46 + .../columntypeguesserfakerobject.class.php | 2 + .../faker-xpdo-orm-adapter/metadata.mysql.php | 13 + .../columntypeguesserfakerobject.class.php | 3 + .../columntypeguesserfakerobject.map.inc.php | 76 + .../mysql/parentchildrenfakerobject.class.php | 3 + .../parentchildrenfakerobject.map.inc.php | 46 + .../mysql/simplefakerobject.class.php | 3 + .../mysql/simplefakerobject.map.inc.php | 26 + .../parentchildrenfakerobject.class.php | 2 + .../simplefakerobject.class.php | 2 + .../faker-xpdo-orm-adapter.mysql.schema.xml | 29 + 28 files changed, 2827 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 composer.json create mode 100644 composer.lock create mode 100644 phpunit.xml.dist create mode 100644 src/Faker/ORM/xPDO/ColumnTypeGuesser.php create mode 100644 src/Faker/ORM/xPDO/EntityPopulator.php create mode 100644 src/Faker/ORM/xPDO/Populator.php create mode 100644 tests/Faker/ORM/xPDO/ColumnTypeGuesserTest.php create mode 100644 tests/Faker/ORM/xPDO/EntityPopulatorTest.php create mode 100644 tests/Faker/ORM/xPDO/PopulatorTest.php create mode 100644 tests/PHPUnit/Framework/DatabaseTestCase.php create mode 100644 tests/properties.sample.inc.php create mode 100644 tests/test_package/_build/build.schema.php create mode 100644 tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/columntypeguesserfakerobject.class.php create mode 100644 tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/metadata.mysql.php create mode 100644 tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/mysql/columntypeguesserfakerobject.class.php create mode 100644 tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/mysql/columntypeguesserfakerobject.map.inc.php create mode 100644 tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/mysql/parentchildrenfakerobject.class.php create mode 100644 tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/mysql/parentchildrenfakerobject.map.inc.php create mode 100644 tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/mysql/simplefakerobject.class.php create mode 100644 tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/mysql/simplefakerobject.map.inc.php create mode 100644 tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/parentchildrenfakerobject.class.php create mode 100644 tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/simplefakerobject.class.php create mode 100644 tests/test_package/core/components/faker-xpdo-orm-adapter/model/schema/faker-xpdo-orm-adapter.mysql.schema.xml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..38e7d58 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,25 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior, including custom code if needed. + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Environment (please complete the following information):** + - OS: [e.g. macOS] + - Database: [e.g. mysql, mariadb] + - xPDO and/or MODX Version: [e.g. xPDO 2.7.0-pl, MODX 2.7.2] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..11fc491 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..98305f2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,72 @@ +### Composer ### +composer.phar +vendor/ + +### PHPUnit ### +phpunit.xml + +### Config files ### +tests/properties.inc.php + +### OSX ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### PhpStorm ### +.idea + +# IntelliJ +out/ + +# Editor-based Rest Client +.idea/httpRequests + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..1218aee --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020-present Springbok Agency BV (https://www.springbokagency.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..315bb66 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# Faker xPDO ORM Adapter + +A [Faker](https://github.com/fzaninotto/Faker) ORM adapter to populate [xPDO](http://xpdo.org) objects with fake data. + +# Table of contents + +- [Installation](#installation) +- [Usage](#usage) + +## Installation + +Install as development dependency using [Composer](https://getcomposer.org). + +``` bash +$ composer require --dev springbokagency/faker-xpdo-orm-adapter +``` + +## Usage +To populate xPDO objects, create a new populator class (using a generator instance as parameter), then list the class and number of all the objects that must be generated. To launch the actual data population, call the execute() method. + +Here is an example showing how to populate 5 `modUser` and 10 `modResource` objects: + +```php +addEntity(\modUser::class, 5); +$populator->addEntity(\modResource::class, 10); +$insertedPKs = $populator->execute(); +``` + +For more info read [the Faker documentation](https://github.com/fzaninotto/Faker#populating-entities-using-an-orm-or-an-odm). \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..4e3d9d9 --- /dev/null +++ b/composer.json @@ -0,0 +1,47 @@ +{ + "name": "springbokagency/faker-xpdo-orm-adapter", + "type": "library", + "description": "xPDO ORM adapter for faker", + "license": "MIT", + "authors": [ + { + "name": "Joshua Lückers", + "email": "joshua.luckers@springbokagency.com" + } + ], + "repositories": [ + { + "type": "package", + "package": { + "name": "modxcms/xpdo2", + "version": "v2.8.0-pl", + "source": { + "url": "git@github.com:modxcms/xpdo.git", + "type": "git", + "reference": "origin/2.x" + } + } + } + ], + "require": { + "fzaninotto/faker": "^1.9.1" + }, + "require-dev": { + "modxcms/xpdo2": "^2.8", + "phpunit/phpunit": "~6.5" + }, + "autoload": { + "psr-4": { + "SpringbokAgency\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "SpringbokAgency\\Tests\\": "tests/" + }, + "classmap": [ + "vendor/modxcms/xpdo2/xpdo/", + "tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/" + ] + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..850b53a --- /dev/null +++ b/composer.lock @@ -0,0 +1,1612 @@ +{ + "_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#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "27e6a99f7c0a24844f37af4d78ea732d", + "packages": [ + { + "name": "fzaninotto/faker", + "version": "v1.9.1", + "source": { + "type": "git", + "url": "https://github.com/fzaninotto/Faker.git", + "reference": "fc10d778e4b84d5bd315dad194661e091d307c6f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/fc10d778e4b84d5bd315dad194661e091d307c6f", + "reference": "fc10d778e4b84d5bd315dad194661e091d307c6f", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "ext-intl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7", + "squizlabs/php_codesniffer": "^2.9.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "time": "2019-12-12T13:22:17+00:00" + } + ], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1", + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2019-10-21T16:45:58+00:00" + }, + { + "name": "modxcms/xpdo2", + "version": "v2.8.0-pl", + "source": { + "type": "git", + "url": "git@github.com:modxcms/xpdo.git", + "reference": "origin/2.x" + }, + "type": "library" + }, + { + "name": "myclabs/deep-copy", + "version": "1.9.5", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/b2c28789e80a97badd14145fda39b545d83ca3ef", + "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2020-01-17T21:11:47+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^1.0.1", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2017-03-05T18:14:27+00:00" + }, + { + "name": "phar-io/version", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2017-03-05T17:38:23+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "~6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2018-08-07T13:53:10+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "4.3.4", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/da3fd972d6bafd628114f7e7e036f45944b62e9c", + "reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c", + "shasum": "" + }, + "require": { + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0", + "phpdocumentor/type-resolver": "~0.4 || ^1.0.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "doctrine/instantiator": "^1.0.5", + "mockery/mockery": "^1.0", + "phpdocumentor/type-resolver": "0.4.*", + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2019-12-28T18:55:12+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", + "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", + "shasum": "" + }, + "require": { + "php": "^7.1", + "phpdocumentor/reflection-common": "^2.0" + }, + "require-dev": { + "ext-tokenizer": "^7.1", + "mockery/mockery": "~1", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "time": "2019-08-22T18:11:29+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "v1.10.3", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "451c3cd1418cf640de218914901e51b064abb093" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", + "reference": "451c3cd1418cf640de218914901e51b064abb093", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", + "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5 || ^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10.x-dev" + } + }, + "autoload": { + "psr-4": { + "Prophecy\\": "src/Prophecy" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2020-03-05T15:02:03+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "5.3.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "c89677919c5dd6d3b3852f230a663118762218ac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c89677919c5dd6d3b3852f230a663118762218ac", + "reference": "c89677919c5dd6d3b3852f230a663118762218ac", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.0", + "phpunit/php-file-iterator": "^1.4.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^2.0.1", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-xdebug": "^2.5.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2018-04-06T15:36:58+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2017-11-27T13:52:08+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.9", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2017-02-26T11:10:40+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "791198a2c6254db10131eecfe8c06670700904db" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", + "reference": "791198a2c6254db10131eecfe8c06670700904db", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.2.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2017-11-27T05:48:46+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "6.5.14", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "bac23fe7ff13dbdb461481f706f0e9fe746334b7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/bac23fe7ff13dbdb461481f706f0e9fe746334b7", + "reference": "bac23fe7ff13dbdb461481f706f0e9fe746334b7", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.6.1", + "phar-io/manifest": "^1.0.1", + "phar-io/version": "^1.0", + "php": "^7.0", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^5.3", + "phpunit/php-file-iterator": "^1.4.3", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^1.0.9", + "phpunit/phpunit-mock-objects": "^5.0.9", + "sebastian/comparator": "^2.1", + "sebastian/diff": "^2.0", + "sebastian/environment": "^3.1", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^1.0", + "sebastian/version": "^2.0.1" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "3.0.2", + "phpunit/dbunit": "<3.0" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-xdebug": "*", + "phpunit/php-invoker": "^1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.5.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2019-02-01T05:22:47+00:00" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "5.0.10", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/cd1cf05c553ecfec36b170070573e540b67d3f1f", + "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.5", + "php": "^7.0", + "phpunit/php-text-template": "^1.2.1", + "sebastian/exporter": "^3.1" + }, + "conflict": { + "phpunit/phpunit": "<6.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.5.11" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "abandoned": true, + "time": "2018-08-09T05:50:03+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04T06:30:41+00:00" + }, + { + "name": "sebastian/comparator", + "version": "2.1.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/34369daee48eafb2651bea869b4b15d75ccc35f9", + "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/diff": "^2.0 || ^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2018-02-01T13:46:46+00:00" + }, + { + "name": "sebastian/diff", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", + "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2017-08-03T08:09:46+00:00" + }, + { + "name": "sebastian/environment", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2017-07-01T08:51:00+00:00" + }, + { + "name": "sebastian/exporter", + "version": "3.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2019-09-14T09:02:43+00:00" + }, + { + "name": "sebastian/global-state", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2017-04-27T15:39:26+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-08-03T12:35:26+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2017-03-03T06:23:57+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2015-07-28T20:34:47+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.15.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/4719fa9c18b0464d399f1a63bf624b42b6fa8d14", + "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.15-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-02-27T09:26:54+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2019-06-13T22:48:21+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.7.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "aed98a490f9a8f78468232db345ab9cf606cf598" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/aed98a490f9a8f78468232db345ab9cf606cf598", + "reference": "aed98a490f9a8f78468232db345ab9cf606cf598", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "vimeo/psalm": "<3.6.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.36 || ^7.5.13" + }, + "type": "library", + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2020-02-14T12:15:55+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "1.1.0" +} diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..84b8797 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,12 @@ + + + + + ./tests/Faker/ + + + + \ No newline at end of file diff --git a/src/Faker/ORM/xPDO/ColumnTypeGuesser.php b/src/Faker/ORM/xPDO/ColumnTypeGuesser.php new file mode 100644 index 0000000..84c70b4 --- /dev/null +++ b/src/Faker/ORM/xPDO/ColumnTypeGuesser.php @@ -0,0 +1,86 @@ +generator = $generator; + } + + /** + * @param array $column + * @return Closure|null + */ + public function guessFormat(array $column) + { + $generator = $this->generator; + + $phptype = $column['phptype']; + + switch ($phptype) { + case 'timestamp': + { + return function () use ($generator) { + return $generator->unixTime(); + }; + } + case 'datetime': + { + return function () use ($generator) { + return $generator->date() . ' ' . $generator->time(); + }; + } + case 'date': + { + return function () use ($generator) { + return $generator->datetime(); + }; + } + case 'boolean': + { + return function () use ($generator) { + return $generator->boolean(); + }; + } + case 'integer': + { + return function () use ($generator) { + return $generator->randomNumber(); + }; + } + case 'array': + { + return function () use ($generator) { + return $generator->randomElements(); + }; + } + case 'string': + { + return function () use ($generator) { + return $generator->text(); + }; + } + } + + return null; + } +} \ No newline at end of file diff --git a/src/Faker/ORM/xPDO/EntityPopulator.php b/src/Faker/ORM/xPDO/EntityPopulator.php new file mode 100644 index 0000000..e9dee24 --- /dev/null +++ b/src/Faker/ORM/xPDO/EntityPopulator.php @@ -0,0 +1,210 @@ +xpdo = $xpdo; + $this->class = $class; + } + + /** + * @return string + */ + public function getClass() + { + return $this->class; + } + + /** + * @param $columnFormatters + */ + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + /** + * @param Generator $generator + * @return array + */ + public function guessColumnFormatters(Generator $generator) + { + $formatters = []; + $class = $this->class; + $schema = $this->xpdo->getFieldMeta($class); + $aggregates = $this->xpdo->getAggregates($class); + $pk = $this->xpdo->getPK($class); + $isFieldForeignKey = function ($field) use ($aggregates) { + foreach ($aggregates as $aggregateClass => $aggregateSchema) { + if ($field === $aggregateSchema['local']) { + return true; + } + } + return false; + }; + + $nameGuesser = new Name($generator); + $columnTypeGuesser = new ColumnTypeGuesser($generator); + + foreach ($schema as $field => $column) { + if ($field === $pk || $field === $isFieldForeignKey($field)) { + continue; + } + + $size = isset($column['precision']) ? (int)$column['precision'] : null; + if ($formatter = $nameGuesser->guessFormat($field, $size)) { + $formatters[$field] = $formatter; + continue; + } + + if ($formatter = $columnTypeGuesser->guessFormat($column)) { + $formatters[$field] = $formatter; + continue; + } + } + + return $formatters; + } + + /** + * @param $modifiers + */ + public function mergeModifiersWith($modifiers) + { + $this->modifiers = array_merge($this->modifiers, $modifiers); + } + + /** + * @param Generator $generator + * @return array + */ + public function guessModifiers(Generator $generator) + { + $modifiers = []; + $class = $this->class; + $schemaAggregates = $this->xpdo->getAggregates($class); + + foreach ($schemaAggregates as $field => $schema) { + $modifiers[$field] = function (xPDOObject $xpdoObject, $insertedEntities) use ($schema, $generator) { + $foreignClass = $schema['class']; + $foreignField = $schema['local']; + + if (!empty($insertedEntities[$foreignClass])) { + $foreignKeys = $insertedEntities[$foreignClass]; + } else { + $foreignKeys = $this->xpdo->getCollection($foreignClass); + } + + if (!empty($foreignKeys)) { + /** @var xPDOObject $foreignKey */ + $foreignKey = $foreignKeys[array_rand($foreignKeys)]; + $xpdoObject->set($foreignField, is_object($foreignKey) ? $foreignKey->getPrimaryKey() : $foreignKey); + } + }; + } + + + return $modifiers; + } + + /** + * @param $class + * @param $insertedEntities + * @return array + */ + public function execute($class, $insertedEntities) + { + /** @var xPDOObject $entity */ + $entity = $this->xpdo->newObject($class); + + foreach ($this->getColumnFormatters() as $column => $format) { + if ($format === null) { + continue; + } + + $entity->set($column, is_callable($format) ? $format($insertedEntities, $entity) : $format); + } + + foreach ($this->getModifiers() as $modifier) { + $modifier($entity, $insertedEntities); + } + + if (!$entity->save()) { + throw new RuntimeException("Failed saving $class record"); + } + + return $entity->getPrimaryKey(); + } + + /** + * @return array + */ + public function getColumnFormatters() + { + return $this->columnFormatters; + } + + /** + * @param array $columnFormatters + */ + public function setColumnFormatters(array $columnFormatters) + { + $this->columnFormatters = $columnFormatters; + } + + /** + * @return array + */ + public function getModifiers() + { + return $this->modifiers; + } + + /** + * @param array $modifiers + */ + public function setModifiers(array $modifiers) + { + $this->modifiers = $modifiers; + } +} \ No newline at end of file diff --git a/src/Faker/ORM/xPDO/Populator.php b/src/Faker/ORM/xPDO/Populator.php new file mode 100644 index 0000000..88bb6e5 --- /dev/null +++ b/src/Faker/ORM/xPDO/Populator.php @@ -0,0 +1,88 @@ +generator = $generator; + $this->xpdo = $xpdo; + } + + /** + * Add an order for the generation of $number records for $entity. + * + * @param mixed $entity A xPDO classname, or a \SpringbokAgency\Faker\ORM\xPDO\EntityPopulator instance + * @param int $number The number of entities to populate + * @param array $customColumnFormatters + * @param array $customModifiers + * @return Populator + */ + public function addEntity($entity, $number, $customColumnFormatters = [], $customModifiers = []) + { + if (!$entity instanceof EntityPopulator) { + if ($this->xpdo === null) { + throw new InvalidArgumentException('No xPDO instance passed to xPDO Populator'); + } + + $entity = new EntityPopulator($this->xpdo, $entity); + } + + $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator)); + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + + $entity->setModifiers($entity->guessModifiers($this->generator)); + if ($customModifiers) { + $entity->mergeModifiersWith($customModifiers); + } + + $class = $entity->getClass(); + $this->entities[$class] = $entity; + $this->quantities[$class] = $number; + + return $this; + } + + /** + * @return array + */ + public function execute() + { + $insertedEntities = []; + + foreach ($this->quantities as $class => $number) { + for ($i = 0; $i < $number; $i++) { + $insertedEntities[$class][] = $this->entities[$class]->execute($class, $insertedEntities); + } + } + + return $insertedEntities; + } +} \ No newline at end of file diff --git a/tests/Faker/ORM/xPDO/ColumnTypeGuesserTest.php b/tests/Faker/ORM/xPDO/ColumnTypeGuesserTest.php new file mode 100644 index 0000000..1e6f361 --- /dev/null +++ b/tests/Faker/ORM/xPDO/ColumnTypeGuesserTest.php @@ -0,0 +1,141 @@ +guessFormat( + [ + 'dbtype' => 'timestamp', + 'phptype' => 'timestamp', + 'null' => true, + ] + ); + + $this->assertInternalType('int', $guessedColumnFormat()); + + $guessedColumnFormat = $columnTypeGuesser->guessFormat( + [ + 'dbtype' => 'datetime', + 'phptype' => 'datetime', + 'null' => true, + ] + ); + + $this->assertInternalType("string", $guessedColumnFormat()); + $dateTimeFormat = 'Y-m-d H:i:s'; + $dateTimeString = $guessedColumnFormat(); + $expectedDateTime = DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $dateTimeString); + $this->assertEquals($expectedDateTime->format($dateTimeFormat), $dateTimeString); + + $guessedColumnFormat = $columnTypeGuesser->guessFormat( + [ + 'dbtype' => 'date', + 'phptype' => 'date', + 'null' => true, + ] + ); + + $this->assertInstanceOf(DateTime::class, $guessedColumnFormat()); + } + + public function testGuessFormatBoolean() + { + $generator = Factory::create(); + $columnTypeGuesser = new ColumnTypeGuesser($generator); + $guessedColumnFormat = $columnTypeGuesser->guessFormat( + [ + 'dbtype' => 'tinyint', + 'precision' => '1', + 'phptype' => 'boolean', + 'null' => false, + ] + ); + + $this->assertInternalType("boolean", $guessedColumnFormat()); + } + + public function testGuessFormatInteger() + { + $generator = Factory::create(); + $columnTypeGuesser = new ColumnTypeGuesser($generator); + $guessedColumnFormat = $columnTypeGuesser->guessFormat( + [ + 'dbtype' => 'int', + 'precision' => '11', + 'phptype' => 'integer', + 'null' => false, + 'default' => 0, + ] + ); + + $this->assertInternalType("int", $guessedColumnFormat()); + } + + public function testGuessFormatArray() + { + $generator = Factory::create(); + $columnTypeGuesser = new ColumnTypeGuesser($generator); + $guessedColumnFormat = $columnTypeGuesser->guessFormat( + [ + 'dbtype' => 'text', + 'phptype' => 'array', + 'null' => false, + ] + ); + + $this->assertInternalType("array", $guessedColumnFormat()); + $this->assertNotEmpty($guessedColumnFormat); + } + + public function testGuessFormatString() + { + $generator = Factory::create(); + $columnTypeGuesser = new ColumnTypeGuesser($generator); + $guessedColumnFormat = $columnTypeGuesser->guessFormat( + [ + 'dbtype' => 'varchar', + 'precision' => '255', + 'phptype' => 'string', + 'null' => false, + ] + ); + + $this->assertInternalType("string", $guessedColumnFormat()); + } + + public function testGuessNotSureWhatToUse() + { + $generator = Factory::create(); + $columnTypeGuesser = new ColumnTypeGuesser($generator); + $guessedColumnFormat = $columnTypeGuesser->guessFormat( + [ + 'dbtype' => 'text', + 'phptype' => 'object', + 'null' => false, + ] + ); + + $this->assertNull($guessedColumnFormat); + } +} \ No newline at end of file diff --git a/tests/Faker/ORM/xPDO/EntityPopulatorTest.php b/tests/Faker/ORM/xPDO/EntityPopulatorTest.php new file mode 100644 index 0000000..6b2f9fb --- /dev/null +++ b/tests/Faker/ORM/xPDO/EntityPopulatorTest.php @@ -0,0 +1,81 @@ +guessColumnFormatters($generator); + + $this->assertNotEmpty($guessedColumnFormatters); + foreach ($guessedColumnFormatters as $guessedColumnFormatter) { + $this->assertInstanceOf(Closure::class, $guessedColumnFormatter); + } + } + + public function testGuessModifiers() + { + $generator = new Generator(); + $entityPopulator = new EntityPopulator(self::$xpdo, ParentChildrenFakerObject::class); + + $guessedModifiers = $entityPopulator->guessModifiers($generator); + $this->assertNotEmpty($guessedModifiers); + + $expectedGuessedModifiers = array_keys(self::$xpdo->map[ParentChildrenFakerObject::class]['aggregates']); + $actualGuessedModifiers = array_keys($guessedModifiers); + $this->assertSame( + array_diff($expectedGuessedModifiers, $actualGuessedModifiers), + array_diff($actualGuessedModifiers, $expectedGuessedModifiers) + ); + } + + public function testExecute() + { + $generator = Factory::create(); + + $entityPopulator = new EntityPopulator(self::$xpdo, SimpleFakerObject::class); + + $entityPopulator->setColumnFormatters($entityPopulator->guessColumnFormatters($generator)); + + $primaryKeyForEntity = $entityPopulator->execute(SimpleFakerObject::class, []); + $this->assertNotNull($primaryKeyForEntity); + } + + public function testExecuteFailed() + { + self::$xpdo->getManager()->removeObjectContainer(SimpleFakerObject::class); + + $class = SimpleFakerObject::class; + + $entityPopulator = new EntityPopulator(self::$xpdo, $class); + + $this->expectException(RuntimeException::class); + $this->expectExceptionMessage("Failed saving $class record"); + $entityPopulator->execute(SimpleFakerObject::class, []); + } +} \ No newline at end of file diff --git a/tests/Faker/ORM/xPDO/PopulatorTest.php b/tests/Faker/ORM/xPDO/PopulatorTest.php new file mode 100644 index 0000000..c37881d --- /dev/null +++ b/tests/Faker/ORM/xPDO/PopulatorTest.php @@ -0,0 +1,47 @@ +addEntity($className, $amount); + $populatedEntities = $populator->execute(); + $this->arrayHasKey($className); + $this->assertCount($expected, $populatedEntities[$className]); + } + + public function addEntityDataProvider() + { + return [ + [SimpleFakerObject::class, 5, 5], + [ParentChildrenFakerObject::class, 10, 10], + ]; + } +} \ No newline at end of file diff --git a/tests/PHPUnit/Framework/DatabaseTestCase.php b/tests/PHPUnit/Framework/DatabaseTestCase.php new file mode 100644 index 0000000..159ed13 --- /dev/null +++ b/tests/PHPUnit/Framework/DatabaseTestCase.php @@ -0,0 +1,72 @@ +getManager()->createSourceContainer(); + $xpdo->setPackage( + 'faker-xpdo-orm-adapter', + dirname(dirname(__DIR__)) . '/test_package/core/components/faker-xpdo-orm-adapter/model/' + ); + + self::$xpdo = $xpdo; + } + + public static function tearDownAfterClass() + { + self::$xpdo->getManager()->removeSourceContainer(); + self::$xpdo = null; + } + + protected function setUp() + { + parent::setUp(); + + foreach ($this->fixtures as $fixture) { + self::$xpdo->getManager()->createObjectContainer($fixture); + } + } + + protected function tearDown() + { + foreach ($this->fixtures as $fixture) { + self::$xpdo->getManager()->removeObjectContainer($fixture); + } + + parent::tearDown(); + } + +} \ No newline at end of file diff --git a/tests/properties.sample.inc.php b/tests/properties.sample.inc.php new file mode 100644 index 0000000..f3e8007 --- /dev/null +++ b/tests/properties.sample.inc.php @@ -0,0 +1,10 @@ +setPackage('faker-xpdo-orm-adapter', $packageBasePath); +$xpdo->setLogTarget('ECHO'); +$xpdo->setLogLevel(xPDO::LOG_LEVEL_INFO); + +$xpdo->getManager()->getGenerator()->parseSchema( + $packageBasePath . 'model/schema/faker-xpdo-orm-adapter.' . $driver . '.schema.xml', + $packageBasePath . 'model/' +); + +$mtime = microtime(); +$mtime = explode(" ", $mtime); +$mtime = $mtime[1] + $mtime[0]; +$tend = $mtime; +$totalTime = ($tend - $tstart); +$totalTime = sprintf("%2.4f s", $totalTime); + +echo "\nExecution time: {$totalTime}\n"; + +exit (); diff --git a/tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/columntypeguesserfakerobject.class.php b/tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/columntypeguesserfakerobject.class.php new file mode 100644 index 0000000..c202061 --- /dev/null +++ b/tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/columntypeguesserfakerobject.class.php @@ -0,0 +1,2 @@ + + array ( + 0 => 'SimpleFakerObject', + 1 => 'ColumnTypeGuesserFakerObject', + ), + 'SimpleFakerObject' => + array ( + 0 => 'ParentChildrenFakerObject', + ), +); \ No newline at end of file diff --git a/tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/mysql/columntypeguesserfakerobject.class.php b/tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/mysql/columntypeguesserfakerobject.class.php new file mode 100644 index 0000000..20da7c7 --- /dev/null +++ b/tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/mysql/columntypeguesserfakerobject.class.php @@ -0,0 +1,3 @@ + 'faker-xpdo-orm-adapter', + 'version' => '1.1', + 'extends' => 'xPDOSimpleObject', + 'tableMeta' => + array ( + 'engine' => 'InnoDB', + ), + 'fields' => + array ( + 'timestamp' => NULL, + 'datetime' => NULL, + 'date' => NULL, + 'boolean' => NULL, + 'integer' => NULL, + 'array' => NULL, + 'string' => NULL, + 'object' => 'not_sure', + ), + 'fieldMeta' => + array ( + 'timestamp' => + array ( + 'dbtype' => 'timestamp', + 'phptype' => 'timestamp', + 'null' => true, + ), + 'datetime' => + array ( + 'dbtype' => 'datetime', + 'phptype' => 'datetime', + 'null' => true, + ), + 'date' => + array ( + 'dbtype' => 'date', + 'phptype' => 'date', + 'null' => true, + ), + 'boolean' => + array ( + 'dbtype' => 'tinyint', + 'precision' => '1', + 'phptype' => 'boolean', + 'null' => true, + ), + 'integer' => + array ( + 'dbtype' => 'int', + 'precision' => '11', + 'phptype' => 'boolean', + 'null' => true, + ), + 'array' => + array ( + 'dbtype' => 'text', + 'phptype' => 'array', + 'null' => true, + ), + 'string' => + array ( + 'dbtype' => 'varchar', + 'precision' => '255', + 'phptype' => 'string', + 'null' => true, + ), + 'object' => + array ( + 'dbtype' => 'text', + 'phptype' => 'object', + 'null' => false, + 'default' => 'not_sure', + ), + ), +); diff --git a/tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/mysql/parentchildrenfakerobject.class.php b/tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/mysql/parentchildrenfakerobject.class.php new file mode 100644 index 0000000..cc6abc1 --- /dev/null +++ b/tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/mysql/parentchildrenfakerobject.class.php @@ -0,0 +1,3 @@ + 'faker-xpdo-orm-adapter', + 'version' => '1.1', + 'table' => 'parent_children_faker_objects', + 'extends' => 'SimpleFakerObject', + 'tableMeta' => + array ( + 'engine' => 'InnoDB', + ), + 'fields' => + array ( + 'parent' => NULL, + ), + 'fieldMeta' => + array ( + 'parent' => + array ( + 'dbtype' => 'int', + 'precision' => '11', + 'phptype' => 'integer', + ), + ), + 'composites' => + array ( + 'Children' => + array ( + 'class' => 'ParentChildrenFakerObject', + 'local' => 'id', + 'foreign' => 'parent', + 'cardinality' => 'many', + 'owner' => 'local', + ), + ), + 'aggregates' => + array ( + 'Parent' => + array ( + 'class' => 'ParentChildrenFakerObject', + 'local' => 'parent', + 'foreign' => 'id', + 'cardinality' => 'one', + 'owner' => 'foreign', + ), + ), +); diff --git a/tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/mysql/simplefakerobject.class.php b/tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/mysql/simplefakerobject.class.php new file mode 100644 index 0000000..f8b3f89 --- /dev/null +++ b/tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/mysql/simplefakerobject.class.php @@ -0,0 +1,3 @@ + 'faker-xpdo-orm-adapter', + 'version' => '1.1', + 'table' => 'simple_faker_objects', + 'extends' => 'xPDOSimpleObject', + 'tableMeta' => + array ( + 'engine' => 'InnoDB', + ), + 'fields' => + array ( + 'title' => '', + ), + 'fieldMeta' => + array ( + 'title' => + array ( + 'dbtype' => 'varchar', + 'precision' => '255', + 'phptype' => 'string', + 'null' => false, + 'default' => '', + ), + ), +); diff --git a/tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/parentchildrenfakerobject.class.php b/tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/parentchildrenfakerobject.class.php new file mode 100644 index 0000000..fbd81d2 --- /dev/null +++ b/tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/parentchildrenfakerobject.class.php @@ -0,0 +1,2 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +