From ed8a2dcc01bfb154c49e0c0b101b7635461383a5 Mon Sep 17 00:00:00 2001 From: Jakob Tolkemit Date: Fri, 10 Aug 2018 15:28:29 +0200 Subject: [PATCH 1/6] Fixed customer option group repository not being able to return null values --- src/Repository/CustomerOptionGroupRepository.php | 8 ++------ .../CustomerOptionGroupRepositoryInterface.php | 10 ++++++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Repository/CustomerOptionGroupRepository.php b/src/Repository/CustomerOptionGroupRepository.php index 6e714b26..07a48181 100644 --- a/src/Repository/CustomerOptionGroupRepository.php +++ b/src/Repository/CustomerOptionGroupRepository.php @@ -18,11 +18,9 @@ class CustomerOptionGroupRepository extends EntityRepository implements CustomerOptionGroupRepositoryInterface { /** - * @param string $code - * - * @return CustomerOptionGroupInterface + * {@inheritdoc} */ - public function findOneByCode(string $code): CustomerOptionGroupInterface + public function findOneByCode(string $code): ?CustomerOptionGroupInterface { return $this->createQueryBuilder('o') ->where('o.code = :code') @@ -34,8 +32,6 @@ public function findOneByCode(string $code): CustomerOptionGroupInterface /** * {@inheritdoc} - * - * @return CustomerOptionGroupInterface[] */ public function findByName(string $name, string $locale): array { diff --git a/src/Repository/CustomerOptionGroupRepositoryInterface.php b/src/Repository/CustomerOptionGroupRepositoryInterface.php index c8a202ad..5fc25c80 100644 --- a/src/Repository/CustomerOptionGroupRepositoryInterface.php +++ b/src/Repository/CustomerOptionGroupRepositoryInterface.php @@ -20,11 +20,17 @@ interface CustomerOptionGroupRepositoryInterface extends RepositoryInterface /** * @param string $code * - * @return CustomerOptionGroupInterface + * @return CustomerOptionGroupInterface|null * * @throws \Doctrine\ORM\NonUniqueResultException */ - public function findOneByCode(string $code): CustomerOptionGroupInterface; + public function findOneByCode(string $code): ?CustomerOptionGroupInterface; + /** + * @param string $name + * @param string $locale + * + * @return CustomerOptionGroupInterface[] + */ public function findByName(string $name, string $locale): array; } From 4b4a8e3c4ce0d8bea02933494741a0557534d690 Mon Sep 17 00:00:00 2001 From: Jakob Tolkemit Date: Fri, 10 Aug 2018 16:42:33 +0200 Subject: [PATCH 2/6] Fixed customer option group context trying to call methods on array --- tests/Behat/Context/Admin/CustomerOptionGroupsContext.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/Behat/Context/Admin/CustomerOptionGroupsContext.php b/tests/Behat/Context/Admin/CustomerOptionGroupsContext.php index 35f9def9..f3466de9 100644 --- a/tests/Behat/Context/Admin/CustomerOptionGroupsContext.php +++ b/tests/Behat/Context/Admin/CustomerOptionGroupsContext.php @@ -394,8 +394,13 @@ function (ValidatorInterface $validator) use ($conditionType): array { $customerOptionGroup->getValidators() ); + $flatConditionsToCheck = []; + foreach ($conditionsToCheck as $conditionsArray) { + $flatConditionsToCheck = array_merge($flatConditionsToCheck, $conditionsArray); + } + foreach ($table->getHash() as $row) { - foreach ($conditionsToCheck as $condition) { + foreach ($flatConditionsToCheck as $condition) { $customerOption = $condition->getCustomerOption(); if ($customerOption->getName() == $row['option']) { From e2fefdda6bff121349b252473576f04aadc1e20a Mon Sep 17 00:00:00 2001 From: Jakob Tolkemit Date: Fri, 10 Aug 2018 16:59:32 +0200 Subject: [PATCH 3/6] Fixed typo --- tests/Behat/Context/Admin/CustomerOptionGroupsContext.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Behat/Context/Admin/CustomerOptionGroupsContext.php b/tests/Behat/Context/Admin/CustomerOptionGroupsContext.php index f3466de9..a963558e 100644 --- a/tests/Behat/Context/Admin/CustomerOptionGroupsContext.php +++ b/tests/Behat/Context/Admin/CustomerOptionGroupsContext.php @@ -406,7 +406,7 @@ function (ValidatorInterface $validator) use ($conditionType): array { if ($customerOption->getName() == $row['option']) { $val = $this->prepareValue($row['value'], $customerOption->getType()); - $sameComp = $condition->getComparator() == $row['condition_comparator']; + $sameComp = $condition->getComparator() == $row['comparator']; $sameVal = $this->values_are_equal( $condition->getValue()['value'], $val, $customerOption->getType() ); From 1811b16ae0184a5d87789e14d9902331e0875401 Mon Sep 17 00:00:00 2001 From: Jakob Tolkemit Date: Fri, 10 Aug 2018 17:20:28 +0200 Subject: [PATCH 4/6] Updated dependencies --- composer.lock | 385 +++++++++--------- .../Admin/CustomerOptionGroupsContext.php | 8 +- 2 files changed, 203 insertions(+), 190 deletions(-) diff --git a/composer.lock b/composer.lock index 320a6da6..3c7187f9 100644 --- a/composer.lock +++ b/composer.lock @@ -170,16 +170,16 @@ }, { "name": "composer/ca-bundle", - "version": "1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "d2c0a83b7533d6912e8d516756ebd34f893e9169" + "reference": "46afded9720f40b9dc63542af4e3e43a1177acb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/d2c0a83b7533d6912e8d516756ebd34f893e9169", - "reference": "d2c0a83b7533d6912e8d516756ebd34f893e9169", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/46afded9720f40b9dc63542af4e3e43a1177acb0", + "reference": "46afded9720f40b9dc63542af4e3e43a1177acb0", "shasum": "" }, "require": { @@ -222,7 +222,7 @@ "ssl", "tls" ], - "time": "2018-03-29 19:57:20" + "time": "2018-08-08 08:57:40" }, { "name": "doctrine/annotations", @@ -1906,16 +1906,16 @@ }, { "name": "gedmo/doctrine-extensions", - "version": "v2.4.35", + "version": "v2.4.36", "source": { "type": "git", "url": "https://github.com/Atlantic18/DoctrineExtensions.git", - "reference": "1e400fbd05b7e5f912f55fe95805450f7d3bed60" + "reference": "87c78ff9fd4b90460386f753d95622f6fbbfcb27" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Atlantic18/DoctrineExtensions/zipball/1e400fbd05b7e5f912f55fe95805450f7d3bed60", - "reference": "1e400fbd05b7e5f912f55fe95805450f7d3bed60", + "url": "https://api.github.com/repos/Atlantic18/DoctrineExtensions/zipball/87c78ff9fd4b90460386f753d95622f6fbbfcb27", + "reference": "87c78ff9fd4b90460386f753d95622f6fbbfcb27", "shasum": "" }, "require": { @@ -1983,7 +1983,7 @@ "tree", "uploadable" ], - "time": "2018-05-08 12:28:40" + "time": "2018-07-26 12:16:35" }, { "name": "guzzlehttp/guzzle", @@ -2461,16 +2461,16 @@ }, { "name": "jms/serializer", - "version": "1.12.1", + "version": "1.13.0", "source": { "type": "git", "url": "https://github.com/schmittjoh/serializer.git", - "reference": "93d6e03fcb71d45854cc44b5a84d645c02c5d763" + "reference": "00863e1d55b411cc33ad3e1de09a4c8d3aae793c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/93d6e03fcb71d45854cc44b5a84d645c02c5d763", - "reference": "93d6e03fcb71d45854cc44b5a84d645c02c5d763", + "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/00863e1d55b411cc33ad3e1de09a4c8d3aae793c", + "reference": "00863e1d55b411cc33ad3e1de09a4c8d3aae793c", "shasum": "" }, "require": { @@ -2510,7 +2510,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-1.x": "1.11-dev" + "dev-1.x": "1.13-dev" } }, "autoload": { @@ -2541,7 +2541,7 @@ "serialization", "xml" ], - "time": "2018-06-01 12:10:12" + "time": "2018-07-25 13:58:54" }, { "name": "jms/serializer-bundle", @@ -4031,16 +4031,16 @@ }, { "name": "payum/payum-bundle", - "version": "2.3.0", + "version": "2.3.1", "source": { "type": "git", "url": "https://github.com/Payum/PayumBundle.git", - "reference": "a740640dae94839518b84815ffe9713311dd60d9" + "reference": "404a718a625f974965393828485ddb696a8bf786" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Payum/PayumBundle/zipball/a740640dae94839518b84815ffe9713311dd60d9", - "reference": "a740640dae94839518b84815ffe9713311dd60d9", + "url": "https://api.github.com/repos/Payum/PayumBundle/zipball/404a718a625f974965393828485ddb696a8bf786", + "reference": "404a718a625f974965393828485ddb696a8bf786", "shasum": "" }, "require": { @@ -4127,7 +4127,7 @@ "stripe.js", "symfony" ], - "time": "2018-01-09 21:09:36" + "time": "2018-07-19 16:47:27" }, { "name": "php-http/guzzle6-adapter", @@ -4858,21 +4858,22 @@ }, { "name": "ramsey/uuid", - "version": "3.7.3", + "version": "3.8.0", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "44abcdad877d9a46685a3a4d221e3b2c4b87cb76" + "reference": "d09ea80159c1929d75b3f9c60504d613aeb4a1e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/44abcdad877d9a46685a3a4d221e3b2c4b87cb76", - "reference": "44abcdad877d9a46685a3a4d221e3b2c4b87cb76", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/d09ea80159c1929d75b3f9c60504d613aeb4a1e3", + "reference": "d09ea80159c1929d75b3f9c60504d613aeb4a1e3", "shasum": "" }, "require": { - "paragonie/random_compat": "^1.0|^2.0", - "php": "^5.4 || ^7.0" + "paragonie/random_compat": "^1.0|^2.0|9.99.99", + "php": "^5.4 || ^7.0", + "symfony/polyfill-ctype": "^1.8" }, "replace": { "rhumsaa/uuid": "self.version" @@ -4880,16 +4881,17 @@ "require-dev": { "codeception/aspect-mock": "^1.0 | ~2.0.0", "doctrine/annotations": "~1.2.0", - "goaop/framework": "1.0.0-alpha.2 | ^1.0 | ^2.1", + "goaop/framework": "1.0.0-alpha.2 | ^1.0 | ~2.1.0", "ircmaxell/random-lib": "^1.1", "jakub-onderka/php-parallel-lint": "^0.9.0", "mockery/mockery": "^0.9.9", "moontoast/math": "^1.1", "php-mock/php-mock-phpunit": "^0.3|^1.1", - "phpunit/phpunit": "^4.7|^5.0", + "phpunit/phpunit": "^4.7|^5.0|^6.5", "squizlabs/php_codesniffer": "^2.3" }, "suggest": { + "ext-ctype": "Provides support for PHP Ctype functions", "ext-libsodium": "Provides the PECL libsodium extension for use with the SodiumRandomGenerator", "ext-uuid": "Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator", "ircmaxell/random-lib": "Provides RandomLib for use with the RandomLibAdapter", @@ -4934,7 +4936,7 @@ "identifier", "uuid" ], - "time": "2018-01-20 00:28:24" + "time": "2018-07-19 23:38:55" }, { "name": "sensiolabs/security-checker", @@ -5138,16 +5140,16 @@ }, { "name": "sonata-project/core-bundle", - "version": "3.11.1", + "version": "3.11.2", "source": { "type": "git", "url": "https://github.com/sonata-project/SonataCoreBundle.git", - "reference": "fbd8c7842aad2326ac31657508fc9a2527e13275" + "reference": "16a89c9dd5f99a3308b992bc5dcc14e16cbdf797" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sonata-project/SonataCoreBundle/zipball/fbd8c7842aad2326ac31657508fc9a2527e13275", - "reference": "fbd8c7842aad2326ac31657508fc9a2527e13275", + "url": "https://api.github.com/repos/sonata-project/SonataCoreBundle/zipball/16a89c9dd5f99a3308b992bc5dcc14e16cbdf797", + "reference": "16a89c9dd5f99a3308b992bc5dcc14e16cbdf797", "shasum": "" }, "require": { @@ -5211,7 +5213,7 @@ "keywords": [ "sonata" ], - "time": "2018-07-12 06:08:25" + "time": "2018-07-18 22:10:58" }, { "name": "sonata-project/datagrid-bundle", @@ -5566,12 +5568,12 @@ "source": { "type": "git", "url": "https://github.com/Sylius/Sylius.git", - "reference": "05349e07f09a08eded7bbf543900ec346a04b4ea" + "reference": "9b5b5e3698a26fe67efd306f6ae9c43b30a8ebf1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Sylius/Sylius/zipball/05349e07f09a08eded7bbf543900ec346a04b4ea", - "reference": "05349e07f09a08eded7bbf543900ec346a04b4ea", + "url": "https://api.github.com/repos/Sylius/Sylius/zipball/9b5b5e3698a26fe67efd306f6ae9c43b30a8ebf1", + "reference": "9b5b5e3698a26fe67efd306f6ae9c43b30a8ebf1", "shasum": "" }, "require": { @@ -5759,7 +5761,7 @@ ], "description": "E-Commerce platform for PHP, based on Symfony framework.", "homepage": "http://sylius.com", - "time": "2018-07-11 13:50:23" + "time": "2018-08-08 09:54:46" }, { "name": "symfony/monolog-bundle", @@ -5826,16 +5828,16 @@ }, { "name": "symfony/polyfill-apcu", - "version": "v1.8.0", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-apcu.git", - "reference": "9b83bd010112ec196410849e840d9b9fefcb15ad" + "reference": "19e1b73bf255265ad0b568f81766ae2a3266d8d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/9b83bd010112ec196410849e840d9b9fefcb15ad", - "reference": "9b83bd010112ec196410849e840d9b9fefcb15ad", + "url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/19e1b73bf255265ad0b568f81766ae2a3266d8d2", + "reference": "19e1b73bf255265ad0b568f81766ae2a3266d8d2", "shasum": "" }, "require": { @@ -5844,7 +5846,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -5878,29 +5880,32 @@ "portable", "shim" ], - "time": "2018-04-26 10:06:28" + "time": "2018-08-06 14:22:27" }, { "name": "symfony/polyfill-ctype", - "version": "v1.8.0", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae" + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7cc359f1b7b80fc25ed7796be7d96adc9b354bae", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", "shasum": "" }, "require": { "php": ">=5.3.3" }, + "suggest": { + "ext-ctype": "For best performance" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -5933,20 +5938,20 @@ "polyfill", "portable" ], - "time": "2018-04-30 19:57:29" + "time": "2018-08-06 14:22:27" }, { "name": "symfony/polyfill-iconv", - "version": "v1.8.0", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-iconv.git", - "reference": "7cb8436a814d5b0fcf292810ee26f8b0cb47584d" + "reference": "bcc0cd69185b8a5d8b4a5400c489ed3333bf9bb2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/7cb8436a814d5b0fcf292810ee26f8b0cb47584d", - "reference": "7cb8436a814d5b0fcf292810ee26f8b0cb47584d", + "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/bcc0cd69185b8a5d8b4a5400c489ed3333bf9bb2", + "reference": "bcc0cd69185b8a5d8b4a5400c489ed3333bf9bb2", "shasum": "" }, "require": { @@ -5958,7 +5963,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -5992,20 +5997,20 @@ "portable", "shim" ], - "time": "2018-04-26 10:06:28" + "time": "2018-08-06 14:22:27" }, { "name": "symfony/polyfill-intl-icu", - "version": "v1.8.0", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-icu.git", - "reference": "80ee17ae83c10cd513e5144f91a73607a21edb4e" + "reference": "f22a90256d577c7ef7efad8df1f0201663d57644" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/80ee17ae83c10cd513e5144f91a73607a21edb4e", - "reference": "80ee17ae83c10cd513e5144f91a73607a21edb4e", + "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/f22a90256d577c7ef7efad8df1f0201663d57644", + "reference": "f22a90256d577c7ef7efad8df1f0201663d57644", "shasum": "" }, "require": { @@ -6018,7 +6023,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -6050,20 +6055,20 @@ "portable", "shim" ], - "time": "2018-04-25 14:53:50" + "time": "2018-08-06 14:22:27" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.8.0", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "3296adf6a6454a050679cde90f95350ad604b171" + "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", - "reference": "3296adf6a6454a050679cde90f95350ad604b171", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8", + "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8", "shasum": "" }, "require": { @@ -6075,7 +6080,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -6109,7 +6114,7 @@ "portable", "shim" ], - "time": "2018-04-26 10:06:28" + "time": "2018-08-06 14:22:27" }, { "name": "symfony/swiftmailer-bundle", @@ -6175,16 +6180,16 @@ }, { "name": "symfony/symfony", - "version": "v3.4.12", + "version": "v3.4.14", "source": { "type": "git", "url": "https://github.com/symfony/symfony.git", - "reference": "c36f8cb21b5f1661a14fdb8cef9cc611d54a3494" + "reference": "f50e17fa4edd6216f7fe5b908f04e64ba1d19a9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/symfony/zipball/c36f8cb21b5f1661a14fdb8cef9cc611d54a3494", - "reference": "c36f8cb21b5f1661a14fdb8cef9cc611d54a3494", + "url": "https://api.github.com/repos/symfony/symfony/zipball/f50e17fa4edd6216f7fe5b908f04e64ba1d19a9e", + "reference": "f50e17fa4edd6216f7fe5b908f04e64ba1d19a9e", "shasum": "" }, "require": { @@ -6207,7 +6212,7 @@ }, "conflict": { "phpdocumentor/reflection-docblock": "<3.0||>=3.2.0,<3.2.2", - "phpdocumentor/type-resolver": "<0.2.1", + "phpdocumentor/type-resolver": "<0.3.0", "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" }, "provide": { @@ -6276,7 +6281,7 @@ "doctrine/data-fixtures": "1.0.*", "doctrine/dbal": "~2.4", "doctrine/doctrine-bundle": "~1.4", - "doctrine/orm": "~2.4,>=2.4.5", + "doctrine/orm": "~2.4,>=2.4.5,<=2.7.0", "egulias/email-validator": "~1.2,>=1.2.8|~2.0", "monolog/monolog": "~1.11", "ocramius/proxy-manager": "~0.4|~1.0|~2.0", @@ -6326,20 +6331,20 @@ "keywords": [ "framework" ], - "time": "2018-06-25 12:29:33" + "time": "2018-08-01 14:48:04" }, { "name": "symfony/thanks", - "version": "v1.0.7", + "version": "v1.0.8", "source": { "type": "git", "url": "https://github.com/symfony/thanks.git", - "reference": "bade4992c46ed722162694b4af8d72f84402819a" + "reference": "ca74c76a2a43aaa491e7a524fd235e094b1129b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/thanks/zipball/bade4992c46ed722162694b4af8d72f84402819a", - "reference": "bade4992c46ed722162694b4af8d72f84402819a", + "url": "https://api.github.com/repos/symfony/thanks/zipball/ca74c76a2a43aaa491e7a524fd235e094b1129b5", + "reference": "ca74c76a2a43aaa491e7a524fd235e094b1129b5", "shasum": "" }, "require": { @@ -6369,28 +6374,28 @@ } ], "description": "Give thanks (in the form of a GitHub ⭐) to your fellow PHP package maintainers (not limited to Symfony components)!", - "time": "2018-03-14 21:51:39" + "time": "2018-08-05 16:46:52" }, { "name": "twig/extensions", - "version": "v1.5.1", + "version": "v1.5.2", "source": { "type": "git", "url": "https://github.com/twigphp/Twig-extensions.git", - "reference": "d188c76168b853481cc75879ea045bf93d718e9c" + "reference": "2c1a86526d0044065220d1b51ac08348bea5ca82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig-extensions/zipball/d188c76168b853481cc75879ea045bf93d718e9c", - "reference": "d188c76168b853481cc75879ea045bf93d718e9c", + "url": "https://api.github.com/repos/twigphp/Twig-extensions/zipball/2c1a86526d0044065220d1b51ac08348bea5ca82", + "reference": "2c1a86526d0044065220d1b51ac08348bea5ca82", "shasum": "" }, "require": { - "twig/twig": "~1.27|~2.0" + "twig/twig": "^1.27|^2.0" }, "require-dev": { - "symfony/phpunit-bridge": "~3.3@dev", - "symfony/translation": "~2.3|~3.0" + "symfony/phpunit-bridge": "^3.4", + "symfony/translation": "^2.7|^3.4" }, "suggest": { "symfony/translation": "Allow the time_diff output to be translated" @@ -6420,12 +6425,11 @@ } ], "description": "Common additional features for Twig that do not directly belong in core", - "homepage": "http://twig.sensiolabs.org/doc/extensions/index.html", "keywords": [ "i18n", "text" ], - "time": "2017-06-08 18:19:53" + "time": "2018-05-22 13:26:07" }, { "name": "twig/twig", @@ -7788,23 +7792,23 @@ }, { "name": "friends-of-behat/symfony-extension", - "version": "v1.2.1", + "version": "v1.2.2", "source": { "type": "git", "url": "https://github.com/FriendsOfBehat/SymfonyExtension.git", - "reference": "0989790fba03d1ab7e9827d86bce3034e933a50e" + "reference": "291530353b19e9e6cbb759e3d0bbf71475fca965" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfBehat/SymfonyExtension/zipball/0989790fba03d1ab7e9827d86bce3034e933a50e", - "reference": "0989790fba03d1ab7e9827d86bce3034e933a50e", + "url": "https://api.github.com/repos/FriendsOfBehat/SymfonyExtension/zipball/291530353b19e9e6cbb759e3d0bbf71475fca965", + "reference": "291530353b19e9e6cbb759e3d0bbf71475fca965", "shasum": "" }, "require": { - "behat/behat": "^3.1", + "behat/behat": "^3.4", "php": "^7.1", - "symfony/dotenv": "^3.3|^4.0", - "symfony/http-kernel": "^3.3|^4.0" + "symfony/dotenv": "^3.4|^4.0", + "symfony/http-kernel": "^3.4|^4.0" }, "require-dev": { "behat/mink": "^1.7", @@ -7812,7 +7816,9 @@ "behat/mink-extension": "^2.2", "friends-of-behat/cross-container-extension": "^1.0", "friends-of-behat/test-context": "^1.0", - "symfony/framework-bundle": "^3.3|^4.0" + "phpstan/phpstan-shim": "^0.10", + "sylius-labs/coding-standard": "^2.0", + "symfony/framework-bundle": "^3.4|^4.0" }, "suggest": { "behat/mink-browserkit-driver": "^1.3", @@ -7836,7 +7842,7 @@ } ], "description": "Integrates Behat with Symfony.", - "time": "2018-05-25 12:59:32" + "time": "2018-08-01 14:35:39" }, { "name": "friends-of-behat/variadic-extension", @@ -8823,16 +8829,16 @@ }, { "name": "phpspec/prophecy", - "version": "1.7.6", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712" + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712", - "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", "shasum": "" }, "require": { @@ -8844,12 +8850,12 @@ }, "require-dev": { "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7.x-dev" + "dev-master": "1.8.x-dev" } }, "autoload": { @@ -8882,7 +8888,7 @@ "spy", "stub" ], - "time": "2018-04-18 13:57:24" + "time": "2018-08-05 17:53:17" }, { "name": "phpstan/phpdoc-parser", @@ -8987,16 +8993,16 @@ }, { "name": "phpstan/phpstan-shim", - "version": "0.10.1", + "version": "0.10.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-shim.git", - "reference": "48ee97f7c066a5f5253dc399b72d9b6977171830" + "reference": "3bc2bed44b6840d90488440a59e53784145f9be4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-shim/zipball/48ee97f7c066a5f5253dc399b72d9b6977171830", - "reference": "48ee97f7c066a5f5253dc399b72d9b6977171830", + "url": "https://api.github.com/repos/phpstan/phpstan-shim/zipball/3bc2bed44b6840d90488440a59e53784145f9be4", + "reference": "3bc2bed44b6840d90488440a59e53784145f9be4", "shasum": "" }, "require": { @@ -9016,25 +9022,30 @@ "dev-master": "0.10-dev" } }, + "autoload": { + "files": [ + "bootstrap.php" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "description": "PHPStan Phar distribution", - "time": "2018-07-01 18:53:29" + "time": "2018-07-22 19:45:42" }, { "name": "phpstan/phpstan-strict-rules", - "version": "0.10", + "version": "0.10.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-strict-rules.git", - "reference": "bffdf03fc70602833936dccf6c2eb3be58ed78d6" + "reference": "18c0b6e8899606b127c680402ab473a7b67166db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/bffdf03fc70602833936dccf6c2eb3be58ed78d6", - "reference": "bffdf03fc70602833936dccf6c2eb3be58ed78d6", + "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/18c0b6e8899606b127c680402ab473a7b67166db", + "reference": "18c0b6e8899606b127c680402ab473a7b67166db", "shasum": "" }, "require": { @@ -9067,20 +9078,20 @@ "MIT" ], "description": "Extra strict and opinionated rules for PHPStan", - "time": "2018-06-22 18:09:47" + "time": "2018-07-06 20:36:44" }, { "name": "phpstan/phpstan-symfony", - "version": "0.10", + "version": "0.10.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-symfony.git", - "reference": "34b1940a678768ba1b957ca550f99bf7c81f6222" + "reference": "d7d1624e1c262a2f207a59d7db906f8b5ba26a41" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/34b1940a678768ba1b957ca550f99bf7c81f6222", - "reference": "34b1940a678768ba1b957ca550f99bf7c81f6222", + "url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/d7d1624e1c262a2f207a59d7db906f8b5ba26a41", + "reference": "d7d1624e1c262a2f207a59d7db906f8b5ba26a41", "shasum": "" }, "require": { @@ -9127,7 +9138,7 @@ } ], "description": "Symfony Framework extensions and rules for PHPStan", - "time": "2018-06-21 12:00:50" + "time": "2018-07-30 17:20:18" }, { "name": "phpstan/phpstan-webmozart-assert", @@ -9428,16 +9439,16 @@ }, { "name": "phpunit/phpunit", - "version": "6.5.9", + "version": "6.5.11", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "093ca5508174cd8ab8efe44fd1dde447adfdec8f" + "reference": "7bab54cb366076023bbf457a2a0d513332cd40f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/093ca5508174cd8ab8efe44fd1dde447adfdec8f", - "reference": "093ca5508174cd8ab8efe44fd1dde447adfdec8f", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7bab54cb366076023bbf457a2a0d513332cd40f2", + "reference": "7bab54cb366076023bbf457a2a0d513332cd40f2", "shasum": "" }, "require": { @@ -9455,7 +9466,7 @@ "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.5", + "phpunit/phpunit-mock-objects": "^5.0.9", "sebastian/comparator": "^2.1", "sebastian/diff": "^2.0", "sebastian/environment": "^3.1", @@ -9508,20 +9519,20 @@ "testing", "xunit" ], - "time": "2018-07-03 06:40:40" + "time": "2018-08-07 07:05:35" }, { "name": "phpunit/phpunit-mock-objects", - "version": "5.0.8", + "version": "5.0.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "6f9a3c8bf34188a2b53ce2ae7a126089c53e0a9f" + "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/6f9a3c8bf34188a2b53ce2ae7a126089c53e0a9f", - "reference": "6f9a3c8bf34188a2b53ce2ae7a126089c53e0a9f", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/cd1cf05c553ecfec36b170070573e540b67d3f1f", + "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f", "shasum": "" }, "require": { @@ -9534,7 +9545,7 @@ "phpunit/phpunit": "<6.0" }, "require-dev": { - "phpunit/phpunit": "^6.5" + "phpunit/phpunit": "^6.5.11" }, "suggest": { "ext-soap": "*" @@ -9567,7 +9578,7 @@ "mock", "xunit" ], - "time": "2018-07-13 03:27:23" + "time": "2018-08-09 05:50:03" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -10169,16 +10180,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.3.0", + "version": "3.3.1", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "d86873af43b4aa9d1f39a3601cc0cfcf02b25266" + "reference": "628a481780561150481a9ec74709092b9759b3ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/d86873af43b4aa9d1f39a3601cc0cfcf02b25266", - "reference": "d86873af43b4aa9d1f39a3601cc0cfcf02b25266", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/628a481780561150481a9ec74709092b9759b3ec", + "reference": "628a481780561150481a9ec74709092b9759b3ec", "shasum": "" }, "require": { @@ -10216,7 +10227,7 @@ "phpcs", "standards" ], - "time": "2018-06-06 23:58:19" + "time": "2018-07-26 23:47:18" }, { "name": "sylius-labs/coding-standard", @@ -10253,16 +10264,16 @@ }, { "name": "symfony/polyfill-php72", - "version": "v1.8.0", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "a4576e282d782ad82397f3e4ec1df8e0f0cafb46" + "reference": "95c50420b0baed23852452a7f0c7b527303ed5ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/a4576e282d782ad82397f3e4ec1df8e0f0cafb46", - "reference": "a4576e282d782ad82397f3e4ec1df8e0f0cafb46", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/95c50420b0baed23852452a7f0c7b527303ed5ae", + "reference": "95c50420b0baed23852452a7f0c7b527303ed5ae", "shasum": "" }, "require": { @@ -10271,7 +10282,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -10304,27 +10315,27 @@ "portable", "shim" ], - "time": "2018-04-26 10:06:28" + "time": "2018-08-06 14:22:27" }, { "name": "symplify/better-phpdoc-parser", - "version": "v4.5.0", + "version": "v4.6.0", "source": { "type": "git", "url": "https://github.com/Symplify/BetterPhpDocParser.git", - "reference": "70da999495c373b311f66b3227714b50b4ace117" + "reference": "2d82bacc9d4f0aeeadf588b7a756b26408a6cb2a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Symplify/BetterPhpDocParser/zipball/70da999495c373b311f66b3227714b50b4ace117", - "reference": "70da999495c373b311f66b3227714b50b4ace117", + "url": "https://api.github.com/repos/Symplify/BetterPhpDocParser/zipball/2d82bacc9d4f0aeeadf588b7a756b26408a6cb2a", + "reference": "2d82bacc9d4f0aeeadf588b7a756b26408a6cb2a", "shasum": "" }, "require": { "nette/utils": "^2.5", "php": "^7.1", - "phpstan/phpdoc-parser": "^0.3", - "symplify/package-builder": "^4.5" + "phpstan/phpdoc-parser": "^0.2|^0.3", + "symplify/package-builder": "^4.6" }, "require-dev": { "phpunit/phpunit": "^7.0" @@ -10332,7 +10343,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.5-dev" + "dev-master": "4.6-dev" } }, "autoload": { @@ -10345,20 +10356,20 @@ "MIT" ], "description": "Slim wrapper around phpstan/phpdoc-parser with format preserving printer", - "time": "2018-06-30 18:46:21" + "time": "2018-07-24 21:48:48" }, { "name": "symplify/coding-standard", - "version": "v4.5.0", + "version": "v4.6.0", "source": { "type": "git", "url": "https://github.com/Symplify/CodingStandard.git", - "reference": "d203235d22327c8a651e62ee464775449c92b626" + "reference": "ad58451374fbf242757828ea5dee6f6242b64393" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Symplify/CodingStandard/zipball/d203235d22327c8a651e62ee464775449c92b626", - "reference": "d203235d22327c8a651e62ee464775449c92b626", + "url": "https://api.github.com/repos/Symplify/CodingStandard/zipball/ad58451374fbf242757828ea5dee6f6242b64393", + "reference": "ad58451374fbf242757828ea5dee6f6242b64393", "shasum": "" }, "require": { @@ -10367,18 +10378,18 @@ "nette/utils": "^2.5", "php": "^7.1", "squizlabs/php_codesniffer": "^3.3", - "symplify/token-runner": "^4.5" + "symplify/token-runner": "^4.6" }, "require-dev": { "nette/application": "^2.4", "phpunit/phpunit": "^7.0", - "symplify/easy-coding-standard-tester": "^4.5", - "symplify/package-builder": "^4.5" + "symplify/easy-coding-standard-tester": "^4.6", + "symplify/package-builder": "^4.6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.5-dev" + "dev-master": "4.6-dev" } }, "autoload": { @@ -10390,21 +10401,21 @@ "license": [ "MIT" ], - "description": "Set of Symplify rules for PHP_CodeSniffer.", - "time": "2018-07-11 16:46:51" + "description": "Set of Symplify rules for PHP_CodeSniffer and PHP CS Fixer.", + "time": "2018-07-31 11:23:44" }, { "name": "symplify/easy-coding-standard", - "version": "v4.5.0", + "version": "v4.6.0", "source": { "type": "git", "url": "https://github.com/Symplify/EasyCodingStandard.git", - "reference": "5bd41c719028fef8a3a02e681abcd507cdc07158" + "reference": "7cbeb85d48c20c3329b078130f7ec052b5c1bd78" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Symplify/EasyCodingStandard/zipball/5bd41c719028fef8a3a02e681abcd507cdc07158", - "reference": "5bd41c719028fef8a3a02e681abcd507cdc07158", + "url": "https://api.github.com/repos/Symplify/EasyCodingStandard/zipball/7cbeb85d48c20c3329b078130f7ec052b5c1bd78", + "reference": "7cbeb85d48c20c3329b078130f7ec052b5c1bd78", "shasum": "" }, "require": { @@ -10414,7 +10425,7 @@ "nette/utils": "^2.5", "ocramius/package-versions": "^1.3", "php": "^7.1", - "slevomat/coding-standard": "^4.5", + "slevomat/coding-standard": "^4.6", "squizlabs/php_codesniffer": "^3.3", "symfony/cache": "^3.4|^4.0", "symfony/config": "^3.4|^4.0", @@ -10423,13 +10434,13 @@ "symfony/finder": "^3.4|^4.0", "symfony/http-kernel": "^3.4|^4.0", "symfony/yaml": "^3.4|^4.0", - "symplify/coding-standard": "^4.5", - "symplify/package-builder": "^4.5", - "symplify/token-runner": "^4.5" + "symplify/coding-standard": "^4.6", + "symplify/package-builder": "^4.6", + "symplify/token-runner": "^4.6" }, "require-dev": { "phpunit/phpunit": "^7.0", - "symplify/easy-coding-standard-tester": "^4.5" + "symplify/easy-coding-standard-tester": "^4.6" }, "bin": [ "bin/ecs" @@ -10437,7 +10448,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.5-dev" + "dev-master": "4.6-dev" } }, "autoload": { @@ -10454,20 +10465,20 @@ "MIT" ], "description": "Use Coding Standard with 0-knowledge of PHP-CS-Fixer and PHP_CodeSniffer.", - "time": "2018-07-12 22:45:18" + "time": "2018-07-30 19:42:09" }, { "name": "symplify/package-builder", - "version": "v4.5.0", + "version": "v4.6.0", "source": { "type": "git", "url": "https://github.com/Symplify/PackageBuilder.git", - "reference": "68d65260fe51d6ffe7e86a47be41c7e756d7b398" + "reference": "7f9ef8025817dc8609f572ec7881a8c9908dfaa0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Symplify/PackageBuilder/zipball/68d65260fe51d6ffe7e86a47be41c7e756d7b398", - "reference": "68d65260fe51d6ffe7e86a47be41c7e756d7b398", + "url": "https://api.github.com/repos/Symplify/PackageBuilder/zipball/7f9ef8025817dc8609f572ec7881a8c9908dfaa0", + "reference": "7f9ef8025817dc8609f572ec7881a8c9908dfaa0", "shasum": "" }, "require": { @@ -10487,7 +10498,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.5-dev" + "dev-master": "4.6-dev" } }, "autoload": { @@ -10500,20 +10511,20 @@ "MIT" ], "description": "Dependency Injection, Console and Kernel toolkit for Symplify packages.", - "time": "2018-07-11 22:39:10" + "time": "2018-07-26 13:44:19" }, { "name": "symplify/token-runner", - "version": "v4.5.0", + "version": "v4.6.0", "source": { "type": "git", "url": "https://github.com/Symplify/TokenRunner.git", - "reference": "f4e22913642a5d82794f94add73c904e017a208c" + "reference": "29973bf5e3fc5f97dad0153f55d071b46cba735d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Symplify/TokenRunner/zipball/f4e22913642a5d82794f94add73c904e017a208c", - "reference": "f4e22913642a5d82794f94add73c904e017a208c", + "url": "https://api.github.com/repos/Symplify/TokenRunner/zipball/29973bf5e3fc5f97dad0153f55d071b46cba735d", + "reference": "29973bf5e3fc5f97dad0153f55d071b46cba735d", "shasum": "" }, "require": { @@ -10522,8 +10533,8 @@ "nette/utils": "^2.5", "php": "^7.1", "squizlabs/php_codesniffer": "^3.3", - "symplify/better-phpdoc-parser": "^4.5", - "symplify/package-builder": "^4.5" + "symplify/better-phpdoc-parser": "^4.6", + "symplify/package-builder": "^4.6" }, "require-dev": { "phpunit/phpunit": "^7.0" @@ -10531,7 +10542,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.5-dev" + "dev-master": "4.6-dev" } }, "autoload": { @@ -10544,7 +10555,7 @@ "MIT" ], "description": "Set of utils for PHP_CodeSniffer and PHP CS Fixer.", - "time": "2018-06-30 18:46:21" + "time": "2018-07-24 21:48:48" }, { "name": "theseer/tokenizer", diff --git a/tests/Behat/Context/Admin/CustomerOptionGroupsContext.php b/tests/Behat/Context/Admin/CustomerOptionGroupsContext.php index a963558e..bb37feec 100644 --- a/tests/Behat/Context/Admin/CustomerOptionGroupsContext.php +++ b/tests/Behat/Context/Admin/CustomerOptionGroupsContext.php @@ -389,7 +389,7 @@ function (ValidatorInterface $validator) use ($conditionType): array { return $validator->getConstraints()->toArray(); } - throw new InvalidArgumentException('the condition type has to be either conditions or constraints'); + throw new InvalidArgumentException('The condition type has to be either conditions or constraints'); }, $customerOptionGroup->getValidators() ); @@ -399,6 +399,8 @@ function (ValidatorInterface $validator) use ($conditionType): array { $flatConditionsToCheck = array_merge($flatConditionsToCheck, $conditionsArray); } + $result = false; + foreach ($table->getHash() as $row) { foreach ($flatConditionsToCheck as $condition) { $customerOption = $condition->getCustomerOption(); @@ -413,13 +415,13 @@ function (ValidatorInterface $validator) use ($conditionType): array { if ($sameComp && $sameVal) { $expectedMessage = $row['error_message']; - return $condition->getValidator()->getErrorMessage()->getMessage() === $expectedMessage; + $result = $condition->getValidator()->getErrorMessage()->getMessage() === $expectedMessage; } } } } - Assert::false(true, 'The validator does not contain the condition'); + Assert::true($result, 'The validator does not contain the condition'); } private function values_are_equal($a, $b, string $optionType) From 1bfcd162b8a56c99391b24328a5bc5ee2c337543 Mon Sep 17 00:00:00 2001 From: Jakob Tolkemit Date: Mon, 13 Aug 2018 10:28:12 +0200 Subject: [PATCH 5/6] Fixed validator comparison --- .../Context/Admin/CustomerOptionGroupsContext.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/Behat/Context/Admin/CustomerOptionGroupsContext.php b/tests/Behat/Context/Admin/CustomerOptionGroupsContext.php index bb37feec..5d18c94d 100644 --- a/tests/Behat/Context/Admin/CustomerOptionGroupsContext.php +++ b/tests/Behat/Context/Admin/CustomerOptionGroupsContext.php @@ -402,12 +402,25 @@ function (ValidatorInterface $validator) use ($conditionType): array { $result = false; foreach ($table->getHash() as $row) { + foreach ($row as $key => $value) { + $row[$key] = str_replace('"', '', $value); + } + foreach ($flatConditionsToCheck as $condition) { + /** @var CustomerOptionInterface $customerOption */ $customerOption = $condition->getCustomerOption(); - if ($customerOption->getName() == $row['option']) { + $optionName = $customerOption->getName(); + + if ($optionName == $row['option']) { $val = $this->prepareValue($row['value'], $customerOption->getType()); + if (CustomerOptionTypeEnum::isSelect($customerOption->getType())) { + foreach ($val as $key => $value) { + $val[$key] = strtolower($value); + } + } + $sameComp = $condition->getComparator() == $row['comparator']; $sameVal = $this->values_are_equal( $condition->getValue()['value'], $val, $customerOption->getType() From d33c5fd187672f5bf25965d8e245409f79a78cfb Mon Sep 17 00:00:00 2001 From: Jakob Tolkemit Date: Mon, 13 Aug 2018 11:31:48 +0200 Subject: [PATCH 6/6] Fixed condition form not pre filling number fields Fixed testing for multiple conditions --- .../configuring_validators.feature | 24 +++++++++---------- src/Form/Validator/ValueType.php | 5 +++- .../Admin/CustomerOptionGroupsContext.php | 10 ++++++-- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/features/admin/customer_option_groups/configuring_validators.feature b/features/admin/customer_option_groups/configuring_validators.feature index 4c22d9ca..34d38221 100644 --- a/features/admin/customer_option_groups/configuring_validators.feature +++ b/features/admin/customer_option_groups/configuring_validators.feature @@ -159,8 +159,8 @@ Feature: Configuring validators Then the customer option group "Some Group" should have conditions: | option | comparator | value | error_message | | Text Option | equal | 5 | Oops | - | Select Option | in_set | Value-1, Value-3 | | - | Boolean Option | equal | true | | + | Select Option | in_set | Value-1, Value-3 | Oops | + | Boolean Option | equal | true | Oops | @ui Scenario: Multiple constraints are saved correctly @@ -187,10 +187,10 @@ Feature: Configuring validators And I save my changes Then the customer option group "Some Group" should have constraints: - | option | comparator | value | error_message | - | Text Option | equal | 5 | Oops | - | Select Option | in_set | "Value-1, Value-3" | | - | Boolean Option | equal | true | | + | option | comparator | value | error_message | + | Text Option | equal | 5 | Oops | + | Select Option | in_set | "Value-1, Value-3" | Oops | + | Boolean Option | equal | true | Oops | @ui Scenario: Saving multiple validators @@ -223,10 +223,10 @@ Feature: Configuring validators And I save my changes Then the customer option group "Some Group" should have conditions: - | condition_option | condition_comparator | condition_value | error_message | - | Text Option | lesser | 10 | msg 1 | - | Number Option | equal | 10 | msg 2 | + | option | comparator | value | error_message | + | Text Option | lesser | 10 | msg 1 | + | Number Option | equal | 10 | msg 2 | - And the customer option group "Some Group" should have constraints: - | option | comparator | value | error_message | - | Text Option | greater | 10 | msg 3 | + And the customer option group "Some Group" should have constraints: + | option | comparator | value | error_message | + | Text Option | greater | 10 | msg 3 | diff --git a/src/Form/Validator/ValueType.php b/src/Form/Validator/ValueType.php index d792352f..4dff6eea 100644 --- a/src/Form/Validator/ValueType.php +++ b/src/Form/Validator/ValueType.php @@ -42,7 +42,8 @@ function ($modelData) use ($options) { if ($modelData !== null && is_array($modelData) && array_key_exists('type', $modelData) - && $modelData['type'] === $newConfig['type']) { + && $modelData['type'] === $newConfig['type'] + ) { $modelData = $modelData['value']; $result = $modelData; } @@ -60,6 +61,8 @@ function ($modelData) use ($options) { if (isset($modelData['timezone'])) { $result->setTimezone(new \DateTimeZone($modelData['timezone'])); } + } else { + $result = $modelData; } } diff --git a/tests/Behat/Context/Admin/CustomerOptionGroupsContext.php b/tests/Behat/Context/Admin/CustomerOptionGroupsContext.php index 5d18c94d..e4e8efee 100644 --- a/tests/Behat/Context/Admin/CustomerOptionGroupsContext.php +++ b/tests/Behat/Context/Admin/CustomerOptionGroupsContext.php @@ -399,13 +399,15 @@ function (ValidatorInterface $validator) use ($conditionType): array { $flatConditionsToCheck = array_merge($flatConditionsToCheck, $conditionsArray); } - $result = false; + $result = true; foreach ($table->getHash() as $row) { foreach ($row as $key => $value) { $row[$key] = str_replace('"', '', $value); } + $hasCondition = false; + foreach ($flatConditionsToCheck as $condition) { /** @var CustomerOptionInterface $customerOption */ $customerOption = $condition->getCustomerOption(); @@ -428,10 +430,14 @@ function (ValidatorInterface $validator) use ($conditionType): array { if ($sameComp && $sameVal) { $expectedMessage = $row['error_message']; - $result = $condition->getValidator()->getErrorMessage()->getMessage() === $expectedMessage; + if ($condition->getValidator()->getErrorMessage()->getMessage() === $expectedMessage) { + $hasCondition = true; + } } } } + + $result = $result && $hasCondition; } Assert::true($result, 'The validator does not contain the condition');