4 Commits

Author SHA1 Message Date
Vassyli 867843dddd Adds a GameBuilder to allow better dependency injection 2017-06-23 14:43:24 +02:00
Vassyli 329430c547 Fixed test 2017-06-12 16:00:44 +02:00
Vassyli d20a59e68a Updated composer; Added optional action title 2017-06-12 15:58:51 +02:00
Vassyli 29e474b9c1 Adds possibility to add parameters to actions. 2017-06-12 14:58:40 +02:00
8 changed files with 489 additions and 152 deletions
Generated
+148 -135
View File
@@ -8,25 +8,29 @@
"packages": [ "packages": [
{ {
"name": "behat/transliterator", "name": "behat/transliterator",
"version": "v1.1.0", "version": "v1.2.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/Behat/Transliterator.git", "url": "https://github.com/Behat/Transliterator.git",
"reference": "868e05be3a9f25ba6424c2dd4849567f50715003" "reference": "826ce7e9c2a6664c0d1f381cbb38b1fb80a7ee2c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Behat/Transliterator/zipball/868e05be3a9f25ba6424c2dd4849567f50715003", "url": "https://api.github.com/repos/Behat/Transliterator/zipball/826ce7e9c2a6664c0d1f381cbb38b1fb80a7ee2c",
"reference": "868e05be3a9f25ba6424c2dd4849567f50715003", "reference": "826ce7e9c2a6664c0d1f381cbb38b1fb80a7ee2c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.3" "php": ">=5.3.3"
}, },
"require-dev": {
"chuyskywalker/rolling-curl": "^3.1",
"php-yaoi/php-yaoi": "^1.0"
},
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.1-dev" "dev-master": "1.2-dev"
} }
}, },
"autoload": { "autoload": {
@@ -44,20 +48,20 @@
"slug", "slug",
"transliterator" "transliterator"
], ],
"time": "2015-09-28T16:26:35+00:00" "time": "2017-04-04T11:38:05+00:00"
}, },
{ {
"name": "composer/ca-bundle", "name": "composer/ca-bundle",
"version": "1.0.6", "version": "1.0.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/ca-bundle.git", "url": "https://github.com/composer/ca-bundle.git",
"reference": "a795611394b3c05164fd0eb291b492b39339cba4" "reference": "b17e6153cb7f33c7e44eb59578dc12eee5dc8e12"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/a795611394b3c05164fd0eb291b492b39339cba4", "url": "https://api.github.com/repos/composer/ca-bundle/zipball/b17e6153cb7f33c7e44eb59578dc12eee5dc8e12",
"reference": "a795611394b3c05164fd0eb291b492b39339cba4", "reference": "b17e6153cb7f33c7e44eb59578dc12eee5dc8e12",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -66,6 +70,7 @@
"php": "^5.3.2 || ^7.0" "php": "^5.3.2 || ^7.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^4.5",
"psr/log": "^1.0", "psr/log": "^1.0",
"symfony/process": "^2.5 || ^3.0" "symfony/process": "^2.5 || ^3.0"
}, },
@@ -102,27 +107,27 @@
"ssl", "ssl",
"tls" "tls"
], ],
"time": "2016-11-02T18:11:27+00:00" "time": "2017-03-06T11:59:08+00:00"
}, },
{ {
"name": "composer/composer", "name": "composer/composer",
"version": "1.3.2", "version": "1.4.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/composer.git", "url": "https://github.com/composer/composer.git",
"reference": "e7569edb4a5eadcbb2e4ad5ed753282260f281df" "reference": "489e09ee6c3ba431fbeeef9147afdaeb6f91b647"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/composer/zipball/e7569edb4a5eadcbb2e4ad5ed753282260f281df", "url": "https://api.github.com/repos/composer/composer/zipball/489e09ee6c3ba431fbeeef9147afdaeb6f91b647",
"reference": "e7569edb4a5eadcbb2e4ad5ed753282260f281df", "reference": "489e09ee6c3ba431fbeeef9147afdaeb6f91b647",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"composer/ca-bundle": "^1.0", "composer/ca-bundle": "^1.0",
"composer/semver": "^1.0", "composer/semver": "^1.0",
"composer/spdx-licenses": "^1.0", "composer/spdx-licenses": "^1.0",
"justinrainbow/json-schema": "^1.6 || ^2.0 || ^3.0 || ^4.0", "justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0",
"php": "^5.3.2 || ^7.0", "php": "^5.3.2 || ^7.0",
"psr/log": "^1.0", "psr/log": "^1.0",
"seld/cli-prompt": "^1.0", "seld/cli-prompt": "^1.0",
@@ -148,7 +153,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.3-dev" "dev-master": "1.4-dev"
} }
}, },
"autoload": { "autoload": {
@@ -179,7 +184,7 @@
"dependency", "dependency",
"package" "package"
], ],
"time": "2017-01-27T17:23:42+00:00" "time": "2017-05-17T06:17:53+00:00"
}, },
{ {
"name": "composer/semver", "name": "composer/semver",
@@ -245,16 +250,16 @@
}, },
{ {
"name": "composer/spdx-licenses", "name": "composer/spdx-licenses",
"version": "1.1.5", "version": "1.1.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/spdx-licenses.git", "url": "https://github.com/composer/spdx-licenses.git",
"reference": "96c6a07b05b716e89a44529d060bc7f5c263cb13" "reference": "2603a0d7ddc00a015deb576fa5297ca43dee6b1c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/spdx-licenses/zipball/96c6a07b05b716e89a44529d060bc7f5c263cb13", "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/2603a0d7ddc00a015deb576fa5297ca43dee6b1c",
"reference": "96c6a07b05b716e89a44529d060bc7f5c263cb13", "reference": "2603a0d7ddc00a015deb576fa5297ca43dee6b1c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -302,7 +307,7 @@
"spdx", "spdx",
"validator" "validator"
], ],
"time": "2016-09-28T07:17:45+00:00" "time": "2017-04-03T19:08:52+00:00"
}, },
{ {
"name": "d11wtq/boris", "name": "d11wtq/boris",
@@ -942,20 +947,20 @@
}, },
{ {
"name": "gedmo/doctrine-extensions", "name": "gedmo/doctrine-extensions",
"version": "v2.4.26", "version": "v2.4.29",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/Atlantic18/DoctrineExtensions.git", "url": "https://github.com/Atlantic18/DoctrineExtensions.git",
"reference": "983dd85d6860f87fb7dffd0d9f7ad1462e20a09d" "reference": "f65c02eae3bff1aa57709ea4c8ca26947df95b9c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Atlantic18/DoctrineExtensions/zipball/983dd85d6860f87fb7dffd0d9f7ad1462e20a09d", "url": "https://api.github.com/repos/Atlantic18/DoctrineExtensions/zipball/f65c02eae3bff1aa57709ea4c8ca26947df95b9c",
"reference": "983dd85d6860f87fb7dffd0d9f7ad1462e20a09d", "reference": "f65c02eae3bff1aa57709ea4c8ca26947df95b9c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"behat/transliterator": "~1.0", "behat/transliterator": "~1.2",
"doctrine/common": "~2.4", "doctrine/common": "~2.4",
"php": ">=5.3.2" "php": ">=5.3.2"
}, },
@@ -963,9 +968,8 @@
"doctrine/common": ">=2.5.0", "doctrine/common": ">=2.5.0",
"doctrine/mongodb-odm": ">=1.0.2", "doctrine/mongodb-odm": ">=1.0.2",
"doctrine/orm": ">=2.5.0", "doctrine/orm": ">=2.5.0",
"phpunit/phpunit": "~4.4", "phpunit/phpunit": "*",
"phpunit/phpunit-mock-objects": "~2.3", "symfony/yaml": "~2.6|~3.0"
"symfony/yaml": "~2.6"
}, },
"suggest": { "suggest": {
"doctrine/mongodb-odm": "to use the extensions with the MongoDB ODM", "doctrine/mongodb-odm": "to use the extensions with the MongoDB ODM",
@@ -1017,28 +1021,29 @@
"tree", "tree",
"uploadable" "uploadable"
], ],
"time": "2016-12-21T13:46:54+00:00" "time": "2017-05-29T17:33:48+00:00"
}, },
{ {
"name": "justinrainbow/json-schema", "name": "justinrainbow/json-schema",
"version": "4.1.0", "version": "5.2.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/justinrainbow/json-schema.git", "url": "https://github.com/justinrainbow/json-schema.git",
"reference": "d39c56a46b3ebe1f3696479966cd2b9f50aaa24f" "reference": "429be236f296ca249d61c65649cdf2652f4a5e80"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/d39c56a46b3ebe1f3696479966cd2b9f50aaa24f", "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/429be236f296ca249d61c65649cdf2652f4a5e80",
"reference": "d39c56a46b3ebe1f3696479966cd2b9f50aaa24f", "reference": "429be236f296ca249d61c65649cdf2652f4a5e80",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.3" "php": ">=5.3.3"
}, },
"require-dev": { "require-dev": {
"friendsofphp/php-cs-fixer": "^2.1",
"json-schema/json-schema-test-suite": "1.2.0", "json-schema/json-schema-test-suite": "1.2.0",
"phpdocumentor/phpdocumentor": "~2", "phpdocumentor/phpdocumentor": "^2.7",
"phpunit/phpunit": "^4.8.22" "phpunit/phpunit": "^4.8.22"
}, },
"bin": [ "bin": [
@@ -1047,7 +1052,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "4.0.x-dev" "dev-master": "5.0.x-dev"
} }
}, },
"autoload": { "autoload": {
@@ -1083,20 +1088,20 @@
"json", "json",
"schema" "schema"
], ],
"time": "2016-12-22T16:43:46+00:00" "time": "2017-05-16T21:06:09+00:00"
}, },
{ {
"name": "monolog/monolog", "name": "monolog/monolog",
"version": "1.22.0", "version": "1.22.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/Seldaek/monolog.git", "url": "https://github.com/Seldaek/monolog.git",
"reference": "bad29cb8d18ab0315e6c477751418a82c850d558" "reference": "1e044bc4b34e91743943479f1be7a1d5eb93add0"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/bad29cb8d18ab0315e6c477751418a82c850d558", "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1e044bc4b34e91743943479f1be7a1d5eb93add0",
"reference": "bad29cb8d18ab0315e6c477751418a82c850d558", "reference": "1e044bc4b34e91743943479f1be7a1d5eb93add0",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1161,7 +1166,7 @@
"logging", "logging",
"psr-3" "psr-3"
], ],
"time": "2016-11-26T00:15:39+00:00" "time": "2017-03-13T07:08:03+00:00"
}, },
{ {
"name": "psr/log", "name": "psr/log",
@@ -1212,16 +1217,16 @@
}, },
{ {
"name": "seld/cli-prompt", "name": "seld/cli-prompt",
"version": "1.0.2", "version": "1.0.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/Seldaek/cli-prompt.git", "url": "https://github.com/Seldaek/cli-prompt.git",
"reference": "8cbe10923cae5bcd7c5a713f6703fc4727c8c1b4" "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Seldaek/cli-prompt/zipball/8cbe10923cae5bcd7c5a713f6703fc4727c8c1b4", "url": "https://api.github.com/repos/Seldaek/cli-prompt/zipball/a19a7376a4689d4d94cab66ab4f3c816019ba8dd",
"reference": "8cbe10923cae5bcd7c5a713f6703fc4727c8c1b4", "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1256,25 +1261,28 @@
"input", "input",
"prompt" "prompt"
], ],
"time": "2016-04-18T09:31:41+00:00" "time": "2017-03-18T11:32:45+00:00"
}, },
{ {
"name": "seld/jsonlint", "name": "seld/jsonlint",
"version": "1.5.0", "version": "1.6.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/Seldaek/jsonlint.git", "url": "https://github.com/Seldaek/jsonlint.git",
"reference": "19495c181d6d53a0a13414154e52817e3b504189" "reference": "791f8c594f300d246cdf01c6b3e1e19611e301d8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/19495c181d6d53a0a13414154e52817e3b504189", "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/791f8c594f300d246cdf01c6b3e1e19611e301d8",
"reference": "19495c181d6d53a0a13414154e52817e3b504189", "reference": "791f8c594f300d246cdf01c6b3e1e19611e301d8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^5.3 || ^7.0" "php": "^5.3 || ^7.0"
}, },
"require-dev": {
"phpunit/phpunit": "^4.5"
},
"bin": [ "bin": [
"bin/jsonlint" "bin/jsonlint"
], ],
@@ -1302,7 +1310,7 @@
"parser", "parser",
"validator" "validator"
], ],
"time": "2016-11-14T17:59:58+00:00" "time": "2017-03-06T16:42:24+00:00"
}, },
{ {
"name": "seld/phar-utils", "name": "seld/phar-utils",
@@ -1350,16 +1358,16 @@
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v3.2.4", "version": "v3.3.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "0e5e6899f82230fcb1153bcaf0e106ffaa44b870" "reference": "70d2a29b2911cbdc91a7e268046c395278238b2e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/0e5e6899f82230fcb1153bcaf0e106ffaa44b870", "url": "https://api.github.com/repos/symfony/console/zipball/70d2a29b2911cbdc91a7e268046c395278238b2e",
"reference": "0e5e6899f82230fcb1153bcaf0e106ffaa44b870", "reference": "70d2a29b2911cbdc91a7e268046c395278238b2e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1367,10 +1375,16 @@
"symfony/debug": "~2.8|~3.0", "symfony/debug": "~2.8|~3.0",
"symfony/polyfill-mbstring": "~1.0" "symfony/polyfill-mbstring": "~1.0"
}, },
"conflict": {
"symfony/dependency-injection": "<3.3"
},
"require-dev": { "require-dev": {
"psr/log": "~1.0", "psr/log": "~1.0",
"symfony/config": "~3.3",
"symfony/dependency-injection": "~3.3",
"symfony/event-dispatcher": "~2.8|~3.0", "symfony/event-dispatcher": "~2.8|~3.0",
"symfony/filesystem": "~2.8|~3.0", "symfony/filesystem": "~2.8|~3.0",
"symfony/http-kernel": "~2.8|~3.0",
"symfony/process": "~2.8|~3.0" "symfony/process": "~2.8|~3.0"
}, },
"suggest": { "suggest": {
@@ -1382,7 +1396,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.2-dev" "dev-master": "3.3-dev"
} }
}, },
"autoload": { "autoload": {
@@ -1409,20 +1423,20 @@
], ],
"description": "Symfony Console Component", "description": "Symfony Console Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2017-02-16T14:07:22+00:00" "time": "2017-06-02T19:24:58+00:00"
}, },
{ {
"name": "symfony/debug", "name": "symfony/debug",
"version": "v3.2.4", "version": "v3.3.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/debug.git", "url": "https://github.com/symfony/debug.git",
"reference": "9b98854cb45bc59d100b7d4cc4cf9e05f21026b9" "reference": "e9c50482841ef696e8fa1470d950a79c8921f45d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/9b98854cb45bc59d100b7d4cc4cf9e05f21026b9", "url": "https://api.github.com/repos/symfony/debug/zipball/e9c50482841ef696e8fa1470d950a79c8921f45d",
"reference": "9b98854cb45bc59d100b7d4cc4cf9e05f21026b9", "reference": "e9c50482841ef696e8fa1470d950a79c8921f45d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1433,13 +1447,12 @@
"symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2"
}, },
"require-dev": { "require-dev": {
"symfony/class-loader": "~2.8|~3.0",
"symfony/http-kernel": "~2.8|~3.0" "symfony/http-kernel": "~2.8|~3.0"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.2-dev" "dev-master": "3.3-dev"
} }
}, },
"autoload": { "autoload": {
@@ -1466,20 +1479,20 @@
], ],
"description": "Symfony Debug Component", "description": "Symfony Debug Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2017-02-16T16:34:18+00:00" "time": "2017-06-01T21:01:25+00:00"
}, },
{ {
"name": "symfony/filesystem", "name": "symfony/filesystem",
"version": "v3.2.4", "version": "v3.3.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/filesystem.git", "url": "https://github.com/symfony/filesystem.git",
"reference": "a0c6ef2dc78d33b58d91d3a49f49797a184d06f4" "reference": "c709670bf64721202ddbe4162846f250735842c0"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/a0c6ef2dc78d33b58d91d3a49f49797a184d06f4", "url": "https://api.github.com/repos/symfony/filesystem/zipball/c709670bf64721202ddbe4162846f250735842c0",
"reference": "a0c6ef2dc78d33b58d91d3a49f49797a184d06f4", "reference": "c709670bf64721202ddbe4162846f250735842c0",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1488,7 +1501,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.2-dev" "dev-master": "3.3-dev"
} }
}, },
"autoload": { "autoload": {
@@ -1515,20 +1528,20 @@
], ],
"description": "Symfony Filesystem Component", "description": "Symfony Filesystem Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2017-01-08T20:47:33+00:00" "time": "2017-05-28T14:08:56+00:00"
}, },
{ {
"name": "symfony/finder", "name": "symfony/finder",
"version": "v3.2.4", "version": "v3.3.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/finder.git", "url": "https://github.com/symfony/finder.git",
"reference": "8c71141cae8e2957946b403cc71a67213c0380d6" "reference": "baea7f66d30854ad32988c11a09d7ffd485810c4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/8c71141cae8e2957946b403cc71a67213c0380d6", "url": "https://api.github.com/repos/symfony/finder/zipball/baea7f66d30854ad32988c11a09d7ffd485810c4",
"reference": "8c71141cae8e2957946b403cc71a67213c0380d6", "reference": "baea7f66d30854ad32988c11a09d7ffd485810c4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1537,7 +1550,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.2-dev" "dev-master": "3.3-dev"
} }
}, },
"autoload": { "autoload": {
@@ -1564,20 +1577,20 @@
], ],
"description": "Symfony Finder Component", "description": "Symfony Finder Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2017-01-02T20:32:22+00:00" "time": "2017-06-01T21:01:25+00:00"
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
"version": "v1.3.0", "version": "v1.4.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git", "url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "e79d363049d1c2128f133a2667e4f4190904f7f4" "reference": "f29dca382a6485c3cbe6379f0c61230167681937"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4", "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f29dca382a6485c3cbe6379f0c61230167681937",
"reference": "e79d363049d1c2128f133a2667e4f4190904f7f4", "reference": "f29dca382a6485c3cbe6379f0c61230167681937",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1589,7 +1602,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.3-dev" "dev-master": "1.4-dev"
} }
}, },
"autoload": { "autoload": {
@@ -1623,20 +1636,20 @@
"portable", "portable",
"shim" "shim"
], ],
"time": "2016-11-14T01:06:16+00:00" "time": "2017-06-09T14:24:12+00:00"
}, },
{ {
"name": "symfony/process", "name": "symfony/process",
"version": "v3.2.4", "version": "v3.3.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/process.git", "url": "https://github.com/symfony/process.git",
"reference": "0ab87c1e7570b3534a6e51eb4ca8e9f6d7327856" "reference": "8e30690c67aafb6c7992d6d8eb0d707807dd3eaf"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/0ab87c1e7570b3534a6e51eb4ca8e9f6d7327856", "url": "https://api.github.com/repos/symfony/process/zipball/8e30690c67aafb6c7992d6d8eb0d707807dd3eaf",
"reference": "0ab87c1e7570b3534a6e51eb4ca8e9f6d7327856", "reference": "8e30690c67aafb6c7992d6d8eb0d707807dd3eaf",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1645,7 +1658,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.2-dev" "dev-master": "3.3-dev"
} }
}, },
"autoload": { "autoload": {
@@ -1672,20 +1685,20 @@
], ],
"description": "Symfony Process Component", "description": "Symfony Process Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2017-02-16T14:07:22+00:00" "time": "2017-05-22T12:32:03+00:00"
}, },
{ {
"name": "symfony/yaml", "name": "symfony/yaml",
"version": "v3.2.4", "version": "v3.3.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/yaml.git", "url": "https://github.com/symfony/yaml.git",
"reference": "9724c684646fcb5387d579b4bfaa63ee0b0c64c8" "reference": "9752a30000a8ca9f4b34b5227d15d0101b96b063"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/9724c684646fcb5387d579b4bfaa63ee0b0c64c8", "url": "https://api.github.com/repos/symfony/yaml/zipball/9752a30000a8ca9f4b34b5227d15d0101b96b063",
"reference": "9724c684646fcb5387d579b4bfaa63ee0b0c64c8", "reference": "9752a30000a8ca9f4b34b5227d15d0101b96b063",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1700,7 +1713,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.2-dev" "dev-master": "3.3-dev"
} }
}, },
"autoload": { "autoload": {
@@ -1727,7 +1740,7 @@
], ],
"description": "Symfony Yaml Component", "description": "Symfony Yaml Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2017-02-16T22:46:52+00:00" "time": "2017-06-02T22:05:06+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [
@@ -1784,16 +1797,16 @@
}, },
{ {
"name": "myclabs/deep-copy", "name": "myclabs/deep-copy",
"version": "1.6.0", "version": "1.6.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/myclabs/DeepCopy.git", "url": "https://github.com/myclabs/DeepCopy.git",
"reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe" "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/5a5a9fc8025a08d8919be87d6884d5a92520cefe", "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8e6e04167378abf1ddb4d3522d8755c5fd90d102",
"reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe", "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1822,7 +1835,7 @@
"object", "object",
"object graph" "object graph"
], ],
"time": "2017-01-26T22:05:40+00:00" "time": "2017-04-12T18:52:22+00:00"
}, },
{ {
"name": "phpdocumentor/reflection-common", "name": "phpdocumentor/reflection-common",
@@ -1972,27 +1985,27 @@
}, },
{ {
"name": "phpspec/prophecy", "name": "phpspec/prophecy",
"version": "v1.6.2", "version": "v1.7.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpspec/prophecy.git", "url": "https://github.com/phpspec/prophecy.git",
"reference": "6c52c2722f8460122f96f86346600e1077ce22cb" "reference": "93d39f1f7f9326d746203c7c056f300f7f126073"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/6c52c2722f8460122f96f86346600e1077ce22cb", "url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073",
"reference": "6c52c2722f8460122f96f86346600e1077ce22cb", "reference": "93d39f1f7f9326d746203c7c056f300f7f126073",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"doctrine/instantiator": "^1.0.2", "doctrine/instantiator": "^1.0.2",
"php": "^5.3|^7.0", "php": "^5.3|^7.0",
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2", "phpdocumentor/reflection-docblock": "^2.0|^3.0.2",
"sebastian/comparator": "^1.1", "sebastian/comparator": "^1.1|^2.0",
"sebastian/recursion-context": "^1.0|^2.0" "sebastian/recursion-context": "^1.0|^2.0|^3.0"
}, },
"require-dev": { "require-dev": {
"phpspec/phpspec": "^2.0", "phpspec/phpspec": "^2.5|^3.2",
"phpunit/phpunit": "^4.8 || ^5.6.5" "phpunit/phpunit": "^4.8 || ^5.6.5"
}, },
"type": "library", "type": "library",
@@ -2031,7 +2044,7 @@
"spy", "spy",
"stub" "stub"
], ],
"time": "2016-11-21T14:58:47+00:00" "time": "2017-03-02T20:05:34+00:00"
}, },
{ {
"name": "phpunit/dbunit", "name": "phpunit/dbunit",
@@ -2090,16 +2103,16 @@
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
"version": "4.0.7", "version": "4.0.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "09e2277d14ea467e5a984010f501343ef29ffc69" "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/09e2277d14ea467e5a984010f501343ef29ffc69", "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d",
"reference": "09e2277d14ea467e5a984010f501343ef29ffc69", "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -2149,7 +2162,7 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2017-03-01T09:12:17+00:00" "time": "2017-04-02T07:44:40+00:00"
}, },
{ {
"name": "phpunit/php-file-iterator", "name": "phpunit/php-file-iterator",
@@ -2339,16 +2352,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "5.7.15", "version": "5.7.20",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "b99112aecc01f62acf3d81a3f59646700a1849e5" "reference": "3cb94a5f8c07a03c8b7527ed7468a2926203f58b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b99112aecc01f62acf3d81a3f59646700a1849e5", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3cb94a5f8c07a03c8b7527ed7468a2926203f58b",
"reference": "b99112aecc01f62acf3d81a3f59646700a1849e5", "reference": "3cb94a5f8c07a03c8b7527ed7468a2926203f58b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -2366,7 +2379,7 @@
"phpunit/php-timer": "^1.0.6", "phpunit/php-timer": "^1.0.6",
"phpunit/phpunit-mock-objects": "^3.2", "phpunit/phpunit-mock-objects": "^3.2",
"sebastian/comparator": "^1.2.4", "sebastian/comparator": "^1.2.4",
"sebastian/diff": "~1.2", "sebastian/diff": "^1.4.3",
"sebastian/environment": "^1.3.4 || ^2.0", "sebastian/environment": "^1.3.4 || ^2.0",
"sebastian/exporter": "~2.0", "sebastian/exporter": "~2.0",
"sebastian/global-state": "^1.1", "sebastian/global-state": "^1.1",
@@ -2417,7 +2430,7 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2017-03-02T15:22:43+00:00" "time": "2017-05-22T07:42:55+00:00"
}, },
{ {
"name": "phpunit/phpunit-mock-objects", "name": "phpunit/phpunit-mock-objects",
@@ -2480,23 +2493,23 @@
}, },
{ {
"name": "sebastian/code-unit-reverse-lookup", "name": "sebastian/code-unit-reverse-lookup",
"version": "1.0.0", "version": "1.0.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git",
"reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe" "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/c36f5e7cfce482fde5bf8d10d41a53591e0198fe", "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18",
"reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe", "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.6" "php": "^5.6 || ^7.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~5" "phpunit/phpunit": "^5.7 || ^6.0"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@@ -2521,7 +2534,7 @@
], ],
"description": "Looks up which function or method a line of code belongs to", "description": "Looks up which function or method a line of code belongs to",
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
"time": "2016-02-13T06:45:14+00:00" "time": "2017-03-04T06:30:41+00:00"
}, },
{ {
"name": "sebastian/comparator", "name": "sebastian/comparator",
@@ -2589,23 +2602,23 @@
}, },
{ {
"name": "sebastian/diff", "name": "sebastian/diff",
"version": "1.4.1", "version": "1.4.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/diff.git", "url": "https://github.com/sebastianbergmann/diff.git",
"reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4",
"reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.3" "php": "^5.3.3 || ^7.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~4.8" "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@@ -2637,7 +2650,7 @@
"keywords": [ "keywords": [
"diff" "diff"
], ],
"time": "2015-12-08T07:14:41+00:00" "time": "2017-05-22T07:24:03+00:00"
}, },
{ {
"name": "sebastian/environment", "name": "sebastian/environment",
+42 -2
View File
@@ -11,15 +11,21 @@ class Action
{ {
protected $id; protected $id;
protected $destinationSceneId; protected $destinationSceneId;
protected $title = null;
protected $parameters = [];
/** /**
* Construct a new action with the specified Scene as its destination. * Construct a new action with the specified Scene as its destination.
* @param int $destinationSceneId * @param int $destinationSceneId
* @param string|null $title
* @param array $parameters
*/ */
public function __construct(int $destinationSceneId) public function __construct(int $destinationSceneId, ?string $title = null, array $parameters = [])
{ {
$this->id = bin2hex(random_bytes(8)); $this->id = bin2hex(random_bytes(8));
$this->destinationSceneId = $destinationSceneId; $this->destinationSceneId = $destinationSceneId;
$this->title = $title;
$this->parameters = $parameters;
} }
/** /**
@@ -35,10 +41,44 @@ class Action
/** /**
* Return the database ID of the destination scene, where the user will * Return the database ID of the destination scene, where the user will
* go if they take this action. * go if they take this action.
* @return string * @return int
*/ */
public function getDestinationSceneId(): int public function getDestinationSceneId(): int
{ {
return $this->destinationSceneId; return $this->destinationSceneId;
} }
/**
* @return null|string
*/
public function getTitle(): ?string
{
return $this->title;
}
/**
* @return null|string
*/
public function setTitle(?string $title)
{
$this->title = $title;
}
/**
* Returns all parameters for this action
* @return array
*/
public function getParameters(): array
{
return $this->parameters;
}
/**
* Sets all parameters for this action
* @param array $parameters
*/
public function setParameters(array $parameters): void
{
$this->parameters = $parameters;
}
} }
+6 -1
View File
@@ -64,7 +64,12 @@ class Bootstrap
$pdo = $this->connectToDatabase($dsn, $user, $password); $pdo = $this->connectToDatabase($dsn, $user, $password);
$entityManager = $this->createEntityManager($pdo); $entityManager = $this->createEntityManager($pdo);
$this->game = new Game($config, $this->logger, $entityManager, $cwd); $this->game = (new GameBuilder())
->withConfiguration($config)
->withLogger($this->logger)
->withEntityManager($entityManager)
->withCwd($cwd)
->create();
return $this->game; return $this->game;
} }
+12
View File
@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace LotGD\Core\Exceptions;
/**
* Exception if a builder is missing an argument
*/
class BuilderException extends CoreException
{
}
+42 -12
View File
@@ -85,24 +85,36 @@ class Game
*/ */
public function getModuleManager(): ModuleManager public function getModuleManager(): ModuleManager
{ {
if ($this->moduleManager === null) {
$this->moduleManager = new ModuleManager($this);
}
return $this->moduleManager; return $this->moduleManager;
} }
/**
* Sets the game's module manager.
* @param ModuleManager $moduleManager
*/
public function setModuleManager(ModuleManager $moduleManager): void
{
$this->moduleManager = $moduleManager;
}
/** /**
* Returns the game's composer manager. * Returns the game's composer manager.
* @return ComposerManager The game's composer manager. * @return ComposerManager The game's composer manager.
*/ */
public function getComposerManager(): ComposerManager public function getComposerManager(): ComposerManager
{ {
if ($this->composerManager === null) {
$this->composerManager = new ComposerManager($this->cwd);
}
return $this->composerManager; return $this->composerManager;
} }
/**
* Sets the game's composer manager.
* @param ComposerManager $composerManager
*/
public function setComposerManager(ComposerManager $composerManager): void
{
$this->composerManager = $composerManager;
}
/** /**
* Returns the game's entity manager. * Returns the game's entity manager.
* @return EntityManagerInterface The game's database entity manager. * @return EntityManagerInterface The game's database entity manager.
@@ -118,24 +130,36 @@ class Game
*/ */
public function getEventManager(): EventManager public function getEventManager(): EventManager
{ {
if ($this->eventManager === null) {
$this->eventManager = new EventManager($this);
}
return $this->eventManager; return $this->eventManager;
} }
/**
* Sets the game's event manager.
* @param EventManager $eventManager
*/
public function setEventManager(EventManager $eventManager): void
{
$this->eventManager = $eventManager;
}
/** /**
* Returns the game's dice bag. * Returns the game's dice bag.
* @return DiceBag * @return DiceBag
*/ */
public function getDiceBag(): DiceBag public function getDiceBag(): DiceBag
{ {
if ($this->diceBag === null) {
$this->diceBag = new DiceBag();
}
return $this->diceBag; return $this->diceBag;
} }
/**
* Sets the game's dice bag.
* @param DiceBag $diceBag
*/
public function setDiceBag(DiceBag $diceBag): void
{
$this->diceBag = $diceBag;
}
/** /**
* Returns the logger instance to write logs. * Returns the logger instance to write logs.
* @return Logger * @return Logger
@@ -333,6 +357,7 @@ class Game
if ($action === null) { if ($action === null) {
throw new ActionNotFoundException("Invalid actionId={$actionId} for current viewpoint."); throw new ActionNotFoundException("Invalid actionId={$actionId} for current viewpoint.");
} }
$actionParameters = $action->getParameters();
$sceneId = $action->getDestinationSceneId(); $sceneId = $action->getDestinationSceneId();
$scene = $this->getEntityManager()->getRepository(Scene::class)->find([ $scene = $this->getEntityManager()->getRepository(Scene::class)->find([
@@ -341,7 +366,12 @@ class Game
if ($scene == null) { if ($scene == null) {
throw new SceneNotFoundException("Cannot find sceneId={$sceneId} specified by actionId={$actionId}."); throw new SceneNotFoundException("Cannot find sceneId={$sceneId} specified by actionId={$actionId}.");
} }
// action parameters overwrite other parameters since the former cannot be changed by the user
$parameters = array_merge($parameters, $actionParameters);
$this->navigateToScene($scene, $parameters); $this->navigateToScene($scene, $parameters);
$v->save($this->getEntityManager()); $v->save($this->getEntityManager());
} }
} }
+156
View File
@@ -0,0 +1,156 @@
<?php
declare(strict_types=1);
namespace LotGD\Core;
use Doctrine\ORM\EntityManagerInterface;
use Monolog\Logger;
use LotGD\Core\Exceptions\BuilderException;
/**
* The GameBuilder class is used to build a Game object with all dependencies that are needed.
*
* You must provide $cwd, $configuration, $entityManager and a logger instance using the with* methods.
* You can provide additional class *names* for additional dependency injections using the use* methods.
* @package LotGD\Core
*/
class GameBuilder
{
private $cwd;
private $configuration;
private $entityManager;
private $logger;
private $moduleManagerClass;
private $composerManagerClass;
private $eventManagerClass;
private $diceBagClass;
/**
* Creates the game instance with the prepared parameters.
* @return Game
* @throws BuilderException if at least one of cwd, configuration, entityManager or logger as not been set.
*/
public function create(): Game
{
if (isset($this->cwd, $this->configuration, $this->entityManager, $this->logger) === false) {
throw new BuilderException(
"For creating a game, you must set at least: cwd, configuration, entityManager and logger."
);
}
// construct the game
$game = new Game(
$this->configuration,
$this->logger,
$this->entityManager,
$this->cwd
);
// add additional managers to it
$moduleManager = $this->moduleManagerClass ?? ModuleManager::class;
$game->setModuleManager(new $moduleManager($game));
$composerManager = $this->composerManagerClass ?? ComposerManager::class;
$game->setComposerManager(new $composerManager($this->cwd));
$eventManager = $this->eventManagerClass ?? EventManager::class;
$game->setEventManager(new $eventManager($game));
$diceBag = $this->diceBagClass ?? DiceBag::class;
$game->setDiceBag(new $diceBag());
return $game;
}
/**
* Adds current working directory argument
* @param string $cwd
* @return self
*/
public function withCwd(string $cwd): self
{
$this->cwd = $cwd;
return $this;
}
/**
* Configuration
* @param Configuration $conf
* @return self
*/
public function withConfiguration(Configuration $conf): self
{
$this->configuration = $conf;
return $this;
}
/**
* Sets the logger for the game instance.
* @param EntityManagerInterface $em
* @return self
*/
public function withEntityManager(EntityManagerInterface $em): self
{
$this->entityManager = $em;
return $this;
}
/**
* Sets the logger for the game instance.
* @param Logger $logger
* @return self
*/
public function withLogger(Logger $logger): self
{
$this->logger = $logger;
return $this;
}
/**
* Sets the fqcn for the module manager to be used.
* @param string $moduleManagerFqcn
* @return self
*/
public function useModuleManager(string $moduleManagerFqcn): self
{
$this->moduleManagerClass = $moduleManagerFqcn;
return $this;
}
/**
* Sets the fqcn for the composer manager to be used.
* @param string $composerManagerFqcn
* @return self
*/
public function useComposerManager(string $composerManagerFqcn): self
{
$this->composerManagerClass = $composerManagerFqcn;
return $this;
}
/**
* Sets the fqcn for the event manager to be used.
* @param string $eventManagerFqcn
* @return GameBuilder
*/
public function useEventManager(string $eventManagerFqcn): self
{
$this->eventManagerClass = $eventManagerFqcn;
return $this;
}
/**
* Sets the fqcn for the dice bag to be used.
* @param string $diceBagFqcn
* @return GameBuilder
*/
public function useDiceBag(string $diceBagFqcn): self
{
$this->diceBagClass = $diceBagFqcn;
return $this;
}
}
+78 -2
View File
@@ -9,7 +9,7 @@ use Monolog\Logger;
use Monolog\Handler\NullHandler; use Monolog\Handler\NullHandler;
use LotGD\Core\{ use LotGD\Core\{
Action, ActionGroup, Bootstrap, Configuration, ComposerManager, DiceBag, EventHandler, EventManager, Events\NewViewpointData, Game, TimeKeeper, ModuleManager Action, ActionGroup, Bootstrap, Configuration, ComposerManager, DiceBag, EventHandler, EventManager, Events\NewViewpointData, Game, GameBuilder, TimeKeeper, ModuleManager
}; };
use LotGD\Core\Models\{ use LotGD\Core\Models\{
Character, Viewpoint, Scene Character, Viewpoint, Scene
@@ -52,6 +52,19 @@ class DefaultSceneProvider implements EventHandler
$v->setAttachments(self::$attachments); $v->setAttachments(self::$attachments);
$v->setData(self::$data); $v->setData(self::$data);
break; break;
case 'h/lotgd/core/navigate-to/lotgd/tests/paramaters':
/* @var Viewpoint $v //*/
$v = $context->getDataField('viewpoint');
/* @var array //*/
$p = $context->getDataField('parameters');
if ($p["foo"] === "baz") {
$v->setDescription("Parameter is baz.");
} else {
$v->setDescription("Parameter is NOT baz.");
}
break;
} }
return $context; return $context;
@@ -72,7 +85,12 @@ class GameTest extends CoreModelTestCase
$logger = new Logger('test'); $logger = new Logger('test');
$logger->pushHandler(new NullHandler()); $logger->pushHandler(new NullHandler());
$this->g = new Game(new Configuration(getenv('LOTGD_TESTS_CONFIG_PATH')), $logger, $this->getEntityManager(), implode(DIRECTORY_SEPARATOR, [__DIR__, '..'])); $this->g = (new GameBuilder())
->withConfiguration(new Configuration(getenv('LOTGD_TESTS_CONFIG_PATH')))
->withLogger($logger)
->withEntityManager($this->getEntityManager())
->withCwd(implode(DIRECTORY_SEPARATOR, [__DIR__, '..']))
->create();
} }
public function testBasicInjection() public function testBasicInjection()
@@ -188,6 +206,64 @@ class GameTest extends CoreModelTestCase
$this->assertSame($s->getTemplate(), $v->getTemplate()); $this->assertSame($s->getTemplate(), $v->getTemplate());
} }
public function testIfActionParametersAreRelayedToEvent()
{
/* @var $c Character */
$c = $this->getEntityManager()->getRepository(Character::class)->find(2);
$this->g->setCharacter($c);
// subscribe event
$this->g->getEventManager()->subscribe('#h/lotgd/core/navigate-to/lotgd/tests/paramaters#', DefaultSceneProvider::class, 'lotgd/core/tests');
$action = new Action(7, null, ["foo" => "baz"]);
$actionId = $action->getId();
$ag = new ActionGroup("group1", "Group 1", 5);
$ag->addAction($action);
$v = $c->getViewpoint();
$v->setDescription("Test");
$v->setActionGroups([$ag]);
$c->setViewpoint($v);
$this->g->takeAction($actionId);
$v = $c->getViewpoint();
$this->assertSame("Parameter is baz.", $v->getDescription());
// unsubscribe event
$this->g->getEventManager()->unsubscribe('#h/lotgd/core/navigate-to/lotgd/tests/paramaters#', DefaultSceneProvider::class, 'lotgd/core/tests');
}
public function testIfActionParametersTakePriorityToOtherParameters()
{
/* @var $c Character */
$c = $this->getEntityManager()->getRepository(Character::class)->find(2);
$this->g->setCharacter($c);
// subscribe event
$this->g->getEventManager()->subscribe('#h/lotgd/core/navigate-to/lotgd/tests/paramaters#', DefaultSceneProvider::class, 'lotgd/core/tests');
$action = new Action(7, null, ["foo" => "baz"]);
$actionId = $action->getId();
$ag = new ActionGroup("group1", "Group 1", 5);
$ag->addAction($action);
$v = $c->getViewpoint();
$v->setDescription("Test");
$v->setActionGroups([$ag]);
$c->setViewpoint($v);
$this->g->takeAction($actionId, ["foo" => "nobaz"]);
$v = $c->getViewpoint();
$this->assertSame("Parameter is baz.", $v->getDescription());
// unsubscribe event
$this->g->getEventManager()->unsubscribe('#h/lotgd/core/navigate-to/lotgd/tests/paramaters#', DefaultSceneProvider::class, 'lotgd/core/tests');
}
public function testIfActionsAreAddedAsExpected() public function testIfActionsAreAddedAsExpected()
{ {
$viewpointToArray = function(Viewpoint $v) { $viewpointToArray = function(Viewpoint $v) {
+5
View File
@@ -51,6 +51,11 @@ scenes:
title: "Child Scene 2" title: "Child Scene 2"
description: "This is a parent scene that connects to two children." description: "This is a parent scene that connects to two children."
template: "lotgd/tests/none" template: "lotgd/tests/none"
-
id: 7
title: "Parameter test"
description: "This is a parameter test"
template: "lotgd/tests/paramaters"
scene_connection_groups: scene_connection_groups:
- -
scene: 4 scene: 4