diff --git a/.circleci/config.yml b/.circleci/config.yml index b286034c5..e7918c315 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,7 +6,7 @@ jobs: - image: devopsstacks/pm:n285-phpunit - image: circleci/mysql:8.0.13-ram command: | - mysqld --default-authentication-plugin='mysql_native_password' --optimizer-switch='derived_merge=off' --sql-mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' + mysqld --default-authentication-plugin='mysql_native_password' --optimizer-switch='derived_merge=off' --sql-mode='NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' --collation-server='utf8mb4_unicode_ci' --character-set-server='utf8mb4' environment: MYSQL_HOST: 127.0.0.1 MYSQL_ROOT_PASSWORD: 'password' @@ -27,7 +27,7 @@ jobs: - run: name: Run Test Units command: | - mkdir coverage + mkdir -p coverage vendor/phpunit/phpunit/phpunit --stop-on-error --testdox-html coverage/result.html --coverage-html coverage --verbose tests/unit/ - store_artifacts: path: coverage diff --git a/app/Factories/Factory.php b/app/Factories/Factory.php new file mode 100644 index 000000000..5c022db46 --- /dev/null +++ b/app/Factories/Factory.php @@ -0,0 +1,70 @@ +model ?: $resolver($this); + } +} diff --git a/app/Factories/HasFactory.php b/app/Factories/HasFactory.php new file mode 100644 index 000000000..fac4a1af0 --- /dev/null +++ b/app/Factories/HasFactory.php @@ -0,0 +1,28 @@ +count(is_numeric($parameters[0] ?? null) ? $parameters[0] : null) + ->state(is_array($parameters[0] ?? null) ? $parameters[0] : ($parameters[1] ?? [])); + } +} diff --git a/composer.json b/composer.json index 55d90c89b..3aff42b9a 100644 --- a/composer.json +++ b/composer.json @@ -53,11 +53,11 @@ "smarty/smarty": "2.6.31", "pdepend/pdepend": "@stable", "php-imap/php-imap": "^3.0", - "nikic/php-parser": "3.1.5", + "nikic/php-parser": "4.14", "laravel/tinker": "^2.0", "league/oauth2-client": "^2.4", "league/oauth2-google": "^3.0", - "tecnickcom/tcpdf": "6.3.*", + "tecnickcom/tcpdf": "6.4.*", "fzaninotto/faker": "^1.7", "predis/predis": "1.1.1", "phpmyadmin/sql-parser": "^5.3", @@ -67,7 +67,7 @@ }, "require-dev": { "guzzlehttp/guzzle": "^6.3", - "phpunit/phpunit": "8.5.26", + "phpunit/phpunit": "9.5", "filp/whoops": "~2.0", "behat/behat": "^3.3", "behat/mink-selenium2-driver": "^1.3", @@ -80,6 +80,7 @@ }, "psr-4": { "App\\": "app/", + "Database\\Factories\\": "database/factories/", "Maveriks\\": "framework/src/Maveriks/", "Tests\\": "tests/" }, diff --git a/composer.lock b/composer.lock index 031201aef..cbdf0209d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1b57ef1bce47dac643b35757970db68f", + "content-hash": "bb16e692fb3b44ddee2f62c8abf9d886", "packages": [ { "name": "aws/aws-crt-php", @@ -58,16 +58,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.222.12", + "version": "3.231.9", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "8503d393b3ebef20241931b1abc20cb2af494cb2" + "reference": "fbda3e544226b44f79ead89de78f220d30ef3796" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/8503d393b3ebef20241931b1abc20cb2af494cb2", - "reference": "8503d393b3ebef20241931b1abc20cb2af494cb2", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/fbda3e544226b44f79ead89de78f220d30ef3796", + "reference": "fbda3e544226b44f79ead89de78f220d30ef3796", "shasum": "" }, "require": { @@ -75,9 +75,9 @@ "ext-json": "*", "ext-pcre": "*", "ext-simplexml": "*", - "guzzlehttp/guzzle": "^5.3.3 || ^6.2.1 || ^7.0", + "guzzlehttp/guzzle": "^6.5.8 || ^7.4.5", "guzzlehttp/promises": "^1.4.0", - "guzzlehttp/psr7": "^1.7.0 || ^2.1.1", + "guzzlehttp/psr7": "^1.8.5 || ^2.3", "mtdowling/jmespath.php": "^2.6", "php": ">=5.5" }, @@ -85,6 +85,7 @@ "andrewsville/php-token-reflection": "^1.4", "aws/aws-php-sns-message-validator": "~1.0", "behat/behat": "~3.0", + "composer/composer": "^1.10.22", "doctrine/cache": "~1.4", "ext-dom": "*", "ext-openssl": "*", @@ -143,9 +144,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.222.12" + "source": "https://github.com/aws/aws-sdk-php/tree/3.231.9" }, - "time": "2022-05-13T18:15:34+00:00" + "time": "2022-07-19T18:14:37+00:00" }, { "name": "brick/math", @@ -960,24 +961,24 @@ }, { "name": "guzzlehttp/guzzle", - "version": "6.5.5", + "version": "6.5.8", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e" + "reference": "a52f0440530b54fa079ce76e8c5d196a42cad981" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/9d4290de1cfd701f38099ef7e183b64b4b7b0c5e", - "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/a52f0440530b54fa079ce76e8c5d196a42cad981", + "reference": "a52f0440530b54fa079ce76e8c5d196a42cad981", "shasum": "" }, "require": { "ext-json": "*", "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.6.1", + "guzzlehttp/psr7": "^1.9", "php": ">=5.5", - "symfony/polyfill-intl-idn": "^1.17.0" + "symfony/polyfill-intl-idn": "^1.17" }, "require-dev": { "ext-curl": "*", @@ -1006,10 +1007,40 @@ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" } ], "description": "Guzzle is a PHP HTTP client library", @@ -1025,9 +1056,23 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/6.5" + "source": "https://github.com/guzzle/guzzle/tree/6.5.8" }, - "time": "2020-06-16T21:01:06+00:00" + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "time": "2022-06-20T22:16:07+00:00" }, { "name": "guzzlehttp/promises", @@ -1115,16 +1160,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.8.5", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "337e3ad8e5716c15f9657bd214d16cc5e69df268" + "reference": "e98e3e6d4f86621a9b75f623996e6bbdeb4b9318" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/337e3ad8e5716c15f9657bd214d16cc5e69df268", - "reference": "337e3ad8e5716c15f9657bd214d16cc5e69df268", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/e98e3e6d4f86621a9b75f623996e6bbdeb4b9318", + "reference": "e98e3e6d4f86621a9b75f623996e6bbdeb4b9318", "shasum": "" }, "require": { @@ -1145,7 +1190,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -1205,7 +1250,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/1.8.5" + "source": "https://github.com/guzzle/psr7/tree/1.9.0" }, "funding": [ { @@ -1221,20 +1266,20 @@ "type": "tidelift" } ], - "time": "2022-03-20T21:51:18+00:00" + "time": "2022-06-20T21:43:03+00:00" }, { "name": "laravel/framework", - "version": "v8.83.12", + "version": "v8.83.20", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "2af2314989845db68dfbb65a54b8748ffaf26204" + "reference": "aa5908e83fccb18b135ca31aa0342cf4bd6909a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/2af2314989845db68dfbb65a54b8748ffaf26204", - "reference": "2af2314989845db68dfbb65a54b8748ffaf26204", + "url": "https://api.github.com/repos/laravel/framework/zipball/aa5908e83fccb18b135ca31aa0342cf4bd6909a8", + "reference": "aa5908e83fccb18b135ca31aa0342cf4bd6909a8", "shasum": "" }, "require": { @@ -1394,20 +1439,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2022-05-10T13:57:07+00:00" + "time": "2022-07-19T14:11:02+00:00" }, { "name": "laravel/serializable-closure", - "version": "v1.1.1", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/laravel/serializable-closure.git", - "reference": "9e4b005daa20b0c161f3845040046dc9ddc1d74e" + "reference": "09f0e9fb61829f628205b7c94906c28740ff9540" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/9e4b005daa20b0c161f3845040046dc9ddc1d74e", - "reference": "9e4b005daa20b0c161f3845040046dc9ddc1d74e", + "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/09f0e9fb61829f628205b7c94906c28740ff9540", + "reference": "09f0e9fb61829f628205b7c94906c28740ff9540", "shasum": "" }, "require": { @@ -1453,7 +1498,7 @@ "issues": "https://github.com/laravel/serializable-closure/issues", "source": "https://github.com/laravel/serializable-closure" }, - "time": "2022-02-11T19:23:53+00:00" + "time": "2022-05-16T17:09:47+00:00" }, { "name": "laravel/tinker", @@ -1525,16 +1570,16 @@ }, { "name": "league/commonmark", - "version": "2.3.0", + "version": "2.3.4", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "32a49eb2b38fe5e5c417ab748a45d0beaab97955" + "reference": "155ec1c95626b16fda0889cf15904d24890a60d5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/32a49eb2b38fe5e5c417ab748a45d0beaab97955", - "reference": "32a49eb2b38fe5e5c417ab748a45d0beaab97955", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/155ec1c95626b16fda0889cf15904d24890a60d5", + "reference": "155ec1c95626b16fda0889cf15904d24890a60d5", "shasum": "" }, "require": { @@ -1627,7 +1672,7 @@ "type": "tidelift" } ], - "time": "2022-04-07T22:37:05+00:00" + "time": "2022-07-17T16:25:47+00:00" }, { "name": "league/config", @@ -2121,16 +2166,16 @@ }, { "name": "monolog/monolog", - "version": "2.6.0", + "version": "2.7.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "247918972acd74356b0a91dfaa5adcaec069b6c0" + "reference": "5579edf28aee1190a798bfa5be8bc16c563bd524" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/247918972acd74356b0a91dfaa5adcaec069b6c0", - "reference": "247918972acd74356b0a91dfaa5adcaec069b6c0", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/5579edf28aee1190a798bfa5be8bc16c563bd524", + "reference": "5579edf28aee1190a798bfa5be8bc16c563bd524", "shasum": "" }, "require": { @@ -2209,7 +2254,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/2.6.0" + "source": "https://github.com/Seldaek/monolog/tree/2.7.0" }, "funding": [ { @@ -2221,7 +2266,7 @@ "type": "tidelift" } ], - "time": "2022-05-10T09:36:00+00:00" + "time": "2022-06-09T08:59:12+00:00" }, { "name": "mtdowling/jmespath.php", @@ -2286,16 +2331,16 @@ }, { "name": "nesbot/carbon", - "version": "2.58.0", + "version": "2.59.1", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "97a34af22bde8d0ac20ab34b29d7bfe360902055" + "reference": "a9000603ea337c8df16cc41f8b6be95a65f4d0f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/97a34af22bde8d0ac20ab34b29d7bfe360902055", - "reference": "97a34af22bde8d0ac20ab34b29d7bfe360902055", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/a9000603ea337c8df16cc41f8b6be95a65f4d0f5", + "reference": "a9000603ea337c8df16cc41f8b6be95a65f4d0f5", "shasum": "" }, "require": { @@ -2310,11 +2355,12 @@ "doctrine/orm": "^2.7", "friendsofphp/php-cs-fixer": "^3.0", "kylekatarnls/multi-tester": "^2.0", + "ondrejmirtes/better-reflection": "*", "phpmd/phpmd": "^2.9", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.12.54 || ^1.0", - "phpunit/php-file-iterator": "^2.0.5", - "phpunit/phpunit": "^7.5.20 || ^8.5.23", + "phpstan/phpstan": "^0.12.99 || ^1.7.14", + "phpunit/php-file-iterator": "^2.0.5 || ^3.0.6", + "phpunit/phpunit": "^7.5.20 || ^8.5.26 || ^9.5.20", "squizlabs/php_codesniffer": "^3.4" }, "bin": [ @@ -2371,15 +2417,19 @@ }, "funding": [ { - "url": "https://opencollective.com/Carbon", - "type": "open_collective" + "url": "https://github.com/sponsors/kylekatarnls", + "type": "github" }, { - "url": "https://tidelift.com/funding/github/packagist/nesbot/carbon", + "url": "https://opencollective.com/Carbon#sponsor", + "type": "opencollective" + }, + { + "url": "https://tidelift.com/subscription/pkg/packagist-nesbot-carbon?utm_source=packagist-nesbot-carbon&utm_medium=referral&utm_campaign=readme", "type": "tidelift" } ], - "time": "2022-04-25T19:31:17+00:00" + "time": "2022-06-29T21:43:55+00:00" }, { "name": "nette/schema", @@ -2530,24 +2580,25 @@ }, { "name": "nikic/php-parser", - "version": "v3.1.5", + "version": "v4.14.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce" + "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", - "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/34bea19b6e03d8153165d8f30bba4c3be86184c1", + "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.5" + "php": ">=7.0" }, "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" }, "bin": [ "bin/php-parse" @@ -2555,7 +2606,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.9-dev" } }, "autoload": { @@ -2579,9 +2630,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v3.1.5" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.14.0" }, - "time": "2018-02-28T20:30:58+00:00" + "time": "2022-05-31T20:59:12+00:00" }, { "name": "opis/closure", @@ -2650,16 +2701,16 @@ }, { "name": "paragonie/constant_time_encoding", - "version": "v2.5.0", + "version": "v2.6.3", "source": { "type": "git", "url": "https://github.com/paragonie/constant_time_encoding.git", - "reference": "9229e15f2e6ba772f0c55dd6986c563b937170a8" + "reference": "58c3f47f650c94ec05a151692652a868995d2938" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/9229e15f2e6ba772f0c55dd6986c563b937170a8", - "reference": "9229e15f2e6ba772f0c55dd6986c563b937170a8", + "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/58c3f47f650c94ec05a151692652a868995d2938", + "reference": "58c3f47f650c94ec05a151692652a868995d2938", "shasum": "" }, "require": { @@ -2713,7 +2764,7 @@ "issues": "https://github.com/paragonie/constant_time_encoding/issues", "source": "https://github.com/paragonie/constant_time_encoding" }, - "time": "2022-01-17T05:32:27+00:00" + "time": "2022-06-14T06:56:20+00:00" }, { "name": "paragonie/random_compat", @@ -3125,16 +3176,16 @@ }, { "name": "phpmailer/phpmailer", - "version": "v6.6.0", + "version": "v6.6.3", "source": { "type": "git", "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "e43bac82edc26ca04b36143a48bde1c051cfd5b1" + "reference": "9400f305a898f194caff5521f64e5dfa926626f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/e43bac82edc26ca04b36143a48bde1c051cfd5b1", - "reference": "e43bac82edc26ca04b36143a48bde1c051cfd5b1", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/9400f305a898f194caff5521f64e5dfa926626f3", + "reference": "9400f305a898f194caff5521f64e5dfa926626f3", "shasum": "" }, "require": { @@ -3146,8 +3197,8 @@ "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "doctrine/annotations": "^1.2", - "php-parallel-lint/php-console-highlighter": "^0.5.0", - "php-parallel-lint/php-parallel-lint": "^1.3.1", + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9.3.5", "roave/security-advisories": "dev-latest", "squizlabs/php_codesniffer": "^3.6.2", @@ -3191,7 +3242,7 @@ "description": "PHPMailer is a full-featured email creation and transfer class for PHP", "support": { "issues": "https://github.com/PHPMailer/PHPMailer/issues", - "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.6.0" + "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.6.3" }, "funding": [ { @@ -3199,7 +3250,7 @@ "type": "github" } ], - "time": "2022-02-28T15:31:21+00:00" + "time": "2022-06-20T09:21:02+00:00" }, { "name": "phpmyadmin/sql-parser", @@ -3840,16 +3891,16 @@ }, { "name": "psy/psysh", - "version": "v0.11.4", + "version": "v0.11.7", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "05c544b339b112226ad14803e1e5b09a61957454" + "reference": "77fc7270031fbc28f9a7bea31385da5c4855cb7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/05c544b339b112226ad14803e1e5b09a61957454", - "reference": "05c544b339b112226ad14803e1e5b09a61957454", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/77fc7270031fbc28f9a7bea31385da5c4855cb7a", + "reference": "77fc7270031fbc28f9a7bea31385da5c4855cb7a", "shasum": "" }, "require": { @@ -3910,9 +3961,9 @@ ], "support": { "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.11.4" + "source": "https://github.com/bobthecow/psysh/tree/v0.11.7" }, - "time": "2022-05-06T12:49:14+00:00" + "time": "2022-07-07T13:49:11+00:00" }, { "name": "ralouphie/getallheaders", @@ -4320,27 +4371,26 @@ }, { "name": "symfony/config", - "version": "v6.0.8", + "version": "v6.1.0", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "6ac50d559aa64c8e7b5b17640c46241e4accb487" + "reference": "ed8d12417bcacd2d969750feb1fe1aab1c11e613" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/6ac50d559aa64c8e7b5b17640c46241e4accb487", - "reference": "6ac50d559aa64c8e7b5b17640c46241e4accb487", + "url": "https://api.github.com/repos/symfony/config/zipball/ed8d12417bcacd2d969750feb1fe1aab1c11e613", + "reference": "ed8d12417bcacd2d969750feb1fe1aab1c11e613", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/deprecation-contracts": "^2.1|^3", "symfony/filesystem": "^5.4|^6.0", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php81": "^1.22" + "symfony/polyfill-ctype": "~1.8" }, "conflict": { - "symfony/finder": "<4.4" + "symfony/finder": "<5.4" }, "require-dev": { "symfony/event-dispatcher": "^5.4|^6.0", @@ -4378,7 +4428,7 @@ "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v6.0.8" + "source": "https://github.com/symfony/config/tree/v6.1.0" }, "funding": [ { @@ -4394,20 +4444,20 @@ "type": "tidelift" } ], - "time": "2022-04-12T16:11:42+00:00" + "time": "2022-05-17T12:56:32+00:00" }, { "name": "symfony/console", - "version": "v5.4.8", + "version": "v5.4.10", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "ffe3aed36c4d60da2cf1b0a1cee6b8f2e5fa881b" + "reference": "4d671ab4ddac94ee439ea73649c69d9d200b5000" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/ffe3aed36c4d60da2cf1b0a1cee6b8f2e5fa881b", - "reference": "ffe3aed36c4d60da2cf1b0a1cee6b8f2e5fa881b", + "url": "https://api.github.com/repos/symfony/console/zipball/4d671ab4ddac94ee439ea73649c69d9d200b5000", + "reference": "4d671ab4ddac94ee439ea73649c69d9d200b5000", "shasum": "" }, "require": { @@ -4477,7 +4527,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.8" + "source": "https://github.com/symfony/console/tree/v5.4.10" }, "funding": [ { @@ -4493,24 +4543,24 @@ "type": "tidelift" } ], - "time": "2022-04-12T16:02:29+00:00" + "time": "2022-06-26T13:00:04+00:00" }, { "name": "symfony/css-selector", - "version": "v6.0.3", + "version": "v6.1.0", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "1955d595c12c111629cc814d3f2a2ff13580508a" + "reference": "05c40f02f621609404b8820ff8bc39acb46e19cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/1955d595c12c111629cc814d3f2a2ff13580508a", - "reference": "1955d595c12c111629cc814d3f2a2ff13580508a", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/05c40f02f621609404b8820ff8bc39acb46e19cf", + "reference": "05c40f02f621609404b8820ff8bc39acb46e19cf", "shasum": "" }, "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "type": "library", "autoload": { @@ -4542,7 +4592,7 @@ "description": "Converts CSS selectors to XPath expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/css-selector/tree/v6.0.3" + "source": "https://github.com/symfony/css-selector/tree/v6.1.0" }, "funding": [ { @@ -4558,32 +4608,31 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:55:41+00:00" + "time": "2022-02-25T11:15:52+00:00" }, { "name": "symfony/dependency-injection", - "version": "v6.0.8", + "version": "v6.1.2", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "571041cd7e765664cc527b461ee41be3013aa08e" + "reference": "5635ff016a814d7984b1c4644ad28e7df546077b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/571041cd7e765664cc527b461ee41be3013aa08e", - "reference": "571041cd7e765664cc527b461ee41be3013aa08e", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/5635ff016a814d7984b1c4644ad28e7df546077b", + "reference": "5635ff016a814d7984b1c4644ad28e7df546077b", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", "psr/container": "^1.1|^2.0", "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-php81": "^1.22", "symfony/service-contracts": "^1.1.6|^2.0|^3.0" }, "conflict": { "ext-psr": "<1.1|>=2", - "symfony/config": "<5.4", + "symfony/config": "<6.1", "symfony/finder": "<5.4", "symfony/proxy-manager-bridge": "<5.4", "symfony/yaml": "<5.4" @@ -4593,7 +4642,7 @@ "symfony/service-implementation": "1.1|2.0|3.0" }, "require-dev": { - "symfony/config": "^5.4|^6.0", + "symfony/config": "^6.1", "symfony/expression-language": "^5.4|^6.0", "symfony/yaml": "^5.4|^6.0" }, @@ -4630,7 +4679,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v6.0.8" + "source": "https://github.com/symfony/dependency-injection/tree/v6.1.2" }, "funding": [ { @@ -4646,29 +4695,29 @@ "type": "tidelift" } ], - "time": "2022-04-26T13:22:23+00:00" + "time": "2022-06-26T13:01:30+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.0.1", + "version": "v3.1.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c" + "reference": "07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", - "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918", + "reference": "07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918", "shasum": "" }, "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.1-dev" }, "thanks": { "name": "symfony/contracts", @@ -4697,7 +4746,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.1" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.1.1" }, "funding": [ { @@ -4713,20 +4762,20 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:55:41+00:00" + "time": "2022-02-25T11:15:52+00:00" }, { "name": "symfony/error-handler", - "version": "v5.4.8", + "version": "v5.4.9", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "c1fcde614dfe99d62a83b796a53b8bad358b266a" + "reference": "c116cda1f51c678782768dce89a45f13c949455d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/c1fcde614dfe99d62a83b796a53b8bad358b266a", - "reference": "c1fcde614dfe99d62a83b796a53b8bad358b266a", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/c116cda1f51c678782768dce89a45f13c949455d", + "reference": "c116cda1f51c678782768dce89a45f13c949455d", "shasum": "" }, "require": { @@ -4768,7 +4817,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v5.4.8" + "source": "https://github.com/symfony/error-handler/tree/v5.4.9" }, "funding": [ { @@ -4784,24 +4833,24 @@ "type": "tidelift" } ], - "time": "2022-04-12T15:48:08+00:00" + "time": "2022-05-21T13:57:48+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v6.0.3", + "version": "v6.1.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "6472ea2dd415e925b90ca82be64b8bc6157f3934" + "reference": "a0449a7ad7daa0f7c0acd508259f80544ab5a347" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/6472ea2dd415e925b90ca82be64b8bc6157f3934", - "reference": "6472ea2dd415e925b90ca82be64b8bc6157f3934", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a0449a7ad7daa0f7c0acd508259f80544ab5a347", + "reference": "a0449a7ad7daa0f7c0acd508259f80544ab5a347", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/event-dispatcher-contracts": "^2|^3" }, "conflict": { @@ -4851,7 +4900,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v6.0.3" + "source": "https://github.com/symfony/event-dispatcher/tree/v6.1.0" }, "funding": [ { @@ -4867,24 +4916,24 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:55:41+00:00" + "time": "2022-05-05T16:51:07+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v3.0.1", + "version": "v3.1.1", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "7bc61cc2db649b4637d331240c5346dcc7708051" + "reference": "02ff5eea2f453731cfbc6bc215e456b781480448" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/7bc61cc2db649b4637d331240c5346dcc7708051", - "reference": "7bc61cc2db649b4637d331240c5346dcc7708051", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/02ff5eea2f453731cfbc6bc215e456b781480448", + "reference": "02ff5eea2f453731cfbc6bc215e456b781480448", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", "psr/event-dispatcher": "^1" }, "suggest": { @@ -4893,7 +4942,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.1-dev" }, "thanks": { "name": "symfony/contracts", @@ -4930,7 +4979,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.0.1" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.1.1" }, "funding": [ { @@ -4946,24 +4995,24 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:55:41+00:00" + "time": "2022-02-25T11:15:52+00:00" }, { "name": "symfony/filesystem", - "version": "v6.0.7", + "version": "v6.1.0", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "6c9e4c41f2c51dfde3db298594ed9cba55dbf5ff" + "reference": "3132d2f43ca799c2aa099f9738d98228c56baa5d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/6c9e4c41f2c51dfde3db298594ed9cba55dbf5ff", - "reference": "6c9e4c41f2c51dfde3db298594ed9cba55dbf5ff", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/3132d2f43ca799c2aa099f9738d98228c56baa5d", + "reference": "3132d2f43ca799c2aa099f9738d98228c56baa5d", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.8" }, @@ -4993,7 +5042,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.0.7" + "source": "https://github.com/symfony/filesystem/tree/v6.1.0" }, "funding": [ { @@ -5009,7 +5058,7 @@ "type": "tidelift" } ], - "time": "2022-04-01T12:54:51+00:00" + "time": "2022-05-21T13:34:40+00:00" }, { "name": "symfony/finder", @@ -5076,16 +5125,16 @@ }, { "name": "symfony/http-foundation", - "version": "v5.4.8", + "version": "v5.4.10", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "ff2818d1c3d49860bcae1f2cbb5eb00fcd3bf9e2" + "reference": "e7793b7906f72a8cc51054fbca9dcff7a8af1c1e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/ff2818d1c3d49860bcae1f2cbb5eb00fcd3bf9e2", - "reference": "ff2818d1c3d49860bcae1f2cbb5eb00fcd3bf9e2", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/e7793b7906f72a8cc51054fbca9dcff7a8af1c1e", + "reference": "e7793b7906f72a8cc51054fbca9dcff7a8af1c1e", "shasum": "" }, "require": { @@ -5129,7 +5178,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v5.4.8" + "source": "https://github.com/symfony/http-foundation/tree/v5.4.10" }, "funding": [ { @@ -5145,20 +5194,20 @@ "type": "tidelift" } ], - "time": "2022-04-22T08:14:12+00:00" + "time": "2022-06-19T13:13:40+00:00" }, { "name": "symfony/http-kernel", - "version": "v5.4.8", + "version": "v5.4.10", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "cf7e61106abfc19b305ca0aedc41724ced89a02a" + "reference": "255ae3b0a488d78fbb34da23d3e0c059874b5948" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/cf7e61106abfc19b305ca0aedc41724ced89a02a", - "reference": "cf7e61106abfc19b305ca0aedc41724ced89a02a", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/255ae3b0a488d78fbb34da23d3e0c059874b5948", + "reference": "255ae3b0a488d78fbb34da23d3e0c059874b5948", "shasum": "" }, "require": { @@ -5241,7 +5290,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v5.4.8" + "source": "https://github.com/symfony/http-kernel/tree/v5.4.10" }, "funding": [ { @@ -5257,20 +5306,20 @@ "type": "tidelift" } ], - "time": "2022-04-27T17:22:21+00:00" + "time": "2022-06-26T16:57:59+00:00" }, { "name": "symfony/mime", - "version": "v5.4.8", + "version": "v5.4.10", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "af49bc163ec3272f677bde3bc44c0d766c1fd662" + "reference": "02265e1e5111c3cd7480387af25e82378b7ab9cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/af49bc163ec3272f677bde3bc44c0d766c1fd662", - "reference": "af49bc163ec3272f677bde3bc44c0d766c1fd662", + "url": "https://api.github.com/repos/symfony/mime/zipball/02265e1e5111c3cd7480387af25e82378b7ab9cc", + "reference": "02265e1e5111c3cd7480387af25e82378b7ab9cc", "shasum": "" }, "require": { @@ -5324,7 +5373,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v5.4.8" + "source": "https://github.com/symfony/mime/tree/v5.4.10" }, "funding": [ { @@ -5340,20 +5389,20 @@ "type": "tidelift" } ], - "time": "2022-04-12T15:48:08+00:00" + "time": "2022-06-09T12:22:40+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "30885182c981ab175d4d034db0f6f469898070ab" + "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", - "reference": "30885182c981ab175d4d034db0f6f469898070ab", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", + "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", "shasum": "" }, "require": { @@ -5368,7 +5417,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5406,7 +5455,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.26.0" }, "funding": [ { @@ -5422,20 +5471,20 @@ "type": "tidelift" } ], - "time": "2021-10-20T20:35:02+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-iconv", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-iconv.git", - "reference": "f1aed619e28cb077fc83fac8c4c0383578356e40" + "reference": "143f1881e655bebca1312722af8068de235ae5dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/f1aed619e28cb077fc83fac8c4c0383578356e40", - "reference": "f1aed619e28cb077fc83fac8c4c0383578356e40", + "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/143f1881e655bebca1312722af8068de235ae5dc", + "reference": "143f1881e655bebca1312722af8068de235ae5dc", "shasum": "" }, "require": { @@ -5450,7 +5499,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5489,7 +5538,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-iconv/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-iconv/tree/v1.26.0" }, "funding": [ { @@ -5505,20 +5554,20 @@ "type": "tidelift" } ], - "time": "2022-01-04T09:04:05+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "81b86b50cf841a64252b439e738e97f4a34e2783" + "reference": "433d05519ce6990bf3530fba6957499d327395c2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/81b86b50cf841a64252b439e738e97f4a34e2783", - "reference": "81b86b50cf841a64252b439e738e97f4a34e2783", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/433d05519ce6990bf3530fba6957499d327395c2", + "reference": "433d05519ce6990bf3530fba6957499d327395c2", "shasum": "" }, "require": { @@ -5530,7 +5579,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5570,7 +5619,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.26.0" }, "funding": [ { @@ -5586,20 +5635,20 @@ "type": "tidelift" } ], - "time": "2021-11-23T21:10:46+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "749045c69efb97c70d25d7463abba812e91f3a44" + "reference": "59a8d271f00dd0e4c2e518104cc7963f655a1aa8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/749045c69efb97c70d25d7463abba812e91f3a44", - "reference": "749045c69efb97c70d25d7463abba812e91f3a44", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/59a8d271f00dd0e4c2e518104cc7963f655a1aa8", + "reference": "59a8d271f00dd0e4c2e518104cc7963f655a1aa8", "shasum": "" }, "require": { @@ -5613,7 +5662,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5657,7 +5706,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.26.0" }, "funding": [ { @@ -5673,20 +5722,20 @@ "type": "tidelift" } ], - "time": "2021-09-14T14:02:44+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" + "reference": "219aa369ceff116e673852dce47c3a41794c14bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/219aa369ceff116e673852dce47c3a41794c14bd", + "reference": "219aa369ceff116e673852dce47c3a41794c14bd", "shasum": "" }, "require": { @@ -5698,7 +5747,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5741,7 +5790,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.26.0" }, "funding": [ { @@ -5757,20 +5806,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" + "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", - "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", + "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", "shasum": "" }, "require": { @@ -5785,7 +5834,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5824,7 +5873,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0" }, "funding": [ { @@ -5840,20 +5889,20 @@ "type": "tidelift" } ], - "time": "2021-11-30T18:21:41+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "9a142215a36a3888e30d0a9eeea9766764e96976" + "reference": "bf44a9fd41feaac72b074de600314a93e2ae78e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9a142215a36a3888e30d0a9eeea9766764e96976", - "reference": "9a142215a36a3888e30d0a9eeea9766764e96976", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/bf44a9fd41feaac72b074de600314a93e2ae78e2", + "reference": "bf44a9fd41feaac72b074de600314a93e2ae78e2", "shasum": "" }, "require": { @@ -5862,7 +5911,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5900,7 +5949,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.26.0" }, "funding": [ { @@ -5916,20 +5965,20 @@ "type": "tidelift" } ], - "time": "2021-05-27T09:17:38+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5" + "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5", - "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/e440d35fa0286f77fb45b79a03fedbeda9307e85", + "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85", "shasum": "" }, "require": { @@ -5938,7 +5987,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5979,7 +6028,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.26.0" }, "funding": [ { @@ -5995,20 +6044,20 @@ "type": "tidelift" } ], - "time": "2021-06-05T21:20:04+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c" + "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c", - "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace", + "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace", "shasum": "" }, "require": { @@ -6017,7 +6066,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -6062,7 +6111,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0" }, "funding": [ { @@ -6078,20 +6127,20 @@ "type": "tidelift" } ], - "time": "2022-03-04T08:16:47+00:00" + "time": "2022-05-10T07:21:04+00:00" }, { "name": "symfony/polyfill-php81", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f" + "reference": "13f6d1271c663dc5ae9fb843a8f16521db7687a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", - "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/13f6d1271c663dc5ae9fb843a8f16521db7687a1", + "reference": "13f6d1271c663dc5ae9fb843a8f16521db7687a1", "shasum": "" }, "require": { @@ -6100,7 +6149,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -6141,7 +6190,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.26.0" }, "funding": [ { @@ -6157,7 +6206,7 @@ "type": "tidelift" } ], - "time": "2021-09-13T13:58:11+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/process", @@ -6313,16 +6362,16 @@ }, { "name": "symfony/service-contracts", - "version": "v2.5.1", + "version": "v2.5.2", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c" + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/24d9dc654b83e91aa59f9d167b131bc3b5bea24c", - "reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", "shasum": "" }, "require": { @@ -6376,7 +6425,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.1" + "source": "https://github.com/symfony/service-contracts/tree/v2.5.2" }, "funding": [ { @@ -6392,24 +6441,24 @@ "type": "tidelift" } ], - "time": "2022-03-13T20:07:29+00:00" + "time": "2022-05-30T19:17:29+00:00" }, { "name": "symfony/string", - "version": "v6.0.8", + "version": "v6.1.2", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "ac0aa5c2282e0de624c175b68d13f2c8f2e2649d" + "reference": "1903f2879875280c5af944625e8246d81c2f0604" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/ac0aa5c2282e0de624c175b68d13f2c8f2e2649d", - "reference": "ac0aa5c2282e0de624c175b68d13f2c8f2e2649d", + "url": "https://api.github.com/repos/symfony/string/zipball/1903f2879875280c5af944625e8246d81c2f0604", + "reference": "1903f2879875280c5af944625e8246d81c2f0604", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", @@ -6461,7 +6510,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.0.8" + "source": "https://github.com/symfony/string/tree/v6.1.2" }, "funding": [ { @@ -6477,24 +6526,24 @@ "type": "tidelift" } ], - "time": "2022-04-22T08:18:02+00:00" + "time": "2022-06-26T16:35:04+00:00" }, { "name": "symfony/translation", - "version": "v6.0.8", + "version": "v6.1.0", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "3d38cf8f8834148c4457681d539bc204de701501" + "reference": "b254416631615bc6fe49b0a67f18658827288147" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/3d38cf8f8834148c4457681d539bc204de701501", - "reference": "3d38cf8f8834148c4457681d539bc204de701501", + "url": "https://api.github.com/repos/symfony/translation/zipball/b254416631615bc6fe49b0a67f18658827288147", + "reference": "b254416631615bc6fe49b0a67f18658827288147", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/polyfill-mbstring": "~1.0", "symfony/translation-contracts": "^2.3|^3.0" }, @@ -6519,6 +6568,7 @@ "symfony/http-kernel": "^5.4|^6.0", "symfony/intl": "^5.4|^6.0", "symfony/polyfill-intl-icu": "^1.21", + "symfony/routing": "^5.4|^6.0", "symfony/service-contracts": "^1.1.2|^2|^3", "symfony/yaml": "^5.4|^6.0" }, @@ -6556,7 +6606,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v6.0.8" + "source": "https://github.com/symfony/translation/tree/v6.1.0" }, "funding": [ { @@ -6572,24 +6622,24 @@ "type": "tidelift" } ], - "time": "2022-04-22T08:18:02+00:00" + "time": "2022-05-11T12:12:29+00:00" }, { "name": "symfony/translation-contracts", - "version": "v3.0.1", + "version": "v3.1.1", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "c4183fc3ef0f0510893cbeedc7718fb5cafc9ac9" + "reference": "606be0f48e05116baef052f7f3abdb345c8e02cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/c4183fc3ef0f0510893cbeedc7718fb5cafc9ac9", - "reference": "c4183fc3ef0f0510893cbeedc7718fb5cafc9ac9", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/606be0f48e05116baef052f7f3abdb345c8e02cc", + "reference": "606be0f48e05116baef052f7f3abdb345c8e02cc", "shasum": "" }, "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "suggest": { "symfony/translation-implementation": "" @@ -6597,7 +6647,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.1-dev" }, "thanks": { "name": "symfony/contracts", @@ -6607,7 +6657,10 @@ "autoload": { "psr-4": { "Symfony\\Contracts\\Translation\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -6634,7 +6687,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/translation-contracts/tree/v3.0.1" + "source": "https://github.com/symfony/translation-contracts/tree/v3.1.1" }, "funding": [ { @@ -6650,20 +6703,20 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:55:41+00:00" + "time": "2022-06-27T17:24:16+00:00" }, { "name": "symfony/var-dumper", - "version": "v5.4.8", + "version": "v5.4.9", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "cdcadd343d31ad16fc5e006b0de81ea307435053" + "reference": "af52239a330fafd192c773795520dc2dd62b5657" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/cdcadd343d31ad16fc5e006b0de81ea307435053", - "reference": "cdcadd343d31ad16fc5e006b0de81ea307435053", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/af52239a330fafd192c773795520dc2dd62b5657", + "reference": "af52239a330fafd192c773795520dc2dd62b5657", "shasum": "" }, "require": { @@ -6723,7 +6776,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v5.4.8" + "source": "https://github.com/symfony/var-dumper/tree/v5.4.9" }, "funding": [ { @@ -6739,20 +6792,20 @@ "type": "tidelift" } ], - "time": "2022-04-26T13:19:20+00:00" + "time": "2022-05-21T10:24:18+00:00" }, { "name": "tecnickcom/tcpdf", - "version": "6.3.5", + "version": "6.4.4", "source": { "type": "git", "url": "https://github.com/tecnickcom/TCPDF.git", - "reference": "19a535eaa7fb1c1cac499109deeb1a7a201b4549" + "reference": "42cd0f9786af7e5db4fcedaa66f717b0d0032320" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/19a535eaa7fb1c1cac499109deeb1a7a201b4549", - "reference": "19a535eaa7fb1c1cac499109deeb1a7a201b4549", + "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/42cd0f9786af7e5db4fcedaa66f717b0d0032320", + "reference": "42cd0f9786af7e5db4fcedaa66f717b0d0032320", "shasum": "" }, "require": { @@ -6803,9 +6856,15 @@ ], "support": { "issues": "https://github.com/tecnickcom/TCPDF/issues", - "source": "https://github.com/tecnickcom/TCPDF/tree/6.3.5" + "source": "https://github.com/tecnickcom/TCPDF/tree/6.4.4" }, - "time": "2020-02-14T14:20:12+00:00" + "funding": [ + { + "url": "https://www.paypal.com/cgi-bin/webscr?cmd=_donations¤cy_code=GBP&business=paypal@tecnick.com&item_name=donation%20for%20tcpdf%20project", + "type": "custom" + } + ], + "time": "2021-12-31T08:39:24+00:00" }, { "name": "tijsverkoyen/css-to-inline-styles", @@ -7078,21 +7137,21 @@ }, { "name": "webmozart/assert", - "version": "1.10.0", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991", + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", - "symfony/polyfill-ctype": "^1.8" + "ext-ctype": "*", + "php": "^7.2 || ^8.0" }, "conflict": { "phpstan/phpstan": "<0.12.20", @@ -7130,24 +7189,24 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.10.0" + "source": "https://github.com/webmozarts/assert/tree/1.11.0" }, - "time": "2021-03-09T10:59:23+00:00" + "time": "2022-06-03T18:03:27+00:00" } ], "packages-dev": [ { "name": "behat/behat", - "version": "v3.10.0", + "version": "v3.11.0", "source": { "type": "git", "url": "https://github.com/Behat/Behat.git", - "reference": "a55661154079cf881ef643b303bfaf67bae3a09f" + "reference": "a19c72c78eb0cdf7b7c4dabfeec9eb3a282728fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Behat/Behat/zipball/a55661154079cf881ef643b303bfaf67bae3a09f", - "reference": "a55661154079cf881ef643b303bfaf67bae3a09f", + "url": "https://api.github.com/repos/Behat/Behat/zipball/a19c72c78eb0cdf7b7c4dabfeec9eb3a282728fc", + "reference": "a19c72c78eb0cdf7b7c4dabfeec9eb3a282728fc", "shasum": "" }, "require": { @@ -7155,7 +7214,7 @@ "behat/transliterator": "^1.2", "ext-mbstring": "*", "php": "^7.2 || ^8.0", - "psr/container": "^1.0", + "psr/container": "^1.0 || ^2.0", "symfony/config": "^4.4 || ^5.0 || ^6.0", "symfony/console": "^4.4 || ^5.0 || ^6.0", "symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0", @@ -7164,7 +7223,6 @@ "symfony/yaml": "^4.4 || ^5.0 || ^6.0" }, "require-dev": { - "container-interop/container-interop": "^1.2", "herrera-io/box": "~1.6.1", "phpunit/phpunit": "^8.5 || ^9.0", "symfony/process": "^4.4 || ^5.0 || ^6.0", @@ -7219,9 +7277,9 @@ ], "support": { "issues": "https://github.com/Behat/Behat/issues", - "source": "https://github.com/Behat/Behat/tree/v3.10.0" + "source": "https://github.com/Behat/Behat/tree/v3.11.0" }, - "time": "2021-11-02T20:09:40+00:00" + "time": "2022-07-07T09:49:27+00:00" }, { "name": "behat/gherkin", @@ -8070,40 +8128,44 @@ }, { "name": "phpunit/php-code-coverage", - "version": "7.0.15", + "version": "9.2.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "819f92bba8b001d4363065928088de22f25a3a48" + "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/819f92bba8b001d4363065928088de22f25a3a48", - "reference": "819f92bba8b001d4363065928088de22f25a3a48", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f", + "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-xmlwriter": "*", - "php": ">=7.2", - "phpunit/php-file-iterator": "^2.0.2", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.1.3 || ^4.0", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^4.2.2", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1.3" + "nikic/php-parser": "^4.13.0", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0.3", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" }, "require-dev": { - "phpunit/phpunit": "^8.2.2" + "phpunit/phpunit": "^9.3" }, "suggest": { - "ext-xdebug": "^2.7.2" + "ext-pcov": "*", + "ext-xdebug": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "7.0-dev" + "dev-master": "9.2-dev" } }, "autoload": { @@ -8131,7 +8193,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/7.0.15" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15" }, "funding": [ { @@ -8139,32 +8201,32 @@ "type": "github" } ], - "time": "2021-07-26T12:20:09+00:00" + "time": "2022-03-07T09:28:20+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "2.0.5", + "version": "3.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5" + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", - "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^8.5" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -8191,7 +8253,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.5" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" }, "funding": [ { @@ -8199,26 +8261,97 @@ "type": "github" } ], - "time": "2021-12-02T12:42:26+00:00" + "time": "2021-12-02T12:48:52+00:00" }, { - "name": "phpunit/php-text-template", - "version": "1.2.1", + "name": "phpunit/php-invoker", + "version": "3.1.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcntl": "*" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-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": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:58:55+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -8242,34 +8375,40 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1" + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" }, - "time": "2015-06-21T13:50:34+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T05:33:50+00:00" }, { "name": "phpunit/php-timer", - "version": "2.1.3", + "version": "5.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662" + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2454ae1765516d20c4ffe103d85a58a9a3bd5662", - "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^8.5" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -8295,7 +8434,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/2.1.3" + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" }, "funding": [ { @@ -8303,80 +8442,20 @@ "type": "github" } ], - "time": "2020-11-30T08:20:02+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "4.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/a853a0e183b9db7eed023d7933a858fa1c8d25a3", - "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": "^7.3 || ^8.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.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" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", - "source": "https://github.com/sebastianbergmann/php-token-stream/tree/master" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "abandoned": true, - "time": "2020-08-04T08:28:15+00:00" + "time": "2020-10-26T13:16:10+00:00" }, { "name": "phpunit/phpunit", - "version": "8.5.26", + "version": "9.5.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "ef117c59fc4c54a979021b26d08a3373e386606d" + "reference": "8e16c225d57c3d6808014df6b1dd7598d0a5bbbe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ef117c59fc4c54a979021b26d08a3373e386606d", - "reference": "ef117c59fc4c54a979021b26d08a3373e386606d", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8e16c225d57c3d6808014df6b1dd7598d0a5bbbe", + "reference": "8e16c225d57c3d6808014df6b1dd7598d0a5bbbe", "shasum": "" }, "require": { @@ -8387,32 +8466,35 @@ "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.0", - "phar-io/manifest": "^2.0.3", + "myclabs/deep-copy": "^1.10.1", + "phar-io/manifest": "^2.0.1", "phar-io/version": "^3.0.2", - "php": ">=7.2", - "phpspec/prophecy": "^1.10.3", - "phpunit/php-code-coverage": "^7.0.12", - "phpunit/php-file-iterator": "^2.0.4", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1.2", - "sebastian/comparator": "^3.0.2", - "sebastian/diff": "^3.0.2", - "sebastian/environment": "^4.2.3", - "sebastian/exporter": "^3.1.2", - "sebastian/global-state": "^3.0.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0.1", - "sebastian/type": "^1.1.3", - "sebastian/version": "^2.0.1" + "php": ">=7.3", + "phpspec/prophecy": "^1.12.1", + "phpunit/php-code-coverage": "^9.2.3", + "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-invoker": "^3.1.1", + "phpunit/php-text-template": "^2.0.3", + "phpunit/php-timer": "^5.0.2", + "sebastian/cli-parser": "^1.0.1", + "sebastian/code-unit": "^1.0.6", + "sebastian/comparator": "^4.0.5", + "sebastian/diff": "^4.0.3", + "sebastian/environment": "^5.1.3", + "sebastian/exporter": "^4.0.3", + "sebastian/global-state": "^5.0.1", + "sebastian/object-enumerator": "^4.0.3", + "sebastian/resource-operations": "^3.0.3", + "sebastian/type": "^2.3", + "sebastian/version": "^3.0.2" }, "require-dev": { - "ext-pdo": "*" + "ext-pdo": "*", + "phpspec/prophecy-phpunit": "^2.0.1" }, "suggest": { "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0.0" + "ext-xdebug": "*" }, "bin": [ "phpunit" @@ -8420,10 +8502,13 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "8.5-dev" + "dev-master": "9.5-dev" } }, "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], "classmap": [ "src/" ] @@ -8448,11 +8533,11 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.26" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.0" }, "funding": [ { - "url": "https://phpunit.de/sponsors.html", + "url": "https://phpunit.de/donate.html", "type": "custom" }, { @@ -8460,32 +8545,144 @@ "type": "github" } ], - "time": "2022-04-01T12:34:39+00:00" + "time": "2020-12-04T05:05:53+00:00" }, { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.2", + "name": "sebastian/cli-parser", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619" + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", - "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", "shasum": "" }, "require": { - "php": ">=5.6" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^8.5" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.0-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 for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:08:49+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "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": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:08:54+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" } }, "autoload": { @@ -8507,7 +8704,7 @@ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.2" + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" }, "funding": [ { @@ -8515,34 +8712,34 @@ "type": "github" } ], - "time": "2020-11-30T08:15:22+00:00" + "time": "2020-09-28T05:30:19+00:00" }, { "name": "sebastian/comparator", - "version": "3.0.3", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1071dfcef776a57013124ff35e1fc41ccd294758" + "reference": "55f4261989e546dc112258c7a75935a81a7ce382" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1071dfcef776a57013124ff35e1fc41ccd294758", - "reference": "1071dfcef776a57013124ff35e1fc41ccd294758", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", + "reference": "55f4261989e546dc112258c7a75935a81a7ce382", "shasum": "" }, "require": { - "php": ">=7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^8.5" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -8581,7 +8778,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" }, "funding": [ { @@ -8589,33 +8786,90 @@ "type": "github" } ], - "time": "2020-11-30T08:04:30+00:00" + "time": "2020-10-26T15:49:45+00:00" }, { - "name": "sebastian/diff", - "version": "3.0.3", + "name": "sebastian/complexity", + "version": "2.0.2", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211" + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/14f72dd46eaf2f2293cbe79c93cc0bc43161a211", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", "shasum": "" }, "require": { - "php": ">=7.1" + "nikic/php-parser": "^4.7", + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.0", - "symfony/process": "^2 || ^3.3 || ^4" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "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", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:52:27+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" } }, "autoload": { @@ -8647,7 +8901,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" }, "funding": [ { @@ -8655,27 +8909,27 @@ "type": "github" } ], - "time": "2020-11-30T07:59:04+00:00" + "time": "2020-10-26T13:10:38+00:00" }, { "name": "sebastian/environment", - "version": "4.2.4", + "version": "5.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0" + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", - "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.5" + "phpunit/phpunit": "^9.3" }, "suggest": { "ext-posix": "*" @@ -8683,7 +8937,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -8710,7 +8964,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/4.2.4" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" }, "funding": [ { @@ -8718,34 +8972,34 @@ "type": "github" } ], - "time": "2020-11-30T07:53:42+00:00" + "time": "2022-04-03T09:37:03+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.4", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db" + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", - "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", "shasum": "" }, "require": { - "php": ">=7.0", - "sebastian/recursion-context": "^3.0" + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "^8.5" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -8780,14 +9034,14 @@ } ], "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", + "homepage": "https://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.4" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" }, "funding": [ { @@ -8795,30 +9049,30 @@ "type": "github" } ], - "time": "2021-11-11T13:51:24+00:00" + "time": "2021-11-11T14:18:36+00:00" }, { "name": "sebastian/global-state", - "version": "3.0.2", + "version": "5.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921" + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/de036ec91d55d2a9e0db2ba975b512cdb1c23921", - "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", "shasum": "" }, "require": { - "php": ">=7.2", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^8.0" + "phpunit/phpunit": "^9.3" }, "suggest": { "ext-uopz": "*" @@ -8826,7 +9080,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -8851,7 +9105,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/3.0.2" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" }, "funding": [ { @@ -8859,34 +9113,91 @@ "type": "github" } ], - "time": "2022-02-10T06:55:38+00:00" + "time": "2022-02-14T08:28:10+00:00" }, { - "name": "sebastian/object-enumerator", - "version": "3.0.4", + "name": "sebastian/lines-of-code", + "version": "1.0.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2" + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", - "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", "shasum": "" }, "require": { - "php": ">=7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" + "nikic/php-parser": "^4.6", + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "1.0-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 for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-28T06:42:11+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" } }, "autoload": { @@ -8908,7 +9219,7 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.4" + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" }, "funding": [ { @@ -8916,32 +9227,32 @@ "type": "github" } ], - "time": "2020-11-30T07:40:27+00:00" + "time": "2020-10-26T13:12:34+00:00" }, { "name": "sebastian/object-reflector", - "version": "1.1.2", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d" + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", - "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", "shasum": "" }, "require": { - "php": ">=7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -8963,7 +9274,7 @@ "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.2" + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" }, "funding": [ { @@ -8971,32 +9282,32 @@ "type": "github" } ], - "time": "2020-11-30T07:37:18+00:00" + "time": "2020-10-26T13:14:26+00:00" }, { "name": "sebastian/recursion-context", - "version": "3.0.1", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb" + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb", - "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", "shasum": "" }, "require": { - "php": ">=7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -9026,7 +9337,7 @@ "homepage": "http://www.github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.1" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" }, "funding": [ { @@ -9034,29 +9345,32 @@ "type": "github" } ], - "time": "2020-11-30T07:34:24+00:00" + "time": "2020-10-26T13:17:30+00:00" }, { "name": "sebastian/resource-operations", - "version": "2.0.2", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3" + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/31d35ca87926450c44eae7e2611d45a7a65ea8b3", - "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -9078,7 +9392,7 @@ "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "support": { "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/2.0.2" + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" }, "funding": [ { @@ -9086,32 +9400,32 @@ "type": "github" } ], - "time": "2020-11-30T07:30:19+00:00" + "time": "2020-09-28T06:45:17+00:00" }, { "name": "sebastian/type", - "version": "1.1.4", + "version": "2.3.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4" + "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/0150cfbc4495ed2df3872fb31b26781e4e077eb4", - "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", "shasum": "" }, "require": { - "php": ">=7.2" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^8.2" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "2.3-dev" } }, "autoload": { @@ -9134,7 +9448,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/1.1.4" + "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" }, "funding": [ { @@ -9142,29 +9456,29 @@ "type": "github" } ], - "time": "2020-11-30T07:25:11+00:00" + "time": "2021-06-15T12:49:02+00:00" }, { "name": "sebastian/version", - "version": "2.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + "reference": "c6c1022351a901512170118436c764e473f6de8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", "shasum": "" }, "require": { - "php": ">=5.6" + "php": ">=7.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -9187,22 +9501,28 @@ "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/master" + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" }, - "time": "2016-10-03T07:35:21+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:39:44+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.6.2", + "version": "3.7.1", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a" + "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a", - "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", + "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", "shasum": "" }, "require": { @@ -9245,24 +9565,24 @@ "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, - "time": "2021-12-12T21:44:58+00:00" + "time": "2022-06-18T07:21:10+00:00" }, { "name": "symfony/yaml", - "version": "v6.0.3", + "version": "v6.1.2", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "e77f3ea0b21141d771d4a5655faa54f692b34af5" + "reference": "b01c4e7dc6a51cbf114567af04a19789fd1011fe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/e77f3ea0b21141d771d4a5655faa54f692b34af5", - "reference": "e77f3ea0b21141d771d4a5655faa54f692b34af5", + "url": "https://api.github.com/repos/symfony/yaml/zipball/b01c4e7dc6a51cbf114567af04a19789fd1011fe", + "reference": "b01c4e7dc6a51cbf114567af04a19789fd1011fe", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/polyfill-ctype": "^1.8" }, "conflict": { @@ -9303,7 +9623,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.0.3" + "source": "https://github.com/symfony/yaml/tree/v6.1.2" }, "funding": [ { @@ -9319,7 +9639,7 @@ "type": "tidelift" } ], - "time": "2022-01-26T17:23:29+00:00" + "time": "2022-06-20T12:01:07+00:00" }, { "name": "theseer/tokenizer", diff --git a/database/factories/AbeConfigurationFactory.php b/database/factories/AbeConfigurationFactory.php index 50f34ab21..09b4b4f49 100644 --- a/database/factories/AbeConfigurationFactory.php +++ b/database/factories/AbeConfigurationFactory.php @@ -1,35 +1,50 @@ define(\ProcessMaker\Model\AbeConfiguration::class, function (Faker $faker) { - $process = factory(\ProcessMaker\Model\Process::class)->create(); - $dynaform = factory(\ProcessMaker\Model\Dynaform::class)->create([ - 'PRO_UID' => $process->PRO_UID - ]); - $task = factory(\ProcessMaker\Model\Task::class)->create([ - 'PRO_UID' => $process->PRO_UID - ]); - $emailServer = factory(\ProcessMaker\Model\EmailServerModel::class)->create(); - return [ - 'ABE_UID' => G::generateUniqueID(), - 'PRO_UID' => $process->PRO_UID, - 'TAS_UID' => $task->TAS_UID, - 'ABE_TYPE' => $faker->randomElement(['', 'LINK']), - 'ABE_TEMPLATE' => 'actionByEmail.html', - 'ABE_DYN_TYPE' => 'NORMAL', - 'DYN_UID' => $dynaform->DYN_UID, - 'ABE_EMAIL_FIELD' => 'admin@processmaker.com', - 'ABE_ACTION_FIELD' => '', - 'ABE_CASE_NOTE_IN_RESPONSE' => $faker->randomElement(['0', '1']), - 'ABE_FORCE_LOGIN' => $faker->randomElement(['0', '1']), - 'ABE_CREATE_DATE' => $faker->dateTime(), - 'ABE_UPDATE_DATE' => $faker->dateTime(), - 'ABE_SUBJECT_FIELD' => '', - 'ABE_MAILSERVER_OR_MAILCURRENT' => 0, - 'ABE_CUSTOM_GRID' => serialize([]), - 'ABE_EMAIL_SERVER_UID' => $emailServer->MESS_UID, - 'ABE_ACTION_BODY_FIELD' => '', - 'ABE_EMAIL_SERVER_RECEIVER_UID' => '' - ]; -}); +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class AbeConfigurationFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + $process = \ProcessMaker\Model\Process::factory()->create(); + $dynaform = \ProcessMaker\Model\Dynaform::factory()->create([ + 'PRO_UID' => $process->PRO_UID + ]); + $task = \ProcessMaker\Model\Task::factory()->create([ + 'PRO_UID' => $process->PRO_UID + ]); + $emailServer = \ProcessMaker\Model\EmailServerModel::factory()->create(); + return [ + 'ABE_UID' => G::generateUniqueID(), + 'PRO_UID' => $process->PRO_UID, + 'TAS_UID' => $task->TAS_UID, + 'ABE_TYPE' => $this->faker->randomElement(['', 'LINK']), + 'ABE_TEMPLATE' => 'actionByEmail.html', + 'ABE_DYN_TYPE' => 'NORMAL', + 'DYN_UID' => $dynaform->DYN_UID, + 'ABE_EMAIL_FIELD' => 'admin@processmaker.com', + 'ABE_ACTION_FIELD' => '', + 'ABE_CASE_NOTE_IN_RESPONSE' => $this->faker->randomElement(['0', '1']), + 'ABE_FORCE_LOGIN' => $this->faker->randomElement(['0', '1']), + 'ABE_CREATE_DATE' => $this->faker->dateTime(), + 'ABE_UPDATE_DATE' => $this->faker->dateTime(), + 'ABE_SUBJECT_FIELD' => '', + 'ABE_MAILSERVER_OR_MAILCURRENT' => 0, + 'ABE_CUSTOM_GRID' => serialize([]), + 'ABE_EMAIL_SERVER_UID' => $emailServer->MESS_UID, + 'ABE_ACTION_BODY_FIELD' => '', + 'ABE_EMAIL_SERVER_RECEIVER_UID' => '' + ]; + } + +} diff --git a/database/factories/AbeRequestFactory.php b/database/factories/AbeRequestFactory.php index 387f10357..458451287 100644 --- a/database/factories/AbeRequestFactory.php +++ b/database/factories/AbeRequestFactory.php @@ -1,25 +1,40 @@ define(\ProcessMaker\Model\AbeRequest::class, function (Faker $faker) { - $process = factory(\ProcessMaker\Model\Process::class)->create(); - $abeConfiguration = factory(\ProcessMaker\Model\AbeConfiguration::class)->create([ - 'PRO_UID' => $process->PRO_UID - ]); - $application = factory(\ProcessMaker\Model\Application::class)->create([ - 'PRO_UID' => $process->PRO_UID - ]); - return [ - 'ABE_REQ_UID' => G::generateUniqueID(), - 'ABE_UID' => $abeConfiguration->ABE_UID, - 'APP_UID' => $application->APP_UID, - 'DEL_INDEX' => 0, - 'ABE_REQ_SENT_TO' => $faker->email, - 'ABE_REQ_SUBJECT' => '', - 'ABE_REQ_BODY' => '', - 'ABE_REQ_DATE' => $faker->date(), - 'ABE_REQ_STATUS' => '', - 'ABE_REQ_ANSWERED' => $faker->numberBetween(1, 9) - ]; -}); +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class AbeRequestFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + $process = \ProcessMaker\Model\Process::factory()->create(); + $abeConfiguration = \ProcessMaker\Model\AbeConfiguration::factory()->create([ + 'PRO_UID' => $process->PRO_UID + ]); + $application = \ProcessMaker\Model\Application::factory()->create([ + 'PRO_UID' => $process->PRO_UID + ]); + return [ + 'ABE_REQ_UID' => G::generateUniqueID(), + 'ABE_UID' => $abeConfiguration->ABE_UID, + 'APP_UID' => $application->APP_UID, + 'DEL_INDEX' => 0, + 'ABE_REQ_SENT_TO' => $this->faker->email, + 'ABE_REQ_SUBJECT' => '', + 'ABE_REQ_BODY' => '', + 'ABE_REQ_DATE' => $this->faker->date(), + 'ABE_REQ_STATUS' => '', + 'ABE_REQ_ANSWERED' => $this->faker->numberBetween(1, 9) + ]; + } + +} diff --git a/database/factories/AdditionalTablesFactory.php b/database/factories/AdditionalTablesFactory.php index 184bfe1b3..be67f30cf 100644 --- a/database/factories/AdditionalTablesFactory.php +++ b/database/factories/AdditionalTablesFactory.php @@ -1,29 +1,44 @@ define(\ProcessMaker\Model\AdditionalTables::class, function(Faker $faker) { - $name = $faker->regexify("/[a-zA-Z]{6}/"); - return [ - 'ADD_TAB_UID' => G::generateUniqueID(), - 'ADD_TAB_NAME' => 'PMT_' . strtoupper($name), - 'ADD_TAB_CLASS_NAME' => 'Pmt' . $name, - 'ADD_TAB_DESCRIPTION' => $faker->text, - 'ADD_TAB_SDW_LOG_INSERT' => 0, - 'ADD_TAB_SDW_LOG_UPDATE' => 0, - 'ADD_TAB_SDW_LOG_DELETE' => 0, - 'ADD_TAB_SDW_LOG_SELECT' => 0, - 'ADD_TAB_SDW_MAX_LENGTH' => 0, - 'ADD_TAB_SDW_AUTO_DELETE' => 0, - 'ADD_TAB_PLG_UID' => '', - 'DBS_UID' => 'workflow', - 'PRO_UID' => function() { - return factory(\ProcessMaker\Model\Process::class)->create()->PRO_UID; - }, - 'ADD_TAB_TYPE' => '', - 'ADD_TAB_GRID' => '', - 'ADD_TAB_TAG' => '', - 'ADD_TAB_OFFLINE' => 0, - 'ADD_TAB_UPDATE_DATE' => $faker->dateTime() - ]; -}); +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class AdditionalTablesFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + $name = $this->faker->regexify("/[a-zA-Z]{6}/"); + return [ + 'ADD_TAB_UID' => G::generateUniqueID(), + 'ADD_TAB_NAME' => 'PMT_' . strtoupper($name), + 'ADD_TAB_CLASS_NAME' => 'Pmt' . $name, + 'ADD_TAB_DESCRIPTION' => $this->faker->text, + 'ADD_TAB_SDW_LOG_INSERT' => 0, + 'ADD_TAB_SDW_LOG_UPDATE' => 0, + 'ADD_TAB_SDW_LOG_DELETE' => 0, + 'ADD_TAB_SDW_LOG_SELECT' => 0, + 'ADD_TAB_SDW_MAX_LENGTH' => 0, + 'ADD_TAB_SDW_AUTO_DELETE' => 0, + 'ADD_TAB_PLG_UID' => '', + 'DBS_UID' => 'workflow', + 'PRO_UID' => function () { + return \ProcessMaker\Model\Process::factory()->create()->PRO_UID; + }, + 'ADD_TAB_TYPE' => '', + 'ADD_TAB_GRID' => '', + 'ADD_TAB_TAG' => '', + 'ADD_TAB_OFFLINE' => 0, + 'ADD_TAB_UPDATE_DATE' => $this->faker->dateTime() + ]; + } + +} diff --git a/database/factories/AppAssignSelfServiceValueFactory.php b/database/factories/AppAssignSelfServiceValueFactory.php index e2ca710f4..30f504bc3 100644 --- a/database/factories/AppAssignSelfServiceValueFactory.php +++ b/database/factories/AppAssignSelfServiceValueFactory.php @@ -1,18 +1,30 @@ define(\ProcessMaker\Model\AppAssignSelfServiceValue::class, function(Faker $faker) { - return [ - 'ID' => $faker->unique()->numberBetween(5000), - 'APP_UID' => G::generateUniqueID(), - 'DEL_INDEX' => 2, - 'PRO_UID' => G::generateUniqueID(), - 'TAS_UID' => G::generateUniqueID(), - 'TAS_ID' => $faker->unique()->numberBetween(1, 2000), - 'GRP_UID' => G::generateUniqueID(), - ]; -}); +namespace Database\Factories; +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class AppAssignSelfServiceValueFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'ID' => $this->faker->unique()->numberBetween(5000), + 'APP_UID' => G::generateUniqueID(), + 'DEL_INDEX' => 2, + 'PRO_UID' => G::generateUniqueID(), + 'TAS_UID' => G::generateUniqueID(), + 'TAS_ID' => $this->faker->unique()->numberBetween(1, 2000), + 'GRP_UID' => G::generateUniqueID(), + ]; + } + +} diff --git a/database/factories/AppAssignSelfServiceValueGroupFactory.php b/database/factories/AppAssignSelfServiceValueGroupFactory.php index 85a96729a..805736bbe 100644 --- a/database/factories/AppAssignSelfServiceValueGroupFactory.php +++ b/database/factories/AppAssignSelfServiceValueGroupFactory.php @@ -1,15 +1,27 @@ define(\ProcessMaker\Model\AppAssignSelfServiceValueGroup::class, function(Faker $faker) { - return [ - 'ID' => $faker->unique()->numberBetween(5000), - 'GRP_UID' => G::generateUniqueID(), - 'ASSIGNEE_ID' => $faker->unique()->numberBetween(1, 2000), - 'ASSIGNEE_TYPE' => $faker->unique()->numberBetween(1, 2000), - ]; -}); +namespace Database\Factories; +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class AppAssignSelfServiceValueGroupFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'ID' => $this->faker->unique()->numberBetween(5000), + 'GRP_UID' => G::generateUniqueID(), + 'ASSIGNEE_ID' => $this->faker->unique()->numberBetween(1, 2000), + 'ASSIGNEE_TYPE' => $this->faker->unique()->numberBetween(1, 2000), + ]; + } + +} diff --git a/database/factories/AppDelayFactory.php b/database/factories/AppDelayFactory.php index fee432649..acfeba695 100644 --- a/database/factories/AppDelayFactory.php +++ b/database/factories/AppDelayFactory.php @@ -1,62 +1,84 @@ define(\ProcessMaker\Model\AppDelay::class, function (Faker $faker) { - $actions = ['CANCEL', 'PAUSE', 'REASSIGN']; - return [ - 'APP_DELAY_UID' => G::generateUniqueID(), - 'PRO_UID' => G::generateUniqueID(), - 'APP_UID' => G::generateUniqueID(), - 'APP_NUMBER' => $faker->unique()->numberBetween(1000), - 'APP_THREAD_INDEX' => $faker->unique()->numberBetween(100), - 'APP_DEL_INDEX' => $faker->unique()->numberBetween(100), - 'APP_TYPE' => $faker->randomElement($actions), - 'APP_STATUS' => 'TO_DO', - 'APP_NEXT_TASK' => 0, - 'APP_DELEGATION_USER' => G::generateUniqueID(), - 'APP_ENABLE_ACTION_USER' => G::generateUniqueID(), - 'APP_ENABLE_ACTION_DATE' => $faker->dateTime(), - 'APP_DISABLE_ACTION_USER' => G::generateUniqueID(), - 'APP_DISABLE_ACTION_DATE' => $faker->dateTime(), - 'APP_AUTOMATIC_DISABLED_DATE' => '', - 'APP_DELEGATION_USER_ID' => $faker->unique()->numberBetween(1000), - 'PRO_ID' => $faker->unique()->numberBetween(1000), - ]; -}); +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; -// Create a delegation with the foreign keys -$factory->state(\ProcessMaker\Model\AppDelay::class, 'paused_foreign_keys', function (Faker $faker) { - // Create values in the foreign key relations - $delegation1 = factory(\ProcessMaker\Model\Delegation::class)->states('closed')->create(); - $delegation2 = factory(\ProcessMaker\Model\Delegation::class)->states('foreign_keys')->create([ - 'PRO_UID' => $delegation1->PRO_UID, - 'PRO_ID' => $delegation1->PRO_ID, - 'TAS_UID' => $delegation1->TAS_UID, - 'TAS_ID' => $delegation1->TAS_ID, - 'APP_NUMBER' => $delegation1->APP_NUMBER, - 'APP_UID' => $delegation1->APP_UID, - 'DEL_THREAD_STATUS' => 'OPEN', - 'USR_UID' => $delegation1->USR_UID, - 'USR_ID' => $delegation1->USR_ID, - 'DEL_PREVIOUS' => $delegation1->DEL_INDEX, - 'DEL_INDEX' => $faker->unique()->numberBetween(2000), - ]); +class AppDelayFactory extends Factory +{ - // Return with default values - return [ - 'APP_DELAY_UID' => G::generateUniqueID(), - 'PRO_UID' => $delegation2->PRO_UID, - 'PRO_ID' => $delegation2->PRO_ID, - 'APP_UID' => $delegation2->APP_UID, - 'APP_NUMBER' => $delegation2->APP_NUMBER, - 'APP_DEL_INDEX' => $delegation2->DEL_INDEX, - 'APP_TYPE' => 'PAUSE', - 'APP_STATUS' => 'TO_DO', - 'APP_DELEGATION_USER' => $delegation2->USR_UID, - 'APP_DELEGATION_USER_ID' => $delegation2->USR_ID, - 'APP_ENABLE_ACTION_USER' => G::generateUniqueID(), - 'APP_ENABLE_ACTION_DATE' => $faker->dateTime(), - 'APP_DISABLE_ACTION_USER' => 0, - ]; -}); + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + $actions = ['CANCEL', 'PAUSE', 'REASSIGN']; + return [ + 'APP_DELAY_UID' => G::generateUniqueID(), + 'PRO_UID' => G::generateUniqueID(), + 'APP_UID' => G::generateUniqueID(), + 'APP_NUMBER' => $this->faker->unique()->numberBetween(1000), + 'APP_THREAD_INDEX' => $this->faker->unique()->numberBetween(100), + 'APP_DEL_INDEX' => $this->faker->unique()->numberBetween(100), + 'APP_TYPE' => $this->faker->randomElement($actions), + 'APP_STATUS' => 'TO_DO', + 'APP_NEXT_TASK' => 0, + 'APP_DELEGATION_USER' => G::generateUniqueID(), + 'APP_ENABLE_ACTION_USER' => G::generateUniqueID(), + 'APP_ENABLE_ACTION_DATE' => $this->faker->dateTime(), + 'APP_DISABLE_ACTION_USER' => G::generateUniqueID(), + 'APP_DISABLE_ACTION_DATE' => $this->faker->dateTime(), + 'APP_AUTOMATIC_DISABLED_DATE' => '', + 'APP_DELEGATION_USER_ID' => $this->faker->unique()->numberBetween(1000), + 'PRO_ID' => $this->faker->unique()->numberBetween(1000), + ]; + } + + /** + * Create a delegation with the foreign keys + * @return type + */ + public function paused_foreign_keys() + { + $state = function (array $attributes) { + // Create values in the foreign key relations + $delegation1 = \ProcessMaker\Model\Delegation::factory()->closed()->create(); + $delegation2 = \ProcessMaker\Model\Delegation::factory()->foreign_keys()->create([ + 'PRO_UID' => $delegation1->PRO_UID, + 'PRO_ID' => $delegation1->PRO_ID, + 'TAS_UID' => $delegation1->TAS_UID, + 'TAS_ID' => $delegation1->TAS_ID, + 'APP_NUMBER' => $delegation1->APP_NUMBER, + 'APP_UID' => $delegation1->APP_UID, + 'DEL_THREAD_STATUS' => 'OPEN', + 'USR_UID' => $delegation1->USR_UID, + 'USR_ID' => $delegation1->USR_ID, + 'DEL_PREVIOUS' => $delegation1->DEL_INDEX, + 'DEL_INDEX' => $this->faker->unique()->numberBetween(2000), + ]); + + // Return with default values + return [ + 'APP_DELAY_UID' => G::generateUniqueID(), + 'PRO_UID' => $delegation2->PRO_UID, + 'PRO_ID' => $delegation2->PRO_ID, + 'APP_UID' => $delegation2->APP_UID, + 'APP_NUMBER' => $delegation2->APP_NUMBER, + 'APP_DEL_INDEX' => $delegation2->DEL_INDEX, + 'APP_TYPE' => 'PAUSE', + 'APP_STATUS' => 'TO_DO', + 'APP_DELEGATION_USER' => $delegation2->USR_UID, + 'APP_DELEGATION_USER_ID' => $delegation2->USR_ID, + 'APP_ENABLE_ACTION_USER' => G::generateUniqueID(), + 'APP_ENABLE_ACTION_DATE' => $this->faker->dateTime(), + 'APP_DISABLE_ACTION_USER' => 0, + ]; + }; + return $this->state($state); + } + +} diff --git a/database/factories/AppMessageFactory.php b/database/factories/AppMessageFactory.php index 3c7a1a997..96ff470bf 100644 --- a/database/factories/AppMessageFactory.php +++ b/database/factories/AppMessageFactory.php @@ -1,37 +1,52 @@ define(\ProcessMaker\Model\AppMessage::class, function(Faker $faker) { - return [ - 'APP_MSG_UID' => G::generateUniqueID(), - 'MSG_UID' => '', - 'APP_UID' => function() { - return factory(\ProcessMaker\Model\Application::class)->create()->APP_UID; - }, - 'DEL_INDEX' => 1, - 'APP_MSG_TYPE' => 'ROUTING', - 'APP_MSG_TYPE_ID' => 0, - 'APP_MSG_SUBJECT' => $faker->title, - 'APP_MSG_FROM' => $faker->email, - 'APP_MSG_TO' => $faker->email, - 'APP_MSG_BODY' => $faker->text, - 'APP_MSG_DATE' => $faker->dateTime(), - 'APP_MSG_CC' => '', - 'APP_MSG_BCC' => '', - 'APP_MSG_TEMPLATE' => '', - 'APP_MSG_STATUS' => 'pending', - 'APP_MSG_STATUS_ID' => 1, - 'APP_MSG_ATTACH' => '', - 'APP_MSG_SEND_DATE' => $faker->dateTime(), - 'APP_MSG_SHOW_MESSAGE' => 1, - 'APP_MSG_ERROR' => '', - 'PRO_ID' => function() { - return factory(\ProcessMaker\Model\Process::class)->create()->PRO_ID; - }, - 'TAS_ID' => function() { - return factory(\ProcessMaker\Model\Task::class)->create()->TAS_ID; - }, - 'APP_NUMBER' => 1 - ]; -}); +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class AppMessageFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'APP_MSG_UID' => G::generateUniqueID(), + 'MSG_UID' => '', + 'APP_UID' => function () { + return \ProcessMaker\Model\Application::factory()->create()->APP_UID; + }, + 'DEL_INDEX' => 1, + 'APP_MSG_TYPE' => 'ROUTING', + 'APP_MSG_TYPE_ID' => 0, + 'APP_MSG_SUBJECT' => $this->faker->title, + 'APP_MSG_FROM' => $this->faker->email, + 'APP_MSG_TO' => $this->faker->email, + 'APP_MSG_BODY' => $this->faker->text, + 'APP_MSG_DATE' => $this->faker->dateTime(), + 'APP_MSG_CC' => '', + 'APP_MSG_BCC' => '', + 'APP_MSG_TEMPLATE' => '', + 'APP_MSG_STATUS' => 'pending', + 'APP_MSG_STATUS_ID' => 1, + 'APP_MSG_ATTACH' => '', + 'APP_MSG_SEND_DATE' => $this->faker->dateTime(), + 'APP_MSG_SHOW_MESSAGE' => 1, + 'APP_MSG_ERROR' => '', + 'PRO_ID' => function () { + return \ProcessMaker\Model\Process::factory()->create()->PRO_ID; + }, + 'TAS_ID' => function () { + return \ProcessMaker\Model\Task::factory()->create()->TAS_ID; + }, + 'APP_NUMBER' => 1 + ]; + } + +} diff --git a/database/factories/AppNotesFactory.php b/database/factories/AppNotesFactory.php index c034a285e..c135fb4ea 100644 --- a/database/factories/AppNotesFactory.php +++ b/database/factories/AppNotesFactory.php @@ -1,42 +1,63 @@ define(\ProcessMaker\Model\AppNotes::class, function (Faker $faker) { - return [ - 'APP_UID' => G::generateUniqueID(), - 'APP_NUMBER' => $faker->unique()->numberBetween(5000), - 'USR_UID' => G::generateUniqueID(), - 'NOTE_DATE' => $faker->dateTime(), - 'NOTE_CONTENT' => $faker->sentence(3), - 'NOTE_TYPE' => 'USER', - 'NOTE_AVAILABILITY' => 'PUBLIC', - 'NOTE_ORIGIN_OBJ' => '', - 'NOTE_AFFECTED_OBJ1' => '', - 'NOTE_AFFECTED_OBJ2' => '', - 'NOTE_RECIPIENTS' => '', - ]; -}); +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; -// Create a case notes with the foreign keys -$factory->state(\ProcessMaker\Model\AppNotes::class, 'foreign_keys', function (Faker $faker) { - // Create values in the foreign key relations - $application = factory(\ProcessMaker\Model\Application::class)->create(); - $user = factory(\ProcessMaker\Model\User::class)->create(); +class AppNotesFactory extends Factory +{ - // Return with default values - return [ - 'APP_UID' => $application->APP_UID, - 'APP_NUMBER' => $application->APP_NUMBER, - 'USR_UID' => $user->USR_UID, - 'NOTE_DATE' => $faker->dateTime(), - 'NOTE_CONTENT' => $faker->sentence(3), - 'NOTE_TYPE' => 'USER', - 'NOTE_AVAILABILITY' => 'PUBLIC', - 'NOTE_ORIGIN_OBJ' => '', - 'NOTE_AFFECTED_OBJ1' => '', - 'NOTE_AFFECTED_OBJ2' => '', - 'NOTE_RECIPIENTS' => '', - ]; -}); + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'APP_UID' => G::generateUniqueID(), + 'APP_NUMBER' => $this->faker->unique()->numberBetween(5000), + 'USR_UID' => G::generateUniqueID(), + 'NOTE_DATE' => $this->faker->dateTime(), + 'NOTE_CONTENT' => $this->faker->sentence(3), + 'NOTE_TYPE' => 'USER', + 'NOTE_AVAILABILITY' => 'PUBLIC', + 'NOTE_ORIGIN_OBJ' => '', + 'NOTE_AFFECTED_OBJ1' => '', + 'NOTE_AFFECTED_OBJ2' => '', + 'NOTE_RECIPIENTS' => '', + ]; + } + /** + * Create a case notes with the foreign keys + * @return type + */ + public function foreign_keys() + { + $state = function (array $attributes) { + // Create values in the foreign key relations + $application = \ProcessMaker\Model\Application::factory()->create(); + $user = \ProcessMaker\Model\User::factory()->create(); + + // Return with default values + return [ + 'APP_UID' => $application->APP_UID, + 'APP_NUMBER' => $application->APP_NUMBER, + 'USR_UID' => $user->USR_UID, + 'NOTE_DATE' => $this->faker->dateTime(), + 'NOTE_CONTENT' => $this->faker->sentence(3), + 'NOTE_TYPE' => 'USER', + 'NOTE_AVAILABILITY' => 'PUBLIC', + 'NOTE_ORIGIN_OBJ' => '', + 'NOTE_AFFECTED_OBJ1' => '', + 'NOTE_AFFECTED_OBJ2' => '', + 'NOTE_RECIPIENTS' => '', + ]; + }; + return $this->state($state); + } + +} diff --git a/database/factories/AppThreadFactory.php b/database/factories/AppThreadFactory.php index 33590b0d8..326ff3c3c 100644 --- a/database/factories/AppThreadFactory.php +++ b/database/factories/AppThreadFactory.php @@ -1,16 +1,28 @@ define(\ProcessMaker\Model\AppThread::class, function (Faker $faker) { - return [ - 'APP_UID' => G::generateUniqueID(), - 'APP_THREAD_INDEX' => $faker->unique()->numberBetween(1, 2000), - 'APP_THREAD_PARENT' => $faker->unique()->numberBetween(1, 2000), - 'APP_THREAD_STATUS' => $faker->randomElement(['OPEN', 'CLOSED']), - 'DEL_INDEX' => $faker->unique()->numberBetween(1, 2000) - ]; -}); \ No newline at end of file +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class AppThreadFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'APP_UID' => G::generateUniqueID(), + 'APP_THREAD_INDEX' => $this->faker->unique()->numberBetween(1, 2000), + 'APP_THREAD_PARENT' => $this->faker->unique()->numberBetween(1, 2000), + 'APP_THREAD_STATUS' => $this->faker->randomElement(['OPEN', 'CLOSED']), + 'DEL_INDEX' => $this->faker->unique()->numberBetween(1, 2000) + ]; + } + +} diff --git a/database/factories/AppTimeoutActionFactory.php b/database/factories/AppTimeoutActionFactory.php index c9a120d07..b51318d38 100644 --- a/database/factories/AppTimeoutActionFactory.php +++ b/database/factories/AppTimeoutActionFactory.php @@ -1,12 +1,27 @@ define(\ProcessMaker\Model\AppTimeoutAction::class, function (Faker $faker) { - $index = $faker->unique()->numberBetween(20); - return [ - 'APP_UID' => G::generateUniqueID(), - 'DEL_INDEX' => $index, - 'EXECUTION_DATE' => $faker->dateTime() - ]; -}); +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class AppTimeoutActionFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + $index = $this->faker->unique()->numberBetween(20); + return [ + 'APP_UID' => G::generateUniqueID(), + 'DEL_INDEX' => $index, + 'EXECUTION_DATE' => $this->faker->dateTime() + ]; + } + +} diff --git a/database/factories/ApplicationFactory.php b/database/factories/ApplicationFactory.php index 74ba1720d..91944ee88 100644 --- a/database/factories/ApplicationFactory.php +++ b/database/factories/ApplicationFactory.php @@ -1,147 +1,233 @@ define(\ProcessMaker\Model\Application::class, function(Faker $faker) { - $user = factory(\ProcessMaker\Model\User::class)->create(); - $appNumber = $faker->unique()->numberBetween(1000); - // APP_TITLE field is used in 'MYSQL: MATCH() AGAINST()' function, string size should not be less than 3. - $appTitle = $faker->lexify(str_repeat('?', rand(3, 5)) . ' ' . str_repeat('?', rand(3, 5))); - return [ - 'APP_UID' => G::generateUniqueID(), - 'APP_TITLE' => $appTitle, - 'APP_DESCRIPTION' => $faker->text, - 'APP_NUMBER' => $appNumber, - 'APP_STATUS' => 'TO_DO', - 'APP_STATUS_ID' => 2, - 'PRO_UID' => function() { - return factory(\ProcessMaker\Model\Process::class)->create()->PRO_UID; - }, - 'APP_PROC_STATUS' => '', - 'APP_PROC_CODE' => '', - 'APP_PARALLEL' => 'N', - 'APP_INIT_USER' => $user->USR_UID, - 'APP_CUR_USER' => $user->USR_UID, - 'APP_PIN' => G::generateUniqueID(), - 'APP_CREATE_DATE' => $faker->dateTimeBetween('now', '+30 minutes'), - 'APP_INIT_DATE' => $faker->dateTimeBetween('now', '+30 minutes'), - 'APP_UPDATE_DATE' => $faker->dateTimeBetween('now', '+30 minutes'), - 'APP_FINISH_DATE' => $faker->dateTimeBetween('now', '+30 minutes'), - 'APP_DATA' => serialize(['APP_NUMBER' => $appNumber]) - ]; -}); +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; -// Create a delegation with the foreign keys -$factory->state(\ProcessMaker\Model\Application::class, 'foreign_keys', function (Faker $faker) { - // Create values in the foreign key relations - $process = factory(\ProcessMaker\Model\Process::class)->create(); - $user = factory(\ProcessMaker\Model\User::class)->create(); - $appNumber = $faker->unique()->numberBetween(1000); +class ApplicationFactory extends Factory +{ - // APP_TITLE field is used in 'MYSQL: MATCH() AGAINST()' function, string size should not be less than 3. - $appTitle = $faker->lexify(str_repeat('?', rand(3, 5)) . ' ' . str_repeat('?', rand(3, 5))); + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + $user = \ProcessMaker\Model\User::factory()->create(); + $appNumber = $this->faker->unique()->numberBetween(1000); + // APP_TITLE field is used in 'MYSQL: MATCH() AGAINST()' function, string size should not be less than 3. + $appTitle = $this->faker->lexify(str_repeat('?', rand(3, 5)) . ' ' . str_repeat('?', rand(3, 5))); + return [ + 'APP_UID' => G::generateUniqueID(), + 'APP_TITLE' => $appTitle, + 'APP_DESCRIPTION' => $this->faker->text, + 'APP_NUMBER' => $appNumber, + 'APP_STATUS' => 'TO_DO', + 'APP_STATUS_ID' => 2, + 'PRO_UID' => function () { + return \ProcessMaker\Model\Process::factory()->create()->PRO_UID; + }, + 'APP_PROC_STATUS' => '', + 'APP_PROC_CODE' => '', + 'APP_PARALLEL' => 'N', + 'APP_INIT_USER' => $user->USR_UID, + 'APP_CUR_USER' => $user->USR_UID, + 'APP_PIN' => G::generateUniqueID(), + 'APP_CREATE_DATE' => $this->faker->dateTimeBetween('now', '+30 minutes'), + 'APP_INIT_DATE' => $this->faker->dateTimeBetween('now', '+30 minutes'), + 'APP_UPDATE_DATE' => $this->faker->dateTimeBetween('now', '+30 minutes'), + 'APP_FINISH_DATE' => $this->faker->dateTimeBetween('now', '+30 minutes'), + 'APP_DATA' => serialize(['APP_NUMBER' => $appNumber]) + ]; + } - $statuses = ['DRAFT', 'TO_DO', 'COMPLETED', 'CANCELLED']; - $status = $faker->randomElement($statuses); - $statusId = array_search($status, $statuses) + 1; + /** + * Create a delegation with the foreign keys + * @return type + */ + public function foreign_keys() + { + $state = function (array $attributes) { + // Create values in the foreign key relations + $process = \ProcessMaker\Model\Process::factory()->create(); + $user = \ProcessMaker\Model\User::factory()->create(); + $appNumber = $this->faker->unique()->numberBetween(1000); - return [ - 'APP_UID' => G::generateUniqueID(), - 'APP_TITLE' => $appTitle, - 'APP_NUMBER' => $appNumber, - 'APP_STATUS' => $status, - 'APP_STATUS_ID' => $statusId, - 'PRO_UID' => $process->PRO_UID, - 'APP_PROC_STATUS' => '', - 'APP_PROC_CODE' => '', - 'APP_PARALLEL' => 'N', - 'APP_INIT_USER' => $user->USR_UID, - 'APP_INIT_USER_ID' => $user->USR_ID, - 'APP_CUR_USER' => $user->USR_UID, - 'APP_PIN' => G::generateUniqueID(), - 'APP_CREATE_DATE' => $faker->dateTime(), - 'APP_INIT_DATE' => $faker->dateTime(), - 'APP_UPDATE_DATE' => $faker->dateTime(), - 'APP_FINISH_DATE' => $faker->dateTime(), - 'APP_DATA' => serialize(['APP_NUMBER' => $appNumber]) - ]; -}); + // APP_TITLE field is used in 'MYSQL: MATCH() AGAINST()' function, string size should not be less than 3. + $appTitle = $this->faker->lexify(str_repeat('?', rand(3, 5)) . ' ' . str_repeat('?', rand(3, 5))); -$factory->state(\ProcessMaker\Model\Application::class, 'web_entry', function (Faker $faker) { - $appNumber = $faker->unique()->numberBetween(5000); - return [ - 'APP_NUMBER' => $appNumber * -1, - 'APP_STATUS_ID' => 2, - 'APP_STATUS' => 'TO_DO' - ]; -}); + $statuses = ['DRAFT', 'TO_DO', 'COMPLETED', 'CANCELLED']; + $status = $this->faker->randomElement($statuses); + $statusId = array_search($status, $statuses) + 1; -$factory->state(\ProcessMaker\Model\Application::class, 'todo', function (Faker $faker) { - return [ - 'APP_NUMBER' => $faker->unique()->numberBetween(1000), - 'APP_STATUS_ID' => 2, - 'APP_STATUS' => 'TO_DO' - ]; -}); + return [ + 'APP_UID' => G::generateUniqueID(), + 'APP_TITLE' => $appTitle, + 'APP_NUMBER' => $appNumber, + 'APP_STATUS' => $status, + 'APP_STATUS_ID' => $statusId, + 'PRO_UID' => $process->PRO_UID, + 'APP_PROC_STATUS' => '', + 'APP_PROC_CODE' => '', + 'APP_PARALLEL' => 'N', + 'APP_INIT_USER' => $user->USR_UID, + 'APP_INIT_USER_ID' => $user->USR_ID, + 'APP_CUR_USER' => $user->USR_UID, + 'APP_PIN' => G::generateUniqueID(), + 'APP_CREATE_DATE' => $this->faker->dateTime(), + 'APP_INIT_DATE' => $this->faker->dateTime(), + 'APP_UPDATE_DATE' => $this->faker->dateTime(), + 'APP_FINISH_DATE' => $this->faker->dateTime(), + 'APP_DATA' => serialize(['APP_NUMBER' => $appNumber]) + ]; + }; + return $this->state($state); + } -$factory->state(\ProcessMaker\Model\Application::class, 'draft', function (Faker $faker) { - $user = factory(\ProcessMaker\Model\User::class)->create(); + /** + * + * @return type + */ + public function web_entry() + { + $state = function (array $attributes) { + $appNumber = $this->faker->unique()->numberBetween(5000); + return [ + 'APP_NUMBER' => $appNumber * -1, + 'APP_STATUS_ID' => 2, + 'APP_STATUS' => 'TO_DO' + ]; + }; + return $this->state($state); + } - return [ - 'APP_NUMBER' => $faker->unique()->numberBetween(1000), - 'APP_STATUS_ID' => 1, - 'APP_STATUS' => 'DRAFT', - 'APP_INIT_USER' => $user->USR_UID, - 'APP_INIT_USER_ID' => $user->USR_ID, - ]; -}); + /** + * + * @return type + */ + public function todo() + { + $state = function (array $attributes) { + return [ + 'APP_NUMBER' => $this->faker->unique()->numberBetween(1000), + 'APP_STATUS_ID' => 2, + 'APP_STATUS' => 'TO_DO' + ]; + }; + return $this->state($state); + } -$factory->state(\ProcessMaker\Model\Application::class, 'paused', function (Faker $faker) { - $user = factory(\ProcessMaker\Model\User::class)->create(); + /** + * + * @return type + */ + public function draft() + { + $state = function (array $attributes) { + $user = \ProcessMaker\Model\User::factory()->create(); - return [ - 'APP_NUMBER' => $faker->unique()->numberBetween(1000), - 'APP_STATUS_ID' => 1, - 'APP_STATUS' => 'PAUSED', - 'APP_INIT_USER' => $user->USR_UID, - 'APP_INIT_USER_ID' => $user->USR_ID, - ]; -}); + return [ + 'APP_NUMBER' => $this->faker->unique()->numberBetween(1000), + 'APP_STATUS_ID' => 1, + 'APP_STATUS' => 'DRAFT', + 'APP_INIT_USER' => $user->USR_UID, + 'APP_INIT_USER_ID' => $user->USR_ID, + ]; + }; + return $this->state($state); + } -$factory->state(\ProcessMaker\Model\Application::class, 'completed', function (Faker $faker) { - return [ - 'APP_NUMBER' => $faker->unique()->numberBetween(1000), - 'APP_STATUS_ID' => 3, - 'APP_STATUS' => 'COMPLETED' - ]; -}); + /** + * + * @return type + */ + public function paused() + { + $state = function (array $attributes) { + $user = \ProcessMaker\Model\User::factory()->create(); -$factory->state(\ProcessMaker\Model\Application::class, 'canceled', function (Faker $faker) { - return [ - 'APP_NUMBER' => $faker->unique()->numberBetween(1000), - 'APP_STATUS_ID' => 4, - 'APP_STATUS' => 'CANCELLED' - ]; -}); + return [ + 'APP_NUMBER' => $this->faker->unique()->numberBetween(1000), + 'APP_STATUS_ID' => 1, + 'APP_STATUS' => 'PAUSED', + 'APP_INIT_USER' => $user->USR_UID, + 'APP_INIT_USER_ID' => $user->USR_ID, + ]; + }; + return $this->state($state); + } -$factory->state(\ProcessMaker\Model\Application::class, 'draft_minor_case', function (Faker $faker) { - $caseNumber = $faker->unique()->numberBetween(1, 1000); - return [ - 'APP_NUMBER' => $caseNumber, - 'APP_TITLE' => 'Case # ' . $caseNumber, - 'APP_STATUS_ID' => 1, - 'APP_STATUS' => 'DRAFT', - 'APP_UPDATE_DATE' => $faker->dateTimeBetween('-2 year', '-1 year') - ]; -}); + /** + * + * @return type + */ + public function completed() + { + $state = function (array $attributes) { + return [ + 'APP_NUMBER' => $this->faker->unique()->numberBetween(1000), + 'APP_STATUS_ID' => 3, + 'APP_STATUS' => 'COMPLETED' + ]; + }; + return $this->state($state); + } -$factory->state(\ProcessMaker\Model\Application::class, 'draft_major_case', function (Faker $faker) { - $caseNumber = $faker->unique()->numberBetween(2000, 3000); - return [ - 'APP_NUMBER' => $caseNumber, - 'APP_TITLE' => 'Case # ' . $caseNumber, - 'APP_STATUS_ID' => 1, - 'APP_STATUS' => 'DRAFT', - 'APP_UPDATE_DATE' => $faker->dateTimeBetween('now', '+1 year') - ]; -}); + /** + * + * @return type + */ + public function canceled() + { + $state = function (array $attributes) { + return [ + 'APP_NUMBER' => $this->faker->unique()->numberBetween(1000), + 'APP_STATUS_ID' => 4, + 'APP_STATUS' => 'CANCELLED' + ]; + }; + return $this->state($state); + } + + /** + * + * @return type + */ + public function draft_minor_case() + { + $state = function (array $attributes) { + $caseNumber = $this->faker->unique()->numberBetween(1, 1000); + return [ + 'APP_NUMBER' => $caseNumber, + 'APP_TITLE' => 'Case # ' . $caseNumber, + 'APP_STATUS_ID' => 1, + 'APP_STATUS' => 'DRAFT', + 'APP_UPDATE_DATE' => $this->faker->dateTimeBetween('-2 year', '-1 year') + ]; + }; + return $this->state($state); + } + + /** + * + * @return type + */ + public function draft_major_case() + { + $state = function (array $attributes) { + $caseNumber = $this->faker->unique()->numberBetween(2000, 3000); + return [ + 'APP_NUMBER' => $caseNumber, + 'APP_TITLE' => 'Case # ' . $caseNumber, + 'APP_STATUS_ID' => 1, + 'APP_STATUS' => 'DRAFT', + 'APP_UPDATE_DATE' => $this->faker->dateTimeBetween('now', '+1 year') + ]; + }; + return $this->state($state); + } + +} diff --git a/database/factories/BpmnDiagramFactory.php b/database/factories/BpmnDiagramFactory.php index 817fe6d3c..72d8a2bdf 100644 --- a/database/factories/BpmnDiagramFactory.php +++ b/database/factories/BpmnDiagramFactory.php @@ -1,14 +1,28 @@ define(\ProcessMaker\Model\BpmnDiagram::class, function(Faker $faker) { - return [ - 'DIA_UID' => $faker->regexify("/[a-zA-Z]{32}/"), - 'PRJ_UID' => function() { - return factory(\ProcessMaker\Model\BpmnProject::class)->create()->PRJ_UID; - }, - 'DIA_NAME' => $faker->name, - 'DIA_IS_CLOSABLE' => 0, - ]; -}); +use App\Factories\Factory; +use Illuminate\Support\Str; + +class BpmnDiagramFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'DIA_UID' => $this->faker->regexify("/[a-zA-Z]{32}/"), + 'PRJ_UID' => function () { + return \ProcessMaker\Model\BpmnProject::factory()->create()->PRJ_UID; + }, + 'DIA_NAME' => $this->faker->name, + 'DIA_IS_CLOSABLE' => 0, + ]; + } + +} diff --git a/database/factories/BpmnEventFactory.php b/database/factories/BpmnEventFactory.php index 5f411972d..77936c6fe 100644 --- a/database/factories/BpmnEventFactory.php +++ b/database/factories/BpmnEventFactory.php @@ -1,32 +1,46 @@ define(\ProcessMaker\Model\BpmnEvent::class, function(Faker $faker) { - $bpmnProcess = factory(\ProcessMaker\Model\BpmnProcess::class)->create(); - return [ - 'EVN_UID' => $faker->regexify("/[a-zA-Z]{32}/"), - 'PRJ_UID' => $bpmnProcess->PRJ_UID, - 'PRO_UID' => $bpmnProcess->PRO_UID, - 'EVN_NAME' => $faker->name, - 'EVN_TYPE' => 'START', - 'EVN_MARKER' => 'EMPTY', - 'EVN_IS_INTERRUPTING' => 1, - 'EVN_ATTACHED_TO' => '', - 'EVN_CANCEL_ACTIVITY' => 0, - 'EVN_ACTIVITY_REF' => null, - 'EVN_WAIT_FOR_COMPLETION' => 0, - 'EVN_ERROR_NAME' => null, - 'EVN_ERROR_CODE' => null, - 'EVN_ESCALATION_NAME' => null, - 'EVN_ESCALATION_CODE' => null, - 'EVN_CONDITION' => null, - 'EVN_MESSAGE' => '', - 'EVN_OPERATION_NAME' => null, - 'EVN_OPERATION_IMPLEMENTATION_REF' => null, - 'EVN_TIME_DATE' => null, - 'EVN_TIME_CYCLE' => null, - 'EVN_TIME_DURATION' => null, - 'EVN_BEHAVIOR' => 'THROW', - ]; -}); +use App\Factories\Factory; +use Illuminate\Support\Str; + +class BpmnEventFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + $bpmnProcess = \ProcessMaker\Model\BpmnProcess::factory()->create(); + return [ + 'EVN_UID' => $this->faker->regexify("/[a-zA-Z]{32}/"), + 'PRJ_UID' => $bpmnProcess->PRJ_UID, + 'PRO_UID' => $bpmnProcess->PRO_UID, + 'EVN_NAME' => $this->faker->name, + 'EVN_TYPE' => 'START', + 'EVN_MARKER' => 'EMPTY', + 'EVN_IS_INTERRUPTING' => 1, + 'EVN_ATTACHED_TO' => '', + 'EVN_CANCEL_ACTIVITY' => 0, + 'EVN_ACTIVITY_REF' => null, + 'EVN_WAIT_FOR_COMPLETION' => 0, + 'EVN_ERROR_NAME' => null, + 'EVN_ERROR_CODE' => null, + 'EVN_ESCALATION_NAME' => null, + 'EVN_ESCALATION_CODE' => null, + 'EVN_CONDITION' => null, + 'EVN_MESSAGE' => '', + 'EVN_OPERATION_NAME' => null, + 'EVN_OPERATION_IMPLEMENTATION_REF' => null, + 'EVN_TIME_DATE' => null, + 'EVN_TIME_CYCLE' => null, + 'EVN_TIME_DURATION' => null, + 'EVN_BEHAVIOR' => 'THROW', + ]; + } + +} diff --git a/database/factories/BpmnProcessFactory.php b/database/factories/BpmnProcessFactory.php index f63304f7c..3bb13e2fa 100644 --- a/database/factories/BpmnProcessFactory.php +++ b/database/factories/BpmnProcessFactory.php @@ -1,21 +1,34 @@ define(\ProcessMaker\Model\BpmnProcess::class, function(Faker $faker) { - return [ - 'PRO_UID' => $faker->regexify("/[a-zA-Z]{32}/"), - 'PRJ_UID' => function() { - return factory(\ProcessMaker\Model\BpmnProject::class)->create()->PRJ_UID; - }, - 'DIA_UID' => function() { - return factory(\ProcessMaker\Model\BpmnDiagram::class)->create()->DIA_UID; - }, - 'PRO_NAME' => $faker->title, - 'PRO_TYPE' => 'NONE', - 'PRO_IS_EXECUTABLE' => 0, - 'PRO_IS_CLOSED' => 0, - 'PRO_IS_SUBPROCESS' => 0, - ]; -}); +use App\Factories\Factory; +use Illuminate\Support\Str; +class BpmnProcessFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'PRO_UID' => $this->faker->regexify("/[a-zA-Z]{32}/"), + 'PRJ_UID' => function () { + return \ProcessMaker\Model\BpmnProject::factory()->create()->PRJ_UID; + }, + 'DIA_UID' => function () { + return \ProcessMaker\Model\BpmnDiagram::factory()->create()->DIA_UID; + }, + 'PRO_NAME' => $this->faker->title, + 'PRO_TYPE' => 'NONE', + 'PRO_IS_EXECUTABLE' => 0, + 'PRO_IS_CLOSED' => 0, + 'PRO_IS_SUBPROCESS' => 0, + ]; + } + +} diff --git a/database/factories/BpmnProjectFactory.php b/database/factories/BpmnProjectFactory.php index 2433c3fe9..048dd9764 100644 --- a/database/factories/BpmnProjectFactory.php +++ b/database/factories/BpmnProjectFactory.php @@ -1,25 +1,40 @@ define(\ProcessMaker\Model\BpmnProject::class, function (Faker $faker) { - // Create user - $user = factory(\ProcessMaker\Model\User::class)->create(); - // Create process - $process = factory(\ProcessMaker\Model\Process::class)->create(); +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; - return [ - 'PRJ_UID' => G::generateUniqueID(), - 'PRJ_NAME' => $faker->sentence(5), - 'PRJ_DESCRIPTION' => $faker->text, - 'PRJ_EXPRESION_LANGUAGE' => '', - 'PRJ_TYPE_LANGUAGE' => '', - 'PRJ_EXPORTER' => '', - 'PRJ_EXPORTER_VERSION' => '', - 'PRJ_CREATE_DATE' => $faker->dateTime(), - 'PRJ_UPDATE_DATE' => $faker->dateTime(), - 'PRJ_AUTHOR' => $user->USR_UID, - 'PRJ_AUTHOR_VERSION' => '', - 'PRJ_ORIGINAL_SOURCE' => '', - ]; -}); +class BpmnProjectFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + // Create user + $user = \ProcessMaker\Model\User::factory()->create(); + // Create process + $process = \ProcessMaker\Model\Process::factory()->create(); + + return [ + 'PRJ_UID' => G::generateUniqueID(), + 'PRJ_NAME' => $this->faker->sentence(5), + 'PRJ_DESCRIPTION' => $this->faker->text, + 'PRJ_EXPRESION_LANGUAGE' => '', + 'PRJ_TYPE_LANGUAGE' => '', + 'PRJ_EXPORTER' => '', + 'PRJ_EXPORTER_VERSION' => '', + 'PRJ_CREATE_DATE' => $this->faker->dateTime(), + 'PRJ_UPDATE_DATE' => $this->faker->dateTime(), + 'PRJ_AUTHOR' => $user->USR_UID, + 'PRJ_AUTHOR_VERSION' => '', + 'PRJ_ORIGINAL_SOURCE' => '', + ]; + } + +} diff --git a/database/factories/CaseListFactory.php b/database/factories/CaseListFactory.php index 3da4352f4..866e8a7ea 100644 --- a/database/factories/CaseListFactory.php +++ b/database/factories/CaseListFactory.php @@ -1,26 +1,40 @@ define(\ProcessMaker\Model\CaseList::class, function (Faker $faker) { - return [ - 'CAL_ID' => $faker->unique()->numberBetween(1, 5000), - 'CAL_TYPE' => 'inbox', - 'CAL_NAME' => $faker->title, - 'CAL_DESCRIPTION' => $faker->text, - 'ADD_TAB_UID' => function () { - $table = factory(\ProcessMaker\Model\AdditionalTables::class)->create(); - return $table->ADD_TAB_UID; - }, - 'CAL_COLUMNS' => '[]', - 'USR_ID' => function () { - $user = factory(\ProcessMaker\Model\User::class)->create(); - return $user->USR_ID; - }, - 'CAL_ICON_LIST' => 'deafult.png', - 'CAL_ICON_COLOR' => 'red', - 'CAL_ICON_COLOR_SCREEN' => 'blue', - 'CAL_CREATE_DATE' => $faker->dateTime(), - 'CAL_UPDATE_DATE' => $faker->dateTime() - ]; -}); +use App\Factories\Factory; +use Illuminate\Support\Str; + +class CaseListFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'CAL_ID' => $this->faker->unique()->numberBetween(1, 5000), + 'CAL_TYPE' => 'inbox', + 'CAL_NAME' => $this->faker->title, + 'CAL_DESCRIPTION' => $this->faker->text, + 'ADD_TAB_UID' => function () { + $table = \ProcessMaker\Model\AdditionalTables::factory()->create(); + return $table->ADD_TAB_UID; + }, + 'CAL_COLUMNS' => '[]', + 'USR_ID' => function () { + $user = \ProcessMaker\Model\User::factory()->create(); + return $user->USR_ID; + }, + 'CAL_ICON_LIST' => 'deafult.png', + 'CAL_ICON_COLOR' => 'red', + 'CAL_ICON_COLOR_SCREEN' => 'blue', + 'CAL_CREATE_DATE' => $this->faker->dateTime(), + 'CAL_UPDATE_DATE' => $this->faker->dateTime() + ]; + } + +} diff --git a/database/factories/ConfigurationFactory.php b/database/factories/ConfigurationFactory.php index c21d20c87..d0c52dfc1 100644 --- a/database/factories/ConfigurationFactory.php +++ b/database/factories/ConfigurationFactory.php @@ -1,37 +1,57 @@ define(Configuration::class, function(Faker $faker) { - return [ - 'CFG_UID' => $faker->randomElement(['AUDIT_LOG', 'EE']), - 'OBJ_UID' => '', - 'CFG_VALUE' => '', - 'PRO_UID' => G::generateUniqueID(), - 'USR_UID' => G::generateUniqueID(), - 'APP_UID' => G::generateUniqueID(), - ]; -}); +class ConfigurationFactory extends Factory +{ -$factory->state(Configuration::class, 'userPreferencesEmpty', function (Faker $faker) { - // Grab a user if random - $users = User::all(); - if (!empty($users)) { - $user = factory(User::class)->create(); - } else { - $user = $users->random(); + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'CFG_UID' => $this->faker->randomElement(['AUDIT_LOG', 'EE']), + 'OBJ_UID' => '', + 'CFG_VALUE' => '', + 'PRO_UID' => G::generateUniqueID(), + 'USR_UID' => G::generateUniqueID(), + 'APP_UID' => G::generateUniqueID(), + ]; } - return [ - 'CFG_UID' => 'USER_PREFERENCES', - 'OBJ_UID' => '', - 'CFG_VALUE' => '', - 'PRO_UID' => '', - 'USR_UID' => $user->USR_UID, - 'APP_UID' => '', - ]; -}); + /** + * + * @return type + */ + public function userPreferencesEmpty() + { + $state = function (array $attributes) { + // Grab a user if random + $users = User::all(); + if (!empty($users)) { + $user = User::factory()->create(); + } else { + $user = $users->random(); + } + return [ + 'CFG_UID' => 'USER_PREFERENCES', + 'OBJ_UID' => '', + 'CFG_VALUE' => '', + 'PRO_UID' => '', + 'USR_UID' => $user->USR_UID, + 'APP_UID' => '', + ]; + }; + return $this->state($state); + } + +} diff --git a/database/factories/ConsolidatedFactory.php b/database/factories/ConsolidatedFactory.php index 53884b01e..2828e7f20 100644 --- a/database/factories/ConsolidatedFactory.php +++ b/database/factories/ConsolidatedFactory.php @@ -1,24 +1,46 @@ define(\ProcessMaker\Model\Consolidated::class, function (Faker $faker) { - return [ - 'TAS_UID' => G::generateUniqueID(), - 'DYN_UID' => G::generateUniqueID(), - 'REP_TAB_UID' => G::generateUniqueID(), - 'CON_STATUS' => 'ACTIVE', - ]; -}); +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; -// Create a consolidated task with the foreign keys -$factory->state(\ProcessMaker\Model\Consolidated::class, 'foreign_keys', function (Faker $faker) { - $task = factory(\ProcessMaker\Model\Task::class)->create(); - $dynaform = factory(\ProcessMaker\Model\Dynaform::class)->create(); - return [ - 'TAS_UID' => $task->TAS_UID, - 'DYN_UID' => $dynaform->DYN_UID, - 'REP_TAB_UID' => G::generateUniqueID(), - 'CON_STATUS' => 'ACTIVE', - ]; -}); \ No newline at end of file +class ConsolidatedFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'TAS_UID' => G::generateUniqueID(), + 'DYN_UID' => G::generateUniqueID(), + 'REP_TAB_UID' => G::generateUniqueID(), + 'CON_STATUS' => 'ACTIVE', + ]; + } + + /** + * Create a consolidated task with the foreign keys + * @return type + */ + public function foreign_keys() + { + $state = function (array $attributes) { + $task = \ProcessMaker\Model\Task::factory()->create(); + $dynaform = \ProcessMaker\Model\Dynaform::factory()->create(); + return [ + 'TAS_UID' => $task->TAS_UID, + 'DYN_UID' => $dynaform->DYN_UID, + 'REP_TAB_UID' => G::generateUniqueID(), + 'CON_STATUS' => 'ACTIVE', + ]; + }; + return $this->state($state); + } + +} diff --git a/database/factories/DbSourceFactory.php b/database/factories/DbSourceFactory.php index de9db69ad..0f7100006 100644 --- a/database/factories/DbSourceFactory.php +++ b/database/factories/DbSourceFactory.php @@ -1,31 +1,43 @@ define(\ProcessMaker\Model\DbSource::class, function(Faker $faker) { +namespace Database\Factories; + +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class DbSourceFactory extends Factory +{ /** - * @todo Determine if we need more base columns populated + * Define the model's default state. + * + * @return array */ - $dbName = $faker->word; - return [ - 'DBS_UID' => G::generateUniqueID(), - 'PRO_UID' => function() { - return factory(\ProcessMaker\Model\Process::class)->create()->PRO_UID; - }, - 'DBS_TYPE' => 'mysql', - 'DBS_SERVER' => $faker->localIpv4, - 'DBS_DATABASE_NAME' => $faker->word, - 'DBS_USERNAME' => $faker->userName, + public function definition() + { /** - * @todo WHY figure out there's a magic value to the encryption here + * @todo Determine if we need more base columns populated */ - 'DBS_PASSWORD' => \G::encrypt( $faker->password, $dbName, false, false) . "_2NnV3ujj3w", - 'DBS_PORT' => $faker->numberBetween(1000, 9000), - 'DBS_ENCODE' => 'utf8', // @todo Perhaps grab this from our definitions in DbConnections - 'DBS_CONNECTION_TYPE' => 'NORMAL', // @todo Determine what this value means - 'DBS_TNS' => null // @todo Determine what this value means - ]; -}); \ No newline at end of file + $dbName = $this->faker->word; + return [ + 'DBS_UID' => G::generateUniqueID(), + 'PRO_UID' => function () { + return \ProcessMaker\Model\Process::factory()->create()->PRO_UID; + }, + 'DBS_TYPE' => 'mysql', + 'DBS_SERVER' => $this->faker->localIpv4, + 'DBS_DATABASE_NAME' => $this->faker->word, + 'DBS_USERNAME' => $this->faker->userName, + /** + * @todo WHY figure out there's a magic value to the encryption here + */ + 'DBS_PASSWORD' => \G::encrypt($this->faker->password, $dbName, false, false) . "_2NnV3ujj3w", + 'DBS_PORT' => $this->faker->numberBetween(1000, 9000), + 'DBS_ENCODE' => 'utf8', // @todo Perhaps grab this from our definitions in DbConnections + 'DBS_CONNECTION_TYPE' => 'NORMAL', // @todo Determine what this value means + 'DBS_TNS' => null // @todo Determine what this value means + ]; + } + +} diff --git a/database/factories/DelegationFactory.php b/database/factories/DelegationFactory.php index 05688f384..543b561ec 100644 --- a/database/factories/DelegationFactory.php +++ b/database/factories/DelegationFactory.php @@ -1,193 +1,247 @@ define(\ProcessMaker\Model\Delegation::class, function(Faker $faker) { - $user = factory(\ProcessMaker\Model\User::class)->create(); - $process = factory(\ProcessMaker\Model\Process::class)->create(); - $task = factory(\ProcessMaker\Model\Task::class)->create([ - 'PRO_UID' => $process->PRO_UID, - 'PRO_ID' => $process->PRO_ID - ]); - $application = factory(\ProcessMaker\Model\Application::class)->create([ - 'PRO_UID' => $process->PRO_UID, - 'APP_INIT_USER' => $user->USR_UID, - 'APP_CUR_USER' => $user->USR_UID - ]); - // Return with default values - return [ - 'DELEGATION_ID' => $faker->unique()->numberBetween(5000), - 'APP_UID' => $application->APP_UID, - 'DEL_INDEX' => 1, - 'APP_NUMBER' => $application->APP_NUMBER, - 'DEL_PREVIOUS' => 0, - 'PRO_UID' => $process->PRO_UID, - 'TAS_UID' => $task->TAS_UID, - 'USR_UID' => $user->USR_UID, - 'DEL_TYPE' => 'NORMAL', - 'DEL_THREAD' => 1, - 'DEL_THREAD_STATUS' => 'OPEN', - 'DEL_PRIORITY' => 3, - 'DEL_DELEGATE_DATE' => $faker->dateTime(), - 'DEL_INIT_DATE' => $faker->dateTime(), - 'DEL_TASK_DUE_DATE' => $faker->dateTime(), - 'DEL_RISK_DATE' => $faker->dateTime(), - 'DEL_LAST_INDEX' => 0, - 'USR_ID' => $user->USR_ID, - 'PRO_ID' => $process->PRO_ID, - 'TAS_ID' => $task->TAS_ID, - 'DEL_DATA' => '', - 'DEL_TITLE' => $faker->word() - ]; -}); +use App\Factories\Factory; +use Illuminate\Support\Str; -// Create a delegation with the foreign keys -$factory->state(\ProcessMaker\Model\Delegation::class, 'foreign_keys', function (Faker $faker) { - // Create values in the foreign key relations - $user = factory(\ProcessMaker\Model\User::class)->create(); - $category = factory(\ProcessMaker\Model\ProcessCategory::class)->create(); - $process = factory(\ProcessMaker\Model\Process::class)->create([ - 'PRO_CATEGORY' => $category->CATEGORY_UID, - 'CATEGORY_ID' => $category->CATEGORY_ID - ]); - $task = factory(\ProcessMaker\Model\Task::class)->create([ - 'PRO_UID' => $process->PRO_UID, - 'PRO_ID' => $process->PRO_ID - ]); - $application = factory(\ProcessMaker\Model\Application::class)->create([ - 'PRO_UID' => $process->PRO_UID, - 'APP_INIT_USER' => $user->USR_UID, - 'APP_CUR_USER' => $user->USR_UID - ]); +class DelegationFactory extends Factory +{ - $delegateDate = $faker->dateTime(); - $initDate = $faker->dateTimeInInterval($delegateDate, '+30 minutes'); - $riskDate = $faker->dateTimeInInterval($initDate, '+1 day'); - $taskDueDate = $faker->dateTimeInInterval($riskDate, '+2 day'); - $index = $faker->unique()->numberBetween(2000); + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + $user = \ProcessMaker\Model\User::factory()->create(); + $process = \ProcessMaker\Model\Process::factory()->create(); + $task = \ProcessMaker\Model\Task::factory()->create([ + 'PRO_UID' => $process->PRO_UID, + 'PRO_ID' => $process->PRO_ID + ]); + $application = \ProcessMaker\Model\Application::factory()->create([ + 'PRO_UID' => $process->PRO_UID, + 'APP_INIT_USER' => $user->USR_UID, + 'APP_CUR_USER' => $user->USR_UID + ]); + // Return with default values + return [ + 'DELEGATION_ID' => $this->faker->unique()->numberBetween(5000), + 'APP_UID' => $application->APP_UID, + 'DEL_INDEX' => 1, + 'APP_NUMBER' => $application->APP_NUMBER, + 'DEL_PREVIOUS' => 0, + 'PRO_UID' => $process->PRO_UID, + 'TAS_UID' => $task->TAS_UID, + 'USR_UID' => $user->USR_UID, + 'DEL_TYPE' => 'NORMAL', + 'DEL_THREAD' => 1, + 'DEL_THREAD_STATUS' => 'OPEN', + 'DEL_PRIORITY' => 3, + 'DEL_DELEGATE_DATE' => $this->faker->dateTime(), + 'DEL_INIT_DATE' => $this->faker->dateTime(), + 'DEL_TASK_DUE_DATE' => $this->faker->dateTime(), + 'DEL_RISK_DATE' => $this->faker->dateTime(), + 'DEL_LAST_INDEX' => 0, + 'USR_ID' => $user->USR_ID, + 'PRO_ID' => $process->PRO_ID, + 'TAS_ID' => $task->TAS_ID, + 'DEL_DATA' => '', + 'DEL_TITLE' => $this->faker->word() + ]; + } - // Return with default values - return [ - 'DELEGATION_ID' => $faker->unique()->numberBetween(5000), - 'APP_UID' => $application->APP_UID, - 'DEL_INDEX' => $index, - 'APP_NUMBER' => $application->APP_NUMBER, - 'DEL_PREVIOUS' => $index - 1, - 'PRO_UID' => $process->PRO_UID, - 'TAS_UID' => $task->TAS_UID, - 'USR_UID' => $user->USR_UID, - 'DEL_TYPE' => 'NORMAL', - 'DEL_THREAD' => 1, - 'DEL_THREAD_STATUS' => 'OPEN', - 'DEL_PRIORITY' => 3, - 'DEL_DELEGATE_DATE' => $delegateDate, - 'DEL_INIT_DATE' => $initDate, - 'DEL_TASK_DUE_DATE' => $taskDueDate, - 'DEL_RISK_DATE' => $riskDate, - 'DEL_LAST_INDEX' => 1, - 'USR_ID' => $user->USR_ID, - 'PRO_ID' => $process->PRO_ID, - 'TAS_ID' => $task->TAS_ID, - 'DEL_DATA' => '', - 'DEL_TITLE' => $faker->word() - ]; -}); + /** + * Create a delegation with the foreign keys + * @return type + */ + public function foreign_keys() + { + $state = function (array $attributes) { + // Create values in the foreign key relations + $user = \ProcessMaker\Model\User::factory()->create(); + $category = \ProcessMaker\Model\ProcessCategory::factory()->create(); + $process = \ProcessMaker\Model\Process::factory()->create([ + 'PRO_CATEGORY' => $category->CATEGORY_UID, + 'CATEGORY_ID' => $category->CATEGORY_ID + ]); + $task = \ProcessMaker\Model\Task::factory()->create([ + 'PRO_UID' => $process->PRO_UID, + 'PRO_ID' => $process->PRO_ID + ]); + $application = \ProcessMaker\Model\Application::factory()->create([ + 'PRO_UID' => $process->PRO_UID, + 'APP_INIT_USER' => $user->USR_UID, + 'APP_CUR_USER' => $user->USR_UID + ]); -// Create a delegation with the foreign keys -$factory->state(\ProcessMaker\Model\Delegation::class, 'web_entry', function (Faker $faker) { - // Create values in the foreign key relations - $user = factory(\ProcessMaker\Model\User::class)->create(); - $category = factory(\ProcessMaker\Model\ProcessCategory::class)->create(); - $process = factory(\ProcessMaker\Model\Process::class)->create([ - 'PRO_CATEGORY' => $category->CATEGORY_UID, - 'CATEGORY_ID' => $category->CATEGORY_ID - ]); - $task = factory(\ProcessMaker\Model\Task::class)->create([ - 'PRO_UID' => $process->PRO_UID, - 'PRO_ID' => $process->PRO_ID - ]); - $application = factory(\ProcessMaker\Model\Application::class)->states('web_entry')->create([ - 'PRO_UID' => $process->PRO_UID, - 'APP_INIT_USER' => $user->USR_UID, - 'APP_CUR_USER' => $user->USR_UID - ]); + $delegateDate = $this->faker->dateTime(); + $initDate = $this->faker->dateTimeInInterval($delegateDate, '+30 minutes'); + $riskDate = $this->faker->dateTimeInInterval($initDate, '+1 day'); + $taskDueDate = $this->faker->dateTimeInInterval($riskDate, '+2 day'); + $index = $this->faker->unique()->numberBetween(2000); - // Return with default values - return [ - 'DELEGATION_ID' => $faker->unique()->numberBetween(5000), - 'APP_UID' => $application->APP_UID, - 'DEL_INDEX' => 1, - 'APP_NUMBER' => $application->APP_NUMBER, - 'DEL_PREVIOUS' => 0, - 'PRO_UID' => $process->PRO_UID, - 'TAS_UID' => $task->TAS_UID, - 'USR_UID' => $user->USR_UID, - 'DEL_TYPE' => 'NORMAL', - 'DEL_THREAD' => 1, - 'DEL_THREAD_STATUS' => 'OPEN', - 'DEL_PRIORITY' => 3, - 'DEL_DELEGATE_DATE' => $faker->dateTime(), - 'DEL_INIT_DATE' => $faker->dateTime(), - 'DEL_TASK_DUE_DATE' => $faker->dateTime(), - 'DEL_RISK_DATE' => $faker->dateTime(), - 'USR_ID' => $user->USR_ID, - 'PRO_ID' => $process->PRO_ID, - 'TAS_ID' => $task->TAS_ID, - 'DEL_DATA' => '', - 'DEL_TITLE' => $faker->word() - ]; -}); + // Return with default values + return [ + 'DELEGATION_ID' => $this->faker->unique()->numberBetween(5000), + 'APP_UID' => $application->APP_UID, + 'DEL_INDEX' => $index, + 'APP_NUMBER' => $application->APP_NUMBER, + 'DEL_PREVIOUS' => $index - 1, + 'PRO_UID' => $process->PRO_UID, + 'TAS_UID' => $task->TAS_UID, + 'USR_UID' => $user->USR_UID, + 'DEL_TYPE' => 'NORMAL', + 'DEL_THREAD' => 1, + 'DEL_THREAD_STATUS' => 'OPEN', + 'DEL_PRIORITY' => 3, + 'DEL_DELEGATE_DATE' => $delegateDate, + 'DEL_INIT_DATE' => $initDate, + 'DEL_TASK_DUE_DATE' => $taskDueDate, + 'DEL_RISK_DATE' => $riskDate, + 'DEL_LAST_INDEX' => 1, + 'USR_ID' => $user->USR_ID, + 'PRO_ID' => $process->PRO_ID, + 'TAS_ID' => $task->TAS_ID, + 'DEL_DATA' => '', + 'DEL_TITLE' => $this->faker->word() + ]; + }; + return $this->state($state); + } -// Create a open delegation -$factory->state(\ProcessMaker\Model\Delegation::class, 'open', function (Faker $faker) { - // Create dates with sense - $delegateDate = $faker->dateTime(); - $initDate = $faker->dateTimeInInterval($delegateDate, '+30 minutes'); - $riskDate = $faker->dateTimeInInterval($initDate, '+1 day'); - $taskDueDate = $faker->dateTimeInInterval($riskDate, '+2 day'); + /** + * Create a delegation with the foreign keys + * @return type + */ + public function web_entry() + { + $state = function (array $attributes) { + // Create values in the foreign key relations + $user = \ProcessMaker\Model\User::factory()->create(); + $category = \ProcessMaker\Model\ProcessCategory::factory()->create(); + $process = \ProcessMaker\Model\Process::factory()->create([ + 'PRO_CATEGORY' => $category->CATEGORY_UID, + 'CATEGORY_ID' => $category->CATEGORY_ID + ]); + $task = \ProcessMaker\Model\Task::factory()->create([ + 'PRO_UID' => $process->PRO_UID, + 'PRO_ID' => $process->PRO_ID + ]); + $application = \ProcessMaker\Model\Application::factory()->web_entry()->create([ + 'PRO_UID' => $process->PRO_UID, + 'APP_INIT_USER' => $user->USR_UID, + 'APP_CUR_USER' => $user->USR_UID + ]); - return [ - 'DEL_THREAD_STATUS' => 'OPEN', - 'DEL_DELEGATE_DATE' => $delegateDate, - 'DEL_INIT_DATE' => $initDate, - 'DEL_RISK_DATE' => $riskDate, - 'DEL_TASK_DUE_DATE' => $taskDueDate, - 'DEL_FINISH_DATE' => null - ]; -}); + // Return with default values + return [ + 'DELEGATION_ID' => $this->faker->unique()->numberBetween(5000), + 'APP_UID' => $application->APP_UID, + 'DEL_INDEX' => 1, + 'APP_NUMBER' => $application->APP_NUMBER, + 'DEL_PREVIOUS' => 0, + 'PRO_UID' => $process->PRO_UID, + 'TAS_UID' => $task->TAS_UID, + 'USR_UID' => $user->USR_UID, + 'DEL_TYPE' => 'NORMAL', + 'DEL_THREAD' => 1, + 'DEL_THREAD_STATUS' => 'OPEN', + 'DEL_PRIORITY' => 3, + 'DEL_DELEGATE_DATE' => $this->faker->dateTime(), + 'DEL_INIT_DATE' => $this->faker->dateTime(), + 'DEL_TASK_DUE_DATE' => $this->faker->dateTime(), + 'DEL_RISK_DATE' => $this->faker->dateTime(), + 'USR_ID' => $user->USR_ID, + 'PRO_ID' => $process->PRO_ID, + 'TAS_ID' => $task->TAS_ID, + 'DEL_DATA' => '', + 'DEL_TITLE' => $this->faker->word() + ]; + }; + return $this->state($state); + } -// Create a closed delegation -$factory->state(\ProcessMaker\Model\Delegation::class, 'closed', function (Faker $faker) { - // Create dates with sense - $delegateDate = $faker->dateTime(); - $initDate = $faker->dateTimeInInterval($delegateDate, '+30 minutes'); - $riskDate = $faker->dateTimeInInterval($initDate, '+1 day'); - $taskDueDate = $faker->dateTimeInInterval($riskDate, '+2 day'); - $finishDate = $faker->dateTimeInInterval($initDate, '+10 days'); + /** + * Create a open delegation + * @return type + */ + public function open() + { + $state = function (array $attributes) { + // Create dates with sense + $delegateDate = $this->faker->dateTime(); + $initDate = $this->faker->dateTimeInInterval($delegateDate, '+30 minutes'); + $riskDate = $this->faker->dateTimeInInterval($initDate, '+1 day'); + $taskDueDate = $this->faker->dateTimeInInterval($riskDate, '+2 day'); - return [ - 'DEL_THREAD_STATUS' => 'CLOSED', - 'DEL_DELEGATE_DATE' => $delegateDate, - 'DEL_INIT_DATE' => $initDate, - 'DEL_RISK_DATE' => $riskDate, - 'DEL_TASK_DUE_DATE' => $taskDueDate, - 'DEL_FINISH_DATE' => $finishDate - ]; -}); + return [ + 'DEL_THREAD_STATUS' => 'OPEN', + 'DEL_DELEGATE_DATE' => $delegateDate, + 'DEL_INIT_DATE' => $initDate, + 'DEL_RISK_DATE' => $riskDate, + 'DEL_TASK_DUE_DATE' => $taskDueDate, + 'DEL_FINISH_DATE' => null + ]; + }; + return $this->state($state); + } -// Create a last delegation -$factory->state(\ProcessMaker\Model\Delegation::class, 'last_thread', function (Faker $faker) { + /** + * Create a closed delegation + * @return type + */ + public function closed() + { + $state = function (array $attributes) { + // Create dates with sense + $delegateDate = $this->faker->dateTime(); + $initDate = $this->faker->dateTimeInInterval($delegateDate, '+30 minutes'); + $riskDate = $this->faker->dateTimeInInterval($initDate, '+1 day'); + $taskDueDate = $this->faker->dateTimeInInterval($riskDate, '+2 day'); + $finishDate = $this->faker->dateTimeInInterval($initDate, '+10 days'); - return [ - 'DEL_LAST_INDEX' => 1, - ]; -}); + return [ + 'DEL_THREAD_STATUS' => 'CLOSED', + 'DEL_DELEGATE_DATE' => $delegateDate, + 'DEL_INIT_DATE' => $initDate, + 'DEL_RISK_DATE' => $riskDate, + 'DEL_TASK_DUE_DATE' => $taskDueDate, + 'DEL_FINISH_DATE' => $finishDate + ]; + }; + return $this->state($state); + } -// Create a first delegation -$factory->state(\ProcessMaker\Model\Delegation::class, 'first_thread', function (Faker $faker) { + /** + * Create a last delegation + * @return type + */ + public function last_thread() + { + $state = function (array $attributes) { + return [ + 'DEL_LAST_INDEX' => 1, + ]; + }; + return $this->state($state); + } - return [ - 'DEL_INDEX' => 1, - 'DEL_PREVIOUS' => 0, - ]; -}); + /** + * Create a first delegation + * @return type + */ + public function first_thread() + { + $state = function (array $attributes) { + return [ + 'DEL_INDEX' => 1, + 'DEL_PREVIOUS' => 0, + ]; + }; + return $this->state($state); + } + +} diff --git a/database/factories/DepartmentFactory.php b/database/factories/DepartmentFactory.php index 1a4cc3ae5..6a99ea771 100644 --- a/database/factories/DepartmentFactory.php +++ b/database/factories/DepartmentFactory.php @@ -1,16 +1,31 @@ define(\ProcessMaker\Model\Department::class, function (Faker $faker) { - return [ - 'DEP_UID' => G::generateUniqueID(), - 'DEP_TITLE' => $faker->sentence(2), - 'DEP_PARENT' => '', - 'DEP_MANAGER' => '', - 'DEP_LOCATION' => 0, - 'DEP_STATUS' => 'ACTIVE', - 'DEP_REF_CODE' => '', - 'DEP_LDAP_DN' => '', - ]; -}); +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class DepartmentFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'DEP_UID' => G::generateUniqueID(), + 'DEP_TITLE' => $this->faker->sentence(2), + 'DEP_PARENT' => '', + 'DEP_MANAGER' => '', + 'DEP_LOCATION' => 0, + 'DEP_STATUS' => 'ACTIVE', + 'DEP_REF_CODE' => '', + 'DEP_LDAP_DN' => '', + ]; + } + +} diff --git a/database/factories/DocumentsFactory.php b/database/factories/DocumentsFactory.php index f4ef0429f..afbec1657 100644 --- a/database/factories/DocumentsFactory.php +++ b/database/factories/DocumentsFactory.php @@ -1,54 +1,76 @@ define(\ProcessMaker\Model\Documents::class, function (Faker $faker) { - $types = ['INPUT', 'OUTPUT', 'ATTACHED']; - $type = $faker->randomElement($types); - return [ - 'APP_DOC_UID' => G::generateUniqueID(), - 'APP_DOC_FILENAME' => 'image.png', - 'APP_DOC_TITLE' => '', - 'APP_DOC_COMMENT' => '', - 'DOC_VERSION' => 1, - 'APP_UID' => G::generateUniqueID(), - 'DEL_INDEX' => 1, - 'DOC_UID' => G::generateUniqueID(), - 'USR_UID' => G::generateUniqueID(), - 'APP_DOC_TYPE' => $type, - 'APP_DOC_CREATE_DATE' => $faker->date(), - 'APP_DOC_INDEX' => 1, - 'FOLDER_UID' => G::generateUniqueID(), - 'APP_DOC_PLUGIN' => '', - 'APP_DOC_TAGS' => '', - 'APP_DOC_STATUS' => 'ACTIVE', - 'APP_DOC_STATUS_DATE' => $faker->date(), - 'APP_DOC_FIELDNAME' => '', - 'APP_DOC_DRIVE_DOWNLOAD' => '', - ]; -}); +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; -// Create a document related to the case notes -$factory->state(\ProcessMaker\Model\Documents::class, 'case_notes', function (Faker $faker) { - return [ - 'APP_DOC_UID' => G::generateUniqueID(), - 'APP_DOC_FILENAME' => 'image.png', - 'APP_DOC_TITLE' => '', - 'APP_DOC_COMMENT' => '', - 'DOC_VERSION' => 1, - 'APP_UID' => G::generateUniqueID(), - 'DEL_INDEX' => 1, - 'DOC_UID' => G::generateUniqueID(), - 'USR_UID' => G::generateUniqueID(), - 'APP_DOC_TYPE' => 'CASE_NOTE', - 'APP_DOC_CREATE_DATE' => $faker->date(), - 'APP_DOC_INDEX' => 1, - 'FOLDER_UID' => G::generateUniqueID(), - 'APP_DOC_PLUGIN' => '', - 'APP_DOC_TAGS' => '', - 'APP_DOC_STATUS' => 'ACTIVE', - 'APP_DOC_STATUS_DATE' => $faker->date(), - 'APP_DOC_FIELDNAME' => '', - 'APP_DOC_DRIVE_DOWNLOAD' => '', - ]; -}); +class DocumentsFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + $types = ['INPUT', 'OUTPUT', 'ATTACHED']; + $type = $this->faker->randomElement($types); + return [ + 'APP_DOC_UID' => G::generateUniqueID(), + 'APP_DOC_FILENAME' => 'image.png', + 'APP_DOC_TITLE' => '', + 'APP_DOC_COMMENT' => '', + 'DOC_VERSION' => 1, + 'APP_UID' => G::generateUniqueID(), + 'DEL_INDEX' => 1, + 'DOC_UID' => G::generateUniqueID(), + 'USR_UID' => G::generateUniqueID(), + 'APP_DOC_TYPE' => $type, + 'APP_DOC_CREATE_DATE' => $this->faker->date(), + 'APP_DOC_INDEX' => 1, + 'FOLDER_UID' => G::generateUniqueID(), + 'APP_DOC_PLUGIN' => '', + 'APP_DOC_TAGS' => '', + 'APP_DOC_STATUS' => 'ACTIVE', + 'APP_DOC_STATUS_DATE' => $this->faker->date(), + 'APP_DOC_FIELDNAME' => '', + 'APP_DOC_DRIVE_DOWNLOAD' => '', + ]; + } + + /** + * Create a document related to the case notes + * @return type + */ + public function case_notes() + { + $state = function (array $attributes) { + return [ + 'APP_DOC_UID' => G::generateUniqueID(), + 'APP_DOC_FILENAME' => 'image.png', + 'APP_DOC_TITLE' => '', + 'APP_DOC_COMMENT' => '', + 'DOC_VERSION' => 1, + 'APP_UID' => G::generateUniqueID(), + 'DEL_INDEX' => 1, + 'DOC_UID' => G::generateUniqueID(), + 'USR_UID' => G::generateUniqueID(), + 'APP_DOC_TYPE' => 'CASE_NOTE', + 'APP_DOC_CREATE_DATE' => $this->faker->date(), + 'APP_DOC_INDEX' => 1, + 'FOLDER_UID' => G::generateUniqueID(), + 'APP_DOC_PLUGIN' => '', + 'APP_DOC_TAGS' => '', + 'APP_DOC_STATUS' => 'ACTIVE', + 'APP_DOC_STATUS_DATE' => $this->faker->date(), + 'APP_DOC_FIELDNAME' => '', + 'APP_DOC_DRIVE_DOWNLOAD' => '', + ]; + }; + return $this->state($state); + } + +} diff --git a/database/factories/DynaformFactory.php b/database/factories/DynaformFactory.php index 793d743d7..7e94b980c 100644 --- a/database/factories/DynaformFactory.php +++ b/database/factories/DynaformFactory.php @@ -1,66 +1,92 @@ define(\ProcessMaker\Model\Dynaform::class, function(Faker $faker) { - $date = $faker->dateTime(); - return [ - 'DYN_UID' => G::generateUniqueID(), - 'DYN_TITLE' => $faker->sentence(2), - 'DYN_DESCRIPTION' => $faker->sentence(5), - 'PRO_UID' => function() { - $process = factory(Process::class)->create(); - return $process->PRO_UID; - }, - 'DYN_TYPE' => 'xmlform', - 'DYN_FILENAME' => '', - 'DYN_CONTENT' => '', - 'DYN_LABEL' => '', - 'DYN_VERSION' => 2, - 'DYN_UPDATE_DATE' => $date->format('Y-m-d H:i:s'), - ]; -}); -// Create a dynaform with the foreign keys -$factory->state(\ProcessMaker\Model\Dynaform::class, 'foreign_keys', function (Faker $faker) { - $date = $faker->dateTime(); - return [ - 'DYN_UID' => G::generateUniqueID(), - 'DYN_TITLE' => $faker->sentence(2), - 'DYN_DESCRIPTION' => $faker->sentence(5), - 'PRO_UID' => function() { - $process = factory(Process::class)->create(); - return $process->PRO_UID; - }, - 'DYN_TYPE' => 'xmlform', - 'DYN_FILENAME' => '', - 'DYN_CONTENT' => '', - 'DYN_LABEL' => '', - 'DYN_VERSION' => 2, - 'DYN_UPDATE_DATE' => $date->format('Y-m-d H:i:s'), - ]; -}); +class DynaformFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + $date = $this->faker->dateTime(); + return [ + 'DYN_UID' => G::generateUniqueID(), + 'DYN_TITLE' => $this->faker->sentence(2), + 'DYN_DESCRIPTION' => $this->faker->sentence(5), + 'PRO_UID' => function () { + $process = Process::factory()->create(); + return $process->PRO_UID; + }, + 'DYN_TYPE' => 'xmlform', + 'DYN_FILENAME' => '', + 'DYN_CONTENT' => '', + 'DYN_LABEL' => '', + 'DYN_VERSION' => 2, + 'DYN_UPDATE_DATE' => $date->format('Y-m-d H:i:s'), + ]; + } -// Create a dynaform with translations defined: ["es", "es-Es"] -$factory->state(\ProcessMaker\Model\Dynaform::class, 'translations', function (Faker $faker) { - $date = $faker->dateTime(); - return [ - 'DYN_UID' => G::generateUniqueID(), - 'DYN_TITLE' => $faker->sentence(2), - 'DYN_DESCRIPTION' => $faker->sentence(5), - 'PRO_UID' => function() { - $process = factory(Process::class)->create(); - return $process->PRO_UID; - }, - 'DYN_TYPE' => 'xmlform', - 'DYN_FILENAME' => '', - 'DYN_CONTENT' => '', - 'DYN_LABEL' => '{"es":{"Project-Id-Version":"PM 4.0.1","POT-Creation-Date":"","PO-Revision-Date":"2019-09-11 12:02-0400","Last-Translator":"Colosa ","Language-Team":"Colosa Developers Team ","MIME-Version":"1.0","Content-Type":"text\/plain; charset=utf-8","Content-Transfer_Encoding":"8bit","X-Poedit-SourceCharset":"utf-8","Content-Transfer-Encoding":"8bit","File-Name":"Test-v2.es.po","X-Generator":"Poedit 1.8.11","X-Poedit-Language":"en","X-Poedit-Country":".","Labels":[{"msgid":"Test without dependent fields","msgstr":"Ejemplo sin campos dependientes"},{"msgid":"Incident Type:","msgstr":"Tipo de incidente:"},{"msgid":"- Select -","msgstr":"- Seleccionar -"},{"msgid":"Incident Sub Type:","msgstr":"Sub tipo de incidente:"},{"msgid":"Test with dependent fields","msgstr":"Ejemplo con campos dependientes"},{"msgid":"Health\/Safety","msgstr":"Salud\/Seguridad"},{"msgid":"Environment","msgstr":"Ambiente"},{"msgid":"Fatality","msgstr":"Ambiente"},{"msgid":"Lost Time Injury","msgstr":"Ambiente"},{"msgid":"Environment","msgstr":"Ambiente"},{"msgid":"Medical Treatment Injury","msgstr":"Lesiones de tratamiento m\u00e9dico"},{"msgid":"Chemical\/Substance Spill","msgstr":"Derrame qu\u00edmico \/ de sustancias"},{"msgid":"Fire\/Explosion","msgstr":"Fuego\/Explosion"},{"msgid":"Offsite Release","msgstr":"Lanzamiento fuera del sitio"}]},"es-Es":{"Project-Id-Version":"PM 4.0.1","POT-Creation-Date":"","PO-Revision-Date":"2019-09-11 12:02-0400","Last-Translator":"Colosa ","Language-Team":"Colosa Developers Team ","MIME-Version":"1.0","Content-Type":"text\/plain; charset=utf-8","Content-Transfer_Encoding":"8bit","X-Poedit-SourceCharset":"utf-8","Content-Transfer-Encoding":"8bit","File-Name":"Test-v2.es-Es.po","X-Generator":"Poedit 1.8.11","X-Poedit-Language":"en","X-Poedit-Country":".","Labels":[{"msgid":"Test without dependent fields","msgstr":"Ejemplo sin campos dependientes"},{"msgid":"Incident Type:","msgstr":"Tipo de incidente:"},{"msgid":"- Select -","msgstr":"- Seleccionar -"},{"msgid":"Incident Sub Type:","msgstr":"Sub tipo de incidente:"},{"msgid":"Test with dependent fields","msgstr":"Ejemplo con campos dependientes"},{"msgid":"Health\/Safety","msgstr":"Salud\/Seguridad"},{"msgid":"Environment","msgstr":"Ambiente"},{"msgid":"Fatality","msgstr":"Ambiente"},{"msgid":"Lost Time Injury","msgstr":"Ambiente"},{"msgid":"Environment","msgstr":"Ambiente"},{"msgid":"Medical Treatment Injury","msgstr":"Lesiones de tratamiento m\u00e9dico"},{"msgid":"Chemical\/Substance Spill","msgstr":"Derrame qu\u00edmico \/ de sustancias"},{"msgid":"Fire\/Explosion","msgstr":"Fuego\/Explosion"},{"msgid":"Offsite Release","msgstr":"Lanzamiento fuera del sitio"}]}}', - 'DYN_VERSION' => 2, - 'DYN_UPDATE_DATE' => $date->format('Y-m-d H:i:s'), - ]; -}); \ No newline at end of file + /** + * Create a dynaform with the foreign keys + * @return type + */ + public function foreign_keys() + { + $state = function (array $attributes) { + $date = $this->faker->dateTime(); + return [ + 'DYN_UID' => G::generateUniqueID(), + 'DYN_TITLE' => $this->faker->sentence(2), + 'DYN_DESCRIPTION' => $this->faker->sentence(5), + 'PRO_UID' => function () { + $process = Process::factory()->create(); + return $process->PRO_UID; + }, + 'DYN_TYPE' => 'xmlform', + 'DYN_FILENAME' => '', + 'DYN_CONTENT' => '', + 'DYN_LABEL' => '', + 'DYN_VERSION' => 2, + 'DYN_UPDATE_DATE' => $date->format('Y-m-d H:i:s'), + ]; + }; + return $this->state($state); + } + + /** + * Create a dynaform with translations defined: ["es", "es-Es"] + * @return type + */ + public function translations() + { + $state = function (array $attributes) { + $date = $this->faker->dateTime(); + return [ + 'DYN_UID' => G::generateUniqueID(), + 'DYN_TITLE' => $this->faker->sentence(2), + 'DYN_DESCRIPTION' => $this->faker->sentence(5), + 'PRO_UID' => function () { + $process = Process::factory()->create(); + return $process->PRO_UID; + }, + 'DYN_TYPE' => 'xmlform', + 'DYN_FILENAME' => '', + 'DYN_CONTENT' => '', + 'DYN_LABEL' => '{"es":{"Project-Id-Version":"PM 4.0.1","POT-Creation-Date":"","PO-Revision-Date":"2019-09-11 12:02-0400","Last-Translator":"Colosa ","Language-Team":"Colosa Developers Team ","MIME-Version":"1.0","Content-Type":"text\/plain; charset=utf-8","Content-Transfer_Encoding":"8bit","X-Poedit-SourceCharset":"utf-8","Content-Transfer-Encoding":"8bit","File-Name":"Test-v2.es.po","X-Generator":"Poedit 1.8.11","X-Poedit-Language":"en","X-Poedit-Country":".","Labels":[{"msgid":"Test without dependent fields","msgstr":"Ejemplo sin campos dependientes"},{"msgid":"Incident Type:","msgstr":"Tipo de incidente:"},{"msgid":"- Select -","msgstr":"- Seleccionar -"},{"msgid":"Incident Sub Type:","msgstr":"Sub tipo de incidente:"},{"msgid":"Test with dependent fields","msgstr":"Ejemplo con campos dependientes"},{"msgid":"Health\/Safety","msgstr":"Salud\/Seguridad"},{"msgid":"Environment","msgstr":"Ambiente"},{"msgid":"Fatality","msgstr":"Ambiente"},{"msgid":"Lost Time Injury","msgstr":"Ambiente"},{"msgid":"Environment","msgstr":"Ambiente"},{"msgid":"Medical Treatment Injury","msgstr":"Lesiones de tratamiento m\u00e9dico"},{"msgid":"Chemical\/Substance Spill","msgstr":"Derrame qu\u00edmico \/ de sustancias"},{"msgid":"Fire\/Explosion","msgstr":"Fuego\/Explosion"},{"msgid":"Offsite Release","msgstr":"Lanzamiento fuera del sitio"}]},"es-Es":{"Project-Id-Version":"PM 4.0.1","POT-Creation-Date":"","PO-Revision-Date":"2019-09-11 12:02-0400","Last-Translator":"Colosa ","Language-Team":"Colosa Developers Team ","MIME-Version":"1.0","Content-Type":"text\/plain; charset=utf-8","Content-Transfer_Encoding":"8bit","X-Poedit-SourceCharset":"utf-8","Content-Transfer-Encoding":"8bit","File-Name":"Test-v2.es-Es.po","X-Generator":"Poedit 1.8.11","X-Poedit-Language":"en","X-Poedit-Country":".","Labels":[{"msgid":"Test without dependent fields","msgstr":"Ejemplo sin campos dependientes"},{"msgid":"Incident Type:","msgstr":"Tipo de incidente:"},{"msgid":"- Select -","msgstr":"- Seleccionar -"},{"msgid":"Incident Sub Type:","msgstr":"Sub tipo de incidente:"},{"msgid":"Test with dependent fields","msgstr":"Ejemplo con campos dependientes"},{"msgid":"Health\/Safety","msgstr":"Salud\/Seguridad"},{"msgid":"Environment","msgstr":"Ambiente"},{"msgid":"Fatality","msgstr":"Ambiente"},{"msgid":"Lost Time Injury","msgstr":"Ambiente"},{"msgid":"Environment","msgstr":"Ambiente"},{"msgid":"Medical Treatment Injury","msgstr":"Lesiones de tratamiento m\u00e9dico"},{"msgid":"Chemical\/Substance Spill","msgstr":"Derrame qu\u00edmico \/ de sustancias"},{"msgid":"Fire\/Explosion","msgstr":"Fuego\/Explosion"},{"msgid":"Offsite Release","msgstr":"Lanzamiento fuera del sitio"}]}}', + 'DYN_VERSION' => 2, + 'DYN_UPDATE_DATE' => $date->format('Y-m-d H:i:s'), + ]; + }; + return $this->state($state); + } + +} diff --git a/database/factories/ElementTaskRelationFactory.php b/database/factories/ElementTaskRelationFactory.php index 67a53f9b7..dbb904f56 100644 --- a/database/factories/ElementTaskRelationFactory.php +++ b/database/factories/ElementTaskRelationFactory.php @@ -1,13 +1,28 @@ define(\ProcessMaker\Model\ElementTaskRelation::class, function(Faker $faker) { - return [ - 'ETR_UID' => G::generateUniqueID(), - 'PRJ_UID' => G::generateUniqueID(), - 'ELEMENT_UID' => G::generateUniqueID(), - 'ELEMENT_TYPE' => 'bpmnEvent', - 'TAS_UID' => G::generateUniqueID(), - ]; -}); +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class ElementTaskRelationFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'ETR_UID' => G::generateUniqueID(), + 'PRJ_UID' => G::generateUniqueID(), + 'ELEMENT_UID' => G::generateUniqueID(), + 'ELEMENT_TYPE' => 'bpmnEvent', + 'TAS_UID' => G::generateUniqueID(), + ]; + } + +} diff --git a/database/factories/EmailEventFactory.php b/database/factories/EmailEventFactory.php index f4839f65b..ddd5369de 100644 --- a/database/factories/EmailEventFactory.php +++ b/database/factories/EmailEventFactory.php @@ -1,21 +1,35 @@ define(\ProcessMaker\Model\EmailEvent::class, function(Faker $faker) { - $bpmnEvent = factory(\ProcessMaker\Model\BpmnEvent::class)->create(); - return [ - 'EMAIL_EVENT_UID' => $faker->regexify("/[a-zA-Z]{32}/"), - 'PRJ_UID' => $bpmnEvent->PRJ_UID, - 'EVN_UID' => $bpmnEvent->EVN_UID, - 'EMAIL_EVENT_FROM' => $faker->email, - 'EMAIL_EVENT_TO' => $faker->email, - 'EMAIL_EVENT_SUBJECT' => $faker->title, - 'PRF_UID' => function() { - return factory(\ProcessMaker\Model\ProcessFiles::class)->create()->PRF_UID; - }, - 'EMAIL_SERVER_UID' => function() { - return factory(\ProcessMaker\Model\EmailServerModel::class)->create()->MESS_UID; - }, - ]; -}); +use App\Factories\Factory; +use Illuminate\Support\Str; + +class EmailEventFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + $bpmnEvent = \ProcessMaker\Model\BpmnEvent::factory()->create(); + return [ + 'EMAIL_EVENT_UID' => $this->faker->regexify("/[a-zA-Z]{32}/"), + 'PRJ_UID' => $bpmnEvent->PRJ_UID, + 'EVN_UID' => $bpmnEvent->EVN_UID, + 'EMAIL_EVENT_FROM' => $this->faker->email, + 'EMAIL_EVENT_TO' => $this->faker->email, + 'EMAIL_EVENT_SUBJECT' => $this->faker->title, + 'PRF_UID' => function () { + return \ProcessMaker\Model\ProcessFiles::factory()->create()->PRF_UID; + }, + 'EMAIL_SERVER_UID' => function () { + return \ProcessMaker\Model\EmailServerModel::factory()->create()->MESS_UID; + }, + ]; + } + +} diff --git a/database/factories/EmailServerFactory.php b/database/factories/EmailServerFactory.php deleted file mode 100755 index 713b0bca5..000000000 --- a/database/factories/EmailServerFactory.php +++ /dev/null @@ -1,92 +0,0 @@ -define(\ProcessMaker\Model\EmailServerModel::class, function(Faker $faker) { - return [ - 'MESS_UID' => G::generateUniqueID(), - 'MESS_ENGINE' => 'MAIL', - 'MESS_SERVER' => '', - 'MESS_PORT' => 0, - 'MESS_INCOMING_SERVER' => '', - 'MESS_INCOMING_PORT' => 0, - 'MESS_RAUTH' => 0, - 'MESS_ACCOUNT' => '', - 'MESS_PASSWORD' => '', - 'MESS_FROM_MAIL' => '', - 'MESS_FROM_NAME' => '', - 'SMTPSECURE' => 'No', - 'MESS_TRY_SEND_INMEDIATLY' => 0, - 'MAIL_TO' => '', - 'MESS_DEFAULT' => 0, - 'OAUTH_CLIENT_ID' => '', - 'OAUTH_CLIENT_SECRET' => '', - 'OAUTH_REFRESH_TOKEN' => '' - ]; -}); - -$factory->state(\ProcessMaker\Model\EmailServerModel::class, 'PHPMAILER', function ($faker) { - return [ - 'MESS_UID' => G::generateUniqueID(), - 'MESS_ENGINE' => 'PHPMAILER', - 'MESS_PORT' => $faker->numberBetween(400, 500), - 'MESS_INCOMING_SERVER' => '', - 'MESS_INCOMING_PORT' => 0, - 'MESS_RAUTH' => 1, - 'MESS_ACCOUNT' => $faker->email, - 'MESS_PASSWORD' => $faker->password, - 'MESS_FROM_MAIL' => $faker->email, - 'MESS_FROM_NAME' => $faker->name, - 'SMTPSECURE' => 'ssl', - 'MESS_TRY_SEND_INMEDIATLY' => 0, - 'MAIL_TO' => $faker->email, - 'MESS_DEFAULT' => 0, - 'OAUTH_CLIENT_ID' => '', - 'OAUTH_CLIENT_SECRET' => '', - 'OAUTH_REFRESH_TOKEN' => '' - ]; -}); - -$factory->state(\ProcessMaker\Model\EmailServerModel::class, 'IMAP', function ($faker) { - return [ - 'MESS_UID' => G::generateUniqueID(), - 'MESS_ENGINE' => 'IMAP', - 'MESS_PORT' => $faker->numberBetween(400, 500), - 'MESS_INCOMING_SERVER' => 'imap.' . $faker->domainName, - 'MESS_INCOMING_PORT' => $faker->numberBetween(400, 500), - 'MESS_RAUTH' => 1, - 'MESS_ACCOUNT' => $faker->email, - 'MESS_PASSWORD' => $faker->password, - 'MESS_FROM_MAIL' => $faker->email, - 'MESS_FROM_NAME' => $faker->name, - 'SMTPSECURE' => 'ssl', - 'MESS_TRY_SEND_INMEDIATLY' => 0, - 'MAIL_TO' => $faker->email, - 'MESS_DEFAULT' => 0, - 'OAUTH_CLIENT_ID' => '', - 'OAUTH_CLIENT_SECRET' => '', - 'OAUTH_REFRESH_TOKEN' => '' - ]; -}); - -$factory->state(\ProcessMaker\Model\EmailServerModel::class, 'GMAILAPI', function ($faker) { - return [ - 'MESS_UID' => G::generateUniqueID(), - 'MESS_ENGINE' => 'GMAILAPI', - 'MESS_PORT' => 0, - 'MESS_INCOMING_SERVER' => '', - 'MESS_INCOMING_PORT' => 0, - 'MESS_RAUTH' => 1, - 'MESS_ACCOUNT' => $faker->email, - 'MESS_PASSWORD' => '', - 'MESS_FROM_MAIL' => $faker->email, - 'MESS_FROM_NAME' => $faker->name, - 'SMTPSECURE' => 'No', - 'MESS_TRY_SEND_INMEDIATLY' => 0, - 'MAIL_TO' => $faker->email, - 'MESS_DEFAULT' => 0, - 'OAUTH_CLIENT_ID' => $faker->regexify("/[0-9]{12}-[a-z]{32}\.apps\.googleusercontent\.com/"), - 'OAUTH_CLIENT_SECRET' => $faker->regexify("/[a-z]{24}/"), - 'OAUTH_REFRESH_TOKEN' => $faker->regexify("/[a-z]{7}[a-zA-Z0-9]{355}==/") - ]; -}); diff --git a/database/factories/EmailServerModelFactory.php b/database/factories/EmailServerModelFactory.php new file mode 100755 index 000000000..37ed66a2e --- /dev/null +++ b/database/factories/EmailServerModelFactory.php @@ -0,0 +1,131 @@ + G::generateUniqueID(), + 'MESS_ENGINE' => 'MAIL', + 'MESS_SERVER' => '', + 'MESS_PORT' => 0, + 'MESS_INCOMING_SERVER' => '', + 'MESS_INCOMING_PORT' => 0, + 'MESS_RAUTH' => 0, + 'MESS_ACCOUNT' => '', + 'MESS_PASSWORD' => '', + 'MESS_FROM_MAIL' => '', + 'MESS_FROM_NAME' => '', + 'SMTPSECURE' => 'No', + 'MESS_TRY_SEND_INMEDIATLY' => 0, + 'MAIL_TO' => '', + 'MESS_DEFAULT' => 0, + 'OAUTH_CLIENT_ID' => '', + 'OAUTH_CLIENT_SECRET' => '', + 'OAUTH_REFRESH_TOKEN' => '' + ]; + } + + /** + * + * @return type + */ + public function PHPMAILER() + { + $state = function (array $attributes) { + return [ + 'MESS_UID' => G::generateUniqueID(), + 'MESS_ENGINE' => 'PHPMAILER', + 'MESS_PORT' => $this->faker->numberBetween(400, 500), + 'MESS_INCOMING_SERVER' => '', + 'MESS_INCOMING_PORT' => 0, + 'MESS_RAUTH' => 1, + 'MESS_ACCOUNT' => $this->faker->email, + 'MESS_PASSWORD' => $this->faker->password, + 'MESS_FROM_MAIL' => $this->faker->email, + 'MESS_FROM_NAME' => $this->faker->name, + 'SMTPSECURE' => 'ssl', + 'MESS_TRY_SEND_INMEDIATLY' => 0, + 'MAIL_TO' => $this->faker->email, + 'MESS_DEFAULT' => 0, + 'OAUTH_CLIENT_ID' => '', + 'OAUTH_CLIENT_SECRET' => '', + 'OAUTH_REFRESH_TOKEN' => '' + ]; + }; + return $this->state($state); + } + + /** + * + * @return type + */ + public function IMAP() + { + $state = function (array $attributes) { + return [ + 'MESS_UID' => G::generateUniqueID(), + 'MESS_ENGINE' => 'IMAP', + 'MESS_PORT' => $this->faker->numberBetween(400, 500), + 'MESS_INCOMING_SERVER' => 'imap.' . $this->faker->domainName, + 'MESS_INCOMING_PORT' => $this->faker->numberBetween(400, 500), + 'MESS_RAUTH' => 1, + 'MESS_ACCOUNT' => $this->faker->email, + 'MESS_PASSWORD' => $this->faker->password, + 'MESS_FROM_MAIL' => $this->faker->email, + 'MESS_FROM_NAME' => $this->faker->name, + 'SMTPSECURE' => 'ssl', + 'MESS_TRY_SEND_INMEDIATLY' => 0, + 'MAIL_TO' => $this->faker->email, + 'MESS_DEFAULT' => 0, + 'OAUTH_CLIENT_ID' => '', + 'OAUTH_CLIENT_SECRET' => '', + 'OAUTH_REFRESH_TOKEN' => '' + ]; + }; + return $this->state($state); + } + + /** + * + * @return type + */ + public function GMAILAPI() + { + $state = function (array $attributes) { + return [ + 'MESS_UID' => G::generateUniqueID(), + 'MESS_ENGINE' => 'GMAILAPI', + 'MESS_PORT' => 0, + 'MESS_INCOMING_SERVER' => '', + 'MESS_INCOMING_PORT' => 0, + 'MESS_RAUTH' => 1, + 'MESS_ACCOUNT' => $this->faker->email, + 'MESS_PASSWORD' => '', + 'MESS_FROM_MAIL' => $this->faker->email, + 'MESS_FROM_NAME' => $this->faker->name, + 'SMTPSECURE' => 'No', + 'MESS_TRY_SEND_INMEDIATLY' => 0, + 'MAIL_TO' => $this->faker->email, + 'MESS_DEFAULT' => 0, + 'OAUTH_CLIENT_ID' => $this->faker->regexify("/[0-9]{12}-[a-z]{32}\.apps\.googleusercontent\.com/"), + 'OAUTH_CLIENT_SECRET' => $this->faker->regexify("/[a-z]{24}/"), + 'OAUTH_REFRESH_TOKEN' => $this->faker->regexify("/[a-z]{7}[a-zA-Z0-9]{355}==/") + ]; + }; + return $this->state($state); + } + +} diff --git a/database/factories/FieldsFactory.php b/database/factories/FieldsFactory.php index 70615e769..3cb87fe81 100644 --- a/database/factories/FieldsFactory.php +++ b/database/factories/FieldsFactory.php @@ -1,50 +1,72 @@ define(\ProcessMaker\Model\Fields::class, function (Faker $faker) { - return [ - 'FLD_UID' => G::generateUniqueID(), - 'ADD_TAB_UID' => G::generateUniqueID(), - 'FLD_INDEX' => 0, - 'FLD_NAME' => 'VAR_' . $faker->sentence(1), - 'FLD_DESCRIPTION' => $faker->sentence(2), - 'FLD_TYPE' => 'VARCHAR', - 'FLD_SIZE' => 255, - 'FLD_NULL' => 1, - 'FLD_AUTO_INCREMENT' => 0, - 'FLD_KEY' => 1, - 'FLD_TABLE_INDEX' => 0, - 'FLD_FOREIGN_KEY' => 0, - 'FLD_FOREIGN_KEY_TABLE' => '', - 'FLD_DYN_NAME' => '', - 'FLD_DYN_UID' => '', - 'FLD_FILTER' => 0, - ]; -}); +class FieldsFactory extends Factory +{ -// Create columns from a table with the foreign keys -$factory->state(\ProcessMaker\Model\Fields::class, 'foreign_keys', function (Faker $faker) { - return [ - 'FLD_UID' => G::generateUniqueID(), - 'ADD_TAB_UID' => function() { - $table = factory(AdditionalTables::class)->create(['ADD_TAB_OFFLINE' => 1]); - return $table->ADD_TAB_UID; - }, - 'FLD_INDEX' => 0, - 'FLD_NAME' => 'VAR_' . $faker->sentence(1), - 'FLD_DESCRIPTION' => $faker->sentence(2), - 'FLD_TYPE' => 'VARCHAR', - 'FLD_SIZE' => 255, - 'FLD_NULL' => 1, - 'FLD_AUTO_INCREMENT' => 0, - 'FLD_KEY' => 1, - 'FLD_TABLE_INDEX' => 0, - 'FLD_FOREIGN_KEY' => 0, - 'FLD_FOREIGN_KEY_TABLE' => '', - 'FLD_DYN_NAME' => '', - 'FLD_DYN_UID' => '', - 'FLD_FILTER' => 0, - ]; -}); + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'FLD_UID' => G::generateUniqueID(), + 'ADD_TAB_UID' => G::generateUniqueID(), + 'FLD_INDEX' => 0, + 'FLD_NAME' => 'VAR_' . $this->faker->sentence(1), + 'FLD_DESCRIPTION' => $this->faker->sentence(2), + 'FLD_TYPE' => 'VARCHAR', + 'FLD_SIZE' => 255, + 'FLD_NULL' => 1, + 'FLD_AUTO_INCREMENT' => 0, + 'FLD_KEY' => 1, + 'FLD_TABLE_INDEX' => 0, + 'FLD_FOREIGN_KEY' => 0, + 'FLD_FOREIGN_KEY_TABLE' => '', + 'FLD_DYN_NAME' => '', + 'FLD_DYN_UID' => '', + 'FLD_FILTER' => 0, + ]; + } + + /** + * Create columns from a table with the foreign keys + * @return type + */ + public function foreign_keys() + { + $state = function (array $attributes) { + return [ + 'FLD_UID' => G::generateUniqueID(), + 'ADD_TAB_UID' => function () { + $table = AdditionalTables::factory()->create(['ADD_TAB_OFFLINE' => 1]); + return $table->ADD_TAB_UID; + }, + 'FLD_INDEX' => 0, + 'FLD_NAME' => 'VAR_' . $this->faker->sentence(1), + 'FLD_DESCRIPTION' => $this->faker->sentence(2), + 'FLD_TYPE' => 'VARCHAR', + 'FLD_SIZE' => 255, + 'FLD_NULL' => 1, + 'FLD_AUTO_INCREMENT' => 0, + 'FLD_KEY' => 1, + 'FLD_TABLE_INDEX' => 0, + 'FLD_FOREIGN_KEY' => 0, + 'FLD_FOREIGN_KEY_TABLE' => '', + 'FLD_DYN_NAME' => '', + 'FLD_DYN_UID' => '', + 'FLD_FILTER' => 0, + ]; + }; + return $this->state($state); + } + +} diff --git a/database/factories/GroupUserFactory.php b/database/factories/GroupUserFactory.php index 013f47a92..6d4d6fa10 100644 --- a/database/factories/GroupUserFactory.php +++ b/database/factories/GroupUserFactory.php @@ -1,25 +1,45 @@ define(\ProcessMaker\Model\GroupUser::class, function(Faker $faker) { - return [ - 'GRP_UID' => G::generateUniqueID(), - 'GRP_ID' => $faker->unique()->numberBetween(1, 2000), - 'USR_UID' => G::generateUniqueID() - ]; -}); +namespace Database\Factories; -// Create columns from a table with the foreign keys -$factory->state(\ProcessMaker\Model\GroupUser::class, 'foreign_keys', function (Faker $faker) { - // Create values in the foreign key relations - $user = factory(\ProcessMaker\Model\User::class)->create(); - $group = factory(\ProcessMaker\Model\Groupwf::class)->create(); - return [ - 'GRP_UID' => $group->GRP_UID, - 'GRP_ID' => $group->GRP_ID, - 'USR_UID' => $user->USR_UID, - ]; -}); \ No newline at end of file +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class GroupUserFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'GRP_UID' => G::generateUniqueID(), + 'GRP_ID' => $this->faker->unique()->numberBetween(1, 2000), + 'USR_UID' => G::generateUniqueID() + ]; + } + + /** + * Create columns from a table with the foreign keys + * @return type + */ + public function foreign_keys() + { + $state = function (array $attributes) { + // Create values in the foreign key relations + $user = \ProcessMaker\Model\User::factory()->create(); + $group = \ProcessMaker\Model\Groupwf::factory()->create(); + return [ + 'GRP_UID' => $group->GRP_UID, + 'GRP_ID' => $group->GRP_ID, + 'USR_UID' => $user->USR_UID, + ]; + }; + return $this->state($state); + } + +} diff --git a/database/factories/GroupwfFactory.php b/database/factories/GroupwfFactory.php index bfcdc09ea..fda46536c 100644 --- a/database/factories/GroupwfFactory.php +++ b/database/factories/GroupwfFactory.php @@ -1,17 +1,29 @@ define(\ProcessMaker\Model\Groupwf::class, function(Faker $faker) { - return [ - 'GRP_UID' => G::generateUniqueID(), - 'GRP_ID' => $faker->unique()->numberBetween(2000), - 'GRP_TITLE' => $faker->sentence(2), - 'GRP_STATUS' => 'ACTIVE', - 'GRP_LDAP_DN' => '', - 'GRP_UX' => 'NORMAL', - ]; -}); +namespace Database\Factories; +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class GroupwfFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'GRP_UID' => G::generateUniqueID(), + 'GRP_ID' => $this->faker->unique()->numberBetween(2000), + 'GRP_TITLE' => $this->faker->sentence(2), + 'GRP_STATUS' => 'ACTIVE', + 'GRP_LDAP_DN' => '', + 'GRP_UX' => 'NORMAL', + ]; + } + +} diff --git a/database/factories/InputDocumentFactory.php b/database/factories/InputDocumentFactory.php index 5d2200275..5625cc288 100644 --- a/database/factories/InputDocumentFactory.php +++ b/database/factories/InputDocumentFactory.php @@ -1,29 +1,41 @@ define(InputDocument::class, function(Faker $faker) { - return [ - 'INP_DOC_UID' => G::generateUniqueID(), - 'PRO_UID' => function() { - $process = factory(Process::class)->create(); - return $process->PRO_UID; - }, - 'INP_DOC_TITLE' => $faker->sentence(2), - 'INP_DOC_DESCRIPTION' => $faker->sentence(10), - 'INP_DOC_FORM_NEEDED' => 'VIRTUAL', - 'INP_DOC_ORIGINAL' => 'ORIGINAL', - 'INP_DOC_PUBLISHED' => 'PRIVATE', - 'INP_DOC_VERSIONING' => 0, - 'INP_DOC_DESTINATION_PATH' => '', - 'INP_DOC_TAGS' => 'INPUT', - 'INP_DOC_TYPE_FILE' => '.*', - 'INP_DOC_MAX_FILESIZE' => 0, - 'INP_DOC_MAX_FILESIZE_UNIT' => 'KB' - ]; -}); +class InputDocumentFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'INP_DOC_UID' => G::generateUniqueID(), + 'PRO_UID' => function () { + $process = Process::factory()->create(); + return $process->PRO_UID; + }, + 'INP_DOC_TITLE' => $this->faker->sentence(2), + 'INP_DOC_DESCRIPTION' => $this->faker->sentence(10), + 'INP_DOC_FORM_NEEDED' => 'VIRTUAL', + 'INP_DOC_ORIGINAL' => 'ORIGINAL', + 'INP_DOC_PUBLISHED' => 'PRIVATE', + 'INP_DOC_VERSIONING' => 0, + 'INP_DOC_DESTINATION_PATH' => '', + 'INP_DOC_TAGS' => 'INPUT', + 'INP_DOC_TYPE_FILE' => '.*', + 'INP_DOC_MAX_FILESIZE' => 0, + 'INP_DOC_MAX_FILESIZE_UNIT' => 'KB' + ]; + } + +} diff --git a/database/factories/LicenseManagerFactory.php b/database/factories/LicenseManagerFactory.php index 22d192f6d..009b2748d 100644 --- a/database/factories/LicenseManagerFactory.php +++ b/database/factories/LicenseManagerFactory.php @@ -1,18 +1,32 @@ define(\ProcessMaker\Model\LicenseManager::class, function(Faker $faker) { - return [ - "LICENSE_UID" => $faker->regexify("/[a-zA-Z]{32}/"), - "LICENSE_USER" => $faker->name, - "LICENSE_START" => 0, - "LICENSE_END" => 0, - "LICENSE_SPAN" => 0, - "LICENSE_STATUS" => 'ACTIVE', - "LICENSE_DATA" => '', - "LICENSE_PATH" => '', - "LICENSE_WORKSPACE" => '', - "LICENSE_TYPE" => 'ONPREMISE' - ]; -}); +use App\Factories\Factory; +use Illuminate\Support\Str; + +class LicenseManagerFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + "LICENSE_UID" => $this->faker->regexify("/[a-zA-Z]{32}/"), + "LICENSE_USER" => $this->faker->name, + "LICENSE_START" => 0, + "LICENSE_END" => 0, + "LICENSE_SPAN" => 0, + "LICENSE_STATUS" => 'ACTIVE', + "LICENSE_DATA" => '', + "LICENSE_PATH" => '', + "LICENSE_WORKSPACE" => '', + "LICENSE_TYPE" => 'ONPREMISE' + ]; + } + +} diff --git a/database/factories/ListUnassignedFactory.php b/database/factories/ListUnassignedFactory.php index 17a19b25c..67023b5c8 100644 --- a/database/factories/ListUnassignedFactory.php +++ b/database/factories/ListUnassignedFactory.php @@ -1,65 +1,85 @@ define(\ProcessMaker\Model\ListUnassigned::class, function(Faker $faker) { - return [ - 'APP_UID' => G::generateUniqueID(), - 'DEL_INDEX' => 2, - 'TAS_UID' => G::generateUniqueID(), - 'PRO_UID' => G::generateUniqueID(), - 'APP_NUMBER' => $faker->unique()->numberBetween(1000), - 'APP_TITLE' => $faker->sentence(3), - 'APP_PRO_TITLE' => $faker->sentence(3), - 'APP_TAS_TITLE' => $faker->sentence(3), - 'DEL_PREVIOUS_USR_USERNAME' => $faker->name, - 'DEL_PREVIOUS_USR_FIRSTNAME' => $faker->firstName, - 'DEL_PREVIOUS_USR_LASTNAME' => $faker->lastName, - 'APP_UPDATE_DATE' => $faker->dateTime(), - 'DEL_PREVIOUS_USR_UID' => G::generateUniqueID(), - 'DEL_DELEGATE_DATE' => $faker->dateTime(), - 'DEL_DUE_DATE' => $faker->dateTime(), - 'DEL_PRIORITY' => 3, - 'PRO_ID' => $faker->unique()->numberBetween(1000), - 'TAS_ID' => $faker->unique()->numberBetween(1000), - ]; -}); +class ListUnassignedFactory extends Factory +{ -$factory->state(\ProcessMaker\Model\ListUnassigned::class, 'foreign_keys', function (Faker $faker) { - $process = factory(Process::class)->create(); - $app = factory(Application::class)->create(['PRO_UID' => $process->PRO_UID]); - $user = factory(User::class)->create(); - $task = factory(Task::class)->create([ - 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', // Define a self-service type - 'TAS_GROUP_VARIABLE' => '', - 'PRO_UID' => $process->PRO_UID - ]); + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'APP_UID' => G::generateUniqueID(), + 'DEL_INDEX' => 2, + 'TAS_UID' => G::generateUniqueID(), + 'PRO_UID' => G::generateUniqueID(), + 'APP_NUMBER' => $this->faker->unique()->numberBetween(1000), + 'APP_TITLE' => $this->faker->sentence(3), + 'APP_PRO_TITLE' => $this->faker->sentence(3), + 'APP_TAS_TITLE' => $this->faker->sentence(3), + 'DEL_PREVIOUS_USR_USERNAME' => $this->faker->name, + 'DEL_PREVIOUS_USR_FIRSTNAME' => $this->faker->firstName, + 'DEL_PREVIOUS_USR_LASTNAME' => $this->faker->lastName, + 'APP_UPDATE_DATE' => $this->faker->dateTime(), + 'DEL_PREVIOUS_USR_UID' => G::generateUniqueID(), + 'DEL_DELEGATE_DATE' => $this->faker->dateTime(), + 'DEL_DUE_DATE' => $this->faker->dateTime(), + 'DEL_PRIORITY' => 3, + 'PRO_ID' => $this->faker->unique()->numberBetween(1000), + 'TAS_ID' => $this->faker->unique()->numberBetween(1000), + ]; + } - return [ - 'APP_UID' => $app->APP_UID, - 'DEL_INDEX' => 2, - 'TAS_UID' => $task->TAS_UID, - 'PRO_UID' => $process->PRO_UID, - 'APP_NUMBER' => $app->APP_NUMBER, - 'APP_TITLE' => $app->APP_TITLE, - 'APP_PRO_TITLE' => $process->PRO_TITLE, - 'APP_TAS_TITLE' => $task->TAS_TITLE, - 'DEL_PREVIOUS_USR_USERNAME' => $user->USR_USERNAME, - 'DEL_PREVIOUS_USR_FIRSTNAME' => $user->USR_FIRSTNAME, - 'DEL_PREVIOUS_USR_LASTNAME' => $user->USR_LASTNAME, - 'APP_UPDATE_DATE' => $faker->dateTime(), - 'DEL_PREVIOUS_USR_UID' => G::generateUniqueID(), - 'DEL_DELEGATE_DATE' => $faker->dateTime(), - 'DEL_DUE_DATE' => $faker->dateTime(), - 'DEL_PRIORITY' => 3, - 'PRO_ID' => $process->PRO_ID, - 'TAS_ID' => $task->TAS_ID, - ]; -}); + /** + * + * @return type + */ + public function foreign_keys() + { + $state = function (array $attributes) { + $process = Process::factory()->create(); + $app = Application::factory()->create(['PRO_UID' => $process->PRO_UID]); + $user = User::factory()->create(); + $task = Task::factory()->create([ + 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', // Define a self-service type + 'TAS_GROUP_VARIABLE' => '', + 'PRO_UID' => $process->PRO_UID + ]); + return [ + 'APP_UID' => $app->APP_UID, + 'DEL_INDEX' => 2, + 'TAS_UID' => $task->TAS_UID, + 'PRO_UID' => $process->PRO_UID, + 'APP_NUMBER' => $app->APP_NUMBER, + 'APP_TITLE' => $app->APP_TITLE, + 'APP_PRO_TITLE' => $process->PRO_TITLE, + 'APP_TAS_TITLE' => $task->TAS_TITLE, + 'DEL_PREVIOUS_USR_USERNAME' => $user->USR_USERNAME, + 'DEL_PREVIOUS_USR_FIRSTNAME' => $user->USR_FIRSTNAME, + 'DEL_PREVIOUS_USR_LASTNAME' => $user->USR_LASTNAME, + 'APP_UPDATE_DATE' => $this->faker->dateTime(), + 'DEL_PREVIOUS_USR_UID' => G::generateUniqueID(), + 'DEL_DELEGATE_DATE' => $this->faker->dateTime(), + 'DEL_DUE_DATE' => $this->faker->dateTime(), + 'DEL_PRIORITY' => 3, + 'PRO_ID' => $process->PRO_ID, + 'TAS_ID' => $task->TAS_ID, + ]; + }; + return $this->state($state); + } + +} diff --git a/database/factories/OauthClientsFactory.php b/database/factories/OauthClientsFactory.php index 21e70c0e2..df1c2b862 100644 --- a/database/factories/OauthClientsFactory.php +++ b/database/factories/OauthClientsFactory.php @@ -1,17 +1,31 @@ define(\ProcessMaker\Model\OauthClients::class, function(Faker $faker) { - return [ - "CLIENT_ID" => $faker->unique()->word(), - "CLIENT_SECRET" => $faker->regexify("/[a-zA-Z]{6}/"), - "CLIENT_NAME" => $faker->regexify("/[a-zA-Z]{6}/"), - "CLIENT_DESCRIPTION" => $faker->text, - "CLIENT_WEBSITE" => $faker->url, - "REDIRECT_URI" => $faker->url, - "USR_UID" => function() { - return factory(\ProcessMaker\Model\User::class)->create()->USR_UID; - } - ]; -}); +use App\Factories\Factory; +use Illuminate\Support\Str; + +class OauthClientsFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + "CLIENT_ID" => $this->faker->unique()->word(), + "CLIENT_SECRET" => $this->faker->regexify("/[a-zA-Z]{6}/"), + "CLIENT_NAME" => $this->faker->regexify("/[a-zA-Z]{6}/"), + "CLIENT_DESCRIPTION" => $this->faker->text, + "CLIENT_WEBSITE" => $this->faker->url, + "REDIRECT_URI" => $this->faker->url, + "USR_UID" => function () { + return \ProcessMaker\Model\User::factory()->create()->USR_UID; + } + ]; + } + +} diff --git a/database/factories/ObjectPermissionFactory.php b/database/factories/ObjectPermissionFactory.php index 8017f1cfc..31777d522 100644 --- a/database/factories/ObjectPermissionFactory.php +++ b/database/factories/ObjectPermissionFactory.php @@ -1,22 +1,34 @@ define(\ProcessMaker\Model\ObjectPermission::class, function(Faker $faker) { - return [ - 'OP_UID' => G::generateUniqueID(), - 'PRO_UID' => '', - 'TAS_UID' => '', - 'USR_UID' => '', - 'OP_USER_RELATION' => 1, - 'OP_TASK_SOURCE' => '', - 'OP_PARTICIPATE' => 0, - 'OP_OBJ_TYPE' => 'MSGS_HISTORY', - 'OP_OBJ_UID' => '', - 'OP_ACTION' => 'VIEW', - 'OP_CASE_STATUS' => 'ALL' - ]; -}); +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class ObjectPermissionFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'OP_UID' => G::generateUniqueID(), + 'PRO_UID' => '', + 'TAS_UID' => '', + 'USR_UID' => '', + 'OP_USER_RELATION' => 1, + 'OP_TASK_SOURCE' => '', + 'OP_PARTICIPATE' => 0, + 'OP_OBJ_TYPE' => 'MSGS_HISTORY', + 'OP_OBJ_UID' => '', + 'OP_ACTION' => 'VIEW', + 'OP_CASE_STATUS' => 'ALL' + ]; + } + +} diff --git a/database/factories/OutputDocumentFactory.php b/database/factories/OutputDocumentFactory.php index 68ef77090..2b8a70863 100644 --- a/database/factories/OutputDocumentFactory.php +++ b/database/factories/OutputDocumentFactory.php @@ -1,45 +1,57 @@ define(OutputDocument::class, function(Faker $faker) { - $date = $faker->dateTime(); - return [ - 'OUT_DOC_UID' => G::generateUniqueID(), - 'OUT_DOC_ID' => $faker->unique()->numberBetween(1, 10000), - 'OUT_DOC_TITLE' => $faker->sentence(2), - 'OUT_DOC_DESCRIPTION' => $faker->sentence(10), - 'OUT_DOC_FILENAME' => $faker->sentence(2), - 'OUT_DOC_TEMPLATE' => '', - 'PRO_UID' => function() { - $process = factory(Process::class)->create(); - return $process->PRO_UID; - }, - 'OUT_DOC_REPORT_GENERATOR' => 'TCPDF', - 'OUT_DOC_LANDSCAPE' => 0, - 'OUT_DOC_MEDIA' => 'Letter', - 'OUT_DOC_LEFT_MARGIN' => 20, - 'OUT_DOC_RIGHT_MARGIN' => 20, - 'OUT_DOC_TOP_MARGIN' => 20, - 'OUT_DOC_BOTTOM_MARGIN' => 20, - 'OUT_DOC_GENERATE' => 'BOTH', - 'OUT_DOC_TYPE' => 'HTML', - 'OUT_DOC_CURRENT_REVISION' => 0, - 'OUT_DOC_FIELD_MAPPING' => '', - 'OUT_DOC_VERSIONING' => 1, - 'OUT_DOC_DESTINATION_PATH' => '', - 'OUT_DOC_TAGS' => '', - 'OUT_DOC_PDF_SECURITY_ENABLED' => 0, - 'OUT_DOC_PDF_SECURITY_OPEN_PASSWORD' => '', - 'OUT_DOC_PDF_SECURITY_OWNER_PASSWORD' => '', - 'OUT_DOC_PDF_SECURITY_PERMISSIONS' => '', - 'OUT_DOC_OPEN_TYPE' => 1, - 'OUT_DOC_HEADER' => null, - 'OUT_DOC_FOOTER' => null - ]; -}); +class OutputDocumentFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + $date = $this->faker->dateTime(); + return [ + 'OUT_DOC_UID' => G::generateUniqueID(), + 'OUT_DOC_ID' => $this->faker->unique()->numberBetween(1, 10000), + 'OUT_DOC_TITLE' => $this->faker->sentence(2), + 'OUT_DOC_DESCRIPTION' => $this->faker->sentence(10), + 'OUT_DOC_FILENAME' => $this->faker->sentence(2), + 'OUT_DOC_TEMPLATE' => '', + 'PRO_UID' => function () { + $process = Process::factory()->create(); + return $process->PRO_UID; + }, + 'OUT_DOC_REPORT_GENERATOR' => 'TCPDF', + 'OUT_DOC_LANDSCAPE' => 0, + 'OUT_DOC_MEDIA' => 'Letter', + 'OUT_DOC_LEFT_MARGIN' => 20, + 'OUT_DOC_RIGHT_MARGIN' => 20, + 'OUT_DOC_TOP_MARGIN' => 20, + 'OUT_DOC_BOTTOM_MARGIN' => 20, + 'OUT_DOC_GENERATE' => 'BOTH', + 'OUT_DOC_TYPE' => 'HTML', + 'OUT_DOC_CURRENT_REVISION' => 0, + 'OUT_DOC_FIELD_MAPPING' => '', + 'OUT_DOC_VERSIONING' => 1, + 'OUT_DOC_DESTINATION_PATH' => '', + 'OUT_DOC_TAGS' => '', + 'OUT_DOC_PDF_SECURITY_ENABLED' => 0, + 'OUT_DOC_PDF_SECURITY_OPEN_PASSWORD' => '', + 'OUT_DOC_PDF_SECURITY_OWNER_PASSWORD' => '', + 'OUT_DOC_PDF_SECURITY_PERMISSIONS' => '', + 'OUT_DOC_OPEN_TYPE' => 1, + 'OUT_DOC_HEADER' => null, + 'OUT_DOC_FOOTER' => null + ]; + } + +} diff --git a/database/factories/ProcessCategoryFactory.php b/database/factories/ProcessCategoryFactory.php index aaaedfd75..f92dc207f 100644 --- a/database/factories/ProcessCategoryFactory.php +++ b/database/factories/ProcessCategoryFactory.php @@ -1,17 +1,28 @@ define(\ProcessMaker\Model\ProcessCategory::class, function (Faker $faker) { - return [ - 'CATEGORY_UID' => G::generateUniqueID(), - 'CATEGORY_ID' => $faker->unique()->numberBetween(1000), - 'CATEGORY_PARENT' => '', - 'CATEGORY_NAME' => $faker->sentence(5), - 'CATEGORY_ICON' => '', - ]; -}); +class ProcessCategoryFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'CATEGORY_UID' => G::generateUniqueID(), + 'CATEGORY_ID' => $this->faker->unique()->numberBetween(1000), + 'CATEGORY_PARENT' => '', + 'CATEGORY_NAME' => $this->faker->sentence(5), + 'CATEGORY_ICON' => '', + ]; + } + +} diff --git a/database/factories/ProcessFactory.php b/database/factories/ProcessFactory.php index 99c42f5a0..79bff8242 100644 --- a/database/factories/ProcessFactory.php +++ b/database/factories/ProcessFactory.php @@ -1,65 +1,77 @@ define(\ProcessMaker\Model\Process::class, function (Faker $faker) { +class ProcessFactory extends Factory +{ - return [ - 'PRO_UID' => G::generateUniqueID(), - 'PRO_ID' => $faker->unique()->numberBetween(2000), - 'PRO_TITLE' => $faker->sentence(3), - 'PRO_DESCRIPTION' => $faker->paragraph(3), - 'PRO_PARENT' => G::generateUniqueID(), - 'PRO_STATUS' => 'ACTIVE', - 'PRO_STATUS_ID' => 1, - 'PRO_TYPE' => 'NORMAL', - 'PRO_ASSIGNMENT' => 'FALSE', - 'PRO_TYPE_PROCESS' => 'PUBLIC', - 'PRO_UPDATE_DATE' => $faker->dateTime(), - 'PRO_CREATE_DATE' => $faker->dateTime(), - 'PRO_CREATE_USER' => '00000000000000000000000000000001', - 'PRO_DEBUG' => 0, - 'PRO_DYNAFORMS' => serialize([]), - 'PRO_ITEE' => 1, - 'PRO_ACTION_DONE' => serialize([]), - 'PRO_SUBPROCESS' => 0, - 'PRO_CATEGORY' => function () { - return factory(\ProcessMaker\Model\ProcessCategory::class)->create()->CATEGORY_UID; - }, - 'CATEGORY_ID' => 0 - ]; -}); + public function definition(): array + { + return [ + 'PRO_UID' => G::generateUniqueID(), + 'PRO_ID' => $this->faker->unique()->numberBetween(2000), + 'PRO_TITLE' => $this->faker->sentence(3), + 'PRO_DESCRIPTION' => $this->faker->paragraph(3), + 'PRO_PARENT' => G::generateUniqueID(), + 'PRO_STATUS' => 'ACTIVE', + 'PRO_STATUS_ID' => 1, + 'PRO_TYPE' => 'NORMAL', + 'PRO_ASSIGNMENT' => 'FALSE', + 'PRO_TYPE_PROCESS' => 'PUBLIC', + 'PRO_UPDATE_DATE' => $this->faker->dateTime(), + 'PRO_CREATE_DATE' => $this->faker->dateTime(), + 'PRO_CREATE_USER' => '00000000000000000000000000000001', + 'PRO_DEBUG' => 0, + 'PRO_DYNAFORMS' => serialize([]), + 'PRO_ITEE' => 1, + 'PRO_ACTION_DONE' => serialize([]), + 'PRO_SUBPROCESS' => 0, + 'PRO_CATEGORY' => function () { + return \ProcessMaker\Model\ProcessCategory::factory()->create()->CATEGORY_UID; + }, + 'CATEGORY_ID' => 0 + ]; + } -// Create a process with the foreign keys -$factory->state(\ProcessMaker\Model\Process::class, 'foreign_keys', function (Faker $faker) { - // Create user - $user = factory(\ProcessMaker\Model\User::class)->create(); + /** + * Create a process with the foreign keys + * @return type + */ + public function foreign_keys() + { + $state = function (array $attributes) { + // Create user + $user = \ProcessMaker\Model\User::factory()->create(); - return [ - 'PRO_UID' => G::generateUniqueID(), - 'PRO_ID' => $faker->unique()->numberBetween(1000), - 'PRO_TITLE' => $faker->sentence(3), - 'PRO_DESCRIPTION' => $faker->paragraph(3), - 'PRO_PARENT' => G::generateUniqueID(), - 'PRO_STATUS' => 'ACTIVE', - 'PRO_STATUS_ID' => 1, - 'PRO_TYPE' => 'NORMAL', - 'PRO_ASSIGNMENT' => 'FALSE', - 'PRO_TYPE_PROCESS' => 'PUBLIC', - 'PRO_UPDATE_DATE' => $faker->dateTime(), - 'PRO_CREATE_DATE' => $faker->dateTime(), - 'PRO_CREATE_USER' => $user->USR_UID, - 'PRO_DEBUG' => 0, - 'PRO_DYNAFORMS' => serialize([]), - 'PRO_ITEE' => 1, - 'PRO_ACTION_DONE' => serialize([]), - 'PRO_SUBPROCESS' => 0, - 'PRO_CATEGORY' => function () { - return factory(\ProcessMaker\Model\ProcessCategory::class)->create()->CATEGORY_UID; - }, - ]; -}); + return [ + 'PRO_UID' => G::generateUniqueID(), + 'PRO_ID' => $this->faker->unique()->numberBetween(1000), + 'PRO_TITLE' => $this->faker->sentence(3), + 'PRO_DESCRIPTION' => $this->faker->paragraph(3), + 'PRO_PARENT' => G::generateUniqueID(), + 'PRO_STATUS' => 'ACTIVE', + 'PRO_STATUS_ID' => 1, + 'PRO_TYPE' => 'NORMAL', + 'PRO_ASSIGNMENT' => 'FALSE', + 'PRO_TYPE_PROCESS' => 'PUBLIC', + 'PRO_UPDATE_DATE' => $this->faker->dateTime(), + 'PRO_CREATE_DATE' => $this->faker->dateTime(), + 'PRO_CREATE_USER' => $user->USR_UID, + 'PRO_DEBUG' => 0, + 'PRO_DYNAFORMS' => serialize([]), + 'PRO_ITEE' => 1, + 'PRO_ACTION_DONE' => serialize([]), + 'PRO_SUBPROCESS' => 0, + 'PRO_CATEGORY' => function () { + return \ProcessMaker\Model\ProcessCategory::factory()->create()->CATEGORY_UID; + }, + ]; + }; + return $this->state($state); + } +} diff --git a/database/factories/ProcessFilesFactory.php b/database/factories/ProcessFilesFactory.php index 2d9c84e59..237a6e875 100644 --- a/database/factories/ProcessFilesFactory.php +++ b/database/factories/ProcessFilesFactory.php @@ -1,17 +1,32 @@ define(\ProcessMaker\Model\ProcessFiles::class, function(Faker $faker) { - return [ - 'PRF_UID' => G::generateUniqueID(), - 'PRO_UID' => '', - 'USR_UID' => '', - 'PRF_UPDATE_USR_UID' => '', - 'PRF_PATH' => 'dummy_path', - 'PRF_TYPE' => '', - 'PRF_EDITABLE' => 1, - 'PRF_CREATE_DATE' => $faker->dateTime(), - 'PRF_UPDATE_DATE' => $faker->dateTime(), - ]; -}); +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class ProcessFilesFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'PRF_UID' => G::generateUniqueID(), + 'PRO_UID' => '', + 'USR_UID' => '', + 'PRF_UPDATE_USR_UID' => '', + 'PRF_PATH' => 'dummy_path', + 'PRF_TYPE' => '', + 'PRF_EDITABLE' => 1, + 'PRF_CREATE_DATE' => $this->faker->dateTime(), + 'PRF_UPDATE_DATE' => $this->faker->dateTime(), + ]; + } + +} diff --git a/database/factories/ProcessUserFactory.php b/database/factories/ProcessUserFactory.php index e84b6b42e..b64a59440 100644 --- a/database/factories/ProcessUserFactory.php +++ b/database/factories/ProcessUserFactory.php @@ -1,26 +1,48 @@ define(\ProcessMaker\Model\ProcessUser::class, function(Faker $faker) { - return [ - 'PU_UID' => G::generateUniqueID(), - 'PRO_UID' => G::generateUniqueID(), - 'USR_UID' => G::generateUniqueID(), - 'PU_TYPE' => 'SUPERVISOR' - ]; -}); +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; -// Create a process with the foreign keys -$factory->state(\ProcessMaker\Model\ProcessUser::class, 'foreign_keys', function (Faker $faker) { - // Create user - $user = factory(\ProcessMaker\Model\User::class)->create(); - $process = factory(\ProcessMaker\Model\Process::class)->create(); +class ProcessUserFactory extends Factory +{ - return [ - 'PU_UID' => G::generateUniqueID(), - 'PRO_UID' => $process->PRO_UID, - 'USR_UID' => $user->USR_UID, - 'PU_TYPE' => 'SUPERVISOR' - ]; -}); \ No newline at end of file + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'PU_UID' => G::generateUniqueID(), + 'PRO_UID' => G::generateUniqueID(), + 'USR_UID' => G::generateUniqueID(), + 'PU_TYPE' => 'SUPERVISOR' + ]; + } + + /** + * Create a process with the foreign keys + * @return type + */ + public function foreign_keys() + { + $state = function (array $attributes) { + // Create user + $user = \ProcessMaker\Model\User::factory()->create(); + $process = \ProcessMaker\Model\Process::factory()->create(); + + return [ + 'PU_UID' => G::generateUniqueID(), + 'PRO_UID' => $process->PRO_UID, + 'USR_UID' => $user->USR_UID, + 'PU_TYPE' => 'SUPERVISOR' + ]; + }; + return $this->state($state); + } + +} diff --git a/database/factories/ProcessVariablesFactory.php b/database/factories/ProcessVariablesFactory.php index 77bc3ed8a..13bec32d8 100644 --- a/database/factories/ProcessVariablesFactory.php +++ b/database/factories/ProcessVariablesFactory.php @@ -1,49 +1,71 @@ define(ProcessVariables::class, function (Faker $faker) { - return [ - 'VAR_UID' => G::generateUniqueID(), - 'PRO_ID' => G::generateUniqueID(), - 'PRJ_UID' => G::generateUniqueID(), - 'VAR_NAME' => $faker->word, - 'VAR_FIELD_TYPE' => G::generateUniqueID(), - 'VAR_FIELD_TYPE_ID' => G::generateUniqueID(), - 'VAR_FIELD_SIZE' => 10, - 'VAR_LABEL' => 'string', - 'VAR_DBCONNECTION' => 'workflow', - 'VAR_SQL' => '', - 'VAR_NULL' => 0, - 'VAR_DEFAULT' => '', - 'VAR_ACCEPTED_VALUES' => '[]', - 'INP_DOC_UID' => '' - ]; -}); +class ProcessVariablesFactory extends Factory +{ -// Create a processVariables with the foreign keys -$factory->state(ProcessVariables::class, 'foreign_keys', function (Faker $faker) { - $types = ['string', 'integer', 'float', 'boolean', 'datetime', 'grid', 'array', 'file', 'multiplefile', 'object']; - $varType = $faker->randomElement($types); - $varTypeId = array_search($varType, $types) + 1; - // Create values in the foreign key relations - $process = factory(\ProcessMaker\Model\Process::class)->create(); + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'VAR_UID' => G::generateUniqueID(), + 'PRO_ID' => G::generateUniqueID(), + 'PRJ_UID' => G::generateUniqueID(), + 'VAR_NAME' => $this->faker->word, + 'VAR_FIELD_TYPE' => G::generateUniqueID(), + 'VAR_FIELD_TYPE_ID' => G::generateUniqueID(), + 'VAR_FIELD_SIZE' => 10, + 'VAR_LABEL' => 'string', + 'VAR_DBCONNECTION' => 'workflow', + 'VAR_SQL' => '', + 'VAR_NULL' => 0, + 'VAR_DEFAULT' => '', + 'VAR_ACCEPTED_VALUES' => '[]', + 'INP_DOC_UID' => '' + ]; + } - return [ - 'VAR_UID' => G::generateUniqueID(), - 'PRO_ID' => $process->PRO_ID, - 'PRJ_UID' => $process->PRO_UID, - 'VAR_NAME' => $faker->word, - 'VAR_FIELD_TYPE' => $varType, - 'VAR_FIELD_TYPE_ID' => $varTypeId, - 'VAR_FIELD_SIZE' => 10, - 'VAR_LABEL' => 'string', - 'VAR_DBCONNECTION' => 'workflow', - 'VAR_SQL' => '', - 'VAR_NULL' => 0, - 'VAR_DEFAULT' => '', - 'VAR_ACCEPTED_VALUES' => '[]', - 'INP_DOC_UID' => '' - ]; -}); \ No newline at end of file + /** + * Create a processVariables with the foreign keys + * @return type + */ + public function foreign_keys() + { + $state = function (array $attributes) { + $types = ['string', 'integer', 'float', 'boolean', 'datetime', 'grid', 'array', 'file', 'multiplefile', 'object']; + $varType = $this->faker->randomElement($types); + $varTypeId = array_search($varType, $types) + 1; + // Create values in the foreign key relations + $process = \ProcessMaker\Model\Process::factory()->create(); + + return [ + 'VAR_UID' => G::generateUniqueID(), + 'PRO_ID' => $process->PRO_ID, + 'PRJ_UID' => $process->PRO_UID, + 'VAR_NAME' => $this->faker->word, + 'VAR_FIELD_TYPE' => $varType, + 'VAR_FIELD_TYPE_ID' => $varTypeId, + 'VAR_FIELD_SIZE' => 10, + 'VAR_LABEL' => 'string', + 'VAR_DBCONNECTION' => 'workflow', + 'VAR_SQL' => '', + 'VAR_NULL' => 0, + 'VAR_DEFAULT' => '', + 'VAR_ACCEPTED_VALUES' => '[]', + 'INP_DOC_UID' => '' + ]; + }; + return $this->state($state); + } + +} diff --git a/database/factories/RbacAuthenticationSourceFactory.php b/database/factories/RbacAuthenticationSourceFactory.php index eb217ee54..6d0d86c39 100644 --- a/database/factories/RbacAuthenticationSourceFactory.php +++ b/database/factories/RbacAuthenticationSourceFactory.php @@ -1,22 +1,37 @@ define(\ProcessMaker\Model\RbacAuthenticationSource::class, function (Faker $faker) { - return [ - 'AUTH_SOURCE_UID' => G::generateUniqueID(), - 'AUTH_SOURCE_NAME' => $faker->title, - 'AUTH_SOURCE_PROVIDER' => 'ldapAdvanced', - 'AUTH_SOURCE_SERVER_NAME' => $faker->domainName, - 'AUTH_SOURCE_PORT' => $faker->numberBetween(100, 1000), - 'AUTH_SOURCE_ENABLED_TLS' => 0, - 'AUTH_SOURCE_VERSION' => 3, - 'AUTH_SOURCE_BASE_DN' => 'dc=processmaker,dc=test', - 'AUTH_ANONYMOUS' => 0, - 'AUTH_SOURCE_SEARCH_USER' => $faker->userName, - 'AUTH_SOURCE_PASSWORD' => $faker->password, - 'AUTH_SOURCE_ATTRIBUTES' => '', - 'AUTH_SOURCE_OBJECT_CLASSES' => '', - 'AUTH_SOURCE_DATA' => 'a:8:{s:9:"LDAP_TYPE";s:4:"ldap";s:25:"AUTH_SOURCE_AUTO_REGISTER";s:1:"0";s:31:"AUTH_SOURCE_IDENTIFIER_FOR_USER";s:3:"uid";s:24:"AUTH_SOURCE_USERS_FILTER";s:0:"";s:22:"AUTH_SOURCE_RETIRED_OU";s:0:"";s:20:"AUTH_SOURCE_SHOWGRID";s:2:"on";s:26:"AUTH_SOURCE_GRID_ATTRIBUTE";a:1:{i:1;a:2:{s:13:"attributeLdap";s:4:"test";s:13:"attributeUser";s:13:"USR_FIRSTNAME";}}s:20:"LDAP_PAGE_SIZE_LIMIT";i:1000;}' - ]; -}); +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class RbacAuthenticationSourceFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'AUTH_SOURCE_UID' => G::generateUniqueID(), + 'AUTH_SOURCE_NAME' => $this->faker->title, + 'AUTH_SOURCE_PROVIDER' => 'ldapAdvanced', + 'AUTH_SOURCE_SERVER_NAME' => $this->faker->domainName, + 'AUTH_SOURCE_PORT' => $this->faker->numberBetween(100, 1000), + 'AUTH_SOURCE_ENABLED_TLS' => 0, + 'AUTH_SOURCE_VERSION' => 3, + 'AUTH_SOURCE_BASE_DN' => 'dc=processmaker,dc=test', + 'AUTH_ANONYMOUS' => 0, + 'AUTH_SOURCE_SEARCH_USER' => $this->faker->userName, + 'AUTH_SOURCE_PASSWORD' => $this->faker->password, + 'AUTH_SOURCE_ATTRIBUTES' => '', + 'AUTH_SOURCE_OBJECT_CLASSES' => '', + 'AUTH_SOURCE_DATA' => 'a:8:{s:9:"LDAP_TYPE";s:4:"ldap";s:25:"AUTH_SOURCE_AUTO_REGISTER";s:1:"0";s:31:"AUTH_SOURCE_IDENTIFIER_FOR_USER";s:3:"uid";s:24:"AUTH_SOURCE_USERS_FILTER";s:0:"";s:22:"AUTH_SOURCE_RETIRED_OU";s:0:"";s:20:"AUTH_SOURCE_SHOWGRID";s:2:"on";s:26:"AUTH_SOURCE_GRID_ATTRIBUTE";a:1:{i:1;a:2:{s:13:"attributeLdap";s:4:"test";s:13:"attributeUser";s:13:"USR_FIRSTNAME";}}s:20:"LDAP_PAGE_SIZE_LIMIT";i:1000;}' + ]; + } + +} diff --git a/database/factories/RbacRolesFactory.php b/database/factories/RbacRolesFactory.php index f4ce2a7bc..081b2b7ba 100644 --- a/database/factories/RbacRolesFactory.php +++ b/database/factories/RbacRolesFactory.php @@ -1,17 +1,30 @@ define(\ProcessMaker\Model\RbacRoles::class, function(Faker $faker) { - return [ - 'ROL_UID' => G::generateUniqueID(), - 'ROL_PARENT' => '', // This value is empty because actually don't exists this type of relations between roles - 'ROL_SYSTEM' => '00000000000000000000000000000002', // Hardcoded value, this value refers to ProcessMaker - 'ROL_CODE' => strtoupper($faker->word), - 'ROL_CREATE_DATE' => $faker->date('Y-m-d H:i:s', 'now'), - 'ROL_UPDATE_DATE' => $faker->date('Y-m-d H:i:s', 'now'), - 'ROL_STATUS' => $faker->randomElement([0, 1]) - ]; -}); +namespace Database\Factories; + +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class RbacRolesFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'ROL_UID' => G::generateUniqueID(), + 'ROL_PARENT' => '', // This value is empty because actually don't exists this type of relations between roles + 'ROL_SYSTEM' => '00000000000000000000000000000002', // Hardcoded value, this value refers to ProcessMaker + 'ROL_CODE' => strtoupper($this->faker->word), + 'ROL_CREATE_DATE' => $this->faker->date('Y-m-d H:i:s', 'now'), + 'ROL_UPDATE_DATE' => $this->faker->date('Y-m-d H:i:s', 'now'), + 'ROL_STATUS' => $this->faker->randomElement([0, 1]) + ]; + } + +} diff --git a/database/factories/RbacUsersFactory.php b/database/factories/RbacUsersFactory.php index 00413b726..e20ea1435 100644 --- a/database/factories/RbacUsersFactory.php +++ b/database/factories/RbacUsersFactory.php @@ -1,46 +1,82 @@ define(\ProcessMaker\Model\RbacUsers::class, function (Faker $faker) { - return [ - 'USR_UID' => G::generateUniqueID(), - 'USR_USERNAME' => $faker->unique()->userName, - 'USR_PASSWORD' => $faker->password, - 'USR_FIRSTNAME' => $faker->firstName, - 'USR_LASTNAME' => $faker->lastName, - 'USR_EMAIL' => $faker->unique()->email, - 'USR_DUE_DATE' => $faker->dateTimeInInterval('now', '+1 year')->format('Y-m-d H:i:s'), - 'USR_CREATE_DATE' => $faker->date('Y-m-d H:i:s', 'now'), - 'USR_UPDATE_DATE' => $faker->date('Y-m-d H:i:s', 'now'), - 'USR_STATUS' => $faker->randomElement([0, 1]), - 'USR_AUTH_TYPE' => 'MYSQL', // Authentication type, by default is MySQL - 'UID_AUTH_SOURCE' => '00000000000000000000000000000000', // When the type is "MYSQL" the value for this field is this... - 'USR_AUTH_USER_DN' => '', // Don't required for now - 'USR_AUTH_SUPERVISOR_DN' => '' // Don't required for now - ]; -}); +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; -// Create a deleted user -$factory->state(\ProcessMaker\Model\RbacUsers::class, 'deleted', function () { - return [ - 'USR_USERNAME' => '', - 'USR_STATUS' => 0, - 'USR_AUTH_TYPE' => '', - 'UID_AUTH_SOURCE' => '' - ]; -}); +class RbacUsersFactory extends Factory +{ -// Create an active user -$factory->state(\ProcessMaker\Model\RbacUsers::class, 'active', function () { - return [ - 'USR_STATUS' => 1 - ]; -}); + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'USR_UID' => G::generateUniqueID(), + 'USR_USERNAME' => $this->faker->unique()->userName, + 'USR_PASSWORD' => $this->faker->password, + 'USR_FIRSTNAME' => $this->faker->firstName, + 'USR_LASTNAME' => $this->faker->lastName, + 'USR_EMAIL' => $this->faker->unique()->email, + 'USR_DUE_DATE' => $this->faker->dateTimeInInterval('now', '+1 year')->format('Y-m-d H:i:s'), + 'USR_CREATE_DATE' => $this->faker->date('Y-m-d H:i:s', 'now'), + 'USR_UPDATE_DATE' => $this->faker->date('Y-m-d H:i:s', 'now'), + 'USR_STATUS' => $this->faker->randomElement([0, 1]), + 'USR_AUTH_TYPE' => 'MYSQL', // Authentication type, by default is MySQL + 'UID_AUTH_SOURCE' => '00000000000000000000000000000000', // When the type is "MYSQL" the value for this field is this... + 'USR_AUTH_USER_DN' => '', // Don't required for now + 'USR_AUTH_SUPERVISOR_DN' => '' // Don't required for now + ]; + } -// Create an inactive user -$factory->state(\ProcessMaker\Model\RbacUsers::class, 'inactive', function () { - return [ - 'USR_STATUS' => 0 - ]; -}); + /** + * Create a deleted user + * @return type + */ + public function deleted() + { + $state = function (array $attributes) { + return [ + 'USR_USERNAME' => '', + 'USR_STATUS' => 0, + 'USR_AUTH_TYPE' => '', + 'UID_AUTH_SOURCE' => '' + ]; + }; + return $this->state($state); + } + + /** + * Create an active user + * @return type + */ + public function active() + { + $state = function (array $attributes) { + return [ + 'USR_STATUS' => 1 + ]; + }; + return $this->state($state); + } + + /** + * Create an inactive user + * @return type + */ + public function inactive() + { + $state = function (array $attributes) { + return [ + 'USR_STATUS' => 0 + ]; + }; + return $this->state($state); + } + +} diff --git a/database/factories/RbacUsersRolesFactory.php b/database/factories/RbacUsersRolesFactory.php index 6d912a9c4..c109591ee 100644 --- a/database/factories/RbacUsersRolesFactory.php +++ b/database/factories/RbacUsersRolesFactory.php @@ -1,17 +1,30 @@ define(\ProcessMaker\Model\RbacUsersRoles::class, function() { - return [ - 'USR_UID' => function() { - $rbacUser = factory(\ProcessMaker\Model\RbacUsers::class)->create(); - return $rbacUser->USR_UID; - }, - 'ROL_UID' => function() { - $rbacRole = factory(\ProcessMaker\Model\RbacRoles::class)->create(); - return $rbacRole->ROL_UID; - } - ]; -}); +namespace Database\Factories; + +use App\Factories\Factory; +use Illuminate\Support\Str; + +class RbacUsersRolesFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'USR_UID' => function () { + $rbacUser = \ProcessMaker\Model\RbacUsers::factory()->create(); + return $rbacUser->USR_UID; + }, + 'ROL_UID' => function () { + $rbacRole = \ProcessMaker\Model\RbacRoles::factory()->create(); + return $rbacRole->ROL_UID; + } + ]; + } + +} diff --git a/database/factories/RouteFactory.php b/database/factories/RouteFactory.php index 18a3e2f57..30fc7d469 100644 --- a/database/factories/RouteFactory.php +++ b/database/factories/RouteFactory.php @@ -1,22 +1,35 @@ define(\ProcessMaker\Model\Route::class, function(Faker $faker) { - return [ - 'PRO_UID' => function() { - $process = factory(\ProcessMaker\Model\Process::class)->create(); - return $process->PRO_UID; - }, - 'TAS_UID' => function() { - $task = factory(\ProcessMaker\Model\Task::class)->create(); - return $task->TAS_UID; - }, - 'ROU_UID' => G::generateUniqueID(), - 'ROU_PARENT' => 0, - 'ROU_CASE' => 1, - 'ROU_TYPE' => 'SEQUENTIAL' - ]; -}); \ No newline at end of file +namespace Database\Factories; + +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class RouteFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'PRO_UID' => function () { + $process = \ProcessMaker\Model\Process::factory()->create(); + return $process->PRO_UID; + }, + 'TAS_UID' => function () { + $task = \ProcessMaker\Model\Task::factory()->create(); + return $task->TAS_UID; + }, + 'ROU_UID' => G::generateUniqueID(), + 'ROU_PARENT' => 0, + 'ROU_CASE' => 1, + 'ROU_TYPE' => 'SEQUENTIAL' + ]; + } + +} diff --git a/database/factories/StepFactory.php b/database/factories/StepFactory.php index c64c09395..61f5f2318 100644 --- a/database/factories/StepFactory.php +++ b/database/factories/StepFactory.php @@ -1,16 +1,31 @@ define(\ProcessMaker\Model\Step::class, function (Faker $faker) { - return [ - 'STEP_UID' => G::generateUniqueID(), - 'PRO_UID' => G::generateUniqueID(), - 'TAS_UID' => G::generateUniqueID(), - 'STEP_TYPE_OBJ' => 'DYNAFORM', - 'STEP_UID_OBJ' => '0', - 'STEP_CONDITION' => 'None', - 'STEP_POSITION' => 0, - 'STEP_MODE' => 'EDIT' - ]; -}); \ No newline at end of file +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class StepFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'STEP_UID' => G::generateUniqueID(), + 'PRO_UID' => G::generateUniqueID(), + 'TAS_UID' => G::generateUniqueID(), + 'STEP_TYPE_OBJ' => 'DYNAFORM', + 'STEP_UID_OBJ' => '0', + 'STEP_CONDITION' => 'None', + 'STEP_POSITION' => 0, + 'STEP_MODE' => 'EDIT' + ]; + } + +} diff --git a/database/factories/StepTriggerFactory.php b/database/factories/StepTriggerFactory.php index 6d63cdd80..d843591c1 100644 --- a/database/factories/StepTriggerFactory.php +++ b/database/factories/StepTriggerFactory.php @@ -1,18 +1,32 @@ define(\ProcessMaker\Model\StepTrigger::class, function (Faker $faker) { - return [ - 'STEP_UID' => $faker->regexify("/[a-zA-Z]{32}/"), - 'TAS_UID' => function() { - return factory(\ProcessMaker\Model\Task::class)->create()->TAS_UID; - }, - 'TRI_UID' => function() { - return factory(\ProcessMaker\Model\Triggers::class)->create()->TRI_UID; - }, - 'ST_TYPE' => 'BEFORE', - 'ST_CONDITION' => '', - 'ST_POSITION' => 1, - ]; -}); +use App\Factories\Factory; +use Illuminate\Support\Str; + +class StepTriggerFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'STEP_UID' => $this->faker->regexify("/[a-zA-Z]{32}/"), + 'TAS_UID' => function () { + return \ProcessMaker\Model\Task::factory()->create()->TAS_UID; + }, + 'TRI_UID' => function () { + return \ProcessMaker\Model\Triggers::factory()->create()->TRI_UID; + }, + 'ST_TYPE' => 'BEFORE', + 'ST_CONDITION' => '', + 'ST_POSITION' => 1, + ]; + } + +} diff --git a/database/factories/SubApplicationFactory.php b/database/factories/SubApplicationFactory.php index e21488705..d23b919a9 100644 --- a/database/factories/SubApplicationFactory.php +++ b/database/factories/SubApplicationFactory.php @@ -1,17 +1,32 @@ define(\ProcessMaker\Model\SubApplication::class, function (Faker $faker) { - return [ - 'APP_UID' => G::generateUniqueID(), - 'APP_PARENT' => G::generateUniqueID(), - 'DEL_INDEX_PARENT' => 2, - 'DEL_THREAD_PARENT' => 1, - 'SA_STATUS' => 'ACTIVE', - 'SA_VALUES_OUT' => 'a:0:{}', - 'SA_VALUES_IN' => 'a:0:{}', - 'SA_INIT_DATE' => $faker->dateTime(), - 'SA_FINISH_DATE' => $faker->dateTime(), - ]; -}); +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class SubApplicationFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'APP_UID' => G::generateUniqueID(), + 'APP_PARENT' => G::generateUniqueID(), + 'DEL_INDEX_PARENT' => 2, + 'DEL_THREAD_PARENT' => 1, + 'SA_STATUS' => 'ACTIVE', + 'SA_VALUES_OUT' => 'a:0:{}', + 'SA_VALUES_IN' => 'a:0:{}', + 'SA_INIT_DATE' => $this->faker->dateTime(), + 'SA_FINISH_DATE' => $this->faker->dateTime(), + ]; + } + +} diff --git a/database/factories/SubProcessFactory.php b/database/factories/SubProcessFactory.php index b98d4ee9b..061c487e3 100644 --- a/database/factories/SubProcessFactory.php +++ b/database/factories/SubProcessFactory.php @@ -1,18 +1,35 @@ define(\ProcessMaker\Model\SubProcess::class, function () { - return [ - 'SP_UID' => G::generateUniqueID(), - 'PRO_UID' => G::generateUniqueID(), - 'TAS_UID' => G::generateUniqueID(), - 'PRO_PARENT' => G::generateUniqueID(), - 'TAS_PARENT' => G::generateUniqueID(), - 'SP_TYPE' => '', - 'SP_SYNCHRONOUS' => 0, - 'SP_SYNCHRONOUS_TYPE' => '', - 'SP_SYNCHRONOUS_WAIT' => 0, - 'SP_VARIABLES_OUT' => '', - 'SP_VARIABLES_IN' => '', - 'SP_GRID_IN' => '' - ]; -}); +namespace Database\Factories; + +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class SubProcessFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'SP_UID' => G::generateUniqueID(), + 'PRO_UID' => G::generateUniqueID(), + 'TAS_UID' => G::generateUniqueID(), + 'PRO_PARENT' => G::generateUniqueID(), + 'TAS_PARENT' => G::generateUniqueID(), + 'SP_TYPE' => '', + 'SP_SYNCHRONOUS' => 0, + 'SP_SYNCHRONOUS_TYPE' => '', + 'SP_SYNCHRONOUS_WAIT' => 0, + 'SP_VARIABLES_OUT' => '', + 'SP_VARIABLES_IN' => '', + 'SP_GRID_IN' => '' + ]; + } + +} diff --git a/database/factories/TaskFactory.php b/database/factories/TaskFactory.php index caef8aba7..66b1eb700 100644 --- a/database/factories/TaskFactory.php +++ b/database/factories/TaskFactory.php @@ -1,90 +1,116 @@ define(\ProcessMaker\Model\Task::class, function(Faker $faker) { - $process = factory(\ProcessMaker\Model\Process::class)->create(); - return [ - 'PRO_UID' => $process->PRO_UID, - 'PRO_ID' => $process->PRO_ID, - 'TAS_UID' => G::generateUniqueID(), - 'TAS_TITLE' => $faker->sentence(2), - 'TAS_TYPE' => 'NORMAL', - 'TAS_TYPE_DAY' => 1, - 'TAS_DURATION' => 1, - 'TAS_ASSIGN_TYPE' => 'BALANCED', - 'TAS_DEF_TITLE' => $faker->sentence(2), - 'TAS_DEF_DESCRIPTION' => $faker->sentence(2), - 'TAS_ASSIGN_VARIABLE' => '@@SYS_NEXT_USER_TO_BE_ASSIGNED', - 'TAS_MI_INSTANCE_VARIABLE' => '@@SYS_VAR_TOTAL_INSTANCE', - 'TAS_MI_COMPLETE_VARIABLE' => '@@SYS_VAR_TOTAL_INSTANCES_COMPLETE', - 'TAS_ASSIGN_LOCATION' => 'FALSE', - 'TAS_ASSIGN_LOCATION_ADHOC' => 'FALSE', - 'TAS_TRANSFER_FLY' => 'FALSE', - 'TAS_LAST_ASSIGNED' => 0, - 'TAS_USER' => 0, - 'TAS_CAN_UPLOAD' => 'FALSE', - 'TAS_CAN_CANCEL' => 'FALSE', - 'TAS_OWNER_APP' => 'FALSE', - 'TAS_CAN_SEND_MESSAGE' => 'FALSE', - 'TAS_SEND_LAST_EMAIL' => 'FALSE', - 'TAS_SELFSERVICE_TIMEOUT' => 0, - ]; -}); +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; -// Create a task with the foreign keys -$factory->state(\ProcessMaker\Model\Task::class, 'foreign_keys', function (Faker $faker) { - $process = factory(\ProcessMaker\Model\Process::class)->create(); - return [ - 'PRO_UID' => $process->PRO_UID, - 'PRO_ID' => $process->PRO_ID, - 'TAS_UID' => G::generateUniqueID(), - 'TAS_TITLE' => $faker->sentence(2), - 'TAS_TYPE' => 'NORMAL', - 'TAS_TYPE_DAY' => 1, - 'TAS_DURATION' => 1, - 'TAS_ASSIGN_TYPE' => 'BALANCED', - 'TAS_DEF_TITLE' => $faker->sentence(2), - 'TAS_DEF_DESCRIPTION' => $faker->sentence(2), - 'TAS_ASSIGN_VARIABLE' => '@@SYS_NEXT_USER_TO_BE_ASSIGNED', - 'TAS_MI_INSTANCE_VARIABLE' => '@@SYS_VAR_TOTAL_INSTANCE', - 'TAS_MI_COMPLETE_VARIABLE' => '@@SYS_VAR_TOTAL_INSTANCES_COMPLETE', - 'TAS_ASSIGN_LOCATION' => 'FALSE', - 'TAS_ASSIGN_LOCATION_ADHOC' => 'FALSE', - 'TAS_TRANSFER_FLY' => 'FALSE', - 'TAS_LAST_ASSIGNED' => 0, - 'TAS_USER' => 0, - 'TAS_CAN_UPLOAD' => 'FALSE', - 'TAS_CAN_CANCEL' => 'FALSE', - 'TAS_OWNER_APP' => 'FALSE', - 'TAS_CAN_SEND_MESSAGE' => 'FALSE', - 'TAS_SEND_LAST_EMAIL' => 'FALSE', - 'TAS_SELFSERVICE_TIMEOUT' => 0, - ]; -}); +class TaskFactory extends Factory +{ -// Create a task related with the self-service timeout execution -$factory->state(\ProcessMaker\Model\Task::class, 'sef_service_timeout', function (Faker $faker) { - $timeUnit = $faker->randomElement(['MINUTES', 'HOURS', 'DAYS']); - $execution = $faker->randomElement(['EVERY_TIME', 'ONCE']); - return [ - 'TAS_UID' => G::generateUniqueID(), - 'TAS_ID' => $faker->unique()->numberBetween(1, 200000), - 'TAS_TITLE' => $faker->sentence(2), - 'TAS_TYPE' => 'NORMAL', - 'TAS_TYPE_DAY' => 1, - 'TAS_DURATION' => 1, - 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', - 'TAS_ASSIGN_VARIABLE' => '@@SYS_NEXT_USER_TO_BE_ASSIGNED', - 'TAS_SELFSERVICE_TIMEOUT' => 1, - 'TAS_SELFSERVICE_TIME' => $faker->unique()->numberBetween(1, 24), - 'TAS_SELFSERVICE_TIME_UNIT' => $timeUnit, - 'TAS_SELFSERVICE_TRIGGER_UID' => function() { - return $trigger = factory(\ProcessMaker\Model\Triggers::class)->create()->TRI_UID; - }, - 'TAS_SELFSERVICE_EXECUTION' => $execution, - ]; -}); + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + $process = \ProcessMaker\Model\Process::factory()->create(); + return [ + 'PRO_UID' => $process->PRO_UID, + 'PRO_ID' => $process->PRO_ID, + 'TAS_UID' => G::generateUniqueID(), + 'TAS_TITLE' => $this->faker->sentence(2), + 'TAS_TYPE' => 'NORMAL', + 'TAS_TYPE_DAY' => 1, + 'TAS_DURATION' => 1, + 'TAS_ASSIGN_TYPE' => 'BALANCED', + 'TAS_DEF_TITLE' => $this->faker->sentence(2), + 'TAS_DEF_DESCRIPTION' => $this->faker->sentence(2), + 'TAS_ASSIGN_VARIABLE' => '@@SYS_NEXT_USER_TO_BE_ASSIGNED', + 'TAS_MI_INSTANCE_VARIABLE' => '@@SYS_VAR_TOTAL_INSTANCE', + 'TAS_MI_COMPLETE_VARIABLE' => '@@SYS_VAR_TOTAL_INSTANCES_COMPLETE', + 'TAS_ASSIGN_LOCATION' => 'FALSE', + 'TAS_ASSIGN_LOCATION_ADHOC' => 'FALSE', + 'TAS_TRANSFER_FLY' => 'FALSE', + 'TAS_LAST_ASSIGNED' => 0, + 'TAS_USER' => 0, + 'TAS_CAN_UPLOAD' => 'FALSE', + 'TAS_CAN_CANCEL' => 'FALSE', + 'TAS_OWNER_APP' => 'FALSE', + 'TAS_CAN_SEND_MESSAGE' => 'FALSE', + 'TAS_SEND_LAST_EMAIL' => 'FALSE', + 'TAS_SELFSERVICE_TIMEOUT' => 0, + ]; + } + + /** + * Create a task with the foreign keys + * @return type + */ + public function foreign_keys() + { + $state = function (array $attributes) { + $process = \ProcessMaker\Model\Process::factory()->create(); + return [ + 'PRO_UID' => $process->PRO_UID, + 'PRO_ID' => $process->PRO_ID, + 'TAS_UID' => G::generateUniqueID(), + 'TAS_TITLE' => $this->faker->sentence(2), + 'TAS_TYPE' => 'NORMAL', + 'TAS_TYPE_DAY' => 1, + 'TAS_DURATION' => 1, + 'TAS_ASSIGN_TYPE' => 'BALANCED', + 'TAS_DEF_TITLE' => $this->faker->sentence(2), + 'TAS_DEF_DESCRIPTION' => $this->faker->sentence(2), + 'TAS_ASSIGN_VARIABLE' => '@@SYS_NEXT_USER_TO_BE_ASSIGNED', + 'TAS_MI_INSTANCE_VARIABLE' => '@@SYS_VAR_TOTAL_INSTANCE', + 'TAS_MI_COMPLETE_VARIABLE' => '@@SYS_VAR_TOTAL_INSTANCES_COMPLETE', + 'TAS_ASSIGN_LOCATION' => 'FALSE', + 'TAS_ASSIGN_LOCATION_ADHOC' => 'FALSE', + 'TAS_TRANSFER_FLY' => 'FALSE', + 'TAS_LAST_ASSIGNED' => 0, + 'TAS_USER' => 0, + 'TAS_CAN_UPLOAD' => 'FALSE', + 'TAS_CAN_CANCEL' => 'FALSE', + 'TAS_OWNER_APP' => 'FALSE', + 'TAS_CAN_SEND_MESSAGE' => 'FALSE', + 'TAS_SEND_LAST_EMAIL' => 'FALSE', + 'TAS_SELFSERVICE_TIMEOUT' => 0, + ]; + }; + return $this->state($state); + } + + /** + * Create a task related with the self-service timeout execution + * @return type + */ + public function sef_service_timeout() + { + $state = function (array $attributes) { + $timeUnit = $this->faker->randomElement(['MINUTES', 'HOURS', 'DAYS']); + $execution = $this->faker->randomElement(['EVERY_TIME', 'ONCE']); + return [ + 'TAS_UID' => G::generateUniqueID(), + 'TAS_ID' => $this->faker->unique()->numberBetween(1, 200000), + 'TAS_TITLE' => $this->faker->sentence(2), + 'TAS_TYPE' => 'NORMAL', + 'TAS_TYPE_DAY' => 1, + 'TAS_DURATION' => 1, + 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', + 'TAS_ASSIGN_VARIABLE' => '@@SYS_NEXT_USER_TO_BE_ASSIGNED', + 'TAS_SELFSERVICE_TIMEOUT' => 1, + 'TAS_SELFSERVICE_TIME' => $this->faker->unique()->numberBetween(1, 24), + 'TAS_SELFSERVICE_TIME_UNIT' => $timeUnit, + 'TAS_SELFSERVICE_TRIGGER_UID' => function () { + return $trigger = \ProcessMaker\Model\Triggers::factory()->create()->TRI_UID; + }, + 'TAS_SELFSERVICE_EXECUTION' => $execution, + ]; + }; + return $this->state($state); + } + +} diff --git a/database/factories/TaskSchedulerFactory.php b/database/factories/TaskSchedulerFactory.php index 1dd54c754..8fc58744e 100644 --- a/database/factories/TaskSchedulerFactory.php +++ b/database/factories/TaskSchedulerFactory.php @@ -1,27 +1,38 @@ define(\ProcessMaker\Model\TaskScheduler::class, function (Faker $faker) { - return [ - 'id' => $faker->unique()->numberBetween(5000), - 'title' => $faker->title, - 'startingTime' => $faker->dateTime(), - 'endingTime' => $faker->dateTime(), - 'everyOn' => "", - 'interval' => "", - 'description' => "", - 'expression' => "", - 'body' => "", - 'type' => "", - 'category' => "emails_notifications", //emails_notifications, case_actions, plugins, processmaker_sync - 'system' => "", - 'timezone' => "", - 'enable' => "", - 'creation_date' => $faker->dateTime(), - 'last_update' => $faker->dateTime() - ]; -}); +use App\Factories\Factory; +use Illuminate\Support\Str; + +class TaskSchedulerFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'id' => $this->faker->unique()->numberBetween(5000), + 'title' => $this->faker->title, + 'startingTime' => $this->faker->dateTime(), + 'endingTime' => $this->faker->dateTime(), + 'everyOn' => "", + 'interval' => "", + 'description' => "", + 'expression' => "", + 'body' => "", + 'type' => "", + 'category' => "emails_notifications", //emails_notifications, case_actions, plugins, processmaker_sync + 'system' => "", + 'timezone' => "", + 'enable' => "", + 'creation_date' => $this->faker->dateTime(), + 'last_update' => $this->faker->dateTime() + ]; + } + +} diff --git a/database/factories/TaskUserFactory.php b/database/factories/TaskUserFactory.php index 2b7c65049..2da94713a 100644 --- a/database/factories/TaskUserFactory.php +++ b/database/factories/TaskUserFactory.php @@ -1,70 +1,106 @@ define(\ProcessMaker\Model\TaskUser::class, function(Faker $faker) { - return [ - 'TAS_UID' => function() { - $task = factory(\ProcessMaker\Model\Task::class)->create(); - return $task->TAS_UID; - }, - 'TU_TYPE' => 1, - 'TU_RELATION' => 1 - ]; -}); +use App\Factories\Factory; +use Illuminate\Support\Str; -// Create a delegation with the foreign keys -$factory->state(\ProcessMaker\Model\TaskUser::class, 'foreign_keys', function (Faker $faker) { - $user = factory(\ProcessMaker\Model\User::class)->create(); - $task = factory(\ProcessMaker\Model\Task::class)->create(); - return [ - 'TAS_UID' => $task->TAS_UID, - 'USR_UID' => $user->USR_UID, - 'TU_TYPE' => 1, - 'TU_RELATION' => 1 - ]; -}); +class TaskUserFactory extends Factory +{ -$factory->state(\ProcessMaker\Model\TaskUser::class, 'normal_assigment_user', function (Faker $faker) { - $user = factory(\ProcessMaker\Model\User::class)->create(); - $task = factory(\ProcessMaker\Model\Task::class)->create(); - return [ - 'TAS_UID' => $task->TAS_UID, - 'USR_UID' => $user->USR_UID, - 'TU_RELATION' => 1, - 'TU_TYPE' => 1, - ]; -}); + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'TAS_UID' => function () { + $task = \ProcessMaker\Model\Task::factory()->create(); + return $task->TAS_UID; + }, + 'TU_TYPE' => 1, + 'TU_RELATION' => 1 + ]; + } -$factory->state(\ProcessMaker\Model\TaskUser::class, 'normal_assigment_group', function (Faker $faker) { - $group = factory(\ProcessMaker\Model\Groupwf::class)->create(); - $task = factory(\ProcessMaker\Model\Task::class)->create(); - return [ - 'TAS_UID' => $task->TAS_UID, - 'USR_UID' => $group->GRP_UID, - 'TU_RELATION' => 2, - 'TU_TYPE' => 1, - ]; -}); + /** + * Create a delegation with the foreign keys. + */ + public function foreign_keys() + { + $state = function (array $attributes) { + $user = \ProcessMaker\Model\User::factory()->create(); + $task = \ProcessMaker\Model\Task::factory()->create(); + return [ + 'TAS_UID' => $task->TAS_UID, + 'USR_UID' => $user->USR_UID, + 'TU_TYPE' => 1, + 'TU_RELATION' => 1 + ]; + }; + return $this->state($state); + } -$factory->state(\ProcessMaker\Model\TaskUser::class, 'adhoc_assigment_user', function (Faker $faker) { - $user = factory(\ProcessMaker\Model\User::class)->create(); - $task = factory(\ProcessMaker\Model\Task::class)->create(); - return [ - 'TAS_UID' => $task->TAS_UID, - 'USR_UID' => $user->USR_UID, - 'TU_RELATION' => 1, - 'TU_TYPE' => 2, - ]; -}); + public function normal_assigment_user() + { + $state = function (array $attributes) { + $user = \ProcessMaker\Model\User::factory()->create(); + $task = \ProcessMaker\Model\Task::factory()->create(); + return [ + 'TAS_UID' => $task->TAS_UID, + 'USR_UID' => $user->USR_UID, + 'TU_RELATION' => 1, + 'TU_TYPE' => 1, + ]; + }; + return $this->state($state); + } -$factory->state(\ProcessMaker\Model\TaskUser::class, 'adhoc_assigment_group', function (Faker $faker) { - $group = factory(\ProcessMaker\Model\Groupwf::class)->create(); - $task = factory(\ProcessMaker\Model\Task::class)->create(); - return [ - 'TAS_UID' => $task->TAS_UID, - 'USR_UID' => $group->GRP_UID, - 'TU_RELATION' => 2, - 'TU_TYPE' => 2, - ]; -}); \ No newline at end of file + public function normal_assigment_group() + { + $state = function (array $attributes) { + $group = \ProcessMaker\Model\Groupwf::factory()->create(); + $task = \ProcessMaker\Model\Task::factory()->create(); + return [ + 'TAS_UID' => $task->TAS_UID, + 'USR_UID' => $group->GRP_UID, + 'TU_RELATION' => 2, + 'TU_TYPE' => 1, + ]; + }; + return $this->state($state); + } + + public function adhoc_assigment_user() + { + $state = function (array $attributes) { + $user = \ProcessMaker\Model\User::factory()->create(); + $task = \ProcessMaker\Model\Task::factory()->create(); + return [ + 'TAS_UID' => $task->TAS_UID, + 'USR_UID' => $user->USR_UID, + 'TU_RELATION' => 1, + 'TU_TYPE' => 2, + ]; + }; + return $this->state($state); + } + + public function adhoc_assigment_group() + { + $state = function (array $attributes) { + $group = \ProcessMaker\Model\Groupwf::factory()->create(); + $task = \ProcessMaker\Model\Task::factory()->create(); + return [ + 'TAS_UID' => $task->TAS_UID, + 'USR_UID' => $group->GRP_UID, + 'TU_RELATION' => 2, + 'TU_TYPE' => 2, + ]; + }; + return $this->state($state); + } + +} diff --git a/database/factories/TriggersFactory.php b/database/factories/TriggersFactory.php index 11117f083..7850769eb 100644 --- a/database/factories/TriggersFactory.php +++ b/database/factories/TriggersFactory.php @@ -1,18 +1,32 @@ define(Triggers::class, function (Faker $faker) { - return [ - 'TRI_UID' => $faker->regexify("/[a-zA-Z]{32}/"), - 'TRI_TITLE' => $faker->sentence(5), - 'TRI_DESCRIPTION' => $faker->text, - 'PRO_UID' => function() { - return factory(\ProcessMaker\Model\Process::class)->create()->PRO_UID; - }, - 'TRI_TYPE' => 'SCRIPT', - 'TRI_WEBBOT' => '$var = 1;', - 'TRI_PARAM' => '', - ]; -}); +class TriggersFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'TRI_UID' => $this->faker->regexify("/[a-zA-Z]{32}/"), + 'TRI_TITLE' => $this->faker->sentence(5), + 'TRI_DESCRIPTION' => $this->faker->text, + 'PRO_UID' => function () { + return \ProcessMaker\Model\Process::factory()->create()->PRO_UID; + }, + 'TRI_TYPE' => 'SCRIPT', + 'TRI_WEBBOT' => '$var = 1;', + 'TRI_PARAM' => '', + ]; + } + +} diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index a5dc9278f..1974fd78a 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -1,21 +1,36 @@ define(\ProcessMaker\Model\User::class, function (Faker $faker) { - return [ - 'USR_UID' => G::generateUniqueID(), - 'USR_USERNAME' => $faker->unique()->userName, - 'USR_PASSWORD' => $faker->password, - 'USR_FIRSTNAME' => $faker->firstName, - 'USR_LASTNAME' => $faker->lastName, - 'USR_EMAIL' => $faker->unique()->email, - 'USR_DUE_DATE' => new \Carbon\Carbon(2030, 1, 1), - 'USR_STATUS' => 'ACTIVE', - 'USR_ROLE' => $faker->randomElement(['PROCESSMAKER_ADMIN', 'PROCESSMAKER_OPERATOR']), - 'USR_UX' => 'NORMAL', - 'USR_TIME_ZONE' => 'America/Anguilla', - 'USR_DEFAULT_LANG' => 'en', - 'USR_LAST_LOGIN' => new \Carbon\Carbon(2019, 1, 1) - ]; -}); \ No newline at end of file +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class UserFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'USR_UID' => G::generateUniqueID(), + 'USR_USERNAME' => $this->faker->unique()->userName, + 'USR_PASSWORD' => $this->faker->password, + 'USR_FIRSTNAME' => $this->faker->firstName, + 'USR_LASTNAME' => $this->faker->lastName, + 'USR_EMAIL' => $this->faker->unique()->email, + 'USR_DUE_DATE' => new \Carbon\Carbon(2030, 1, 1), + 'USR_STATUS' => 'ACTIVE', + 'USR_ROLE' => $this->faker->randomElement(['PROCESSMAKER_ADMIN', 'PROCESSMAKER_OPERATOR']), + 'USR_UX' => 'NORMAL', + 'USR_TIME_ZONE' => 'America/Anguilla', + 'USR_DEFAULT_LANG' => 'en', + 'USR_LAST_LOGIN' => new \Carbon\Carbon(2019, 1, 1) + ]; + } + +} diff --git a/database/factories/UserReportingFactory.php b/database/factories/UserReportingFactory.php index 46da8d3fd..3927d7690 100644 --- a/database/factories/UserReportingFactory.php +++ b/database/factories/UserReportingFactory.php @@ -1,13 +1,28 @@ define(\ProcessMaker\Model\UserReporting::class, function (Faker $faker) { - return [ - 'USR_UID' => G::generateUniqueID(), - 'TAS_UID' => G::generateUniqueID(), - 'PRO_UID' => G::generateUniqueID(), - 'MONTH' => 12, - 'YEAR' => 2020, - ]; -}); +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class UserReportingFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'USR_UID' => G::generateUniqueID(), + 'TAS_UID' => G::generateUniqueID(), + 'PRO_UID' => G::generateUniqueID(), + 'MONTH' => 12, + 'YEAR' => 2020, + ]; + } + +} diff --git a/database/factories/WebEntryFactory.php b/database/factories/WebEntryFactory.php index 6161e2c4c..9ed78a2e7 100644 --- a/database/factories/WebEntryFactory.php +++ b/database/factories/WebEntryFactory.php @@ -1,33 +1,46 @@ define(\ProcessMaker\Model\WebEntry::class, function(Faker $faker) { - return [ - 'WE_UID' => G::generateUniqueID(), - 'PRO_UID' => G::generateUniqueID(), - 'TAS_UID' => G::generateUniqueID(), - 'DYN_UID' => G::generateUniqueID(), - 'USR_UID' => G::generateUniqueID(), - 'WE_METHOD' => $faker->randomElement(['WS', 'HTML']), - 'WE_INPUT_DOCUMENT_ACCESS' => $faker->randomElement([0, 1]), - 'WE_DATA' => G::generateUniqueID() . '.php', - 'WE_CREATE_USR_UID' => G::generateUniqueID(), - 'WE_UPDATE_USR_UID' => G::generateUniqueID(), - 'WE_CREATE_DATE' => $faker->date('Y-m-d H:i:s', 'now'), - 'WE_UPDATE_DATE' => $faker->date('Y-m-d H:i:s', 'now'), - 'WE_TYPE' => $faker->randomElement(['SINGLE', 'MULTIPLE']), - 'WE_CUSTOM_TITLE' => $faker->words(5, true), - 'WE_AUTHENTICATION' => $faker->randomElement(['LOGIN_REQUIRED', 'ANONYMOUS']), - 'WE_HIDE_INFORMATION_BAR' => $faker->randomElement(['0', '1']), - 'WE_CALLBACK' => $faker->randomElement(['PROCESSMAKER', 'CUSTOM', 'CUSTOM_CLEAR']), - 'WE_CALLBACK_URL' => $faker->url, - 'WE_LINK_GENERATION' => $faker->randomElement(['DEFAULT', 'ADVANCED']), - 'WE_LINK_SKIN' => 'classic', - 'WE_LINK_LANGUAGE' => 'en', - 'WE_LINK_DOMAIN' => $faker->domainName, - 'WE_SHOW_IN_NEW_CASE' => $faker->randomElement(['0', '1']) - ]; -}); +namespace Database\Factories; + +use App\Factories\Factory; +use G; +use Illuminate\Support\Str; + +class WebEntryFactory extends Factory +{ + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'WE_UID' => G::generateUniqueID(), + 'PRO_UID' => G::generateUniqueID(), + 'TAS_UID' => G::generateUniqueID(), + 'DYN_UID' => G::generateUniqueID(), + 'USR_UID' => G::generateUniqueID(), + 'WE_METHOD' => $this->faker->randomElement(['WS', 'HTML']), + 'WE_INPUT_DOCUMENT_ACCESS' => $this->faker->randomElement([0, 1]), + 'WE_DATA' => G::generateUniqueID() . '.php', + 'WE_CREATE_USR_UID' => G::generateUniqueID(), + 'WE_UPDATE_USR_UID' => G::generateUniqueID(), + 'WE_CREATE_DATE' => $this->faker->date('Y-m-d H:i:s', 'now'), + 'WE_UPDATE_DATE' => $this->faker->date('Y-m-d H:i:s', 'now'), + 'WE_TYPE' => $this->faker->randomElement(['SINGLE', 'MULTIPLE']), + 'WE_CUSTOM_TITLE' => $this->faker->words(5, true), + 'WE_AUTHENTICATION' => $this->faker->randomElement(['LOGIN_REQUIRED', 'ANONYMOUS']), + 'WE_HIDE_INFORMATION_BAR' => $this->faker->randomElement(['0', '1']), + 'WE_CALLBACK' => $this->faker->randomElement(['PROCESSMAKER', 'CUSTOM', 'CUSTOM_CLEAR']), + 'WE_CALLBACK_URL' => $this->faker->url, + 'WE_LINK_GENERATION' => $this->faker->randomElement(['DEFAULT', 'ADVANCED']), + 'WE_LINK_SKIN' => 'classic', + 'WE_LINK_LANGUAGE' => 'en', + 'WE_LINK_DOMAIN' => $this->faker->domainName, + 'WE_SHOW_IN_NEW_CASE' => $this->faker->randomElement(['0', '1']) + ]; + } + +} diff --git a/gulliver/system/class.bootstrap.php b/gulliver/system/class.bootstrap.php index d0a6dc85a..b1af1edaa 100644 --- a/gulliver/system/class.bootstrap.php +++ b/gulliver/system/class.bootstrap.php @@ -510,7 +510,7 @@ class Bootstrap * @param array list plugins active * @return void */ - public static function LoadTranslationPlugins($lang = SYS_LANG, $listPluginsActive) + public static function LoadTranslationPlugins($lang = SYS_LANG, $listPluginsActive = []) { if (! (is_array($listPluginsActive))) { return null; diff --git a/tests/Feature/DBQueryTest.php b/tests/Feature/DBQueryTest.php index a1bcc7d6e..af614e54b 100644 --- a/tests/Feature/DBQueryTest.php +++ b/tests/Feature/DBQueryTest.php @@ -2,10 +2,10 @@ namespace Tests\Feature; -use Illuminate\Foundation\Testing\DatabaseTransactions; -use Illuminate\Support\Facades\DB; use ProcessMaker\Model\DbSource; use ProcessMaker\Model\Process; +use Illuminate\Foundation\Testing\DatabaseTransactions; +use Illuminate\Support\Facades\DB; use Tests\TestCase; class DBQueryTest extends TestCase @@ -16,7 +16,7 @@ class DBQueryTest extends TestCase /** * Sets up the unit tests. */ - protected function setUp() + protected function setUp(): void { parent::setUp(); } @@ -35,7 +35,9 @@ class DBQueryTest extends TestCase 'USR_UID' => '00000000000000000000000000000001', 'USR_USERNAME' => 'admin' ]; - $this->assertArraySubset($expected, $results[1]); + foreach ($expected as $key => $value) { + $this->assertEquals($value, $results[1][$key]); + } } /** @@ -56,9 +58,9 @@ class DBQueryTest extends TestCase { // Our test external database is created in our tests/bootstrap.php file // We'll use our factories to create our process and database - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); // Let's create an external DB to ourselves - $externalDB = factory(DbSource::class)->create([ + $externalDB = DbSource::factory()->create([ 'DBS_SERVER' => config('database.connections.testexternal.host'), 'DBS_PORT' => '3306', 'DBS_USERNAME' => config('database.connections.testexternal.username'), @@ -90,9 +92,9 @@ class DBQueryTest extends TestCase } // Our test external database is created in our tests/bootstrap.php file // We'll use our factories to create our process and database - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); // Let's create an external DB to ourselves - $externalDB = factory(DbSource::class)->create([ + $externalDB = DbSource::factory()->create([ 'DBS_SERVER' => env('MSSQL_HOST'), 'DBS_PORT' => env('MSSQL_PORT'), 'DBS_TYPE' => 'mssql', diff --git a/tests/Performance/workflow/engine/src/ProcessMaker/Model/DelegationTest.php b/tests/Performance/workflow/engine/src/ProcessMaker/Model/DelegationTest.php index 866ece66b..637529a12 100644 --- a/tests/Performance/workflow/engine/src/ProcessMaker/Model/DelegationTest.php +++ b/tests/Performance/workflow/engine/src/ProcessMaker/Model/DelegationTest.php @@ -1,4 +1,5 @@ maximumExecutionTime; //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create a task self service - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, //Related to the user 'TU_TYPE' => 1 ]); //Create the register in delegation relate to self-service - factory(Delegation::class, $total)->create([ + Delegation::factory($total)->create([ 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, @@ -93,31 +94,31 @@ class DelegationTest extends TestCase //Define the maximum time of execution $maximumTime = $this->maximumExecutionTime; //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create a case - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create a task self service value based - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '@@ARRAY_OF_USERS', 'PRO_UID' => $process->PRO_UID ]); //Create the relation for the value assigned in the TAS_GROUP_VARIABLE - $appSelfValue = factory(AppAssignSelfServiceValue::class)->create([ + $appSelfValue = AppAssignSelfServiceValue::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => 2, 'TAS_ID' => $task->TAS_ID ]); - factory(AppAssignSelfServiceValueGroup::class)->create([ + AppAssignSelfServiceValueGroup::factory()->create([ 'ID' => $appSelfValue->ID, 'GRP_UID' => $user->USR_UID, 'ASSIGNEE_ID' => $user->USR_ID, //The usrId or grpId 'ASSIGNEE_TYPE' => 1 //Related to the user=1 related to the group=2 ]); //Create the register in self-service - factory(Delegation::class, $total)->create([ + Delegation::factory($total)->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => $appSelfValue->DEL_INDEX, 'TAS_ID' => $task->TAS_ID, @@ -146,50 +147,50 @@ class DelegationTest extends TestCase //Define the maximum time of execution $maximumTime = $this->maximumExecutionTime; //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create a case - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create a task self service - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, //Related to the user 'TU_TYPE' => 1 ]); //Create the register in self service - factory(Delegation::class, $total / 2)->create([ + Delegation::factory($total / 2)->create([ 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, ]); //Create a task self service value based - $task1 = factory(Task::class)->create([ + $task1 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '@@ARRAY_OF_USERS', 'PRO_UID' => $process->PRO_UID ]); //Create the relation for the value assigned in the TAS_GROUP_VARIABLE - $appSelfValue = factory(AppAssignSelfServiceValue::class)->create([ + $appSelfValue = AppAssignSelfServiceValue::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => 2, 'TAS_ID' => $task1->TAS_ID ]); - factory(AppAssignSelfServiceValueGroup::class)->create([ + AppAssignSelfServiceValueGroup::factory()->create([ 'ID' => $appSelfValue->ID, 'GRP_UID' => $user->USR_UID, 'ASSIGNEE_ID' => $user->USR_ID, //The usrId or grpId 'ASSIGNEE_TYPE' => 1 //Related to the user=1 related to the group=2 ]); //Create the register in self service value based - factory(Delegation::class, $total / 2)->create([ + Delegation::factory($total / 2)->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => $appSelfValue->DEL_INDEX, 'TAS_ID' => $task->TAS_ID, @@ -218,32 +219,32 @@ class DelegationTest extends TestCase //Define the maximum time of execution $maximumTime = $this->maximumExecutionTime; //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create group - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Assign a user in the group - factory(GroupUser::class)->create([ + GroupUser::factory()->create([ 'GRP_UID' => $group->GRP_UID, 'GRP_ID' => $group->GRP_ID, 'USR_UID' => $user->USR_UID ]); //Create a task self service - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 2, //Related to the group 'TU_TYPE' => 1 ]); //Create the register in self-service - factory(Delegation::class, $total)->create([ + Delegation::factory($total)->create([ 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, @@ -271,44 +272,44 @@ class DelegationTest extends TestCase //Define the maximum time of execution $maximumTime = $this->maximumExecutionTime; //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create a task self service value based - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '@@ARRAY_OF_USERS', 'PRO_UID' => $process->PRO_UID ]); //Create a case - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); //Create group - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); //Create user - $user = factory(User::class)->create([ + $user = User::factory()->create([ 'USR_USERNAME' => 'gary', 'USR_LASTNAME' => 'Gary', 'USR_FIRSTNAME' => 'Bailey', ]); //Assign a user in the group - factory(GroupUser::class)->create([ + GroupUser::factory()->create([ 'GRP_UID' => $group->GRP_UID, 'GRP_ID' => $group->GRP_ID, 'USR_UID' => $user->USR_UID, ]); //Create the relation for the value assigned in the TAS_GROUP_VARIABLE - $appSelfValue = factory(AppAssignSelfServiceValue::class)->create([ + $appSelfValue = AppAssignSelfServiceValue::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, 'DEL_INDEX' => 2, 'TAS_ID' => $task->TAS_ID ]); - factory(AppAssignSelfServiceValueGroup::class)->create([ + AppAssignSelfServiceValueGroup::factory()->create([ 'ID' => $appSelfValue->ID, 'GRP_UID' => $group->GRP_UID, 'ASSIGNEE_ID' => $group->GRP_ID, //The usrId or grpId 'ASSIGNEE_TYPE' => 2 //Related to the user=1 related to the group=2 ]); //Create the register in self-service - factory(Delegation::class, $total)->create([ + Delegation::factory($total)->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => 2, 'TAS_ID' => $task->TAS_ID, @@ -337,89 +338,89 @@ class DelegationTest extends TestCase //Define the maximum time of execution $maximumTime = $this->maximumExecutionTime; //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create group - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Assign a user in the group - factory(GroupUser::class)->create([ + GroupUser::factory()->create([ 'GRP_UID' => $group->GRP_UID, 'GRP_ID' => $group->GRP_ID, 'USR_UID' => $user->USR_UID ]); //Create a task self service - $task1 = factory(Task::class)->create([ + $task1 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task1 - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task1->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, //Related to the user 'TU_TYPE' => 1 ]); //Create a task self service - $task2 = factory(Task::class)->create([ + $task2 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task2 - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task2->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, //Related to the user 'TU_TYPE' => 1 ]); //Create a task self service - $task3 = factory(Task::class)->create([ + $task3 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task3->TAS_UID, 'USR_UID' => $group->GRP_UID, 'TU_RELATION' => 2, //Related to the group 'TU_TYPE' => 1 ]); //Create a task self service - $task4 = factory(Task::class)->create([ + $task4 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task4->TAS_UID, 'USR_UID' => $group->GRP_UID, 'TU_RELATION' => 2, //Related to the group 'TU_TYPE' => 1 ]); //Create the register in self-service related to the task1 - factory(Delegation::class, $total / 4)->create([ + Delegation::factory($total / 4)->create([ 'TAS_ID' => $task1->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, ]); //Create the register in self-service related to the task2 - factory(Delegation::class, $total / 4)->create([ + Delegation::factory($total / 4)->create([ 'TAS_ID' => $task2->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, ]); //Create the register in self-service related to the task3 - factory(Delegation::class, $total / 4)->create([ + Delegation::factory($total / 4)->create([ 'TAS_ID' => $task3->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, ]); //Create the register in self-service related to the task4 - factory(Delegation::class, $total / 4)->create([ + Delegation::factory($total / 4)->create([ 'TAS_ID' => $task4->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, @@ -447,30 +448,30 @@ class DelegationTest extends TestCase //Define the maximum time of execution $maximumTime = $this->maximumExecutionTime; //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create a case - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create a task1 self service value based - $task1 = factory(Task::class)->create([ + $task1 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '@@ARRAY_OF_USERS', 'PRO_UID' => $process->PRO_UID ]); //Create the relation for the value assigned in the TAS_GROUP_VARIABLE - $appSelfValue = factory(AppAssignSelfServiceValue::class)->create([ + $appSelfValue = AppAssignSelfServiceValue::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task1->TAS_ID ]); - factory(AppAssignSelfServiceValueGroup::class)->create([ + AppAssignSelfServiceValueGroup::factory()->create([ 'ID' => $appSelfValue->ID, 'GRP_UID' => $user->USR_UID, 'ASSIGNEE_ID' => $user->USR_ID, //The usrId or grpId 'ASSIGNEE_TYPE' => 1 //Related to the user=1 related to the group=2 ]); //Create the register in self-service - factory(Delegation::class, $total / 2)->create([ + Delegation::factory($total / 2)->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => $appSelfValue->DEL_INDEX, 'TAS_ID' => $task1->TAS_ID, @@ -478,24 +479,24 @@ class DelegationTest extends TestCase 'USR_ID' => 0, ]); //Create a task2 self service value based - $task2 = factory(Task::class)->create([ + $task2 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '@@ARRAY_OF_USERS', 'PRO_UID' => $process->PRO_UID ]); //Create the relation for the value assigned in the TAS_GROUP_VARIABLE - $appSelfValue = factory(AppAssignSelfServiceValue::class)->create([ + $appSelfValue = AppAssignSelfServiceValue::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task2->TAS_ID ]); - factory(AppAssignSelfServiceValueGroup::class)->create([ + AppAssignSelfServiceValueGroup::factory()->create([ 'ID' => $appSelfValue->ID, 'GRP_UID' => $user->USR_UID, 'ASSIGNEE_ID' => $user->USR_ID, //The usrId or grpId 'ASSIGNEE_TYPE' => 1 //Related to the user=1 related to the group=2 ]); //Create the register in self-service - factory(Delegation::class, $total / 2)->create([ + Delegation::factory($total / 2)->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => $appSelfValue->DEL_INDEX, 'TAS_ID' => $task2->TAS_ID, diff --git a/tests/TestCase.php b/tests/TestCase.php index f21643fad..fbcf82b3f 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,6 +2,7 @@ namespace Tests; +use App\Factories\Factory; use Illuminate\Foundation\Testing\TestCase as BaseTestCase; use Illuminate\Support\Facades\DB; use Propel; @@ -20,6 +21,12 @@ abstract class TestCase extends BaseTestCase */ protected $currentArgv; + /** + * The array of the initial tables to be dropped. + * @var array + */ + public static $truncateInitialTables = ''; + /** * Create application */ @@ -61,6 +68,7 @@ abstract class TestCase extends BaseTestCase * Lost config are restored. */ app()->instance('config', $this->currentConfig); + error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT); } /** @@ -71,4 +79,68 @@ abstract class TestCase extends BaseTestCase { parent::tearDown(); } + + /** + * truncate non-initial Models. + * @return void + */ + public function truncateNonInitialModels(): void + { + DB::statement("set global max_connections = 300;"); + if (empty(static::$truncateInitialTables)) { + $initialTables = [ + 'RBAC_PERMISSIONS', + 'RBAC_ROLES', + 'RBAC_ROLES_PERMISSIONS', + 'RBAC_SYSTEMS', + 'RBAC_USERS', + 'RBAC_USERS_ROLES', + 'USERS', + 'CONTENT', + 'LANGUAGE', + 'ISO_COUNTRY', + 'ISO_SUBDIVISION', + 'ISO_LOCATION', + 'TRANSLATION', + 'DASHLET', + 'DASHLET_INSTANCE', + 'CONFIGURATION', + 'CATALOG', + 'ADDONS_MANAGER', + 'APP_SEQUENCE', + 'OAUTH_CLIENTS', + 'OAUTH_ACCESS_TOKENS' + ]; + $directory = Factory::$customDirectoryForModels; + if (file_exists($directory)) { + $files = scandir($directory); + $files = array_diff($files, ['.', '..']); + $tables = []; + foreach ($files as $filename) { + $filepath = $directory . $filename; + $ext = pathinfo($filepath, PATHINFO_EXTENSION); + if (strtolower($ext) !== 'php') { + continue; + } + $modelName = pathinfo($filepath, PATHINFO_FILENAME); + $model = Factory::$customNameSpaceForModels . $modelName; + $tableName = (new $model())->getTable(); + $tables[] = $tableName; + } + $result = array_diff($tables, $initialTables); + $result = array_values($result); + $truncates = []; + foreach ($result as $value) { + $truncates[] = 'TRUNCATE TABLE ' . $value; + } + static::$truncateInitialTables = implode(';', $truncates); + } + } else { + DB::unprepared( + "SET FOREIGN_KEY_CHECKS = 0;" . + static::$truncateInitialTables . + ";SET FOREIGN_KEY_CHECKS = 1;" + ); + } + } } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 7508f3b4d..dc85e3948 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -136,6 +136,15 @@ if (env('RUN_MSSQL_TESTS')) { * This is for standard ProcessMaker tables */ if (!env('POPULATE_DATABASE')) { + refreshDatabases(); +} + +/** + * Refresh databases. + * @return void + */ +function refreshDatabases(): void +{ // Create a table for define the connection Schema::connection('testexternal')->dropIfExists('test'); Schema::connection('testexternal')->create('test', function ($table) { diff --git a/tests/unit/app/CustomizeFormatterTest.php b/tests/unit/app/CustomizeFormatterTest.php index c840b56ff..f3901348c 100644 --- a/tests/unit/app/CustomizeFormatterTest.php +++ b/tests/unit/app/CustomizeFormatterTest.php @@ -68,6 +68,6 @@ class CustomizeFormatterTest extends TestCase $this->assertCount(1, $files); $string = File::get($files[0]); - $this->assertRegExp("/{$message}/", $string); + $this->assertMatchesRegularExpression("/{$message}/", $string); } } diff --git a/tests/unit/gulliver/methods/DefaultAjaxTest.php b/tests/unit/gulliver/methods/DefaultAjaxTest.php index fc0265a25..de3a7ee8a 100644 --- a/tests/unit/gulliver/methods/DefaultAjaxTest.php +++ b/tests/unit/gulliver/methods/DefaultAjaxTest.php @@ -6,11 +6,16 @@ use Tests\TestCase; class DefaultAjaxTest extends TestCase { - + /** + * Set up method. + * @return void + */ public function setUp(): void { + parent::setUp(); $this->markTestSkipped('Issues with php 8'); } + /** * This gets data from a json file. * @param string $pathData diff --git a/tests/unit/gulliver/system/BootstrapTest.php b/tests/unit/gulliver/system/BootstrapTest.php index ca9e90b8b..19a7ee5cb 100644 --- a/tests/unit/gulliver/system/BootstrapTest.php +++ b/tests/unit/gulliver/system/BootstrapTest.php @@ -34,35 +34,35 @@ class BootstrapTest extends TestCase $result = Bootstrap::streamCSSBigFile($filename); //add more assertions - $this->assertRegexp("/{$filename}/", $result); - $this->assertRegexp("/font-face/", $result); - $this->assertRegexp("/font-family/", $result); + $this->assertMatchesRegularExpression("/{$filename}/", $result); + $this->assertMatchesRegularExpression("/font-face/", $result); + $this->assertMatchesRegularExpression("/font-family/", $result); $filename = "jscolors"; $result = Bootstrap::streamCSSBigFile($filename); //add more assertions - $this->assertRegexp("/{$filename}/", $result); + $this->assertMatchesRegularExpression("/{$filename}/", $result); $filename = "xmlcolors"; $result = Bootstrap::streamCSSBigFile($filename); //add more assertions - $this->assertRegexp("/{$filename}/", $result); + $this->assertMatchesRegularExpression("/{$filename}/", $result); $filename = "classic"; $result = Bootstrap::streamCSSBigFile($filename); //add more assertions - $this->assertRegexp("/{$filename}/", $result); - $this->assertRegexp("/font-family/", $result); - $this->assertRegexp("/ss_group_suit/", $result); + $this->assertMatchesRegularExpression("/{$filename}/", $result); + $this->assertMatchesRegularExpression("/font-family/", $result); + $this->assertMatchesRegularExpression("/ss_group_suit/", $result); $filename = "classic-extjs"; $result = Bootstrap::streamCSSBigFile($filename); //add more assertions - $this->assertRegexp("/{$filename}/", $result); + $this->assertMatchesRegularExpression("/{$filename}/", $result); } /** @@ -101,7 +101,7 @@ class BootstrapTest extends TestCase foreach ($files as $value) { $result = $result . File::get($value->getPathname()); } - $this->assertRegExp("/{$channel}/", $result); + $this->assertMatchesRegularExpression("/{$channel}/", $result); } /** @@ -136,6 +136,6 @@ class BootstrapTest extends TestCase foreach ($files as $value) { $result = $result . File::get($value->getPathname()); } - $this->assertRegExp("/{$channel}/", $result); + $this->assertMatchesRegularExpression("/{$channel}/", $result); } } diff --git a/tests/unit/gulliver/system/CodeScannerTest.php b/tests/unit/gulliver/system/CodeScannerTest.php index d57b5940b..fd4785d73 100644 --- a/tests/unit/gulliver/system/CodeScannerTest.php +++ b/tests/unit/gulliver/system/CodeScannerTest.php @@ -203,7 +203,7 @@ class CodeScannerTest extends TestCase $result = $codeScanner->checkDisabledCode('PATH', $this->pathPlugin); $this->assertNotEmpty($result); } else { - $this->markTestIncomplete( + $this->markTestSkipped( 'Please check the configurations to the Code Security Scanner' ); } diff --git a/tests/unit/gulliver/system/ReplaceDataFieldTest.php b/tests/unit/gulliver/system/ReplaceDataFieldTest.php index f0653c86c..662683bad 100644 --- a/tests/unit/gulliver/system/ReplaceDataFieldTest.php +++ b/tests/unit/gulliver/system/ReplaceDataFieldTest.php @@ -33,7 +33,7 @@ class ReplaceDataFieldTest extends TestCase $stringToCheck = G::replaceDataField($string, $result, $dbEngine, $recursive); // Assert the @qq is not being set as an empty value - $this->assertRegExp("/asa@qq.fds/", $stringToCheck); + $this->assertMatchesRegularExpression("/asa@qq.fds/", $stringToCheck); // Testing with a "@qstring" value $result = [ @@ -48,7 +48,7 @@ class ReplaceDataFieldTest extends TestCase $stringToCheck = G::replaceDataField($string, $result, $dbEngine, $recursive); // Assert the @qstring is not being set as an empty value - $this->assertRegExp("/@qstring/", $stringToCheck); + $this->assertMatchesRegularExpression("/@qstring/", $stringToCheck); } /** @@ -80,7 +80,7 @@ class ReplaceDataFieldTest extends TestCase $stringToCheck = G::replaceDataField($string, $result, $dbEngine, $recursive); // Assert the @qq is not being set as an empty value - $this->assertRegExp("/asa@qq.fds/", $stringToCheck); + $this->assertMatchesRegularExpression("/asa@qq.fds/", $stringToCheck); // Testing with a "@qstring" value $result = [ @@ -95,7 +95,7 @@ class ReplaceDataFieldTest extends TestCase $stringToCheck = G::replaceDataField($string, $result, $dbEngine, $recursive); // Assert the @qstring is not being set as an empty value - $this->assertRegExp("/@qstring/", $stringToCheck); + $this->assertMatchesRegularExpression("/@qstring/", $stringToCheck); } /** @@ -119,7 +119,7 @@ class ReplaceDataFieldTest extends TestCase $stringToCheck = G::replaceDataField($string, $variables, $dbEngine, $recursive); // The variable @#DOC_UID inside in the variable "@#upload_New" shouldn't be replaced - $this->assertRegExp("/@#DOC_UID/", $stringToCheck); + $this->assertMatchesRegularExpression("/@#DOC_UID/", $stringToCheck); // Set parameters to test the method $dbEngine = 'mysql'; @@ -129,7 +129,7 @@ class ReplaceDataFieldTest extends TestCase $stringToCheck = G::replaceDataField($string, $variables, $dbEngine, $recursive); // The variable @#DOC_UID inside in the variable "@#upload_New" should be replaced correctly - $this->assertRegExp("/1988828025cc89aba0cd2b8079038028/", $stringToCheck); + $this->assertMatchesRegularExpression("/1988828025cc89aba0cd2b8079038028/", $stringToCheck); } /** @@ -153,7 +153,7 @@ class ReplaceDataFieldTest extends TestCase $stringToCheck = G::replaceDataField($string, $variables, $dbEngine, $recursive); // The variable @=DOC_UID inside in the variable "@=upload_New" shouldn't be replaced - $this->assertRegExp("/@=DOC_UID/", $stringToCheck); + $this->assertMatchesRegularExpression("/@=DOC_UID/", $stringToCheck); // Set parameters to test the method $dbEngine = 'mysql'; @@ -163,6 +163,6 @@ class ReplaceDataFieldTest extends TestCase $stringToCheck = G::replaceDataField($string, $variables, $dbEngine, $recursive); // The variable @=DOC_UID inside in the variable "@=upload_New" should be replaced correctly - $this->assertRegExp("/1988828025cc89aba0cd2b8079038028/", $stringToCheck); + $this->assertMatchesRegularExpression("/1988828025cc89aba0cd2b8079038028/", $stringToCheck); } } diff --git a/tests/unit/rbac/engine/classes/model/RolesTest.php b/tests/unit/rbac/engine/classes/model/RolesTest.php index c032095c8..4e44ae409 100644 --- a/tests/unit/rbac/engine/classes/model/RolesTest.php +++ b/tests/unit/rbac/engine/classes/model/RolesTest.php @@ -23,13 +23,13 @@ class RolesTest extends TestCase $rolesInstance = new Roles(); // Create elements - $role = factory(RbacRoles::class)->create(); - $deletedUser = factory(RbacUsers::class)->states('deleted')->create(); - $activeUser = factory(RbacUsers::class)->states('active')->create(); - $inactiveUser = factory(RbacUsers::class)->states('inactive')->create(); + $role = RbacRoles::factory()->create(); + $deletedUser = RbacUsers::factory()->deleted()->create(); + $activeUser = RbacUsers::factory()->active()->create(); + $inactiveUser = RbacUsers::factory()->inactive()->create(); // Assign the role to a deleted user - factory(RbacUsersRoles::class)->create([ + RbacUsersRoles::factory()->create([ 'ROL_UID' => $role->ROL_UID, 'USR_UID' => $deletedUser->USR_UID ]); @@ -37,7 +37,7 @@ class RolesTest extends TestCase $this->assertEquals(0, $rolesInstance->numUsersWithRole($role->ROL_UID)); // Assign the role to an active user - factory(RbacUsersRoles::class)->create([ + RbacUsersRoles::factory()->create([ 'ROL_UID' => $role->ROL_UID, 'USR_UID' => $activeUser->USR_UID ]); @@ -45,7 +45,7 @@ class RolesTest extends TestCase $this->assertEquals(1, $rolesInstance->numUsersWithRole($role->ROL_UID)); // Assign the role to an inactive user - factory(RbacUsersRoles::class)->create([ + RbacUsersRoles::factory()->create([ 'ROL_UID' => $role->ROL_UID, 'USR_UID' => $inactiveUser->USR_UID ]); diff --git a/tests/unit/workflow/engine/bin/tasks/CliWorkspacesTest.php b/tests/unit/workflow/engine/bin/tasks/CliWorkspacesTest.php index 0e34784d5..93bc80184 100644 --- a/tests/unit/workflow/engine/bin/tasks/CliWorkspacesTest.php +++ b/tests/unit/workflow/engine/bin/tasks/CliWorkspacesTest.php @@ -7,11 +7,13 @@ use ProcessMaker\Model\Dynaform; use ProcessMaker\Model\Process; use ProcessMaker\Model\ProcessVariables; use ProcessMaker\Model\Triggers; +use Tests\CreateTestSite; use Tests\TestCase; class CliWorkspacesTest extends TestCase { use DatabaseTransactions; + use CreateTestSite; /** * Test that the deprecated files are removed successfully @@ -21,6 +23,7 @@ class CliWorkspacesTest extends TestCase */ public function it_should_delete_the_deprecated_files() { + ob_start(); include(PATH_TRUNK . 'workflow/engine/bin/tasks/cliWorkspaces.php'); if (!file_exists(PATH_TRUNK . 'workflow/engine/methods/users/data_usersList.php')) { $filename = PATH_TRUNK . 'workflow/engine/methods/users/data_usersList.php'; @@ -79,6 +82,7 @@ class CliWorkspacesTest extends TestCase } } + ob_get_clean(); // This assert the data_usersList.php does not exist anymore $this->assertFalse(file_exists(PATH_TRUNK . 'workflow/engine/methods/users/data_usersList.php')); } @@ -150,33 +154,34 @@ class CliWorkspacesTest extends TestCase */ public function it_should_test_the_incompatibilities_in_the_dynaforms_queries() { - $this->markTestIncomplete();//This can't be tested due to the db.php invocation config(["system.workspace" => 'workflow']); + $workspace = config("system.workspace"); + $this->createDBFile($workspace); - $process = factory(Process::class, 2)->create(); + $process = Process::factory(2)->create(); - factory(Dynaform::class)->create( + Dynaform::factory()->create( [ 'PRO_UID' => $process[0]['PRO_UID'], 'DYN_CONTENT' => '{"name":"2","description":"","items":[{"type":"form","variable":"","var_uid":"","dataType":"","id":"6170264265d1b544bebdbd5098250194","name":"2","description":"","mode":"edit","script":"","language":"en","externalLibs":"","printable":false,"items":[[{"type":"title","id":"title0000000001","label":"title_1","colSpan":12}],[{"type":"text","variable":"textVar002","var_uid":"9778460595d1b545088dd69091601043","dataType":"string","protectedValue":false,"id":"textVar002","name":"textVar002","label":"text_1","defaultValue":"","placeholder":"","hint":"","required":false,"requiredFieldErrorMessage":"","textTransform":"none","validate":"","validateMessage":"","maxLength":1000,"formula":"","mode":"parent","operation":"","dbConnection":"workflow","dbConnectionLabel":"PM Database","sql":"","var_name":"textVar002","colSpan":12}],[{"type":"textarea","variable":"textareaVar001","var_uid":"2934510045d1b5453f21373072798412","dataType":"string","protectedValue":false,"id":"textareaVar001","name":"textareaVar001","label":"textarea_1","defaultValue":"","placeholder":"","hint":"","required":false,"requiredFieldErrorMessage":"","validate":"","validateMessage":"","mode":"parent","dbConnection":"workflow","dbConnectionLabel":"PM Database","sql":"","rows":"5","var_name":"textareaVar001","colSpan":12}],[{"type":"datetime","variable":"datetimeVar001","var_uid":"9780823375d1b5455e9c3a2064729484","dataType":"datetime","protectedValue":false,"id":"datetimeVar001","name":"datetimeVar001","label":"datetime_1","placeholder":"","hint":"","required":false,"requiredFieldErrorMessage":"","mode":"parent","format":"YYYY-MM-DD","dayViewHeaderFormat":"MMMM YYYY","extraFormats":false,"stepping":1,"minDate":"","maxDate":"","useCurrent":"false","collapse":true,"locale":"","defaultDate":"","disabledDates":false,"enabledDates":false,"icons":{"time":"glyphicon glyphicon-time","date":"glyphicon glyphicon-calendar","up":"glyphicon glyphicon-chevron-up","down":"glyphicon glyphicon-chevron-down","previous":"glyphicon glyphicon-chevron-left","next":"glyphicon glyphicon-chevron-right","today":"glyphicon glyphicon-screenshot","clear":"glyphicon glyphicon-trash"},"useStrict":false,"sideBySide":false,"daysOfWeekDisabled":false,"calendarWeeks":false,"viewMode":"days","toolbarPlacement":"default","showTodayButton":false,"showClear":"false","widgetPositioning":{"horizontal":"auto","vertical":"auto"},"widgetParent":null,"keepOpen":false,"var_name":"datetimeVar001","colSpan":12}],[{"type":"submit","id":"submit0000000001","name":"submit0000000001","label":"submit_1","colSpan":12}]],"variables":[{"var_uid":"9778460595d1b545088dd69091601043","prj_uid":"5139642915ccb3fca429a36061714972","var_name":"textVar002","var_field_type":"string","var_field_size":10,"var_label":"string","var_dbconnection":"workflow","var_dbconnection_label":"PM Database","var_sql":"","var_null":0,"var_default":"","var_accepted_values":"[]","inp_doc_uid":""},{"var_uid":"2934510045d1b5453f21373072798412","prj_uid":"5139642915ccb3fca429a36061714972","var_name":"textareaVar001","var_field_type":"string","var_field_size":10,"var_label":"string","var_dbconnection":"workflow","var_dbconnection_label":"PM Database","var_sql":"","var_null":0,"var_default":"","var_accepted_values":"[]","inp_doc_uid":""},{"var_uid":"9780823375d1b5455e9c3a2064729484","prj_uid":"5139642915ccb3fca429a36061714972","var_name":"datetimeVar001","var_field_type":"datetime","var_field_size":10,"var_label":"datetime","var_dbconnection":"workflow","var_dbconnection_label":"PM Database","var_sql":"","var_null":0,"var_default":"","var_accepted_values":"[]","inp_doc_uid":""}]}]}' ] ); - $dynaform = factory(Dynaform::class)->create( + $dynaform = Dynaform::factory()->create( [ 'PRO_UID' => $process[1]['PRO_UID'], 'DYN_CONTENT' => '{"name":"1","description":"","items":[{"type":"form","variable":"","var_uid":"","dataType":"","id":"6817532755d16225629cb05061521548","name":"1","description":"","mode":"edit","script":"","language":"en","externalLibs":"","printable":false,"items":[[{"type":"text","variable":"textVar001","var_uid":"4746221155d1622658943d1014840579","dataType":"string","protectedValue":false,"id":"textVar001","name":"textVar001","label":"text_1","defaultValue":"","placeholder":"","hint":"","required":false,"requiredFieldErrorMessage":"","textTransform":"none","validate":"","validateMessage":"","maxLength":1000,"formula":"","mode":"parent","operation":"","dbConnection":"workflow","dbConnectionLabel":"PM Database","sql":"SELECT * FROM USERS WHERE \nUSR_UID=\'$UID\' UNION SELECT * from PROCESS","var_name":"textVar001","colSpan":12}]],"variables":[{"var_uid":"4746221155d1622658943d1014840579","prj_uid":"5139642915ccb3fca429a36061714972","var_name":"textVar001","var_field_type":"string","var_field_size":10,"var_label":"string","var_dbconnection":"workflow","var_dbconnection_label":"PM Database","var_sql":"","var_null":0,"var_default":"","var_accepted_values":"[]","inp_doc_uid":""}]}]}' ] ); - $variables = factory(ProcessVariables::class)->create( + $variables = ProcessVariables::factory()->create( [ 'PRJ_UID' => $process[0]['PRO_UID'], 'VAR_SQL' => 'SELECT * FROM USERS WHERE USR_UID="213" UNION SELECT * from PROCESS' ] ); - $trigger = factory(Triggers::class)->create( + $trigger = Triggers::factory()->create( [ 'PRO_UID' => $process[0]['PRO_UID'], 'TRI_WEBBOT' => '$text=222; @@ -203,26 +208,28 @@ class CliWorkspacesTest extends TestCase ] ); + ob_start(); check_queries_incompatibilities('workflow'); $result = ob_get_contents(); + ob_get_clean(); // This assert that the message contains the second process name - $this->assertRegExp('/'.$process[1]['PRO_TITLE'].'/',$result); + $this->assertMatchesRegularExpression('/'.$process[1]['PRO_TITLE'].'/',$result); // This assert that the message contains the second dynaform with the UNION query - $this->assertRegExp('/'.$dynaform['DYN_TITLE'].'/',$result); + $this->assertMatchesRegularExpression('/'.$dynaform['DYN_TITLE'].'/',$result); // This assert that the message contains the first process name - $this->assertRegExp('/'.$process[0]['PRO_TITLE'].'/',$result); + $this->assertMatchesRegularExpression('/'.$process[0]['PRO_TITLE'].'/',$result); // This assert that the message contains the first dynaform with the UNION query - $this->assertRegExp('/'.$variables['VAR_TITLE'].'/',$result); + $this->assertMatchesRegularExpression('/'.$variables['VAR_TITLE'].'/',$result); // This assert that the message contains the first process name - $this->assertRegExp('/'.$process[0]['PRO_TITLE'].'/',$result); + $this->assertMatchesRegularExpression('/'.$process[0]['PRO_TITLE'].'/',$result); // This assert that the message contains the first trigger with the UNION query - $this->assertRegExp('/'.$trigger['TRI_TITLE'].'/',$result); + $this->assertMatchesRegularExpression('/'.$trigger['TRI_TITLE'].'/',$result); } } \ No newline at end of file diff --git a/tests/unit/workflow/engine/classes/ActionsByEmailCoreClassTest.php b/tests/unit/workflow/engine/classes/ActionsByEmailCoreClassTest.php index 01ba746e7..aaa4b7cc5 100644 --- a/tests/unit/workflow/engine/classes/ActionsByEmailCoreClassTest.php +++ b/tests/unit/workflow/engine/classes/ActionsByEmailCoreClassTest.php @@ -52,14 +52,14 @@ class ActionsByEmailCoreClassTest extends TestCase $user = User::where('USR_UID', '=', '00000000000000000000000000000001') ->get() ->first(); - $process = factory(Process::class)->create(); - $task = factory(Task::class)->create([ + $process = Process::factory()->create(); + $task = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $task->TAS_UID, @@ -91,17 +91,17 @@ class ActionsByEmailCoreClassTest extends TestCase $user = User::where('USR_UID', '=', '00000000000000000000000000000001') ->get() ->first(); - $process = factory(Process::class)->create(); - $task = factory(Task::class)->create([ + $process = Process::factory()->create(); + $task = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); $abeConfiguration = [ 'ABE_EMAIL_SERVER_UID' => '' ]; - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $task->TAS_UID, @@ -133,15 +133,15 @@ class ActionsByEmailCoreClassTest extends TestCase $user = User::where('USR_UID', '=', '00000000000000000000000000000001') ->get() ->first(); - $process = factory(Process::class)->create(); - $task = factory(Task::class)->create([ + $process = Process::factory()->create(); + $task = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $dynaform = factory(Dynaform::class)->create([ + $dynaform = Dynaform::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $emailServer = factory(ProcessMaker\Model\EmailServerModel::class)->create(); - $abeConfiguration = factory(AbeConfiguration::class)->create([ + $emailServer = ProcessMaker\Model\EmailServerModel::factory()->create(); + $abeConfiguration = AbeConfiguration::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => '', 'DYN_UID' => $dynaform->DYN_UID, @@ -151,10 +151,10 @@ class ActionsByEmailCoreClassTest extends TestCase ]); $abeConfiguration = $abeConfiguration->toArray(); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $task->TAS_UID, @@ -186,19 +186,19 @@ class ActionsByEmailCoreClassTest extends TestCase */ public function it_should_test_sendActionsByEmail_method_with_exception_if_email_to_is_empty() { - $user = factory(User::class)->create([ + $user = User::factory()->create([ 'USR_EMAIL' => '' ]); - $process = factory(Process::class)->create(); - $task = factory(Task::class)->create([ + $process = Process::factory()->create(); + $task = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $dynaform = factory(Dynaform::class)->create([ + $dynaform = Dynaform::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $emailServer = factory(ProcessMaker\Model\EmailServerModel::class)->create(); - $abeConfiguration = factory(AbeConfiguration::class)->create([ + $emailServer = ProcessMaker\Model\EmailServerModel::factory()->create(); + $abeConfiguration = AbeConfiguration::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $task->TAS_UID, 'DYN_UID' => $dynaform->DYN_UID, @@ -209,10 +209,10 @@ class ActionsByEmailCoreClassTest extends TestCase ]); $abeConfiguration = $abeConfiguration->toArray(); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $task->TAS_UID, @@ -245,17 +245,17 @@ class ActionsByEmailCoreClassTest extends TestCase */ public function it_should_test_sendActionsByEmail_method_with_exception_if_email_type_is_empty() { - $user = factory(User::class)->create(); + $user = User::factory()->create(); - $process = factory(Process::class)->create(); - $task = factory(Task::class)->create([ + $process = Process::factory()->create(); + $task = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $dynaform = factory(Dynaform::class)->create([ + $dynaform = Dynaform::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $emailServer = factory(ProcessMaker\Model\EmailServerModel::class)->create(); - $abeConfiguration = factory(AbeConfiguration::class)->create([ + $emailServer = ProcessMaker\Model\EmailServerModel::factory()->create(); + $abeConfiguration = AbeConfiguration::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $task->TAS_UID, 'DYN_UID' => $dynaform->DYN_UID, @@ -266,10 +266,10 @@ class ActionsByEmailCoreClassTest extends TestCase ]); $abeConfiguration = $abeConfiguration->toArray(); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $task->TAS_UID, @@ -304,15 +304,15 @@ class ActionsByEmailCoreClassTest extends TestCase $user = User::where('USR_UID', '=', '00000000000000000000000000000001') ->get() ->first(); - $process = factory(Process::class)->create(); - $task = factory(Task::class)->create([ + $process = Process::factory()->create(); + $task = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $dynaform = factory(Dynaform::class)->create([ + $dynaform = Dynaform::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $emailServer = factory(ProcessMaker\Model\EmailServerModel::class)->create(); - $abeConfiguration = factory(AbeConfiguration::class)->create([ + $emailServer = ProcessMaker\Model\EmailServerModel::factory()->create(); + $abeConfiguration = AbeConfiguration::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $task->TAS_UID, 'DYN_UID' => $dynaform->DYN_UID, @@ -322,11 +322,11 @@ class ActionsByEmailCoreClassTest extends TestCase ]); $abeConfiguration = $abeConfiguration->toArray(); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $task->TAS_UID, @@ -363,15 +363,15 @@ class ActionsByEmailCoreClassTest extends TestCase $user = User::where('USR_UID', '=', '00000000000000000000000000000001') ->get() ->first(); - $process = factory(Process::class)->create(); - $task = factory(Task::class)->create([ + $process = Process::factory()->create(); + $task = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $dynaform = factory(Dynaform::class)->create([ + $dynaform = Dynaform::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $emailServer = factory(ProcessMaker\Model\EmailServerModel::class)->create(); - $abeConfiguration = factory(AbeConfiguration::class)->create([ + $emailServer = ProcessMaker\Model\EmailServerModel::factory()->create(); + $abeConfiguration = AbeConfiguration::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $task->TAS_UID, 'DYN_UID' => $dynaform->DYN_UID, @@ -382,11 +382,11 @@ class ActionsByEmailCoreClassTest extends TestCase ]); $abeConfiguration = $abeConfiguration->toArray(); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $task->TAS_UID, @@ -423,15 +423,15 @@ class ActionsByEmailCoreClassTest extends TestCase $user = User::where('USR_UID', '=', '00000000000000000000000000000001') ->get() ->first(); - $process = factory(Process::class)->create(); - $task = factory(Task::class)->create([ + $process = Process::factory()->create(); + $task = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $dynaform = factory(Dynaform::class)->create([ + $dynaform = Dynaform::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $emailServer = factory(ProcessMaker\Model\EmailServerModel::class)->create(); - $abeConfiguration = factory(AbeConfiguration::class)->create([ + $emailServer = ProcessMaker\Model\EmailServerModel::factory()->create(); + $abeConfiguration = AbeConfiguration::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $task->TAS_UID, 'DYN_UID' => $dynaform->DYN_UID, @@ -442,11 +442,11 @@ class ActionsByEmailCoreClassTest extends TestCase ]); $abeConfiguration = $abeConfiguration->toArray(); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $task->TAS_UID, @@ -483,16 +483,16 @@ class ActionsByEmailCoreClassTest extends TestCase $user = User::where('USR_UID', '=', '00000000000000000000000000000001') ->get() ->first(); - $process = factory(Process::class)->create(); - $task = factory(Task::class)->create([ + $process = Process::factory()->create(); + $task = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $dynaform = factory(Dynaform::class)->create([ + $dynaform = Dynaform::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'DYN_CONTENT' => file_get_contents(PATH_TRUNK . "/tests/resources/dynaform2.json") ]); - $emailServer = factory(ProcessMaker\Model\EmailServerModel::class)->create(); - $abeConfiguration = factory(AbeConfiguration::class)->create([ + $emailServer = ProcessMaker\Model\EmailServerModel::factory()->create(); + $abeConfiguration = AbeConfiguration::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $task->TAS_UID, 'DYN_UID' => $dynaform->DYN_UID, @@ -503,11 +503,11 @@ class ActionsByEmailCoreClassTest extends TestCase ]); $abeConfiguration = $abeConfiguration->toArray(); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $task->TAS_UID, @@ -544,16 +544,16 @@ class ActionsByEmailCoreClassTest extends TestCase $user = User::where('USR_UID', '=', '00000000000000000000000000000001') ->get() ->first(); - $process = factory(Process::class)->create(); - $task = factory(Task::class)->create([ + $process = Process::factory()->create(); + $task = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $dynaform = factory(Dynaform::class)->create([ + $dynaform = Dynaform::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'DYN_CONTENT' => file_get_contents(PATH_TRUNK . "/tests/resources/dynaform3.json") ]); - $emailServer = factory(ProcessMaker\Model\EmailServerModel::class)->create(); - $abeConfiguration = factory(AbeConfiguration::class)->create([ + $emailServer = ProcessMaker\Model\EmailServerModel::factory()->create(); + $abeConfiguration = AbeConfiguration::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $task->TAS_UID, 'DYN_UID' => $dynaform->DYN_UID, @@ -565,11 +565,11 @@ class ActionsByEmailCoreClassTest extends TestCase ]); $abeConfiguration = $abeConfiguration->toArray(); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $task->TAS_UID, @@ -598,11 +598,11 @@ class ActionsByEmailCoreClassTest extends TestCase $result = $reflectionMethod->invokeArgs($this->actionsByEmailCoreClass, []); - $this->assertContains('jsondata', $result); - $this->assertContains('httpServerHostname', $result); - $this->assertContains('pm_run_outside_main_app', $result); - $this->assertContains('pathRTLCss', $result); - $this->assertContains('fieldsRequired', $result); + $this->assertStringContainsString('jsondata', $result); + $this->assertStringContainsString('httpServerHostname', $result); + $this->assertStringContainsString('pm_run_outside_main_app', $result); + $this->assertStringContainsString('pathRTLCss', $result); + $this->assertStringContainsString('fieldsRequired', $result); } /** @@ -615,16 +615,16 @@ class ActionsByEmailCoreClassTest extends TestCase $user = User::where('USR_UID', '=', '00000000000000000000000000000001') ->get() ->first(); - $process = factory(Process::class)->create(); - $task = factory(Task::class)->create([ + $process = Process::factory()->create(); + $task = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $dynaform = factory(Dynaform::class)->create([ + $dynaform = Dynaform::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'DYN_CONTENT' => file_get_contents(PATH_TRUNK . "/tests/resources/dynaform3.json") ]); - $emailServer = factory(ProcessMaker\Model\EmailServerModel::class)->create(); - $abeConfiguration = factory(AbeConfiguration::class)->create([ + $emailServer = ProcessMaker\Model\EmailServerModel::factory()->create(); + $abeConfiguration = AbeConfiguration::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $task->TAS_UID, 'DYN_UID' => $dynaform->DYN_UID, @@ -636,11 +636,11 @@ class ActionsByEmailCoreClassTest extends TestCase ]); $abeConfiguration = $abeConfiguration->toArray(); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $task->TAS_UID, @@ -669,11 +669,11 @@ class ActionsByEmailCoreClassTest extends TestCase $result = $reflectionMethod->invokeArgs($this->actionsByEmailCoreClass, []); - $this->assertContains('jsondata', $result); - $this->assertContains('httpServerHostname', $result); - $this->assertContains('pm_run_outside_main_app', $result); - $this->assertContains('pathRTLCss', $result); - $this->assertContains('fieldsRequired', $result); + $this->assertStringContainsString('jsondata', $result); + $this->assertStringContainsString('httpServerHostname', $result); + $this->assertStringContainsString('pm_run_outside_main_app', $result); + $this->assertStringContainsString('pathRTLCss', $result); + $this->assertStringContainsString('fieldsRequired', $result); } /** @@ -687,16 +687,16 @@ class ActionsByEmailCoreClassTest extends TestCase $user = User::where('USR_UID', '=', '00000000000000000000000000000001') ->get() ->first(); - $process = factory(Process::class)->create(); - $task = factory(Task::class)->create([ + $process = Process::factory()->create(); + $task = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $dynaform = factory(Dynaform::class)->create([ + $dynaform = Dynaform::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'DYN_CONTENT' => file_get_contents(PATH_TRUNK . "/tests/resources/dynaform3.json") ]); - $emailServer = factory(ProcessMaker\Model\EmailServerModel::class)->create(); - $abeConfiguration = factory(AbeConfiguration::class)->create([ + $emailServer = ProcessMaker\Model\EmailServerModel::factory()->create(); + $abeConfiguration = AbeConfiguration::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $task->TAS_UID, 'DYN_UID' => $dynaform->DYN_UID, @@ -708,11 +708,11 @@ class ActionsByEmailCoreClassTest extends TestCase ]); $abeConfiguration = $abeConfiguration->toArray(); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $task->TAS_UID, @@ -741,10 +741,10 @@ class ActionsByEmailCoreClassTest extends TestCase $result = $reflectionMethod->invokeArgs($this->actionsByEmailCoreClass, []); - $this->assertContains('jsondata', $result); - $this->assertContains('httpServerHostname', $result); - $this->assertContains('pm_run_outside_main_app', $result); - $this->assertContains('pathRTLCss', $result); - $this->assertContains('fieldsRequired', $result); + $this->assertStringContainsString('jsondata', $result); + $this->assertStringContainsString('httpServerHostname', $result); + $this->assertStringContainsString('pm_run_outside_main_app', $result); + $this->assertStringContainsString('pathRTLCss', $result); + $this->assertStringContainsString('fieldsRequired', $result); } } diff --git a/tests/unit/workflow/engine/classes/CasesTest.php b/tests/unit/workflow/engine/classes/CasesTest.php index 1197a7f3c..9aa26ba15 100644 --- a/tests/unit/workflow/engine/classes/CasesTest.php +++ b/tests/unit/workflow/engine/classes/CasesTest.php @@ -42,13 +42,13 @@ class CasesTest extends TestCase */ public function it_should_test_get_next_step_method() { - $process = factory(Process::class)->create(); - $application = factory(Application::class)->create(['PRO_UID' => $process->PRO_UID]); - $appDelegation = factory(Delegation::class)->create([ + $process = Process::factory()->create(); + $application = Application::factory()->create(['PRO_UID' => $process->PRO_UID]); + $appDelegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID, 'DEL_INDEX' => 2, @@ -68,19 +68,19 @@ class CasesTest extends TestCase */ public function it_should_test_get_next_step_method_position() { - $process = factory(Process::class)->create(); - $application = factory(Application::class)->create(['PRO_UID' => $process->PRO_UID]); - $appDelegation = factory(Delegation::class)->create([ + $process = Process::factory()->create(); + $application = Application::factory()->create(['PRO_UID' => $process->PRO_UID]); + $appDelegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID, 'DEL_INDEX' => 2, 'DEL_PREVIOUS' => $appDelegation->DEL_INDEX ]); - factory(Step::class)->create([ + Step::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $appDelegation->TAS_UID, 'STEP_POSITION' => 2, @@ -99,19 +99,19 @@ class CasesTest extends TestCase */ public function it_should_test_get_next_step_method_output_document() { - $process = factory(Process::class)->create(); - $application = factory(Application::class)->create(['PRO_UID' => $process->PRO_UID]); - $appDelegation = factory(Delegation::class)->create([ + $process = Process::factory()->create(); + $application = Application::factory()->create(['PRO_UID' => $process->PRO_UID]); + $appDelegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID, 'DEL_INDEX' => 2, 'DEL_PREVIOUS' => $appDelegation->DEL_INDEX ]); - factory(Step::class)->create([ + Step::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $appDelegation->TAS_UID, 'STEP_POSITION' => 2, @@ -131,19 +131,19 @@ class CasesTest extends TestCase */ public function it_should_test_get_next_step_method_input_document() { - $process = factory(Process::class)->create(); - $application = factory(Application::class)->create(['PRO_UID' => $process->PRO_UID]); - $appDelegation = factory(Delegation::class)->create([ + $process = Process::factory()->create(); + $application = Application::factory()->create(['PRO_UID' => $process->PRO_UID]); + $appDelegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID, 'DEL_INDEX' => 2, 'DEL_PREVIOUS' => $appDelegation->DEL_INDEX ]); - factory(Step::class)->create([ + Step::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $appDelegation->TAS_UID, 'STEP_POSITION' => 2, @@ -163,19 +163,19 @@ class CasesTest extends TestCase */ public function it_should_test_get_next_step_method_external() { - $process = factory(Process::class)->create(); - $application = factory(Application::class)->create(['PRO_UID' => $process->PRO_UID]); - $appDelegation = factory(Delegation::class)->create([ + $process = Process::factory()->create(); + $application = Application::factory()->create(['PRO_UID' => $process->PRO_UID]); + $appDelegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID, 'DEL_INDEX' => 2, 'DEL_PREVIOUS' => $appDelegation->DEL_INDEX ]); - factory(Step::class)->create([ + Step::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $appDelegation->TAS_UID, 'STEP_POSITION' => 2, @@ -195,19 +195,19 @@ class CasesTest extends TestCase */ public function it_should_test_get_next_step_method_message() { - $process = factory(Process::class)->create(); - $application = factory(Application::class)->create(['PRO_UID' => $process->PRO_UID]); - $appDelegation = factory(Delegation::class)->create([ + $process = Process::factory()->create(); + $application = Application::factory()->create(['PRO_UID' => $process->PRO_UID]); + $appDelegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID, 'DEL_INDEX' => 2, 'DEL_PREVIOUS' => $appDelegation->DEL_INDEX ]); - factory(Step::class)->create([ + Step::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $appDelegation->TAS_UID, 'STEP_POSITION' => 2, @@ -227,13 +227,13 @@ class CasesTest extends TestCase */ public function it_should_test_get_next_step_method_step_does_not_exists() { - $process = factory(Process::class)->create(); - $application = factory(Application::class)->create(['PRO_UID' => $process->PRO_UID]); - $appDelegation = factory(Delegation::class)->create([ + $process = Process::factory()->create(); + $application = Application::factory()->create(['PRO_UID' => $process->PRO_UID]); + $appDelegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID, 'DEL_INDEX' => 2, @@ -265,9 +265,9 @@ class CasesTest extends TestCase */ public function it_should_test_get_next_step_method_step_false() { - $process = factory(Process::class)->create(); - $application = factory(Application::class)->create(); - $appDelegation = factory(Delegation::class)->create(); + $process = Process::factory()->create(); + $application = Application::factory()->create(); + $appDelegation = Delegation::factory()->create(); $cases = new Cases(); $res = $cases->getNextStep($process->PRO_UID, $application->APP_UID, $appDelegation->DEL_INDEX); $this->assertFalse($res); @@ -282,19 +282,19 @@ class CasesTest extends TestCase public function it_should_test_get_next_step_method_gmail() { $_SESSION['gmail'] = ''; - $process = factory(Process::class)->create(); - $application = factory(Application::class)->create(['PRO_UID' => $process->PRO_UID]); - $appDelegation = factory(Delegation::class)->create([ + $process = Process::factory()->create(); + $application = Application::factory()->create(['PRO_UID' => $process->PRO_UID]); + $appDelegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID, 'DEL_INDEX' => 2, 'DEL_PREVIOUS' => $appDelegation->DEL_INDEX ]); - factory(Step::class)->create([ + Step::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $appDelegation->TAS_UID, 'STEP_POSITION' => 2, @@ -315,19 +315,19 @@ class CasesTest extends TestCase public function it_should_test_get_next_step_method_gmail_nextstep() { $_SESSION['gmail'] = ''; - $process = factory(Process::class)->create(); - $application = factory(Application::class)->create(['PRO_UID' => $process->PRO_UID]); - $appDelegation = factory(Delegation::class)->create([ + $process = Process::factory()->create(); + $application = Application::factory()->create(['PRO_UID' => $process->PRO_UID]); + $appDelegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID, 'DEL_INDEX' => 2, 'DEL_PREVIOUS' => $appDelegation->DEL_INDEX ]); - factory(Step::class)->create([ + Step::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $appDelegation->TAS_UID, 'STEP_POSITION' => 1, @@ -348,19 +348,19 @@ class CasesTest extends TestCase public function it_should_test_get_next_step_method_condition_empty() { $_SESSION['gmail'] = ''; - $process = factory(Process::class)->create(); - $application = factory(Application::class)->create(['PRO_UID' => $process->PRO_UID]); - $appDelegation = factory(Delegation::class)->create([ + $process = Process::factory()->create(); + $application = Application::factory()->create(['PRO_UID' => $process->PRO_UID]); + $appDelegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'PRO_UID' => $process->PRO_UID, 'DEL_INDEX' => 2, 'DEL_PREVIOUS' => $appDelegation->DEL_INDEX ]); - factory(Step::class)->create([ + Step::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $appDelegation->TAS_UID, 'STEP_POSITION' => 2, @@ -381,24 +381,24 @@ class CasesTest extends TestCase public function it_should_test_get_start_cases() { // Creating a process with initial tasks - $process = factory(Process::class)->create(); - $user = factory(User::class)->create(); - $normalTask = factory(Task::class)->create([ + $process = Process::factory()->create(); + $user = User::factory()->create(); + $normalTask = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'PRO_ID' => $process->PRO_ID, 'TAS_START' => 'TRUE' ]); - $webEntryTask = factory(Task::class)->create([ + $webEntryTask = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'PRO_ID' => $process->PRO_ID, 'TAS_START' => 'TRUE', 'TAS_TYPE' => 'WEBENTRYEVENT' ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $normalTask->TAS_UID, 'USR_UID' => $user->USR_UID ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $webEntryTask->TAS_UID, 'USR_UID' => $user->USR_UID ]); @@ -423,8 +423,8 @@ class CasesTest extends TestCase */ public function it_shoult_test_the_get_to_method_with_default_tas_assign_type() { - $task = factory(Task::class)->create(); - $user = factory(User::class)->create([ + $task = Task::factory()->create(); + $user = User::factory()->create([ 'USR_EMAIL' => 'test@test.com' ]); @@ -432,7 +432,7 @@ class CasesTest extends TestCase $cases = new Cases(); $result = $cases->getTo($task->TAS_UID, $user->USR_UID, ''); $this->assertNotEmpty($result); - $this->assertRegExp("/{$user->USR_EMAIL}/", $result["to"]); + $this->assertMatchesRegularExpression("/{$user->USR_EMAIL}/", $result["to"]); } /** @@ -443,41 +443,41 @@ class CasesTest extends TestCase */ public function it_shoult_test_the_get_to_method_with_self_service_tas_assign_type() { - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_ASSIGN_TYPE' => 'BALANCED' ]); - $task2 = factory(Task::class)->create([ + $task2 = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE' ]); - $user = factory(User::class)->create([ + $user = User::factory()->create([ 'USR_EMAIL' => 'test@test.com' ]); - $user2 = factory(User::class)->create([ + $user2 = User::factory()->create([ 'USR_EMAIL' => 'test2@test2.com' ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task2->TAS_UID, 'USR_UID' => $user->USR_UID ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task2->TAS_UID, 'USR_UID' => $user2->USR_UID ]); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 2, 'PRO_UID' => $process->PRO_UID, 'APP_INIT_USER' => "00000000000000000000000000000001", 'APP_CUR_USER' => $user2->USR_UID ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'DEL_INDEX' => 1, 'APP_NUMBER' => $application->APP_NUMBER, @@ -488,7 +488,7 @@ class CasesTest extends TestCase 'DEL_THREAD' => 1, 'DEL_THREAD_STATUS' => 'CLOSED' ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'DEL_INDEX' => 2, 'APP_NUMBER' => $application->APP_NUMBER, @@ -499,7 +499,7 @@ class CasesTest extends TestCase 'DEL_THREAD' => 2, 'DEL_THREAD_STATUS' => 'OPEN' ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'DEL_INDEX' => 3, 'APP_NUMBER' => $application->APP_NUMBER, @@ -534,8 +534,8 @@ class CasesTest extends TestCase $this->assertNotEmpty($result); // Asserts the emails of both users are contained in the result - $this->assertRegExp("/{$user->USR_EMAIL}/", $result["to"]); - $this->assertRegExp("/{$user2->USR_EMAIL}/", $result["to"]); + $this->assertMatchesRegularExpression("/{$user->USR_EMAIL}/", $result["to"]); + $this->assertMatchesRegularExpression("/{$user2->USR_EMAIL}/", $result["to"]); } /** @@ -546,41 +546,41 @@ class CasesTest extends TestCase */ public function it_shoult_test_the_get_to_method_with_multiple_instance_tas_assign_type() { - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_ASSIGN_TYPE' => 'BALANCED' ]); - $task2 = factory(Task::class)->create([ + $task2 = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_ASSIGN_TYPE' => 'MULTIPLE_INSTANCE' ]); - $user = factory(User::class)->create([ + $user = User::factory()->create([ 'USR_EMAIL' => 'test@test.com' ]); - $user2 = factory(User::class)->create([ + $user2 = User::factory()->create([ 'USR_EMAIL' => 'test2@test2.com' ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task2->TAS_UID, 'USR_UID' => $user->USR_UID ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task2->TAS_UID, 'USR_UID' => $user2->USR_UID ]); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 2, 'PRO_UID' => $process->PRO_UID, 'APP_INIT_USER' => "00000000000000000000000000000001", 'APP_CUR_USER' => $user2->USR_UID ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'DEL_INDEX' => 1, 'APP_NUMBER' => $application->APP_NUMBER, @@ -591,7 +591,7 @@ class CasesTest extends TestCase 'DEL_THREAD' => 1, 'DEL_THREAD_STATUS' => 'CLOSED' ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'DEL_INDEX' => 2, 'APP_NUMBER' => $application->APP_NUMBER, @@ -602,7 +602,7 @@ class CasesTest extends TestCase 'DEL_THREAD' => 2, 'DEL_THREAD_STATUS' => 'OPEN' ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'DEL_INDEX' => 3, 'APP_NUMBER' => $application->APP_NUMBER, @@ -637,7 +637,7 @@ class CasesTest extends TestCase $this->assertNotEmpty($result); // Asserts the emails of both users are contained in the result - $this->assertRegExp("/{$user->USR_EMAIL}/", $result["to"]); + $this->assertMatchesRegularExpression("/{$user->USR_EMAIL}/", $result["to"]); } /** @@ -648,42 +648,42 @@ class CasesTest extends TestCase */ public function it_shoult_test_the_get_to_method_with_multiple_instance_value_based_tas_assign_type() { - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_ASSIGN_TYPE' => 'BALANCED' ]); - $task2 = factory(Task::class)->create([ + $task2 = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_ASSIGN_TYPE' => 'MULTIPLE_INSTANCE_VALUE_BASED', 'TAS_ASSIGN_VARIABLE' => '@@users' ]); - $user = factory(User::class)->create([ + $user = User::factory()->create([ 'USR_EMAIL' => 'test@test.com' ]); - $user2 = factory(User::class)->create([ + $user2 = User::factory()->create([ 'USR_EMAIL' => 'test2@test2.com' ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task2->TAS_UID, 'USR_UID' => $user->USR_UID ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task2->TAS_UID, 'USR_UID' => $user2->USR_UID ]); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 2, 'PRO_UID' => $process->PRO_UID, 'APP_INIT_USER' => "00000000000000000000000000000001", 'APP_CUR_USER' => $user2->USR_UID ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'DEL_INDEX' => 1, 'APP_NUMBER' => $application->APP_NUMBER, @@ -694,7 +694,7 @@ class CasesTest extends TestCase 'DEL_THREAD' => 1, 'DEL_THREAD_STATUS' => 'CLOSED' ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'DEL_INDEX' => 2, 'APP_NUMBER' => $application->APP_NUMBER, @@ -705,7 +705,7 @@ class CasesTest extends TestCase 'DEL_THREAD' => 2, 'DEL_THREAD_STATUS' => 'OPEN' ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'DEL_INDEX' => 3, 'APP_NUMBER' => $application->APP_NUMBER, @@ -741,6 +741,6 @@ class CasesTest extends TestCase $this->assertNotEmpty($result); // Asserts the emails of both users are contained in the result - $this->assertRegExp("/{$user->USR_EMAIL}/", $result["to"]); + $this->assertMatchesRegularExpression("/{$user->USR_EMAIL}/", $result["to"]); } } diff --git a/tests/unit/workflow/engine/classes/ConfigurationsTest.php b/tests/unit/workflow/engine/classes/ConfigurationsTest.php index 4530a67aa..de33e48c0 100644 --- a/tests/unit/workflow/engine/classes/ConfigurationsTest.php +++ b/tests/unit/workflow/engine/classes/ConfigurationsTest.php @@ -19,7 +19,7 @@ class ConfigurationsTest extends TestCase public function it_should_return_empty_preferences() { //Define a user preferences empty - $configuration = factory(Configuration::class)->states('userPreferencesEmpty')->create(); + $configuration = Configuration::factory()->userPreferencesEmpty()->create(); //Get the user preferences $conf = new Configurations(); diff --git a/tests/unit/workflow/engine/classes/DbConnectionsTest.php b/tests/unit/workflow/engine/classes/DbConnectionsTest.php index 90fab271b..ec97d5c56 100644 --- a/tests/unit/workflow/engine/classes/DbConnectionsTest.php +++ b/tests/unit/workflow/engine/classes/DbConnectionsTest.php @@ -29,10 +29,10 @@ class DbConnectionsTest extends TestCase */ public function it_should_test_loadAdditionalConnections_method() { - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); $dbName = env('DB_DATABASE'); - $dbSource = factory(DbSource::class)->create([ + $dbSource = DbSource::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'DBS_TYPE' => 'mysql', 'DBS_SERVER' => env('DB_HOST'), @@ -60,10 +60,10 @@ class DbConnectionsTest extends TestCase */ public function it_should_test_loadAdditionalConnections_method_with_force_option_true() { - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); $dbName = env('DB_DATABASE'); - $dbSource = factory(DbSource::class)->create([ + $dbSource = DbSource::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'DBS_TYPE' => 'mysql', 'DBS_SERVER' => env('DB_HOST'), @@ -88,10 +88,10 @@ class DbConnectionsTest extends TestCase */ public function it_should_test_loadAdditionalConnections_method_with_force_option_false() { - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); $dbName = env('DB_DATABASE'); - $dbSource = factory(DbSource::class)->create([ + $dbSource = DbSource::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'DBS_TYPE' => 'mysql', 'DBS_SERVER' => env('DB_HOST'), diff --git a/tests/unit/workflow/engine/classes/DerivationTest.php b/tests/unit/workflow/engine/classes/DerivationTest.php index d0684001d..a3235d8d2 100644 --- a/tests/unit/workflow/engine/classes/DerivationTest.php +++ b/tests/unit/workflow/engine/classes/DerivationTest.php @@ -119,23 +119,23 @@ class DerivationTest extends TestCase public function it_should_test_the_do_derivation_method_sending_variables_synchronously() { // Create the models - $user = factory(User::class)->create(); - $process = factory(Process::class)->create([ + $user = User::factory()->create(); + $process = Process::factory()->create([ 'PRO_CREATE_USER' => $user->USR_UID ]); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID, ]); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'APP_INIT_USER' => $user->USR_UID, 'APP_CUR_USER' => $user->USR_UID ]); - $appDelegation = factory(Delegation::class)->create([ + $appDelegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'APP_NUMBER' => $application->APP_NUMBER ]); - factory(SubApplication::class)->create([ + SubApplication::factory()->create([ 'APP_UID' => $application->APP_UID, 'APP_PARENT' => $application->APP_UID, 'DEL_INDEX_PARENT' => $appDelegation->DEL_INDEX @@ -203,35 +203,35 @@ class DerivationTest extends TestCase public function it_should_test_the_do_derivation_method_sending_variables_asynchronously() { // Create the models - $user = factory(User::class)->create(); - $process = factory(Process::class)->create([ + $user = User::factory()->create(); + $process = Process::factory()->create([ 'PRO_CREATE_USER' => $user->USR_UID ]); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_USER' => $user->USR_UID ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID ]); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'APP_INIT_USER' => $user->USR_UID, 'APP_CUR_USER' => $user->USR_UID ]); - $appDelegation = factory(Delegation::class)->create([ + $appDelegation = Delegation::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'APP_UID' => $application->APP_UID, 'APP_NUMBER' => $application->APP_NUMBER ]); - factory(SubApplication::class)->create([ + SubApplication::factory()->create([ 'APP_UID' => $application->APP_UID, 'APP_PARENT' => $application->APP_UID, 'DEL_INDEX_PARENT' => $appDelegation->DEL_INDEX, 'SA_STATUS' => 'FINISHED' ]); - factory(Route::class)->create([ + Route::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'ROU_NEXT_TASK' => $task->TAS_UID, 'PRO_UID' => $process->PRO_UID diff --git a/tests/unit/workflow/engine/classes/PmDynaformTest.php b/tests/unit/workflow/engine/classes/PmDynaformTest.php index d3b79f743..28c6d9bda 100644 --- a/tests/unit/workflow/engine/classes/PmDynaformTest.php +++ b/tests/unit/workflow/engine/classes/PmDynaformTest.php @@ -1,7 +1,6 @@ truncateNonInitialModels(); } /** @@ -48,9 +47,9 @@ class PmDynaformTest extends TestCase { $arrayForm = $this->createArrayDynaform(); - $process = factory(Process::class, 1)->create(); + $process = Process::factory(1)->create(); - $dynaform = factory(Dynaform::class, 1)->create([ + $dynaform = Dynaform::factory(1)->create([ 'DYN_ID' => 6, 'DYN_UID' => $arrayForm['items'][0]['id'], 'PRO_UID' => $process[0]->PRO_UID, @@ -72,9 +71,9 @@ class PmDynaformTest extends TestCase { $arrayForm = $this->createArrayDynaform(); - $process = factory(Process::class, 1)->create(); + $process = Process::factory(1)->create(); - $dynaform = factory(Dynaform::class, 1)->create([ + $dynaform = Dynaform::factory(1)->create([ 'DYN_ID' => 5, 'DYN_UID' => $arrayForm['items'][0]['id'], 'PRO_UID' => $process[0]->PRO_UID, @@ -96,9 +95,9 @@ class PmDynaformTest extends TestCase { $arrayForm = $this->createArrayDynaform(); - $process = factory(Process::class, 1)->create(); + $process = Process::factory(1)->create(); - $dynaform = factory(Dynaform::class, 1)->create([ + $dynaform = Dynaform::factory(1)->create([ 'DYN_ID' => 5, 'DYN_UID' => $arrayForm['items'][0]['id'], 'PRO_UID' => $process[0]->PRO_UID, @@ -120,9 +119,9 @@ class PmDynaformTest extends TestCase { $arrayForm = $this->createArrayDynaform(); - $process = factory(Process::class, 1)->create(); + $process = Process::factory(1)->create(); - $dynaform = factory(Dynaform::class, 1)->create([ + $dynaform = Dynaform::factory(1)->create([ 'DYN_ID' => 5, 'DYN_UID' => $arrayForm['items'][0]['id'], 'PRO_UID' => $process[0]->PRO_UID, @@ -144,9 +143,9 @@ class PmDynaformTest extends TestCase { $arrayForm = $this->createArrayDynaform(); - $process = factory(Process::class, 1)->create(); + $process = Process::factory(1)->create(); - $dynaform = factory(Dynaform::class, 1)->create([ + $dynaform = Dynaform::factory(1)->create([ 'DYN_ID' => 5, 'DYN_UID' => $arrayForm['items'][0]['id'], 'PRO_UID' => $process[0]->PRO_UID, @@ -169,9 +168,9 @@ class PmDynaformTest extends TestCase { $arrayForm = $this->createArrayDynaform(); - $process = factory(Process::class, 1)->create(); + $process = Process::factory(1)->create(); - $dynaform = factory(Dynaform::class, 1)->create([ + $dynaform = Dynaform::factory(1)->create([ 'DYN_ID' => 5, 'DYN_UID' => $arrayForm['items'][0]['id'], 'PRO_UID' => $process[0]->PRO_UID, @@ -194,9 +193,9 @@ class PmDynaformTest extends TestCase { $arrayForm = $this->createArrayDynaform(); - $process = factory(Process::class, 1)->create(); + $process = Process::factory(1)->create(); - $dynaform = factory(Dynaform::class, 1)->create([ + $dynaform = Dynaform::factory(1)->create([ 'DYN_ID' => 4, 'DYN_UID' => $arrayForm['items'][0]['id'], 'PRO_UID' => $process[0]->PRO_UID, @@ -223,9 +222,9 @@ class PmDynaformTest extends TestCase { $arrayForm = $this->createArrayDynaform(); - $process = factory(Process::class, 1)->create(); + $process = Process::factory(1)->create(); - $dynaform = factory(Dynaform::class, 1)->create([ + $dynaform = Dynaform::factory(1)->create([ 'DYN_ID' => 6, 'DYN_UID' => $arrayForm['items'][0]['id'], 'PRO_UID' => $process[0]->PRO_UID, @@ -247,9 +246,9 @@ class PmDynaformTest extends TestCase { $arrayForm = $this->createArrayDynaform(); - $process = factory(Process::class, 1)->create(); + $process = Process::factory(1)->create(); - $dynaform = factory(Dynaform::class, 1)->create([ + $dynaform = Dynaform::factory(1)->create([ 'DYN_ID' => 5, 'DYN_UID' => $arrayForm['items'][0]['id'], 'PRO_UID' => $process[0]->PRO_UID, @@ -271,9 +270,9 @@ class PmDynaformTest extends TestCase { $arrayForm = $this->createArrayDynaform(); - $process = factory(Process::class, 1)->create(); + $process = Process::factory(1)->create(); - $dynaform = factory(Dynaform::class, 1)->create([ + $dynaform = Dynaform::factory(1)->create([ 'DYN_ID' => 3, 'DYN_UID' => $arrayForm['items'][0]['id'], 'PRO_UID' => $process[0]->PRO_UID, @@ -294,10 +293,10 @@ class PmDynaformTest extends TestCase */ public function it_should_return_null_when_not_exist_dynaform() { - $process = factory(Process::class, 1)->create(); + $process = Process::factory(1)->create(); $arrayForm = $this->createArrayDynaform(); - $dynaform = factory(Dynaform::class, 1)->create([ + $dynaform = Dynaform::factory(1)->create([ 'DYN_ID' => 7, 'DYN_UID' => $arrayForm['items'][0]['id'], 'PRO_UID' => $process[0]->PRO_UID, @@ -330,10 +329,10 @@ class PmDynaformTest extends TestCase */ public function it_should_return_array_dynaforms_except_current_dynaform_in_second_execution() { - $process = factory(Process::class, 1)->create(); + $process = Process::factory(1)->create(); $arrayForm = $this->createArrayDynaform(); - $dynaform = factory(Dynaform::class, 1)->create([ + $dynaform = Dynaform::factory(1)->create([ 'DYN_ID' => 7, 'DYN_UID' => $arrayForm['items'][0]['id'], 'PRO_UID' => $process[0]->PRO_UID, @@ -341,7 +340,7 @@ class PmDynaformTest extends TestCase ]); $arrayForm2 = $this->createArrayDynaform(); - $dynaform2 = factory(Dynaform::class, 1)->create([ + $dynaform2 = Dynaform::factory(1)->create([ 'DYN_ID' => 9, 'DYN_UID' => $arrayForm2['items'][0]['id'], 'PRO_UID' => $process[0]->PRO_UID, @@ -364,10 +363,10 @@ class PmDynaformTest extends TestCase */ public function it_should_return_array_dynaforms_except_current_dynaform() { - $process = factory(Process::class, 1)->create(); + $process = Process::factory(1)->create(); $arrayForm = $this->createArrayDynaform(); - $dynaform = factory(Dynaform::class, 1)->create([ + $dynaform = Dynaform::factory(1)->create([ 'DYN_ID' => 7, 'DYN_UID' => $arrayForm['items'][0]['id'], 'PRO_UID' => $process[0]->PRO_UID, @@ -375,7 +374,7 @@ class PmDynaformTest extends TestCase ]); $arrayForm2 = $this->createArrayDynaform(); - $dynaform2 = factory(Dynaform::class, 1)->create([ + $dynaform2 = Dynaform::factory(1)->create([ 'DYN_ID' => 9, 'DYN_UID' => $arrayForm2['items'][0]['id'], 'PRO_UID' => $process[0]->PRO_UID, @@ -416,9 +415,9 @@ class PmDynaformTest extends TestCase { $arrayForm = $this->createArrayDynaform(); - $process = factory(Process::class, 1)->create(); + $process = Process::factory(1)->create(); - $dynaform = factory(Dynaform::class, 1)->create([ + $dynaform = Dynaform::factory(1)->create([ 'DYN_ID' => 1, 'DYN_UID' => $arrayForm['items'][0]['id'], 'PRO_UID' => $process[0]->PRO_UID, @@ -443,9 +442,9 @@ class PmDynaformTest extends TestCase $arrayForm = $this->createArrayDynaform(); - $process = factory(Process::class, 1)->create(); + $process = Process::factory(1)->create(); - $dynaform = factory(Dynaform::class, 1)->create([ + $dynaform = Dynaform::factory(1)->create([ 'DYN_ID' => 2, 'PRO_UID' => $process[0]->PRO_UID, 'DYN_CONTENT' => G::json_encode($arrayForm) @@ -831,7 +830,7 @@ class PmDynaformTest extends TestCase { // Create a form without translations defined $arrayForm = $this->createArrayDynaform(); - $form = factory(Dynaform::class)->create([ + $form = Dynaform::factory()->create([ 'DYN_UID' => $arrayForm['items'][0]['id'], 'DYN_CONTENT' => G::json_encode($arrayForm) ]); @@ -841,7 +840,7 @@ class PmDynaformTest extends TestCase // Create a form with translations defined $arrayForm = $this->createArrayDynaform(); - $form = factory(Dynaform::class)->states('translations')->create([ + $form = Dynaform::factory()->translations()->create([ 'DYN_UID' => $arrayForm['items'][0]['id'], 'DYN_CONTENT' => G::json_encode($arrayForm) ]); @@ -861,7 +860,7 @@ class PmDynaformTest extends TestCase { $arrayForm = $this->createArrayDynaform(); // Create a translations related to ["es", "es-Es"] - $form = factory(Dynaform::class)->states('translations')->create([ + $form = Dynaform::factory()->translations()->create([ 'DYN_UID' => $arrayForm['items'][0]['id'], 'DYN_CONTENT' => G::json_encode($arrayForm) ]); @@ -963,7 +962,7 @@ class PmDynaformTest extends TestCase public function it_should_get_dynaform_title() { // Create a Dynaform - $dynaform = factory(Dynaform::class)->create([]); + $dynaform = Dynaform::factory()->create([]); // Instance the class to test $pmDynaform = new PmDynaform(); @@ -1082,10 +1081,10 @@ class PmDynaformTest extends TestCase $data2 = file_get_contents($pathData2); $json2 = json_decode($data2); - $dynaform = factory(Dynaform::class)->create([ + $dynaform = Dynaform::factory()->create([ 'DYN_CONTENT' => $data ]); - factory(Dynaform::class)->create([ + Dynaform::factory()->create([ 'DYN_CONTENT' => $data, 'PRO_UID' => $dynaform->PRO_UID ]); @@ -1160,10 +1159,10 @@ class PmDynaformTest extends TestCase $data2 = file_get_contents($pathData2); $json2 = json_decode($data2); - $dynaform = factory(Dynaform::class)->create([ + $dynaform = Dynaform::factory()->create([ 'DYN_CONTENT' => $data ]); - factory(Dynaform::class)->create([ + Dynaform::factory()->create([ 'DYN_CONTENT' => $data, 'PRO_UID' => $dynaform->PRO_UID ]); diff --git a/tests/unit/workflow/engine/classes/PmFunctions/ExecuteQueryTest.php b/tests/unit/workflow/engine/classes/PmFunctions/ExecuteQueryTest.php index 736508b0f..166600175 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/ExecuteQueryTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/ExecuteQueryTest.php @@ -4,7 +4,6 @@ namespace Tests\unit\workflow\engine\classes\PmFunctions; use Faker\Factory; use G; -use Illuminate\Foundation\Testing\DatabaseTransactions; use ProcessMaker\Model\DbSource; use ProcessMaker\Model\ProcessCategory; use ProcessMaker\Model\User; @@ -25,7 +24,7 @@ class ExecuteQueryTest extends TestCase public function setUp(): void { parent::setUp(); - ProcessCategory::truncate(); + $this->truncateNonInitialModels(); $this->oldContentSystemTables = ""; $path = PATH_CONFIG . $this->nameSystemTables; if (file_exists($path)) { @@ -47,7 +46,7 @@ class ExecuteQueryTest extends TestCase */ public function it_must_return_the_result_of_execute_query_method() { - $user = factory(User::class, 5)->create(); + $user = User::factory(5)->create(); $user = $user->sortByDesc('USR_UID')->values()->map(function($item) { $result = [ @@ -139,7 +138,7 @@ class ExecuteQueryTest extends TestCase $id = $faker->unique()->numberBetween(1, 10000000); $newName = str_replace("'", " ", $faker->name); - $category = factory(ProcessCategory::class)->create([ + $category = ProcessCategory::factory()->create([ 'CATEGORY_ID' => $id ]); $expected = $category->toArray(); @@ -176,7 +175,7 @@ class ExecuteQueryTest extends TestCase $id = $faker->unique()->numberBetween(1, 10000000); $newName = str_replace("'", " ", $faker->name); - $category = factory(ProcessCategory::class)->create([ + $category = ProcessCategory::factory()->create([ 'CATEGORY_ID' => $id ]); $expected = $category->toArray(); @@ -205,7 +204,7 @@ class ExecuteQueryTest extends TestCase { $this->expectException(SQLException::class); $database = env('DB_DATABASE'); - $category = factory(ProcessCategory::class)->create(); + $category = ProcessCategory::factory()->create(); $sql = "" . "DELETE FROM {$database}.PROCESS_CATEGORY " @@ -228,7 +227,7 @@ class ExecuteQueryTest extends TestCase public function this_connects_to_an_external_database_using_the_execute_query_method() { $dbName = env('DB_DATABASE'); - $dbSource = factory(DbSource::class)->create([ + $dbSource = DbSource::factory()->create([ 'DBS_TYPE' => 'mysql', 'DBS_SERVER' => env('DB_HOST'), 'DBS_DATABASE_NAME' => $dbName, @@ -253,10 +252,10 @@ class ExecuteQueryTest extends TestCase */ public function this_connects_to_an_external_oracle_database_using_the_execute_query_method() { - $this->markTestIncomplete('This test has not been implemented yet.'); + $this->markTestSkipped('This test has not been implemented yet.'); $dbName = "XE"; - $dbSource = factory(DbSource::class)->create([ + $dbSource = DbSource::factory()->create([ 'DBS_TYPE' => 'oracle', 'DBS_CONNECTION_TYPE' => 'NORMAL', 'DBS_SERVER' => 'localhost', @@ -322,7 +321,7 @@ class ExecuteQueryTest extends TestCase $id = $faker->unique()->numberBetween(1, 10000000); $newName = str_replace("'", " ", $faker->name); - $category = factory(ProcessCategory::class)->create([ + $category = ProcessCategory::factory()->create([ 'CATEGORY_ID' => $id ]); $expected = $category->toArray(); diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFAddCaseNoteTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFAddCaseNoteTest.php index 7a030d362..8be936730 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFAddCaseNoteTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFAddCaseNoteTest.php @@ -23,7 +23,7 @@ class PMFAddCaseNoteTest extends TestCase public function it_add_case_notes() { // Create notes - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); // Force commit for propel DB::commit(); $result = PMFAddCaseNote($table->APP_UID, $table->PRO_UID, $table->TAS_UID, $table->USR_UID, 'note'); diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFAssignUserToGroupTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFAssignUserToGroupTest.php index 4a50e0ec5..124ad70bc 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFAssignUserToGroupTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFAssignUserToGroupTest.php @@ -26,15 +26,15 @@ class PMFAssignUserToGroupTest extends TestCase { // Create user global $RBAC; - $user = factory(User::class)->create(); - factory(RbacUsers::class)->create([ + $user = User::factory()->create(); + RbacUsers::factory()->create([ 'USR_UID' => $user->USR_UID, 'USR_USERNAME' => $user->USR_USERNAME, 'USR_FIRSTNAME' => $user->USR_FIRSTNAME, 'USR_LASTNAME' => $user->USR_LASTNAME ]); // Create group - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); DB::commit(); $result = PMFAssignUserToGroup($user->USR_UID, $group->GRP_UID); $this->assertNotEmpty($result); diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFCaseInformationTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFCaseInformationTest.php index 22335b89d..15fec1072 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFCaseInformationTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFCaseInformationTest.php @@ -1,6 +1,6 @@ states('foreign_keys')->create(); + $table = Application::factory()->foreign_keys()->create(); // Force commit for propel DB::commit(); // Call the funtion @@ -74,8 +74,8 @@ class PMFCaseInformation extends TestCase */ public function it_should_test_this_pmfunction_index_parameter() { - $application = factory(Application::class)->states('todo')->create(); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->todo()->create(); + $table = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); @@ -104,8 +104,8 @@ class PMFCaseInformation extends TestCase */ public function it_should_test_this_pmfunction_app_data_parameter() { - $application = factory(Application::class)->states('todo')->create(); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->todo()->create(); + $table = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFCaseListTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFCaseListTest.php index 623592931..195e4603c 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFCaseListTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFCaseListTest.php @@ -24,8 +24,8 @@ class PMFCaseListTest extends TestCase public function it_return_list_of_cases() { // Create delegation - $table = factory(Delegation::class)->states('foreign_keys')->create(); - factory(AppThread::class)->create([ + $table = Delegation::factory()->foreign_keys()->create(); + AppThread::factory()->create([ 'APP_THREAD_STATUS' => 'OPEN', 'APP_UID' => $table->APP_UID ]); diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFCreateUserTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFCreateUserTest.php index 543a5f5ca..9a24f41e0 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFCreateUserTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFCreateUserTest.php @@ -25,8 +25,8 @@ class PMFCreateUserTest extends TestCase public function it_create_user() { // Create User - $user = factory(User::class)->create(); - factory(RbacUsers::class)->create([ + $user = User::factory()->create(); + RbacUsers::factory()->create([ 'USR_UID' => $user->USR_UID, 'USR_USERNAME' => $user->USR_USERNAME, 'USR_FIRSTNAME' => $user->USR_FIRSTNAME, diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFDeleteCaseTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFDeleteCaseTest.php index ac923c6d8..726898118 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFDeleteCaseTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFDeleteCaseTest.php @@ -25,8 +25,8 @@ class PMFDeleteCaseTest extends TestCase public function it_should_test_this_pmfunction_default_parameters() { $this->expectException(Exception::class); - $table = factory(Delegation::class)->states('foreign_keys')->create(); - factory(Triggers::class)->create([ + $table = Delegation::factory()->foreign_keys()->create(); + Triggers::factory()->create([ 'PRO_UID' => $table->PRO_UID ]); // Force commit for propel diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFGetCaseNotesTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFGetCaseNotesTest.php index 8356e14ca..59a925a84 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFGetCaseNotesTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFGetCaseNotesTest.php @@ -24,8 +24,8 @@ class PMFGetCaseNotesTest extends TestCase public function it_get_case_notes() { // Create notes - $user = factory(User::class)->create(); - $table = factory(AppNotes::class)->create([ + $user = User::factory()->create(); + $table = AppNotes::factory()->create([ 'USR_UID' => $user->USR_UID ]); // Force commit for propel diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFGetGroupNameTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFGetGroupNameTest.php index 02b8edf89..8c291e009 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFGetGroupNameTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFGetGroupNameTest.php @@ -23,7 +23,7 @@ class PMFGetGroupNameTest extends TestCase public function it_get_group_name() { // Create group - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); DB::commit(); $result = PMFGetGroupName($group->GRP_TITLE, 'en'); $this->assertFalse($result); diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFGetGroupUIDTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFGetGroupUIDTest.php index b734415fd..89ceae571 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFGetGroupUIDTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFGetGroupUIDTest.php @@ -22,7 +22,7 @@ class PMFGetGroupUIDTest extends TestCase public function it_group_uid() { // Create group - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); $result = PMFGetGroupUID($group->GRP_UID); $this->assertFalse($result); } diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFGetGroupUsersTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFGetGroupUsersTest.php index 7158be644..410d5bc88 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFGetGroupUsersTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFGetGroupUsersTest.php @@ -23,7 +23,7 @@ class PMFGetGroupUsersTest extends TestCase public function it_return_list_of_groups() { // Create group - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); DB::commit(); $result = PMFGetGroupUsers($group->GRP_UID); $this->assertEmpty($result); diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFGetProcessUidByNameTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFGetProcessUidByNameTest.php index 3bf26bcdd..e32d67d3b 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFGetProcessUidByNameTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFGetProcessUidByNameTest.php @@ -23,7 +23,7 @@ class PMFGetProcessUidByNameTest extends TestCase public function it_return_process() { // Create process - $table = factory(Process::class)->create(); + $table = Process::factory()->create(); DB::commit(); $result = PMFGetProcessUidByName($table->PRO_TITLE); $this->assertNotEmpty($result); diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFGetTaskNameTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFGetTaskNameTest.php index 298b91d4d..fb942b7e9 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFGetTaskNameTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFGetTaskNameTest.php @@ -23,7 +23,7 @@ class PMFGetTaskNameTest extends TestCase public function it_return_task_name() { // Create task - $task = factory(Task::class)->create(); + $task = Task::factory()->create(); DB::commit(); $result = PMFGetTaskName($task->TAS_UID); $this->assertNotEmpty($result); diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFGetTaskUIDTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFGetTaskUIDTest.php index e1db6e911..2519d10e8 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFGetTaskUIDTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFGetTaskUIDTest.php @@ -23,7 +23,7 @@ class PMFGetTaskUIDTest extends TestCase public function it_return_task_uid() { // Create task - $table = factory(Task::class)->states('foreign_keys')->create(); + $table = Task::factory()->foreign_keys()->create(); DB::commit(); $result = PMFGetTaskUID($table->TAS_TITLE); $this->assertFalse($result); diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFGetUserEmailAddressTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFGetUserEmailAddressTest.php index 4750e1108..490a9e44c 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFGetUserEmailAddressTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFGetUserEmailAddressTest.php @@ -22,7 +22,7 @@ class PMFGetUserEmailAddressTest extends TestCase { // Create User global $RBAC; - $user = factory(User::class)->create(); + $user = User::factory()->create(); DB::commit(); $result = PMFGetUserEmailAddress([$user->USR_UID], null); $this->assertNotEmpty($result); diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFGroupListTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFGroupListTest.php index 29ee9143c..566e4fdac 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFGroupListTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFGroupListTest.php @@ -23,7 +23,7 @@ class PMFGroupListTest extends TestCase public function it_return_list_of_groups() { // Create group - factory(Groupwf::class)->create(); + Groupwf::factory()->create(); DB::commit(); $result = PMFGroupList(); $this->assertNotEmpty($result); diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFInformationUserTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFInformationUserTest.php index 51606e76a..55e0442ee 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFInformationUserTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFInformationUserTest.php @@ -24,7 +24,7 @@ class PMFInformationUserTest extends TestCase { // Create User global $RBAC; - $user = factory(User::class)->create(); + $user = User::factory()->create(); DB::commit(); $result = PMFInformationUser($user->USR_UID); $this->assertNotEmpty($result); diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFNewCaseImpersonateTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFNewCaseImpersonateTest.php index 8766b32a8..dcd2c8485 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFNewCaseImpersonateTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFNewCaseImpersonateTest.php @@ -1,6 +1,6 @@ states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); // Force commit for propel DB::commit(); $result = PMFNewCaseImpersonate($table->PRO_UID, $table->USR_UID, [], ''); diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFNewCaseTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFNewCaseTest.php index 76aafbfbf..b562950d6 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFNewCaseTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFNewCaseTest.php @@ -1,6 +1,6 @@ states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); // Force commit for propel DB::commit(); $result = PMFNewCase($table->PRO_UID, $table->USR_UID, $table->TAS_UID, [], null); diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFNewUserTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFNewUserTest.php index d74a509c6..09ddfc7d4 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFNewUserTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFNewUserTest.php @@ -2,8 +2,6 @@ namespace Tests\unit\workflow\engine\classes\PmFunctions; -use Illuminate\Foundation\Testing\DatabaseTransactions; -use Illuminate\Support\Facades\DB; use ProcessMaker\Model\GroupUser; use ProcessMaker\Model\Groupwf; use ProcessMaker\Model\RbacUsers; @@ -56,7 +54,7 @@ class PMFNewUserTest extends TestCase $RBAC->initRBAC(); $RBAC->loadUserRolePermission('PROCESSMAKER', $_SESSION['USER_LOGGED']); - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); // Active $result = PMFNewUser("test", "Test123*", "test", "test", "test@test.com", "PROCESSMAKER_ADMIN", null, null, $group['GRP_UID']); diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFProcessListTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFProcessListTest.php index b15b437f8..0b2ab5e01 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFProcessListTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFProcessListTest.php @@ -22,7 +22,7 @@ class PMFProcessListTest extends TestCase public function it_return_list_of_process() { // Create delegation - factory(Process::class)->create(); + Process::factory()->create(); $result = PMFProcessList(); $this->assertNotEmpty($result); } diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFRemoveUsersFromGroupTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFRemoveUsersFromGroupTest.php index 5f84140a9..1a25dd16b 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFRemoveUsersFromGroupTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFRemoveUsersFromGroupTest.php @@ -25,9 +25,9 @@ class PMFRemoveUsersFromGroupTest extends TestCase public function it_remove_user_group() { // Create group - $user = factory(User::class)->create(); - $group = factory(Groupwf::class)->create(); - $groupUser = factory(GroupUser::class)->create([ + $user = User::factory()->create(); + $group = Groupwf::factory()->create(); + $groupUser = GroupUser::factory()->create([ 'GRP_UID' => $group->GRP_UID, 'GRP_ID' => $group->GRP_ID, 'USR_UID' =>$user->USR_UID diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFRemoveUsersToGroupTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFRemoveUsersToGroupTest.php index 3c35b59f7..4c34ce18d 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFRemoveUsersToGroupTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFRemoveUsersToGroupTest.php @@ -25,9 +25,9 @@ class PMFRemoveUsersToGroupTest extends TestCase public function it_remove_user_group() { // Create group - $user = factory(User::class)->create(); - $group = factory(Groupwf::class)->create(); - $groupUser = factory(GroupUser::class)->create([ + $user = User::factory()->create(); + $group = Groupwf::factory()->create(); + $groupUser = GroupUser::factory()->create([ 'GRP_UID' => $group->GRP_UID, 'GRP_ID' => $group->GRP_ID, 'USR_UID' =>$user->USR_UID diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFRoleListTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFRoleListTest.php index 89d18e9ef..1dd44a461 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFRoleListTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFRoleListTest.php @@ -24,7 +24,7 @@ class PMFRoleListTest extends TestCase { // Create roles global $RBAC; - factory(RbacRoles::class)->create(); + RbacRoles::factory()->create(); DB::commit(); $result = PMFRoleList(); $this->assertNotEmpty($result); diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFSendMessageTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFSendMessageTest.php index 276366f6d..37bfc6b14 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFSendMessageTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFSendMessageTest.php @@ -39,7 +39,7 @@ class PMFSendMessageTest extends TestCase mkdir(PATH_DATA_SITE . 'mailTemplates' . PATH_SEP . $proUid); } file_put_contents(PATH_DATA_SITE . 'mailTemplates' . PATH_SEP . $proUid . PATH_SEP . 'template.html', $data); - $template = factory(\ProcessMaker\Model\ProcessFiles::class)->create([ + $template = \ProcessMaker\Model\ProcessFiles::factory()->create([ 'PRO_UID' => $proUid, 'USR_UID' => $usrUid, 'PRF_PATH' => 'template.html' @@ -56,7 +56,7 @@ class PMFSendMessageTest extends TestCase { $passwordEnv = env('emailAccountPassword'); $password = G::encrypt("hash:" . $passwordEnv, 'EMAILENCRYPT'); - $emailServer = factory(EmailServerModel::class)->create([ + $emailServer = EmailServerModel::factory()->create([ 'MESS_ENGINE' => env('emailEngine'), 'MESS_SERVER' => env('emailServer'), 'MESS_PORT' => env('emailPort'), @@ -82,11 +82,11 @@ class PMFSendMessageTest extends TestCase */ public function it_send_message_related_to_same_case() { - $user = factory(User::class)->create(); - $process = factory(Process::class)->create([ + $user = User::factory()->create(); + $process = Process::factory()->create([ 'PRO_CREATE_USER' => $user->USR_UID ]); - $app = factory(Application::class)->create([ + $app = Application::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'APP_INIT_USER' => $user->USR_UID, 'APP_CUR_USER' => $user->USR_UID @@ -111,10 +111,10 @@ class PMFSendMessageTest extends TestCase */ public function it_send_message_related_to_different_case() { - $user = factory(User::class)->create(); - $process = factory(Process::class)->create(); - $app = factory(Application::class)->create(['PRO_UID' => $process->PRO_UID]); - $app2 = factory(Application::class)->create(['PRO_UID' => $process->PRO_UID]); + $user = User::factory()->create(); + $process = Process::factory()->create(); + $app = Application::factory()->create(['PRO_UID' => $process->PRO_UID]); + $app2 = Application::factory()->create(['PRO_UID' => $process->PRO_UID]); $template = $this->createTemplate($process->PRO_UID, $user->USR_UID); $emailServer = $this->createEmailServer(); // Set different case in session diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFTaskCaseTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFTaskCaseTest.php index dd0f4e639..e1e026d8a 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFTaskCaseTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFTaskCaseTest.php @@ -23,8 +23,8 @@ class PMFTaskCaseTest extends TestCase */ public function it_return_pending_tasks() { - $task = factory(Task::class)->create(); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $task = Task::factory()->create(); + $table = Delegation::factory()->foreign_keys()->create([ 'TAS_ID' => $task->TAS_ID, 'TAS_UID' => $task->TAS_UID ]); diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFTaskListTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFTaskListTest.php index a06d5728f..4a73dfbc9 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFTaskListTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFTaskListTest.php @@ -25,11 +25,11 @@ class PMFTaskListTest extends TestCase public function it_return_pending_tasks() { // Create task - $task = factory(Task::class)->create(); + $task = Task::factory()->create(); // Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); // Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, //Related to the user diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFTasksListByProcessIdTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFTasksListByProcessIdTest.php index 81867df76..590011bb7 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFTasksListByProcessIdTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFTasksListByProcessIdTest.php @@ -23,7 +23,7 @@ class PMFTasksListByProcessIdTest extends TestCase public function it_return_process_tasks() { // Create task - $task = factory(Task::class)->create(); + $task = Task::factory()->create(); DB::commit(); $result = PMFTasksListByProcessId($task->PRO_UID); $this->assertNotEmpty($result); diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFUnpauseCaseTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFUnpauseCaseTest.php index 5decfe3de..01f496de6 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFUnpauseCaseTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFUnpauseCaseTest.php @@ -25,7 +25,7 @@ class PMFUnpauseCaseTest extends TestCase public function it_should_test_this_pmfunction_default_parameters() { $this->expectException(Exception::class); - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); // Force commit for propel DB::commit(); $result = PMFUnpauseCase($table->APP_UID, $table->DEL_INDEX, $table->USR_UID); diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFUpdateUserTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFUpdateUserTest.php index 284621bfc..a26177ecf 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFUpdateUserTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFUpdateUserTest.php @@ -24,7 +24,7 @@ class PMFUpdateUserTest extends TestCase { // Create User global $RBAC; - $user = factory(User::class)->create(); + $user = User::factory()->create(); DB::commit(); $result = PMFUpdateUser($user->USR_UID, $user->USR_USERNAME, 'John A.'); $this->assertEquals(0, $result); diff --git a/tests/unit/workflow/engine/classes/PmFunctions/PMFUserListTest.php b/tests/unit/workflow/engine/classes/PmFunctions/PMFUserListTest.php index 6f91b52e4..bf2921fef 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/PMFUserListTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/PMFUserListTest.php @@ -22,7 +22,7 @@ class PMFUserListTest extends TestCase public function it_return_list_of_users() { // Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); $result = PMFUserList(); $this->assertNotEmpty($result); } diff --git a/tests/unit/workflow/engine/classes/PmFunctions/UserInfoTest.php b/tests/unit/workflow/engine/classes/PmFunctions/UserInfoTest.php index d95f74e1d..61f96f827 100644 --- a/tests/unit/workflow/engine/classes/PmFunctions/UserInfoTest.php +++ b/tests/unit/workflow/engine/classes/PmFunctions/UserInfoTest.php @@ -22,7 +22,7 @@ class UserInfoTest extends TestCase { // Create User global $RBAC; - $user = factory(User::class)->create(); + $user = User::factory()->create(); DB::commit(); $result = userInfo($user->USR_UID); $this->assertNotEmpty($result); diff --git a/tests/unit/workflow/engine/classes/PmTableTest.php b/tests/unit/workflow/engine/classes/PmTableTest.php index 7de49c917..82c8812c5 100644 --- a/tests/unit/workflow/engine/classes/PmTableTest.php +++ b/tests/unit/workflow/engine/classes/PmTableTest.php @@ -2,7 +2,7 @@ use Tests\TestCase; -class PmTablesTest extends TestCase +class PmTableTest extends TestCase { /** * Check if the "removePmtPropelFolder" is working correctly diff --git a/tests/unit/workflow/engine/classes/ProcessesTest.php b/tests/unit/workflow/engine/classes/ProcessesTest.php index ac58f6dc4..373f2475a 100644 --- a/tests/unit/workflow/engine/classes/ProcessesTest.php +++ b/tests/unit/workflow/engine/classes/ProcessesTest.php @@ -48,10 +48,10 @@ class ProcessesTest extends TestCase */ public function it_should_return_dynaforms() { - $process = factory(Process::class)->create()->first(); + $process = Process::factory()->create()->first(); $proUid = $process->PRO_UID; - $dynaforms = factory(Dynaform::class, 6) + $dynaforms = Dynaform::factory(6) ->create([ 'PRO_UID' => $proUid ]) @@ -100,10 +100,10 @@ class ProcessesTest extends TestCase */ public function it_should_return_input_documents() { - $process = factory(Process::class)->create()->first(); + $process = Process::factory()->create()->first(); $proUid = $process->PRO_UID; - $inputDocument = factory(InputDocument::class, 6) + $inputDocument = InputDocument::factory(6) ->create([ 'PRO_UID' => $proUid ]) @@ -152,10 +152,10 @@ class ProcessesTest extends TestCase */ public function it_should_return_output_documents() { - $process = factory(Process::class)->create()->first(); + $process = Process::factory()->create()->first(); $proUid = $process->PRO_UID; - $outputDocument = factory(OutputDocument::class, 6) + $outputDocument = OutputDocument::factory(6) ->create([ 'PRO_UID' => $proUid ]) @@ -434,7 +434,7 @@ class ProcessesTest extends TestCase */ public function it_should_get_workflow_data() { - $process = factory(\ProcessMaker\Model\Process::class)->create(); + $process = \ProcessMaker\Model\Process::factory()->create(); $processes = new Processes(); $result = $processes->getWorkflowData($process->PRO_UID); $this->assertNotNull($result); @@ -484,7 +484,7 @@ class ProcessesTest extends TestCase */ public function it_create_variables_from_import_old() { - $process = factory(\ProcessMaker\Model\Process::class)->create(); + $process = \ProcessMaker\Model\Process::factory()->create(); $attributes[] = [ 'VAR_UID' => G::generateUniqueID(), 'PRJ_UID' => $process->PRO_UID, @@ -517,7 +517,7 @@ class ProcessesTest extends TestCase */ public function it_create_variables_from_import_new() { - $process = factory(\ProcessMaker\Model\Process::class)->create(); + $process = \ProcessMaker\Model\Process::factory()->create(); $attributes[] = [ 'VAR_UID' => G::generateUniqueID(), 'PRJ_UID' => $process->PRO_UID, diff --git a/tests/unit/workflow/engine/classes/ReportTablesTest.php b/tests/unit/workflow/engine/classes/ReportTablesTest.php index 99275efdc..db66b370e 100644 --- a/tests/unit/workflow/engine/classes/ReportTablesTest.php +++ b/tests/unit/workflow/engine/classes/ReportTablesTest.php @@ -1,6 +1,5 @@ create([ + $user = User::factory()->create([ 'USR_UID' => $userUid ]); - $process = factory(Process::class)->create([ + $process = Process::factory()->create([ 'PRO_UID' => $processUid ]); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'APP_UID' => $applicationUid, 'APP_NUMBER' => $applicationNumber, @@ -825,7 +822,7 @@ class ReportTablesTest extends TestCase $grid = 'var_Grid1'; //assert exception - $this->expectException(Exception::class); + $this->expectException(TypeError::class); $reportTables = new ReportTables(); $reportTables->populateTable($tableName, $connectionShortName, $type, null, $proUid, $grid); diff --git a/tests/unit/workflow/engine/classes/SpoolRunTest.php b/tests/unit/workflow/engine/classes/SpoolRunTest.php index 942a7054c..4d472f970 100644 --- a/tests/unit/workflow/engine/classes/SpoolRunTest.php +++ b/tests/unit/workflow/engine/classes/SpoolRunTest.php @@ -83,11 +83,11 @@ class SpoolRunTest extends TestCase public function it_should_handle_gmail_oauth_option() { $appMsgUid = G::generateUniqueID(); - factory(AppMessage::class)->create([ + AppMessage::factory()->create([ 'APP_MSG_UID' => $appMsgUid ]); - $emailServer = factory(EmailServerModel::class)->states('GMAILAPI')->make(); + $emailServer = EmailServerModel::factory()->GMAILAPI()->make(); $config = $emailServer->toArray(); $config['SMTPSecure'] = 'ssl'; @@ -124,14 +124,14 @@ class SpoolRunTest extends TestCase { $string = ini_get("sendmail_path"); if (!is_executable($string)) { - $this->markTestIncomplete($string . " not found"); + $this->markTestSkipped($string . " not found"); } $appMsgUid = G::generateUniqueID(); - factory(AppMessage::class)->create([ + AppMessage::factory()->create([ 'APP_MSG_UID' => $appMsgUid ]); - $emailServer = factory(EmailServerModel::class)->create(); + $emailServer = EmailServerModel::factory()->create(); $config = $emailServer->toArray(); @@ -166,11 +166,11 @@ class SpoolRunTest extends TestCase public function it_should_handle_php_mailer_option() { $appMsgUid = G::generateUniqueID(); - factory(AppMessage::class)->create([ + AppMessage::factory()->create([ 'APP_MSG_UID' => $appMsgUid ]); - $emailServer = factory(EmailServerModel::class)->states('PHPMAILER')->make(); + $emailServer = EmailServerModel::factory()->PHPMAILER()->make(); $config = $emailServer->toArray(); $config['SMTPSecure'] = 'ssl'; @@ -207,11 +207,11 @@ class SpoolRunTest extends TestCase public function it_should_handle_utf8_characters() { $appMsgUid = G::generateUniqueID(); - factory(AppMessage::class)->create([ + AppMessage::factory()->create([ 'APP_MSG_UID' => $appMsgUid ]); - $emailServer = factory(EmailServerModel::class)->states('PHPMAILER')->make(); + $emailServer = EmailServerModel::factory()->PHPMAILER()->make(); $config = $emailServer->toArray(); $config['SMTPSecure'] = 'ssl'; @@ -250,11 +250,11 @@ class SpoolRunTest extends TestCase public function it_should_handle_attachment_files() { $appMsgUid = G::generateUniqueID(); - factory(AppMessage::class)->create([ + AppMessage::factory()->create([ 'APP_MSG_UID' => $appMsgUid ]); - $emailServer = factory(EmailServerModel::class)->states('PHPMAILER')->make(); + $emailServer = EmailServerModel::factory()->PHPMAILER()->make(); $config = $emailServer->toArray(); $config['SMTPSecure'] = 'ssl'; @@ -303,11 +303,11 @@ class SpoolRunTest extends TestCase public function it_should_handle_envelope_to() { $appMsgUid = G::generateUniqueID(); - factory(AppMessage::class)->create([ + AppMessage::factory()->create([ 'APP_MSG_UID' => $appMsgUid ]); - $emailServer = factory(EmailServerModel::class)->states('PHPMAILER')->make(); + $emailServer = EmailServerModel::factory()->PHPMAILER()->make(); $config = $emailServer->toArray(); $config['SMTPSecure'] = 'ssl'; @@ -345,11 +345,11 @@ class SpoolRunTest extends TestCase public function it_should_test_updateSpoolStatus_method() { $appMsgUid = G::generateUniqueID(); - factory(AppMessage::class)->create([ + AppMessage::factory()->create([ 'APP_MSG_UID' => $appMsgUid ]); - $emailServer = factory(EmailServerModel::class)->states('PHPMAILER')->make(); + $emailServer = EmailServerModel::factory()->PHPMAILER()->make(); $config = $emailServer->toArray(); $config['SMTPSecure'] = 'ssl'; diff --git a/tests/unit/workflow/engine/classes/WorkflowToolsTest.php b/tests/unit/workflow/engine/classes/WorkflowToolsTest.php index 9d03a4c51..617fb9015 100644 --- a/tests/unit/workflow/engine/classes/WorkflowToolsTest.php +++ b/tests/unit/workflow/engine/classes/WorkflowToolsTest.php @@ -34,8 +34,7 @@ class WorkflowToolsTest extends TestCase public function it_should_test_addAsyncOptionToSchedulerCommands_method() { //method "WorkspaceTools::initPropel(true)" crashes all connections - $message = "WorkspaceTools::initPropel(true) crashes all connections"; - $this->markTestIncomplete($message); + $this->markTestSkipped("WorkspaceTools::initPropel(true) crashes all connections"); ob_start(); $this->workspaceTools->addAsyncOptionToSchedulerCommands(false); diff --git a/tests/unit/workflow/engine/classes/WorkspaceToolsTest.php b/tests/unit/workflow/engine/classes/WorkspaceToolsTest.php index 0b1d9d75a..58450cffb 100644 --- a/tests/unit/workflow/engine/classes/WorkspaceToolsTest.php +++ b/tests/unit/workflow/engine/classes/WorkspaceToolsTest.php @@ -6,6 +6,16 @@ use Tests\TestCase; class WorkspaceToolsTest extends TestCase { + /** + * Set up method. + * @return void + */ + public function setUp(): void + { + parent::setUp(); + $this->truncateNonInitialModels(); + } + /** * Tests the migrateCaseTitleToThreads method * @@ -14,63 +24,89 @@ class WorkspaceToolsTest extends TestCase */ public function it_should_test_migrate_case_title_to_threads_method() { - $application1 = factory(Application::class)->create([ + $application1 = Application::factory()->create([ 'APP_STATUS' => 'TO_DO', 'APP_STATUS_ID' => 2, ]); - $application2 = factory(Application::class)->create([ + $application2 = Application::factory()->create([ 'APP_STATUS' => 'COMPLETED', 'APP_STATUS_ID' => 3, ]); - $application3 = factory(Application::class)->create([ + $application3 = Application::factory()->create([ 'APP_STATUS' => 'CANCELED', 'APP_STATUS_ID' => 4, ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application1->APP_UID, 'APP_NUMBER' => $application1->APP_NUMBER, 'DEL_INDEX' => 1 ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application1->APP_UID, 'APP_NUMBER' => $application1->APP_NUMBER, 'DEL_INDEX' => 2 ]); - $delegation1 = factory(Delegation::class)->create([ + $delegation1 = Delegation::factory()->create([ 'APP_UID' => $application1->APP_UID, 'APP_NUMBER' => $application1->APP_NUMBER, 'DEL_INDEX' => 3, ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application2->APP_UID, 'APP_NUMBER' => $application2->APP_NUMBER, 'DEL_INDEX' => 1 ]); - $delegation2 = factory(Delegation::class)->create([ + $delegation2 = Delegation::factory()->create([ 'APP_UID' => $application2->APP_UID, 'APP_NUMBER' => $application2->APP_NUMBER, 'DEL_INDEX' => 2, 'DEL_LAST_INDEX' => 1 ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application3->APP_UID, 'APP_NUMBER' => $application3->APP_NUMBER, 'DEL_INDEX' => 1 ]); - $delegation3 = factory(Delegation::class)->create([ + $delegation3 = Delegation::factory()->create([ 'APP_UID' => $application3->APP_UID, 'APP_NUMBER' => $application3->APP_NUMBER, 'DEL_INDEX' => 2, 'DEL_LAST_INDEX' => 1 ]); + if (!defined('DB_RBAC_USER')) { + define('DB_RBAC_USER', DB_USER); + } + if (!defined('DB_RBAC_PASS')) { + define('DB_RBAC_PASS', DB_PASS); + } + if (!defined('DB_RBAC_HOST')) { + define('DB_RBAC_HOST', DB_HOST); + } + if (!defined('DB_RBAC_NAME')) { + define('DB_RBAC_NAME', DB_NAME); + } + if (!defined('DB_REPORT_USER')) { + define('DB_REPORT_USER', DB_USER); + } + if (!defined('DB_REPORT_PASS')) { + define('DB_REPORT_PASS', DB_PASS); + } + if (!defined('DB_REPORT_HOST')) { + define('DB_REPORT_HOST', DB_HOST); + } + if (!defined('DB_REPORT_NAME')) { + define('DB_REPORT_NAME', DB_NAME); + } + ob_start(); $workspaceTools = new WorkspaceTools(''); $workspaceTools->migrateCaseTitleToThreads(['testexternal']); $result = ob_get_contents(); - $this->assertRegExp("/The Case Title has been updated successfully in APP_DELEGATION table./", $result); + ob_end_clean(); + $this->assertMatchesRegularExpression("/The Case Title has been updated successfully in APP_DELEGATION table./", $result); $r = Delegation::select('DEL_TITLE')->where('DELEGATION_ID', $delegation1->DELEGATION_ID)->get()->values()->toArray(); $this->assertEquals($r[0]['DEL_TITLE'], $application1->APP_TITLE); diff --git a/tests/unit/workflow/engine/classes/WsBaseTest.php b/tests/unit/workflow/engine/classes/WsBaseTest.php index 33da1ffcf..4bf0df8fe 100755 --- a/tests/unit/workflow/engine/classes/WsBaseTest.php +++ b/tests/unit/workflow/engine/classes/WsBaseTest.php @@ -2,7 +2,6 @@ use App\Jobs\EmailEvent; use Faker\Factory; -use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Support\Facades\Queue; use ProcessMaker\Model\Application; use ProcessMaker\Model\AppDelay; @@ -23,9 +22,6 @@ use Tests\TestCase; */ class WsBaseTest extends TestCase { - - use DatabaseTransactions; - /** * Constructor of the class. * @@ -80,19 +76,19 @@ class WsBaseTest extends TestCase 'PIN' => '97ZN' ]; - $user = factory(User::class)->create([ + $user = User::factory()->create([ 'USR_UID' => $userUid ]); - $process = factory(Process::class)->create([ + $process = Process::factory()->create([ 'PRO_UID' => $processUid ]); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'APP_UID' => $applicationUid, 'APP_NUMBER' => $applicationNumber, @@ -115,7 +111,7 @@ class WsBaseTest extends TestCase { $passwordEnv = env('emailAccountPassword'); $password = G::encrypt("hash:" . $passwordEnv, 'EMAILENCRYPT'); - $emailServer = factory(EmailServerModel::class)->create([ + $emailServer = EmailServerModel::factory()->create([ 'MESS_ENGINE' => env('emailEngine'), 'MESS_SERVER' => env('emailServer'), 'MESS_PORT' => env('emailPort'), @@ -158,7 +154,7 @@ class WsBaseTest extends TestCase mkdir(PATH_DATA_SITE . 'mailTemplates' . PATH_SEP . $proUid); } file_put_contents(PATH_DATA_SITE . 'mailTemplates' . PATH_SEP . $proUid . PATH_SEP . 'template.html', $data); - $template = factory(\ProcessMaker\Model\ProcessFiles::class)->create([ + $template = \ProcessMaker\Model\ProcessFiles::factory()->create([ 'PRO_UID' => $proUid, 'USR_UID' => $usrUid, 'PRF_PATH' => 'template.html' @@ -497,16 +493,16 @@ class WsBaseTest extends TestCase public function it_should_test_that_the_cases_list_method_returns_the_case_title() { //Create the user factory - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create the application factory - $application1 = factory(Application::class)->create( + $application1 = Application::factory()->create( [ 'APP_STATUS' => 'TO_DO', 'APP_TITLE' => 'Title1' ] ); - $application2 = factory(Application::class)->create( + $application2 = Application::factory()->create( [ 'APP_STATUS' => 'DRAFT', 'APP_TITLE' => 'Title2' @@ -514,7 +510,7 @@ class WsBaseTest extends TestCase ); //Create the delegation factory - $delegation1 = factory(Delegation::class)->create( + $delegation1 = Delegation::factory()->create( [ 'USR_UID' => $user->USR_UID, 'DEL_THREAD_STATUS' => 'OPEN', @@ -522,7 +518,7 @@ class WsBaseTest extends TestCase 'APP_NUMBER' => $application1->APP_NUMBER ] ); - $delegation2 = factory(Delegation::class)->create( + $delegation2 = Delegation::factory()->create( [ 'USR_UID' => $user->USR_UID, 'DEL_THREAD_STATUS' => 'OPEN', @@ -532,13 +528,13 @@ class WsBaseTest extends TestCase ); //Create app thread factory - factory(AppThread::class)->create( + AppThread::factory()->create( [ 'APP_THREAD_STATUS' => 'OPEN', 'APP_UID' => $delegation1->APP_UID ] ); - factory(AppThread::class)->create( + AppThread::factory()->create( [ 'APP_THREAD_STATUS' => 'OPEN', 'APP_UID' => $delegation2->APP_UID @@ -571,17 +567,17 @@ class WsBaseTest extends TestCase public function it_should_test_the_cases_list_method_when_there_are_no_results() { //Create the user factory - $user1 = factory(User::class)->create(); - $user2 = factory(User::class)->create(); + $user1 = User::factory()->create(); + $user2 = User::factory()->create(); //Create the application factory - $application1 = factory(Application::class)->create( + $application1 = Application::factory()->create( [ 'APP_STATUS' => 'TO_DO', 'APP_TITLE' => 'Title1' ] ); - $application2 = factory(Application::class)->create( + $application2 = Application::factory()->create( [ 'APP_STATUS' => 'DRAFT', 'APP_TITLE' => 'Title2' @@ -589,7 +585,7 @@ class WsBaseTest extends TestCase ); //Create the delegation factory - $delegation1 = factory(Delegation::class)->create( + $delegation1 = Delegation::factory()->create( [ 'USR_UID' => $user1->USR_UID, 'DEL_THREAD_STATUS' => 'OPEN', @@ -597,7 +593,7 @@ class WsBaseTest extends TestCase 'APP_NUMBER' => $application1->APP_NUMBER ] ); - $delegation2 = factory(Delegation::class)->create( + $delegation2 = Delegation::factory()->create( [ 'USR_UID' => $user1->USR_UID, 'DEL_THREAD_STATUS' => 'OPEN', @@ -607,13 +603,13 @@ class WsBaseTest extends TestCase ); //Create app thread factory - factory(AppThread::class)->create( + AppThread::factory()->create( [ 'APP_THREAD_STATUS' => 'OPEN', 'APP_UID' => $delegation1->APP_UID ] ); - factory(AppThread::class)->create( + AppThread::factory()->create( [ 'APP_THREAD_STATUS' => 'OPEN', 'APP_UID' => $delegation2->APP_UID @@ -794,11 +790,11 @@ class WsBaseTest extends TestCase */ public function it_should_set_flag_when_is_same_case() { - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 2, 'APP_STATUS' => 'TO_DO' ]); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $delegation = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); @@ -817,7 +813,7 @@ class WsBaseTest extends TestCase */ public function it_should_validate_required_app_uid() { - $delegation = factory(Delegation::class)->states('foreign_keys')->create(); + $delegation = Delegation::factory()->foreign_keys()->create(); $ws = new WsBase(); $response = (object) $ws->cancelCase('', $delegation->DE_INDEX, $delegation->URS_UID); $this->assertEquals($response->status_code, 100); @@ -833,11 +829,11 @@ class WsBaseTest extends TestCase public function it_should_validate_required_status_todo() { // Create a case in DRAFT status - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 1, 'APP_STATUS' => 'DRAFT' ]); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $delegation = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); @@ -847,11 +843,11 @@ class WsBaseTest extends TestCase $this->assertEquals($response->message, G::LoadTranslation("ID_CASE_IN_STATUS") . ' DRAFT'); // Create a case in COMPLETED status - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 3, 'APP_STATUS' => 'COMPLETED' ]); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $delegation = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); @@ -861,11 +857,11 @@ class WsBaseTest extends TestCase $this->assertEquals($response->message, G::LoadTranslation("ID_CASE_IN_STATUS") . ' COMPLETED'); // Create a case in CANCELLED status - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 4, 'APP_STATUS' => 'CANCELLED' ]); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $delegation = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); @@ -883,11 +879,11 @@ class WsBaseTest extends TestCase */ public function it_should_validate_required_del_index() { - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 2, 'APP_STATUS' => 'TO_DO' ]); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $delegation = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); @@ -905,11 +901,11 @@ class WsBaseTest extends TestCase */ public function it_should_validate_required_open_thread() { - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 2, 'APP_STATUS' => 'TO_DO' ]); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $delegation = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, 'DEL_THREAD_STATUS' => 'CLOSED' @@ -928,11 +924,11 @@ class WsBaseTest extends TestCase */ public function it_should_validate_required_usr_uid() { - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 2, 'APP_STATUS' => 'TO_DO' ]); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $delegation = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); @@ -950,30 +946,30 @@ class WsBaseTest extends TestCase */ public function it_should_validate_only_one_thread_opened() { - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 2, 'APP_STATUS' => 'TO_DO' ]); - factory(AppThread::class)->create([ + AppThread::factory()->create([ 'APP_UID' => $application->APP_UID, 'APP_THREAD_INDEX' => 1, 'APP_THREAD_PARENT' => 1, 'APP_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1 ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, 'DEL_THREAD_STATUS' => 'OPEN' ]); - factory(AppThread::class)->create([ + AppThread::factory()->create([ 'APP_UID' => $application->APP_UID, 'APP_THREAD_INDEX' => 2, 'APP_THREAD_PARENT' => 1, 'APP_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2 ]); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $delegation = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, 'DEL_THREAD_STATUS' => 'OPEN', @@ -1003,35 +999,35 @@ class WsBaseTest extends TestCase $RBAC->loadUserRolePermission('PROCESSMAKER', $_SESSION['USER_LOGGED']); // Create the data related to the cancel a case - $process = factory(Process::class)->create([ + $process = Process::factory()->create([ 'PRO_CREATE_USER' => $user->USR_UID ]); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_USER' => $user->USR_UID ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID ]); - factory(UserReporting::class)->create([ + UserReporting::factory()->create([ 'TAS_UID' => $task->TAS_UID ]); - $application = factory(Application::class)->states('foreign_keys')->create([ + $application = Application::factory()->foreign_keys()->create([ 'PRO_UID' => $process->PRO_UID, 'APP_INIT_USER' => $user->USR_UID, 'APP_CUR_USER' => $user->USR_UID, 'APP_STATUS_ID' => 2, 'APP_STATUS' => 'TO_DO' ]); - factory(AppThread::class)->create([ + AppThread::factory()->create([ 'APP_UID' => $application->APP_UID, 'APP_THREAD_INDEX' => 1, 'APP_THREAD_PARENT' => 1, 'APP_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2 ]); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $delegation = Delegation::factory()->foreign_keys()->create([ 'TAS_UID' => $task->TAS_UID, 'PRO_UID' => $application->PRO_UID, 'APP_NUMBER' => $application->APP_NUMBER, @@ -1065,25 +1061,25 @@ class WsBaseTest extends TestCase $RBAC->loadUserRolePermission('PROCESSMAKER', $_SESSION['USER_LOGGED']); // Create the data related to the cancel a case - $task = factory(Task::class)->create(); - factory(UserReporting::class)->create([ + $task = Task::factory()->create(); + UserReporting::factory()->create([ 'TAS_UID' => $task->TAS_UID ]); - $application = factory(Application::class)->states('foreign_keys')->create([ + $application = Application::factory()->foreign_keys()->create([ 'APP_STATUS_ID' => 2, 'APP_INIT_USER' => $user->USR_UID, 'APP_CUR_USER' => $user->USR_UID, 'APP_STATUS' => 'TO_DO' ]); // Create the first thread - factory(AppThread::class)->create([ + AppThread::factory()->create([ 'APP_UID' => $application->APP_UID, 'APP_THREAD_INDEX' => 2, 'APP_THREAD_PARENT' => 1, 'APP_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2 ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'TAS_UID' => $task->TAS_UID, 'PRO_UID' => $application->PRO_UID, 'APP_NUMBER' => $application->APP_NUMBER, @@ -1093,14 +1089,14 @@ class WsBaseTest extends TestCase 'DEL_PREVIOUS' => 2, ]); // Create the second thread - factory(AppThread::class)->create([ + AppThread::factory()->create([ 'APP_UID' => $application->APP_UID, 'APP_THREAD_INDEX' => 3, 'APP_THREAD_PARENT' => 1, 'APP_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 3 ]); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $delegation = Delegation::factory()->foreign_keys()->create([ 'TAS_UID' => $task->TAS_UID, 'PRO_UID' => $application->PRO_UID, 'USR_UID' => $user->USR_UID, @@ -1127,18 +1123,18 @@ class WsBaseTest extends TestCase public function it_tried_cancel_an_undefined_case() { $fakeApp = G::generateUniqueID(); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 2, 'APP_STATUS' => 'TO_DO' ]); - factory(AppThread::class)->create([ + AppThread::factory()->create([ 'APP_UID' => $application->APP_UID, 'APP_THREAD_INDEX' => 1, 'APP_THREAD_PARENT' => 1, 'APP_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2 ]); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $delegation = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, 'DEL_THREAD_STATUS' => 'OPEN', @@ -1147,7 +1143,7 @@ class WsBaseTest extends TestCase $ws = new WsBase(); $response = (object) $ws->cancelCase($fakeApp, $delegation->DEL_INDEX, $delegation->USR_UID); $this->assertEquals($response->status_code, 100); - $this->assertContains($fakeApp, $response->message); + $this->assertStringContainsString($fakeApp, $response->message); } /** @@ -1159,51 +1155,51 @@ class WsBaseTest extends TestCase public function it_should_test_the_unassigned_case_list_method_with_unassigned_cases() { //Create process - $process1 = factory(Process::class)->create([ + $process1 = Process::factory()->create([ 'PRO_TITLE' => 'China Supplier Payment Proposal' ]); - $process2 = factory(Process::class)->create([ + $process2 = Process::factory()->create([ 'PRO_TITLE' => 'Egypt Supplier Payment Proposal' ]); //Create application - $application1 = factory(Application::class)->create([ + $application1 = Application::factory()->create([ 'APP_STATUS_ID' => 2 ]); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create a task self service - $task1 = factory(Task::class)->create([ + $task1 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process1->PRO_UID ]); - $task2 = factory(Task::class)->create([ + $task2 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process1->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task1->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, //Related to the user 'TU_TYPE' => 1 ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task2->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, //Related to the user 'TU_TYPE' => 1 ]); //Create the register in delegation relate to self-service - factory(Delegation::class, 2)->create([ + Delegation::factory(2)->create([ 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task1->TAS_ID, 'PRO_ID' => $process1->id, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, ]); - factory(Delegation::class, 2)->create([ + Delegation::factory(2)->create([ 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task2->TAS_ID, 'PRO_ID' => $process2->id, @@ -1226,52 +1222,52 @@ class WsBaseTest extends TestCase public function it_should_test_the_unassigned_case_list_method_without_unassigned_cases() { //Create process - $process1 = factory(Process::class)->create([ + $process1 = Process::factory()->create([ 'PRO_TITLE' => 'China Supplier Payment Proposal' ]); - $process2 = factory(Process::class)->create([ + $process2 = Process::factory()->create([ 'PRO_TITLE' => 'Egypt Supplier Payment Proposal' ]); //Create application - $application1 = factory(Application::class)->create([ + $application1 = Application::factory()->create([ 'APP_STATUS_ID' => 2 ]); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create a task self service - $task1 = factory(Task::class)->create([ + $task1 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process1->PRO_UID ]); - $task2 = factory(Task::class)->create([ + $task2 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process1->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task1->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, //Related to the user 'TU_TYPE' => 1 ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task2->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, //Related to the user 'TU_TYPE' => 1 ]); //Create the register in delegation relate to self-service - factory(Delegation::class, 2)->create([ + Delegation::factory(2)->create([ 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task1->TAS_ID, 'PRO_ID' => $process1->id, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 5, ]); - factory(Delegation::class, 2)->create([ + Delegation::factory(2)->create([ 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task2->TAS_ID, 'PRO_ID' => $process2->id, @@ -1299,18 +1295,18 @@ class WsBaseTest extends TestCase $response = (object) $ws->pauseCase('', 0, ''); $this->assertEquals($response->status_code, 100); // Validate the status - $application = factory(Application::class)->states('draft')->create(); + $application = Application::factory()->draft()->create(); $ws = new WsBase(); $response = (object) $ws->pauseCase($application->APP_UID, 0, ''); $this->assertEquals($response->status_code, 100); // Validate the index - $application = factory(Application::class)->states('todo')->create(); + $application = Application::factory()->todo()->create(); $ws = new WsBase(); $response = (object) $ws->pauseCase($application->APP_UID, '', ''); $this->assertEquals($response->status_code, 100); // Validate the user - $application = factory(Application::class)->states('todo')->create(); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->todo()->create(); + $delegation = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); @@ -1318,12 +1314,12 @@ class WsBaseTest extends TestCase $response = (object) $ws->pauseCase($application->APP_UID, $delegation->DEL_INDEX, ''); $this->assertEquals($response->status_code, 100); // If needs to validate the current user - $user = factory(User::class)->create(); + $user = User::factory()->create(); $response = (object) $ws->pauseCase($application->APP_UID, $delegation->DEL_INDEX, $user->USR_UID, null, true); $this->assertEquals($response->status_code, 100); // Validate if status is closed - $application = factory(Application::class)->states('todo')->create(); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->todo()->create(); + $delegation = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, 'DEL_THREAD_STATUS' => 'CLOSED', @@ -1333,12 +1329,12 @@ class WsBaseTest extends TestCase $response = (object) $ws->pauseCase($application->APP_UID, $delegation->DEL_INDEX, $delegation->USR_UID, null); $this->assertEquals($response->status_code, 100); // Validate if the case is paused - $application = factory(Application::class)->states('todo')->create(); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->todo()->create(); + $delegation = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); - factory(AppDelay::class)->create([ + AppDelay::factory()->create([ 'APP_DELEGATION_USER' => $delegation->USR_UID, 'PRO_UID' => $delegation->PRO_UID, 'APP_NUMBER' => $delegation->APP_NUMBER, @@ -1346,7 +1342,7 @@ class WsBaseTest extends TestCase 'APP_DISABLE_ACTION_USER' => 0, 'APP_TYPE' => 'PAUSE' ]); - factory(AppThread::class)->create([ + AppThread::factory()->create([ 'APP_UID' => $delegation->APP_UID, 'APP_THREAD_INDEX' => 1, 'APP_THREAD_PARENT' => 0, @@ -1356,8 +1352,8 @@ class WsBaseTest extends TestCase $ws = new WsBase(); $response = (object) $ws->pauseCase($application->APP_UID, $delegation->DEL_INDEX, $delegation->USR_UID, null); // Review the unpaused date - $application = factory(Application::class)->states('todo')->create(); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->todo()->create(); + $delegation = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); @@ -1374,14 +1370,14 @@ class WsBaseTest extends TestCase */ public function it_pause_case() { - $application = factory(Application::class)->states('todo')->create(); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->todo()->create(); + $delegation = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, ]); - factory(AppDelay::class)->create([ + AppDelay::factory()->create([ 'APP_DELEGATION_USER' => $delegation->USR_UID, 'PRO_UID' => $delegation->PRO_UID, 'APP_NUMBER' => $delegation->APP_NUMBER, @@ -1389,7 +1385,7 @@ class WsBaseTest extends TestCase 'APP_DISABLE_ACTION_USER' => 0, 'APP_TYPE' => 'PAUSE' ]); - factory(AppThread::class)->create([ + AppThread::factory()->create([ 'APP_UID' => $delegation->APP_UID, 'APP_THREAD_INDEX' => 1, 'APP_THREAD_PARENT' => 0, @@ -1398,6 +1394,6 @@ class WsBaseTest extends TestCase ]); $ws = new WsBase(); $response = (object) $ws->pauseCase($delegation->APP_UID, $delegation->DEL_INDEX, $delegation->USR_UID); - $this->assertNotEmpty($response->status_code); + $this->assertEquals(0, $response->status_code); } } diff --git a/tests/unit/workflow/engine/classes/WsResponseTest.php b/tests/unit/workflow/engine/classes/WsResponseTest.php index 1bf9408a2..12083f623 100644 --- a/tests/unit/workflow/engine/classes/WsResponseTest.php +++ b/tests/unit/workflow/engine/classes/WsResponseTest.php @@ -66,7 +66,7 @@ class WsResponseTest extends TestCase //assert $actual = $this->wsResponse->getPayloadString('test'); - $this->assertContains('test', $actual); + $this->assertStringContainsString('test', $actual); } /** diff --git a/tests/unit/workflow/engine/classes/model/AdditionalTablesTest.php b/tests/unit/workflow/engine/classes/model/AdditionalTablesTest.php index 4a29e2b1f..4e2a6042a 100644 --- a/tests/unit/workflow/engine/classes/model/AdditionalTablesTest.php +++ b/tests/unit/workflow/engine/classes/model/AdditionalTablesTest.php @@ -26,9 +26,6 @@ class AdditionalTablesTest extends TestCase */ public function setUp(): void { - if (version_compare(phpversion(), 7.3, '>') ) { - $this->markTestSkipped('The changes in third party are not available'); - } parent::setUp(); } @@ -62,7 +59,9 @@ class AdditionalTablesTest extends TestCase $actual = $additionalTablesModel->toArray(); unset($data["ADD_TAB_UID"]); - $this->assertArraySubset($data, $actual); + foreach ($data as $key => $value) { + $this->assertEquals($value, $actual[$key]); + } } /** @@ -86,7 +85,7 @@ class AdditionalTablesTest extends TestCase */ public function it_should_update() { - $additionalTables = factory(AdditionalTablesModel::class)->create(); + $additionalTables = AdditionalTablesModel::factory()->create(); $expected = [ "ADD_TAB_UID" => $additionalTables->ADD_TAB_UID, @@ -135,11 +134,11 @@ class AdditionalTablesTest extends TestCase */ public function it_should_get_all_registries() { - $proUid = factory(\ProcessMaker\Model\Process::class)->create()->PRO_UID; + $proUid = \ProcessMaker\Model\Process::factory()->create()->PRO_UID; //local connections - $additionalTables = factory(AdditionalTablesModel::class, 3); - $dbSource = factory(\ProcessMaker\Model\DbSource::class)->create([ + $additionalTables = AdditionalTablesModel::factory(3); + $dbSource = \ProcessMaker\Model\DbSource::factory()->create([ 'PRO_UID' => $proUid, 'DBS_SERVER' => env('DB_HOST'), 'DBS_DATABASE_NAME' => env('DB_DATABASE'), @@ -148,7 +147,7 @@ class AdditionalTablesTest extends TestCase 'DBS_PORT' => '3306', 'DBS_CONNECTION_TYPE' => 'NORMAL' ]); - $additionalTable = factory(AdditionalTablesModel::class)->create([ + $additionalTable = AdditionalTablesModel::factory()->create([ 'PRO_UID' => $proUid, 'DBS_UID' => $dbSource->DBS_UID, ]); @@ -157,7 +156,7 @@ class AdditionalTablesTest extends TestCase $this->createSchema($dbSource->DBS_DATABASE_NAME, $tableName, $name, $dbSource->DBS_UID); //external connection - $dbSource = factory(\ProcessMaker\Model\DbSource::class)->create([ + $dbSource = \ProcessMaker\Model\DbSource::factory()->create([ 'PRO_UID' => $proUid, 'DBS_SERVER' => config('database.connections.testexternal.host'), 'DBS_DATABASE_NAME' => config('database.connections.testexternal.database'), @@ -166,7 +165,7 @@ class AdditionalTablesTest extends TestCase 'DBS_PORT' => '3306', 'DBS_CONNECTION_TYPE' => 'NORMAL' ]); - $additionalTable = factory(AdditionalTablesModel::class)->create([ + $additionalTable = AdditionalTablesModel::factory()->create([ 'PRO_UID' => $proUid, 'DBS_UID' => $dbSource->DBS_UID, ]); @@ -223,14 +222,14 @@ class AdditionalTablesTest extends TestCase */ public function it_should_test_populate_report_table() { - $proUid = factory(Process::class)->create()->PRO_UID; + $proUid = Process::factory()->create()->PRO_UID; - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'PRO_UID' => $proUid ]); //local connections - $dbSource = factory(DbSource::class)->create([ + $dbSource = DbSource::factory()->create([ 'PRO_UID' => $proUid, 'DBS_SERVER' => env('DB_HOST'), 'DBS_DATABASE_NAME' => env('DB_DATABASE'), @@ -239,7 +238,7 @@ class AdditionalTablesTest extends TestCase 'DBS_PORT' => '3306', 'DBS_CONNECTION_TYPE' => 'NORMAL' ]); - $additionalTable = factory(AdditionalTablesModel::class)->create([ + $additionalTable = AdditionalTablesModel::factory()->create([ 'PRO_UID' => $proUid, 'DBS_UID' => $dbSource->DBS_UID, ]); @@ -248,7 +247,7 @@ class AdditionalTablesTest extends TestCase $this->createSchema($dbSource->DBS_DATABASE_NAME, $tableName, $name, $dbSource->DBS_UID); //external connection - $dbSource = factory(DbSource::class)->create([ + $dbSource = DbSource::factory()->create([ 'PRO_UID' => $proUid, 'DBS_SERVER' => config('database.connections.testexternal.host'), 'DBS_DATABASE_NAME' => config('database.connections.testexternal.database'), @@ -257,7 +256,7 @@ class AdditionalTablesTest extends TestCase 'DBS_PORT' => '3306', 'DBS_CONNECTION_TYPE' => 'NORMAL' ]); - $additionalTable = factory(AdditionalTablesModel::class)->create([ + $additionalTable = AdditionalTablesModel::factory()->create([ 'PRO_UID' => $proUid, 'DBS_UID' => $dbSource->DBS_UID, ]); @@ -265,10 +264,10 @@ class AdditionalTablesTest extends TestCase $nameExternal = $additionalTable->ADD_TAB_CLASS_NAME; $this->createSchema($dbSource->DBS_DATABASE_NAME, $tableNameExternal, $nameExternal, $dbSource->DBS_UID); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'PRO_UID' => $proUid ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'DEL_THREAD_STATUS' => 'CLOSED', 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_UID' => $task->TAS_UID, @@ -356,7 +355,6 @@ class AdditionalTablesTest extends TestCase */ private function createSchema(string $connection, string $tableName, string $className, string $dbsUid = 'workflow') { - $this->markTestIncomplete('Illegal mix of collations'); $query = "" . "CREATE TABLE IF NOT EXISTS `{$tableName}` (" . "`APP_UID` varchar(32) NOT NULL," @@ -366,7 +364,8 @@ class AdditionalTablesTest extends TestCase . "`VAR2` varchar(255) DEFAULT NULL," . "`VAR3` varchar(255) DEFAULT NULL," . "PRIMARY KEY (`APP_UID`)," - . "KEY `indexTable` (`APP_UID`))"; + . "KEY `indexTable` (`APP_UID`)" + . ")ENGINE=InnoDB DEFAULT CHARSET='utf8'"; if (!empty(config("database.connections.{$connection}"))) { DB::connection($connection)->statement($query); } else { diff --git a/tests/unit/workflow/engine/classes/model/AppNotesTest.php b/tests/unit/workflow/engine/classes/model/AppNotesTest.php index b13a5fc27..da1dc9906 100644 --- a/tests/unit/workflow/engine/classes/model/AppNotesTest.php +++ b/tests/unit/workflow/engine/classes/model/AppNotesTest.php @@ -39,8 +39,8 @@ class AppNotesTest extends TestCase */ public function it_test_case_notes_creation() { - $application = factory(Application::class)->create(); - $user = factory(User::class)->create(); + $application = Application::factory()->create(); + $user = User::factory()->create(); $reason = "The case was canceled due to:"; $appNotes = new ModelAppNotes(); $noteContent = addslashes($reason); @@ -62,8 +62,8 @@ class AppNotesTest extends TestCase */ public function it_test_case_notes_creation_and_send_email_to_user() { - $application = factory(Application::class)->create(); - $user = factory(User::class)->create(); + $application = Application::factory()->create(); + $user = User::factory()->create(); $reason = "The case was canceled due to:"; $appNotes = new ModelAppNotes(); $noteContent = addslashes($reason); @@ -91,9 +91,9 @@ class AppNotesTest extends TestCase */ public function it_test_case_notes_creation_and_send_email() { - $application = factory(Application::class)->create(); - $user = factory(User::class)->create(); - factory(Delegation::class)->create([ + $application = Application::factory()->create(); + $user = User::factory()->create(); + Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'USR_UID' => $user->USR_UID ]); @@ -141,8 +141,8 @@ class AppNotesTest extends TestCase $user = User::where('USR_UID', '=', '00000000000000000000000000000001') ->get() ->first(); - $application = factory(Application::class)->create(); - $delegation = factory(Delegation::class)->create([ + $application = Application::factory()->create(); + $delegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'USR_UID' => $user->USR_UID ]); @@ -174,17 +174,17 @@ class AppNotesTest extends TestCase $user = User::where('USR_UID', '=', '00000000000000000000000000000001') ->get() ->first(); - $application = factory(Application::class)->create(); - $delegation = factory(Delegation::class)->create([ + $application = Application::factory()->create(); + $delegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'USR_UID' => $user->USR_UID ]); - $appNote = factory(AppNotes::class)->create(); - $appDocument = factory(Documents::class)->create([ + $appNote = AppNotes::factory()->create(); + $appDocument = Documents::factory()->create([ 'APP_UID' => $application->APP_UID, 'DOC_ID' => $appNote->NOTE_ID ]); - factory(EmailServerModel::class)->create([ + EmailServerModel::factory()->create([ 'MESS_DEFAULT' => 1 ]); @@ -212,8 +212,8 @@ class AppNotesTest extends TestCase */ public function it_should_test_get_attached_files_from_the_casenote() { - $appNote = factory(AppNotes::class)->create(); - $appDocument = factory(Documents::class)->create([ + $appNote = AppNotes::factory()->create(); + $appDocument = Documents::factory()->create([ 'DOC_ID' => $appNote->NOTE_ID ]); diff --git a/tests/unit/workflow/engine/classes/model/ListCanceledTest.php b/tests/unit/workflow/engine/classes/model/ListCanceledTest.php index 64579c0be..e4ecd0bc3 100644 --- a/tests/unit/workflow/engine/classes/model/ListCanceledTest.php +++ b/tests/unit/workflow/engine/classes/model/ListCanceledTest.php @@ -36,7 +36,7 @@ class ListCanceledTest extends TestCase */ public function it_should_test_loadFilters_method() { - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'DEL_THREAD_STATUS' => 'CLOSED', ]); @@ -45,7 +45,7 @@ class ListCanceledTest extends TestCase 'filter' => '', 'search' => $delegation->application->APP_UID, 'process' => $delegation->process->PRO_UID, - 'category' => $delegation->process->PRO_CATEGORY, + 'category' => $this->faker->word, 'dateFrom' => '', 'dateTo' => '' ]; diff --git a/tests/unit/workflow/engine/classes/model/ListCompletedTest.php b/tests/unit/workflow/engine/classes/model/ListCompletedTest.php index e394480fe..a3d128927 100644 --- a/tests/unit/workflow/engine/classes/model/ListCompletedTest.php +++ b/tests/unit/workflow/engine/classes/model/ListCompletedTest.php @@ -36,7 +36,7 @@ class ListCompletedTest extends TestCase */ public function it_should_test_loadFilters_method() { - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'DEL_THREAD_STATUS' => 'CLOSED', ]); @@ -48,7 +48,7 @@ class ListCompletedTest extends TestCase 'filter' => '', //read,unread 'search' => $delegation->application->APP_UID, 'process' => $delegation->process->PRO_UID, - 'category' => $delegation->process->PRO_CATEGORY, + 'category' => $this->faker->word, 'dateFrom' => '', 'dateTo' => '' ]; diff --git a/tests/unit/workflow/engine/classes/model/ListInboxTest.php b/tests/unit/workflow/engine/classes/model/ListInboxTest.php index c63b41f13..ef98858fa 100644 --- a/tests/unit/workflow/engine/classes/model/ListInboxTest.php +++ b/tests/unit/workflow/engine/classes/model/ListInboxTest.php @@ -36,7 +36,7 @@ class ListInboxTest extends TestCase */ public function it_should_test_loadFilters_method() { - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'DEL_THREAD_STATUS' => 'CLOSED', ]); @@ -48,7 +48,7 @@ class ListInboxTest extends TestCase 'search' => $delegation->application->APP_UID, 'caseLink' => $delegation->application->APP_UID, 'process' => $delegation->process->PRO_UID, - 'category' => $delegation->process->PRO_CATEGORY, + 'category' => $this->faker->word, 'dateFrom' => '', 'dateTo' => '', 'filterStatus' => 'ON_TIME', //ON_TIME,AT_RISK,OVERDUE diff --git a/tests/unit/workflow/engine/classes/model/ListMyInboxTest.php b/tests/unit/workflow/engine/classes/model/ListMyInboxTest.php index 71877bf7e..8d2c6aab9 100644 --- a/tests/unit/workflow/engine/classes/model/ListMyInboxTest.php +++ b/tests/unit/workflow/engine/classes/model/ListMyInboxTest.php @@ -36,7 +36,7 @@ class ListMyInboxTest extends TestCase */ public function it_should_test_loadFilters_method() { - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'DEL_THREAD_STATUS' => 'CLOSED', ]); @@ -45,7 +45,7 @@ class ListMyInboxTest extends TestCase 'filter' => '', 'search' => $delegation->application->APP_UID, 'process' => $delegation->process->PRO_UID, - 'category' => $delegation->process->PRO_CATEGORY, + 'category' => $this->faker->word, 'dateFrom' => '', 'dateTo' => '' ]; diff --git a/tests/unit/workflow/engine/classes/model/ListParticipatedHistoryTest.php b/tests/unit/workflow/engine/classes/model/ListParticipatedHistoryTest.php index 2a175c614..83ac79455 100644 --- a/tests/unit/workflow/engine/classes/model/ListParticipatedHistoryTest.php +++ b/tests/unit/workflow/engine/classes/model/ListParticipatedHistoryTest.php @@ -36,7 +36,7 @@ class ListParticipatedHistoryTest extends TestCase */ public function it_should_test_loadFilters_method() { - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'DEL_THREAD_STATUS' => 'CLOSED', ]); @@ -45,7 +45,7 @@ class ListParticipatedHistoryTest extends TestCase 'filter' => '', 'search' => $delegation->application->APP_UID, 'process' => $delegation->process->PRO_UID, - 'category' => $delegation->process->PRO_CATEGORY, + 'category' => $this->faker->word, 'dateFrom' => '', 'dateTo' => '' ]; diff --git a/tests/unit/workflow/engine/classes/model/ListParticipatedLastTest.php b/tests/unit/workflow/engine/classes/model/ListParticipatedLastTest.php index 257853927..7632cbb76 100644 --- a/tests/unit/workflow/engine/classes/model/ListParticipatedLastTest.php +++ b/tests/unit/workflow/engine/classes/model/ListParticipatedLastTest.php @@ -36,7 +36,7 @@ class ListParticipatedLastTest extends TestCase */ public function it_should_test_loadFilters_method() { - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'DEL_THREAD_STATUS' => 'CLOSED', ]); @@ -46,7 +46,7 @@ class ListParticipatedLastTest extends TestCase 'search' => $delegation->application->APP_UID, 'caseLink' => $delegation->application->APP_UID, 'process' => $delegation->process->PRO_UID, - 'category' => $delegation->process->PRO_CATEGORY, + 'category' => $this->faker->word, 'dateFrom' => '', 'dateTo' => '', 'filterStatus' => 'ON_TIME', //ON_TIME,AT_RISK,OVERDUE diff --git a/tests/unit/workflow/engine/classes/model/ListPausedTest.php b/tests/unit/workflow/engine/classes/model/ListPausedTest.php index 6b459a09d..fd66d312a 100644 --- a/tests/unit/workflow/engine/classes/model/ListPausedTest.php +++ b/tests/unit/workflow/engine/classes/model/ListPausedTest.php @@ -36,7 +36,7 @@ class ListPausedTest extends TestCase */ public function it_should_test_loadFilters_method() { - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'DEL_THREAD_STATUS' => 'CLOSED', ]); @@ -46,7 +46,7 @@ class ListPausedTest extends TestCase 'search' => $delegation->application->APP_UID, 'caseLink' => $delegation->application->APP_UID, 'process' => $delegation->process->PRO_UID, - 'category' => $delegation->process->PRO_CATEGORY, + 'category' => $this->faker->word, 'filterStatus' => 'ON_TIME' //ON_TIME,AT_RISK,OVERDUE ]; $this->listPaused->loadFilters($criteria, $filters); diff --git a/tests/unit/workflow/engine/classes/model/ListUnassignedTest.php b/tests/unit/workflow/engine/classes/model/ListUnassignedTest.php index fc2035b87..76f2795e8 100644 --- a/tests/unit/workflow/engine/classes/model/ListUnassignedTest.php +++ b/tests/unit/workflow/engine/classes/model/ListUnassignedTest.php @@ -36,7 +36,7 @@ class ListUnassignedTest extends TestCase */ public function it_should_test_loadFilters_method() { - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'DEL_THREAD_STATUS' => 'CLOSED', ]); @@ -46,7 +46,7 @@ class ListUnassignedTest extends TestCase 'search' => $delegation->application->APP_UID, 'caseLink' => $delegation->application->APP_UID, 'process' => $delegation->process->PRO_UID, - 'category' => $delegation->process->PRO_CATEGORY, + 'category' => $this->faker->word, 'newestthan' => $delegation->DEL_DELEGATE_DATE->format('Y-m-d H:i:s'), 'oldestthan' => $delegation->DEL_DELEGATE_DATE->format('Y-m-d H:i:s'), 'appUidCheck' => $delegation->application->APP_UID diff --git a/tests/unit/workflow/engine/classes/model/OutputDocumentTest.php b/tests/unit/workflow/engine/classes/model/OutputDocumentTest.php index f454c8692..d44a11dc3 100644 --- a/tests/unit/workflow/engine/classes/model/OutputDocumentTest.php +++ b/tests/unit/workflow/engine/classes/model/OutputDocumentTest.php @@ -48,7 +48,7 @@ class OutputDocumentTest extends TestCase public function it_should_generate_tcpdf() { // Create a register in the output document - $output = factory(OutputDocumentModel::class)->create([ + $output = OutputDocumentModel::factory()->create([ 'OUT_DOC_TEMPLATE' => ' diff --git a/tests/unit/workflow/engine/controllers/DesignerTest.php b/tests/unit/workflow/engine/controllers/DesignerTest.php index 3f3d24ba4..fef03826c 100644 --- a/tests/unit/workflow/engine/controllers/DesignerTest.php +++ b/tests/unit/workflow/engine/controllers/DesignerTest.php @@ -18,9 +18,9 @@ class DesignerTest extends TestCase public function it_should_test_that_the_index_method_is_not_throwing_an_exception() { //Create the process factory - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create the application factory - $application = factory(Application::class)->create( + $application = Application::factory()->create( [ 'APP_PIN' => G::encryptOld('LJ5W'), ] @@ -69,8 +69,8 @@ class DesignerTest extends TestCase $res = ob_get_clean(); //Assert the result does not have errors - $this->assertNotContains('Call to a member function getUsrUid() on null', $res); - $this->assertNotContains('Uncaught TypeError: Argument 2 passed to Illumincate\Routing\UrlGenerator::_construct() must be an instance of Illuminate\Http\Request, null given', + $this->assertStringNotContainsString('Call to a member function getUsrUid() on null', $res); + $this->assertStringNotContainsString('Uncaught TypeError: Argument 2 passed to Illumincate\Routing\UrlGenerator::_construct() must be an instance of Illuminate\Http\Request, null given', $res); } @@ -82,9 +82,9 @@ class DesignerTest extends TestCase public function it_should_test_the_index_method_when_the_user_logged_is_empty() { //Create the process factory - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create the application factory - $application = factory(Application::class)->create( + $application = Application::factory()->create( [ 'APP_PIN' => G::encryptOld('LJ5W'), ] diff --git a/tests/unit/workflow/engine/controllers/PmTablesProxyTest.php b/tests/unit/workflow/engine/controllers/PmTablesProxyTest.php index 13023c560..f69e5f34a 100644 --- a/tests/unit/workflow/engine/controllers/PmTablesProxyTest.php +++ b/tests/unit/workflow/engine/controllers/PmTablesProxyTest.php @@ -3,6 +3,8 @@ namespace Tests\unit\workflow\engine\controllers; use AdditionalTables; +use Exception; +use Faker\Factory; use G; use Illuminate\Foundation\Testing\DatabaseTransactions; use pmTablesProxy; @@ -83,7 +85,6 @@ class PmTablesProxyTest extends TestCase */ public function it_should_test_big_int_id() { - $this->markTestIncomplete(); $reportTable = new ReportTable(); //PM table with a bigint id @@ -194,7 +195,6 @@ class PmTablesProxyTest extends TestCase */ public function it_should_test_var_char_id() { - $this->markTestIncomplete(); $reportTable = new ReportTable(); //PM table with a char id @@ -305,7 +305,6 @@ class PmTablesProxyTest extends TestCase */ public function it_should_test_integer_id() { - $this->markTestIncomplete(); $reportTable = new ReportTable(); //PM table with an integer id @@ -416,7 +415,6 @@ class PmTablesProxyTest extends TestCase */ public function it_should_test_smallint_id() { - $this->markTestIncomplete(); $reportTable = new ReportTable(); //PM table with a smallint id @@ -526,7 +524,6 @@ class PmTablesProxyTest extends TestCase */ public function it_should_test_tinyint_id() { - $this->markTestIncomplete(); $reportTable = new ReportTable(); //PM table with a tinyint id @@ -636,7 +633,6 @@ class PmTablesProxyTest extends TestCase */ public function it_should_test_varchar_id() { - $this->markTestIncomplete(); $reportTable = new ReportTable(); //PM table with a varchar id @@ -745,7 +741,6 @@ class PmTablesProxyTest extends TestCase */ public function it_should_test_varchar_id_filter() { - $this->markTestIncomplete(); $reportTable = new ReportTable(); //PM table with a varchar id @@ -820,7 +815,6 @@ class PmTablesProxyTest extends TestCase */ public function it_should_test_varchar_id_exception() { - $this->markTestSkipped("Is not compatible with php74."); $reportTable = new ReportTable(); //PM table with a varchar id @@ -900,7 +894,6 @@ class PmTablesProxyTest extends TestCase */ public function it_should_test_varchar_id_rows() { - $this->markTestIncomplete(); $reportTable = new ReportTable(); //PM table with a varchar id @@ -985,7 +978,7 @@ class PmTablesProxyTest extends TestCase ]), ]; - $this->expectExceptionMessage("**ID_PMTABLE_CLASS_DOESNT_EXIST**"); + $this->expectException(Exception::class); //This method update the PM tables rows $obj->dataUpdate($httpDataUpdateVarChar); } @@ -998,17 +991,18 @@ class PmTablesProxyTest extends TestCase */ public function it_should_test_destroy_method() { - $this->markTestSkipped("Is not compatible with php74."); + $faker = Factory::create(); $obj = new pmTablesProxy(); //Variable that is sent to the destroy method $httpDataDestroyTest = (object)[ - 'id' => "fakeUID", - 'rows' => G::encrypt("076", PMTABLE_KEY), + 'id' => $faker->unique()->numberBetween(1, 100), + 'rows' => G::encrypt("076", PMTABLE_KEY) ]; //Assert the exception message when the PM table does not exists - $this->expectExceptionMessage('ID_PMTABLE_CLASS_DOESNT_EXIST'); + $this->expectException(Exception::class); + //This method deletes a specific row of a PM table $obj->dataDestroy($httpDataDestroyTest); } @@ -1021,7 +1015,6 @@ class PmTablesProxyTest extends TestCase */ public function it_should_test_destroy_method_success() { - $this->markTestSkipped("Is not compatible with php74."); $reportTable = new ReportTable(); //PM table with a varchar id @@ -1087,6 +1080,7 @@ class PmTablesProxyTest extends TestCase //This method deletes a specific row of a PM table $obj->dataDestroy($httpDataDestroyTest); + $this->assertTrue(property_exists($obj, 'jsonResponse')); } /** @@ -1119,6 +1113,7 @@ class PmTablesProxyTest extends TestCase $pmTablesProxy = new pmTablesProxy(); $result = $pmTablesProxy->import($httpData); + ob_end_clean(); //asserts $this->assertObjectHasAttribute('fromAdmin', $result); diff --git a/tests/unit/workflow/engine/methods/authSources/AuthSourcesEditTest.php b/tests/unit/workflow/engine/methods/authSources/AuthSourcesEditTest.php index 1e70e17e9..c8db87f7b 100644 --- a/tests/unit/workflow/engine/methods/authSources/AuthSourcesEditTest.php +++ b/tests/unit/workflow/engine/methods/authSources/AuthSourcesEditTest.php @@ -18,6 +18,9 @@ class AuthSourcesEditTest extends TestCase { parent::setUp(); $this->settingUserLogged(); + if (!defined('SYS_COLLECTION')) { + define('SYS_COLLECTION', 'case'); + } } /** @@ -59,7 +62,7 @@ class AuthSourcesEditTest extends TestCase $fileName = PATH_METHODS . 'authSources/authSources_Edit.php'; $_REQUEST['AUTH_SOURCE_PROVIDER'] = 'ldapAdvanced'; - $authenticationSource = factory(RbacAuthenticationSource::class) + $authenticationSource = RbacAuthenticationSource::factory() ->create(); $_GET['sUID'] = $authenticationSource->AUTH_SOURCE_UID; diff --git a/tests/unit/workflow/engine/methods/cases/CaseMessageHistory_AjaxTest.php b/tests/unit/workflow/engine/methods/cases/CaseMessageHistory_AjaxTest.php index 4204842fb..37f761aa0 100644 --- a/tests/unit/workflow/engine/methods/cases/CaseMessageHistory_AjaxTest.php +++ b/tests/unit/workflow/engine/methods/cases/CaseMessageHistory_AjaxTest.php @@ -20,9 +20,6 @@ class CaseMessageHistory_AjaxTest extends TestCase */ public function setUp(): void { - if (version_compare(phpversion(), 7.3, '>') ) { - $this->markTestSkipped('The changes in third party are not available'); - } parent::setUp(); } @@ -41,27 +38,27 @@ class CaseMessageHistory_AjaxTest extends TestCase */ public function it_shoud_test_the_message_history_grid_list_jxp_action_with_no_permissions() { - $user = factory(USER::class)->create(); - $process = factory(PROCESS::class)->create(); + $user = USER::factory()->create(); + $process = PROCESS::factory()->create(); - $application = factory(APPLICATION::class)->create([ + $application = APPLICATION::factory()->create([ 'PRO_UID' => $process['PRO_UID'], 'APP_INIT_USER' => $user['USR_UID'], 'APP_CUR_USER' => $user['USR_UID'] ]); - $task = factory(TASK::class)->create([ + $task = TASK::factory()->create([ 'PRO_UID' => $process['PRO_UID'], 'TAS_USER' => $user['USR_UID'] ]); - $appmessage1 = factory(APPMESSAGE::class)->create([ + $appmessage1 = APPMESSAGE::factory()->create([ 'PRO_ID' => $process['PRO_ID'], 'TAS_ID' => $task['TAS_ID'], 'APP_NUMBER' => $application['APP_NUMBER'] ]); - $appmessage2 = factory(APPMESSAGE::class)->create([ + $appmessage2 = APPMESSAGE::factory()->create([ 'APP_MSG_TYPE' => 'PM_FUNCTION', 'PRO_ID' => $process['PRO_ID'], 'TAS_ID' => $task['TAS_ID'], @@ -94,24 +91,24 @@ class CaseMessageHistory_AjaxTest extends TestCase */ public function it_shoud_test_the_message_history_grid_list_jxp_action_with_view_permission() { - $user = factory(USER::class)->create(); + $user = USER::factory()->create(); - $processView = factory(PROCESS::class)->create([ + $processView = PROCESS::factory()->create([ 'PRO_CREATE_USER' => $user['USR_UID'] ]); - $application = factory(APPLICATION::class)->create([ + $application = APPLICATION::factory()->create([ 'PRO_UID' => $processView['PRO_UID'], 'APP_INIT_USER' => $user['USR_UID'], 'APP_CUR_USER' => $user['USR_UID'] ]); - $task = factory(TASK::class)->create([ + $task = TASK::factory()->create([ 'PRO_UID' => $processView['PRO_UID'], 'TAS_USER' => $user['USR_UID'] ]); - $delegation = factory(DELEGATION::class)->create([ + $delegation = DELEGATION::factory()->create([ 'APP_UID' => $application['APP_UID'], 'DEL_INDEX' => 0, 'DEL_PREVIOUS' => 0, @@ -124,14 +121,14 @@ class CaseMessageHistory_AjaxTest extends TestCase 'DEL_PRIORITY' => 3, ]); - $appmessage1 = factory(APPMESSAGE::class)->create([ + $appmessage1 = APPMESSAGE::factory()->create([ 'PRO_ID' => $processView['PRO_ID'], 'TAS_ID' => $task['TAS_ID'], 'APP_NUMBER' => $application['APP_NUMBER'], 'DEL_INDEX' => 0 ]); - $appmessage2 = factory(APPMESSAGE::class)->create([ + $appmessage2 = APPMESSAGE::factory()->create([ 'APP_MSG_TYPE' => 'PM_FUNCTION', 'PRO_ID' => $processView['PRO_ID'], 'TAS_ID' => $task['TAS_ID'], @@ -139,7 +136,7 @@ class CaseMessageHistory_AjaxTest extends TestCase 'DEL_INDEX' => 0 ]); - $objectPermission = factory(OBJECTPERMISSION::class)->create([ + $objectPermission = OBJECTPERMISSION::factory()->create([ 'PRO_UID' => $processView['PRO_UID'], 'TAS_UID' => $task['TAS_UID'], 'USR_UID' => $user['USR_UID'], @@ -170,24 +167,24 @@ class CaseMessageHistory_AjaxTest extends TestCase */ public function it_shoud_test_the_message_history_grid_list_jxp_action_with_resend_permission() { - $user = factory(USER::class)->create(); + $user = USER::factory()->create(); - $processView = factory(PROCESS::class)->create([ + $processView = PROCESS::factory()->create([ 'PRO_CREATE_USER' => $user['USR_UID'] ]); - $application = factory(APPLICATION::class)->create([ + $application = APPLICATION::factory()->create([ 'PRO_UID' => $processView['PRO_UID'], 'APP_INIT_USER' => $user['USR_UID'], 'APP_CUR_USER' => $user['USR_UID'] ]); - $task = factory(TASK::class)->create([ + $task = TASK::factory()->create([ 'PRO_UID' => $processView['PRO_UID'], 'TAS_USER' => $user['USR_UID'] ]); - $delegation = factory(DELEGATION::class)->create([ + $delegation = DELEGATION::factory()->create([ 'APP_UID' => $application['APP_UID'], 'DEL_INDEX' => 0, 'DEL_PREVIOUS' => 0, @@ -200,14 +197,14 @@ class CaseMessageHistory_AjaxTest extends TestCase 'DEL_PRIORITY' => 3, ]); - $appmessage1 = factory(APPMESSAGE::class)->create([ + $appmessage1 = APPMESSAGE::factory()->create([ 'PRO_ID' => $processView['PRO_ID'], 'TAS_ID' => $task['TAS_ID'], 'APP_NUMBER' => $application['APP_NUMBER'], 'DEL_INDEX' => 0 ]); - $appmessage2 = factory(APPMESSAGE::class)->create([ + $appmessage2 = APPMESSAGE::factory()->create([ 'APP_MSG_TYPE' => 'PM_FUNCTION', 'PRO_ID' => $processView['PRO_ID'], 'TAS_ID' => $task['TAS_ID'], @@ -215,7 +212,7 @@ class CaseMessageHistory_AjaxTest extends TestCase 'DEL_INDEX' => 0 ]); - $objectPermission = factory(OBJECTPERMISSION::class)->create([ + $objectPermission = OBJECTPERMISSION::factory()->create([ 'PRO_UID' => $processView['PRO_UID'], 'TAS_UID' => $task['TAS_UID'], 'USR_UID' => $user['USR_UID'], @@ -246,35 +243,35 @@ class CaseMessageHistory_AjaxTest extends TestCase */ public function it_shoud_test_the_message_history_grid_list_jxp_action_with_block_permission() { - $user = factory(USER::class)->create(); + $user = USER::factory()->create(); - $process = factory(PROCESS::class)->create(); + $process = PROCESS::factory()->create(); - $application = factory(APPLICATION::class)->create([ + $application = APPLICATION::factory()->create([ 'PRO_UID' => $process['PRO_UID'], 'APP_INIT_USER' => $user['USR_UID'], 'APP_CUR_USER' => $user['USR_UID'] ]); - $task = factory(TASK::class)->create([ + $task = TASK::factory()->create([ 'PRO_UID' => $process['PRO_UID'], 'TAS_USER' => $user['USR_UID'] ]); - $appmessage1 = factory(APPMESSAGE::class)->create([ + $appmessage1 = APPMESSAGE::factory()->create([ 'PRO_ID' => $process['PRO_ID'], 'TAS_ID' => $task['TAS_ID'], 'APP_NUMBER' => $application['APP_NUMBER'] ]); - $appmessage2 = factory(APPMESSAGE::class)->create([ + $appmessage2 = APPMESSAGE::factory()->create([ 'APP_MSG_TYPE' => 'PM_FUNCTION', 'PRO_ID' => $process['PRO_ID'], 'TAS_ID' => $task['TAS_ID'], 'APP_NUMBER' => $application['APP_NUMBER'] ]); - $objectPermission = factory(OBJECTPERMISSION::class)->create([ + $objectPermission = OBJECTPERMISSION::factory()->create([ 'PRO_UID' => $process['PRO_UID'], 'TAS_UID' => $task['TAS_UID'], 'USR_UID' => $user['USR_UID'], diff --git a/tests/unit/workflow/engine/methods/cases/CasesMenuHighlightTest.php b/tests/unit/workflow/engine/methods/cases/CasesMenuHighlightTest.php index e14a840ae..69c43bdc7 100644 --- a/tests/unit/workflow/engine/methods/cases/CasesMenuHighlightTest.php +++ b/tests/unit/workflow/engine/methods/cases/CasesMenuHighlightTest.php @@ -52,17 +52,17 @@ class CasesMenuHighlightTest extends TestCase public function it_should_test_the_response_of_the_cases_menu_highlight_file() { // Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); // Create a task self service - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); // Assign the current user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $this->user->USR_UID, 'TU_RELATION' => 1, //Related to the user @@ -70,7 +70,7 @@ class CasesMenuHighlightTest extends TestCase ]); // Create records in delegation relate to self-service - factory(Delegation::class, 10)->create([ + Delegation::factory(10)->create([ 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0 diff --git a/tests/unit/workflow/engine/methods/cases/CasesOpenTest.php b/tests/unit/workflow/engine/methods/cases/CasesOpenTest.php index 0d5a262a8..2601624d4 100644 --- a/tests/unit/workflow/engine/methods/cases/CasesOpenTest.php +++ b/tests/unit/workflow/engine/methods/cases/CasesOpenTest.php @@ -40,23 +40,23 @@ class CasesOpenTest extends TestCase $RBAC->initRBAC(); $RBAC->loadUserRolePermission('PROCESSMAKER', $_SESSION['USER_LOGGED']); - $task = factory(Task::class)->create(); - $dynaform = factory(Dynaform::class)->create(); - $process = factory(Process::class)->create([ + $task = Task::factory()->create(); + $dynaform = Dynaform::factory()->create(); + $process = Process::factory()->create([ 'PRO_DYNAFORMS' => $dynaform['DYN_UID'] ]); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'PRO_UID' => $process['PRO_UID'], 'APP_STATUS' => 'COMPLETED' ]); - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_UID' => $application['APP_UID'], 'TAS_UID' => $task['TAS_UID'], 'DEL_INDEX' => 1, 'DEL_THREAD_STATUS' => 'CLOSED' ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application['APP_UID'], 'TAS_UID' => $task['TAS_UID'], 'DEL_INDEX' => 2, @@ -85,6 +85,6 @@ class CasesOpenTest extends TestCase ob_end_clean(); $res = ''; - $this->assertContains($res, $outputBuffer); + $this->assertStringContainsString($res, $outputBuffer); } } diff --git a/tests/unit/workflow/engine/methods/cases/CasesShowDocumentTest.php b/tests/unit/workflow/engine/methods/cases/CasesShowDocumentTest.php index deba8b6a6..099c29468 100644 --- a/tests/unit/workflow/engine/methods/cases/CasesShowDocumentTest.php +++ b/tests/unit/workflow/engine/methods/cases/CasesShowDocumentTest.php @@ -15,10 +15,6 @@ class CasesShowDocumentTest extends TestCase */ public function setUp(): void { - if (version_compare(phpversion(), 7.3, '>') ) { - $this->markTestSkipped('The changes in third party are not available'); - } - parent::setUp(); if (!defined('PATH_DOCUMENT')) { define('PATH_DOCUMENT', PATH_DB . config('system.workspace') . PATH_SEP . 'files' . PATH_SEP); @@ -35,7 +31,7 @@ class CasesShowDocumentTest extends TestCase $RBAC = RBAC::getSingleton(); $RBAC->initRBAC(); - $appDocument = factory(Documents::class)->create([ + $appDocument = Documents::factory()->create([ 'APP_DOC_FILENAME' => 'text.txt' ]); diff --git a/tests/unit/workflow/engine/methods/emailServer/EmailServerAjaxTest.php b/tests/unit/workflow/engine/methods/emailServer/EmailServerAjaxTest.php index bb8e2fa7d..fc455b367 100644 --- a/tests/unit/workflow/engine/methods/emailServer/EmailServerAjaxTest.php +++ b/tests/unit/workflow/engine/methods/emailServer/EmailServerAjaxTest.php @@ -133,7 +133,7 @@ class EmailServerAjaxTest extends TestCase { $faker = Factory::create(); - $emailServer = factory(EmailServerModel::class)->create([ + $emailServer = EmailServerModel::factory()->create([ 'MESS_ENGINE' => 'PHPMAILER', ]); @@ -169,7 +169,7 @@ class EmailServerAjaxTest extends TestCase */ public function it_should_verify_the_option_del() { - $emailServer = factory(EmailServerModel::class)->create([ + $emailServer = EmailServerModel::factory()->create([ 'MESS_ENGINE' => 'PHPMAILER', ]); diff --git a/tests/unit/workflow/engine/methods/emailServer/EmailServerTest.php b/tests/unit/workflow/engine/methods/emailServer/EmailServerTest.php index 5ea67190d..38f9a85de 100644 --- a/tests/unit/workflow/engine/methods/emailServer/EmailServerTest.php +++ b/tests/unit/workflow/engine/methods/emailServer/EmailServerTest.php @@ -32,6 +32,6 @@ class EmailServerTest extends TestCase require_once PATH_METHODS . 'emailServer/emailServer.php'; $content = ob_get_clean(); - $this->assertContains("EMAILSERVER_LICENSED", $content); + $this->assertStringContainsString("EMAILSERVER_LICENSED", $content); } } diff --git a/tests/unit/workflow/engine/methods/groups/GroupsAjaxTest.php b/tests/unit/workflow/engine/methods/groups/GroupsAjaxTest.php index 1a7fc1007..17e5ac389 100644 --- a/tests/unit/workflow/engine/methods/groups/GroupsAjaxTest.php +++ b/tests/unit/workflow/engine/methods/groups/GroupsAjaxTest.php @@ -18,8 +18,8 @@ class GroupsAjaxTest extends TestCase public function setUp(): void { parent::setUp(); + $this->truncateNonInitialModels(); $this->settingUserLogged(); - Groupwf::truncate(); $this->createGroups(); } @@ -28,7 +28,7 @@ class GroupsAjaxTest extends TestCase */ private function createGroups() { - $this->groups = factory(Groupwf::class, 10)->create(); + $this->groups = Groupwf::factory(10)->create(); } /** @@ -58,6 +58,7 @@ class GroupsAjaxTest extends TestCase { global $RBAC; $_POST['action'] = 'groupsList'; + $_GET['action'] = 'groupsList'; $_REQUEST["dir"] = "DESC"; $_REQUEST["sort"] = "GRP_TITLE"; @@ -68,10 +69,9 @@ class GroupsAjaxTest extends TestCase $content = ob_get_clean(); $content = json_decode($content, JSON_OBJECT_AS_ARRAY); - // @todo, review the issue in the circle CI - //$this->assertArrayHasKey("success", $content); - //$this->assertArrayHasKey("groups", $content); - //$this->assertTrue($content["success"]); - //$this->assertTrue(is_array($content["groups"])); + $this->assertArrayHasKey("success", $content); + $this->assertArrayHasKey("groups", $content); + $this->assertTrue($content["success"]); + $this->assertTrue(is_array($content["groups"])); } } diff --git a/tests/unit/workflow/engine/methods/services/ActionsByEmailDataFormTest.php b/tests/unit/workflow/engine/methods/services/ActionsByEmailDataFormTest.php index 61033397f..f4d348de8 100644 --- a/tests/unit/workflow/engine/methods/services/ActionsByEmailDataFormTest.php +++ b/tests/unit/workflow/engine/methods/services/ActionsByEmailDataFormTest.php @@ -46,16 +46,16 @@ class ActionsByEmailDataFormTest extends TestCase */ public function it_should_test_view_action_by_email_with_time_zone() { - $process = factory(\ProcessMaker\Model\Process::class)->create(); + $process = \ProcessMaker\Model\Process::factory()->create(); $pathData = PATH_TRUNK . "tests/resources/dynaform1.json"; $content = file_get_contents($pathData); - $dynaform = factory(\ProcessMaker\Model\Dynaform::class)->create([ + $dynaform = \ProcessMaker\Model\Dynaform::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'DYN_CONTENT' => $content ]); - $delegation = factory(\ProcessMaker\Model\Delegation::class)->state('closed')->create([ + $delegation = \ProcessMaker\Model\Delegation::factory()->closed()->create([ 'PRO_UID' => $process->PRO_UID ]); @@ -78,6 +78,6 @@ class ActionsByEmailDataFormTest extends TestCase ob_end_clean(); $this->assertNotEmpty($content); - $this->assertContains('ID_ABE_FORM_ALREADY_FILLED', $content); + $this->assertStringContainsString('ID_ABE_FORM_ALREADY_FILLED', $content); } } diff --git a/tests/unit/workflow/engine/methods/users/UsersAjaxTest.php b/tests/unit/workflow/engine/methods/users/UsersAjaxTest.php index a5825b391..7262b44e3 100644 --- a/tests/unit/workflow/engine/methods/users/UsersAjaxTest.php +++ b/tests/unit/workflow/engine/methods/users/UsersAjaxTest.php @@ -28,10 +28,10 @@ class UsersAjaxTest extends TestCase //Declare the global variable global $RBAC; //Creates the user factory - $user = factory(User::class)->create(); + $user = User::factory()->create(); $usrUid = $user['USR_UID']; //Creates the configuration factory - factory(Configuration::class)->create([ + Configuration::factory()->create([ 'CFG_UID' => 'USER_PREFERENCES', 'OBJ_UID' => '', 'CFG_VALUE' => 'a:3:{s:12:"DEFAULT_LANG";s:0:"";s:12:"DEFAULT_MENU";s:8:"PM_SETUP";s:18:"DEFAULT_CASES_MENU";s:0:"";}', @@ -88,7 +88,7 @@ class UsersAjaxTest extends TestCase //Declare the global variable global $RBAC; //Creates the user factory - $user2 = factory(User::class)->create( + $user2 = User::factory()->create( [ 'USR_ROLE' => 'PROCESSMAKER_ADMIN', 'USR_EMAIL' => 'test@processmaker.com' @@ -96,7 +96,7 @@ class UsersAjaxTest extends TestCase ); $usrUid = $user2['USR_UID']; //Creates the configuration factory - factory(Configuration::class)->create([ + Configuration::factory()->create([ 'CFG_UID' => 'USER_PREFERENCES', 'OBJ_UID' => '', 'CFG_VALUE' => 'a:3:{s:12:"DEFAULT_LANG";s:0:"";s:12:"DEFAULT_MENU";s:8:"PM_SETUP";s:18:"DEFAULT_CASES_MENU";s:0:"";}', @@ -106,7 +106,7 @@ class UsersAjaxTest extends TestCase ]); //Creates the UsersRoles factory - factory(RbacUsersRoles::class)->create( + RbacUsersRoles::factory()->create( [ 'USR_UID' => $usrUid, 'ROL_UID' => '00000000000000000000000000000002' diff --git a/tests/unit/workflow/engine/methods/users/Users_AjaxTest.php b/tests/unit/workflow/engine/methods/users/Users_AjaxTest.php index c247310d7..441cb7b2a 100644 --- a/tests/unit/workflow/engine/methods/users/Users_AjaxTest.php +++ b/tests/unit/workflow/engine/methods/users/Users_AjaxTest.php @@ -31,16 +31,16 @@ class Users_AjaxTest extends TestCase global $RBAC; //Creates the user factory - $user = factory(User::class)->create(); + $user = User::factory()->create(); $usrUid = $user['USR_UID']; - factory(Process::class)->create([ + Process::factory()->create([ 'PRO_CREATE_USER' => $usrUid, 'PRO_STATUS' => 'ACTIVE', 'PRO_TYPE_PROCESS' => 'PRIVATE', ]); //Creates the configuration factory - factory(Configuration::class)->create([ + Configuration::factory()->create([ 'CFG_UID' => 'USER_PREFERENCES', 'OBJ_UID' => '', 'CFG_VALUE' => 'a:3:{s:12:"DEFAULT_LANG";s:0:"";s:12:"DEFAULT_MENU";s:8:"PM_SETUP";s:18:"DEFAULT_CASES_MENU";s:0:"";}', @@ -94,8 +94,8 @@ class Users_AjaxTest extends TestCase global $RBAC; //Creates the user factory - $user = factory(User::class)->create(); - factory(RbacUsers::class)->create([ + $user = User::factory()->create(); + RbacUsers::factory()->create([ 'USR_UID' => $user['USR_UID'], 'USR_USERNAME' => $user->USR_USERNAME, 'USR_FIRSTNAME' => $user->USR_FIRSTNAME, @@ -103,7 +103,7 @@ class Users_AjaxTest extends TestCase ]); $usrUid = $user['USR_UID']; - $process = factory(Process::class)->create([ + $process = Process::factory()->create([ 'PRO_CREATE_USER' => $usrUid, 'PRO_STATUS' => 'ACTIVE', 'PRO_TYPE_PROCESS' => 'PRIVATE', diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/ActionsByEmailTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/ActionsByEmailTest.php index ab20ed1ee..fec4be8ee 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/ActionsByEmailTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/ActionsByEmailTest.php @@ -16,6 +16,16 @@ use Tests\TestCase; class ActionsByEmailTest extends TestCase { + /** + * + * @return void + */ + public function setUp(): void + { + parent::setUp(); + $this->truncateNonInitialModels(); + } + /** * Test the forwardMail method * @@ -25,21 +35,21 @@ class ActionsByEmailTest extends TestCase public function it_should_test_the_forward_mail_method() { //Create the Task factory - factory(Task::class)->create(); + Task::factory()->create(); //Create the Process factory - factory(Process::class)->create(); + Process::factory()->create(); //Create the Dynaform factory - factory(Dynaform::class)->create(); + Dynaform::factory()->create(); //Create the EmailServerModel factory - factory(EmailServerModel::class)->create(); + EmailServerModel::factory()->create(); //Create the Application factory - factory(Application::class)->create(); + Application::factory()->create(); //Create the Delegation factory - $delegation = factory(Delegation::class)->create(); + $delegation = Delegation::factory()->create(); //Create the AbeConfiguration factory - $abeConfiguration = factory(AbeConfiguration::class)->create(); + $abeConfiguration = AbeConfiguration::factory()->create(); //Create the AbeConfiguration factory - $abeRequest = factory(AbeRequest::class)->create([ + $abeRequest = AbeRequest::factory()->create([ 'ABE_UID' => $abeConfiguration->ABE_UID, 'APP_UID' => $delegation->APP_UID, 'DEL_INDEX' => $delegation->DEL_INDEX, @@ -60,7 +70,7 @@ class ActionsByEmailTest extends TestCase $res = $abe->forwardMail($arrayData); //Assert the email was sent successfully - $this->assertContains('**ID_EMAIL_RESENT_TO**: ' . $abeRequest->ABE_REQ_SENT_TO, $res); + $this->assertStringContainsString('**ID_EMAIL_RESENT_TO**: ' . $abeRequest->ABE_REQ_SENT_TO, $res); } /** @@ -72,21 +82,21 @@ class ActionsByEmailTest extends TestCase public function it_should_test_the_forward_mail_method_when_an_error_occurs() { //Create the Task factory - factory(Task::class)->create(); + Task::factory()->create(); //Create the Process factory - factory(Process::class)->create(); + Process::factory()->create(); //Create the Dynaform factory - factory(Dynaform::class)->create(); + Dynaform::factory()->create(); //Create the EmailServerModel factory - factory(EmailServerModel::class)->create(); + EmailServerModel::factory()->create(); //Create the Application factory - factory(Application::class)->create(); + Application::factory()->create(); //Create the Delegation factory - $delegation = factory(Delegation::class)->create(); + $delegation = Delegation::factory()->create(); //Create the AbeConfiguration factory - $abeConfiguration = factory(AbeConfiguration::class)->create(); + $abeConfiguration = AbeConfiguration::factory()->create(); //Create the AbeConfiguration factory - $abeRequest = factory(AbeRequest::class)->create([ + $abeRequest = AbeRequest::factory()->create([ 'ABE_UID' => $abeConfiguration->ABE_UID, 'APP_UID' => $delegation->APP_UID, 'DEL_INDEX' => $delegation->DEL_INDEX, @@ -107,7 +117,7 @@ class ActionsByEmailTest extends TestCase $res = $abe->forwardMail($arrayData); //Assert that an unexpected error occur - $this->assertContains('**ID_UNEXPECTED_ERROR_OCCURRED_PLEASE**', $res); + $this->assertStringContainsString('**ID_UNEXPECTED_ERROR_OCCURRED_PLEASE**', $res); } /** @@ -119,23 +129,23 @@ class ActionsByEmailTest extends TestCase public function it_should_test_the_forward_mail_method_when_the_email_cannot_be_sent() { //Create the Task factory - factory(Task::class)->create(); + Task::factory()->create(); //Create the Process factory - factory(Process::class)->create(); + Process::factory()->create(); //Create the Dynaform factory - factory(Dynaform::class)->create(); + Dynaform::factory()->create(); //Create the EmailServerModel factory - factory(EmailServerModel::class)->create(); + EmailServerModel::factory()->create(); //Create the Application factory - factory(Application::class)->create(); + Application::factory()->create(); //Create the Delegation factory - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'DEL_FINISH_DATE' => '2019-09-27 14:53:06' ]); //Create the AbeConfiguration factory - $abeConfiguration = factory(AbeConfiguration::class)->create(); + $abeConfiguration = AbeConfiguration::factory()->create(); //Create the AbeConfiguration factory - $abeRequest = factory(AbeRequest::class)->create([ + $abeRequest = AbeRequest::factory()->create([ 'ABE_UID' => $abeConfiguration->ABE_UID, 'APP_UID' => $delegation->APP_UID, 'DEL_INDEX' => $delegation->DEL_INDEX, @@ -156,7 +166,7 @@ class ActionsByEmailTest extends TestCase $res = $abe->forwardMail($arrayData); //Assert the email was not sent - $this->assertContains('**ID_UNABLE_TO_SEND_EMAIL**', $res); + $this->assertStringContainsString('**ID_UNABLE_TO_SEND_EMAIL**', $res); } /** @@ -168,23 +178,23 @@ class ActionsByEmailTest extends TestCase public function it_should_test_the_forward_mail_method_when_the_req_uid_is_not_set() { //Create the Task factory - factory(Task::class)->create(); + Task::factory()->create(); //Create the Process factory - factory(Process::class)->create(); + Process::factory()->create(); //Create the Dynaform factory - factory(Dynaform::class)->create(); + Dynaform::factory()->create(); //Create the EmailServerModel factory - factory(EmailServerModel::class)->create(); + EmailServerModel::factory()->create(); //Create the Application factory - factory(Application::class)->create(); + Application::factory()->create(); //Create the Delegation factory - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'DEL_FINISH_DATE' => '2019-09-27 14:53:06' ]); //Create the AbeConfiguration factory - $abeConfiguration = factory(AbeConfiguration::class)->create(); + $abeConfiguration = AbeConfiguration::factory()->create(); //Create the AbeConfiguration factory - $abeRequest = factory(AbeRequest::class)->create([ + $abeRequest = AbeRequest::factory()->create([ 'ABE_UID' => $abeConfiguration->ABE_UID, 'APP_UID' => $delegation->APP_UID, 'DEL_INDEX' => $delegation->DEL_INDEX, @@ -204,7 +214,7 @@ class ActionsByEmailTest extends TestCase $res = $abe->forwardMail($arrayData); //Assert the email was not sent - $this->assertContains('**ID_UNEXPECTED_ERROR_OCCURRED_PLEASE**', $res); + $this->assertStringContainsString('**ID_UNEXPECTED_ERROR_OCCURRED_PLEASE**', $res); } /** @@ -216,23 +226,23 @@ class ActionsByEmailTest extends TestCase public function it_should_test_the_forward_mail_method_with_ssl() { //Create the Task factory - factory(Task::class)->create(); + Task::factory()->create(); //Create the Process factory - factory(Process::class)->create(); + Process::factory()->create(); //Create the Dynaform factory - factory(Dynaform::class)->create(); + Dynaform::factory()->create(); //Create the EmailServerModel factory with smtp secure - factory(EmailServerModel::class)->create( + EmailServerModel::factory()->create( ['SMTPSECURE' => 'ssl'] ); //Create the Application factory - factory(Application::class)->create(); + Application::factory()->create(); //Create the Delegation factory - $delegation = factory(Delegation::class)->create(); + $delegation = Delegation::factory()->create(); //Create the AbeConfiguration factory - $abeConfiguration = factory(AbeConfiguration::class)->create(); + $abeConfiguration = AbeConfiguration::factory()->create(); //Create the AbeConfiguration factory - $abeRequest = factory(AbeRequest::class)->create([ + $abeRequest = AbeRequest::factory()->create([ 'ABE_UID' => $abeConfiguration->ABE_UID, 'APP_UID' => $delegation->APP_UID, 'DEL_INDEX' => $delegation->DEL_INDEX, @@ -253,7 +263,7 @@ class ActionsByEmailTest extends TestCase $res = $abe->forwardMail($arrayData); //Assert the email was sent successfully - $this->assertContains('**ID_EMAIL_RESENT_TO**: ' . $abeRequest->ABE_REQ_SENT_TO, $res); + $this->assertStringContainsString('**ID_EMAIL_RESENT_TO**: ' . $abeRequest->ABE_REQ_SENT_TO, $res); } /** @@ -264,13 +274,11 @@ class ActionsByEmailTest extends TestCase */ public function it_should_test_the_load_action_by_email_method() { - AbeConfiguration::truncate(); - AbeRequest::truncate(); - $user = factory(User::class)->create(); - $application = factory(Application::class)->create([ + $user = User::factory()->create(); + $application = Application::factory()->create([ 'APP_UID' => '123456asse' ]); - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'USR_UID' => $user->USR_UID, 'USR_ID' => $user->USR_ID, 'APP_UID' => $application->APP_UID, @@ -278,7 +286,7 @@ class ActionsByEmailTest extends TestCase 'DEL_PREVIOUS' => 0, 'DEL_INDEX' => 1 ]); - $delegation2 = factory(Delegation::class)->create([ + $delegation2 = Delegation::factory()->create([ 'USR_UID' => $user->USR_UID, 'USR_ID' => $user->USR_ID, 'APP_UID' => $application->APP_UID, @@ -286,12 +294,12 @@ class ActionsByEmailTest extends TestCase 'DEL_PREVIOUS' => 1, 'DEL_INDEX' => 2 ]); - $abeConfiguration = factory(AbeConfiguration::class)->create([ + $abeConfiguration = AbeConfiguration::factory()->create([ 'PRO_UID' => $delegation->PRO_UID, 'TAS_UID' => $delegation->TAS_UID, 'ABE_TYPE' => 'LINK', ]); - $abeRequest = factory(AbeRequest::class)->create([ + $abeRequest = AbeRequest::factory()->create([ 'ABE_UID' => $abeConfiguration->ABE_UID, 'APP_UID' => $delegation2->APP_UID, 'DEL_INDEX' => $delegation2->DEL_INDEX, diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/AbstractCasesTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/AbstractCasesTest.php index eac1d5506..2b7516a16 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/AbstractCasesTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/AbstractCasesTest.php @@ -4,7 +4,6 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases; use Exception; use G; -use Illuminate\Foundation\Testing\DatabaseTransactions; use ProcessMaker\BusinessModel\Cases\AbstractCases; use ProcessMaker\BusinessModel\Cases\Draft; use ProcessMaker\BusinessModel\Cases\Paused; @@ -24,7 +23,14 @@ use Tests\TestCase; */ class AbstractCasesTest extends TestCase { - use DatabaseTransactions; + /** + * Method set up. + */ + public function setUp(): void + { + parent::setUp(); + $this->truncateNonInitialModels(); + } /** * This check the getter and setter related to the category @@ -35,7 +41,7 @@ class AbstractCasesTest extends TestCase */ public function it_return_set_get_category() { - $category = factory(ProcessCategory::class)->create(); + $category = ProcessCategory::factory()->create(); $absCases = new AbstractCases(); $absCases->setCategoryId($category->CATEGORY_ID); $actual = $absCases->getCategoryId(); @@ -51,7 +57,7 @@ class AbstractCasesTest extends TestCase */ public function it_return_set_get_category_uid() { - $category = factory(ProcessCategory::class)->create(); + $category = ProcessCategory::factory()->create(); $absCases = new AbstractCases(); $absCases->setCategoryUid($category->CATEGORY_UID); $actual = $absCases->getCategoryUid(); @@ -69,7 +75,7 @@ class AbstractCasesTest extends TestCase */ public function it_return_set_get_process() { - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); $absCases = new AbstractCases(); $absCases->setProcessUid($process->PRO_UID); $actual = $absCases->getProcessUid(); @@ -88,7 +94,7 @@ class AbstractCasesTest extends TestCase */ public function it_return_set_get_task() { - $task = factory(Task::class)->create(); + $task = Task::factory()->create(); $absCases = new AbstractCases(); $absCases->setTaskId($task->TAS_ID); $actual = $absCases->getTaskId(); @@ -106,7 +112,7 @@ class AbstractCasesTest extends TestCase */ public function it_return_set_get_user() { - $users = factory(User::class)->create(); + $users = User::factory()->create(); $absCases = new AbstractCases(); $absCases->setUserUid($users->USR_UID); $actual = $absCases->getUserUid(); @@ -125,7 +131,7 @@ class AbstractCasesTest extends TestCase */ public function it_return_set_get_user_completed() { - $users = factory(User::class)->create(); + $users = User::factory()->create(); $absCases = new AbstractCases(); $absCases->setUserCompletedId($users->USR_ID); $actual = $absCases->getUserCompletedId(); @@ -141,7 +147,7 @@ class AbstractCasesTest extends TestCase */ public function it_return_set_get_user_started() { - $users = factory(User::class)->create(); + $users = User::factory()->create(); $absCases = new AbstractCases(); $absCases->setUserStartedId($users->USR_ID); $actual = $absCases->getUserStartedId(); @@ -157,7 +163,7 @@ class AbstractCasesTest extends TestCase */ public function it_return_set_get_user_send() { - $users = factory(User::class)->create(); + $users = User::factory()->create(); $absCases = new AbstractCases(); $absCases->setSendBy($users->USR_UID); $actual = $absCases->getSendBy(); @@ -224,7 +230,7 @@ class AbstractCasesTest extends TestCase */ public function it_return_set_get_case_number() { - $case = factory(Application::class)->create(); + $case = Application::factory()->create(); $absCases = new AbstractCases(); $absCases->setCaseNumber($case->APP_NUMBER); $actual = $absCases->getCaseNumber(); @@ -242,8 +248,8 @@ class AbstractCasesTest extends TestCase */ public function it_return_set_get_range_case_number() { - $case1 = factory(Application::class)->create(); - $case2 = factory(Application::class)->create([ + $case1 = Application::factory()->create(); + $case2 = Application::factory()->create([ 'APP_NUMBER' => $case1->APP_NUMBER + 1 ]); $absCases = new AbstractCases(); @@ -448,7 +454,7 @@ class AbstractCasesTest extends TestCase */ public function it_return_set_get_case() { - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); $absCases = new AbstractCases(); $absCases->setCaseUid($application->APP_UID); $actual = $absCases->getCaseUid(); @@ -934,7 +940,7 @@ class AbstractCasesTest extends TestCase */ public function it_return_task_pending_result() { - $task = factory(Task::class, 2)->create(); + $task = Task::factory(2)->create(); $absCases = new AbstractCases(); $pending = '[ {"tas_id":'.$task[0]->TAS_ID.', "user_id":1, "due_date":"2020-12-04 19:11:14"}, @@ -956,7 +962,7 @@ class AbstractCasesTest extends TestCase */ public function it_return_thread_information() { - $delegation = factory(Delegation::class)->states('foreign_keys')->create(); + $delegation = Delegation::factory()->foreign_keys()->create(); $taskPending = Delegation::getLastThread($delegation->APP_NUMBER); $absCases = new AbstractCases(); foreach ($taskPending as $thread) { diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/BatchRoutingTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/BatchRoutingTest.php index dd274780f..c9fa23842 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/BatchRoutingTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/BatchRoutingTest.php @@ -2,7 +2,6 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases; -use Illuminate\Foundation\Testing\DatabaseTransactions; use ProcessMaker\BusinessModel\Cases\BatchRouting; use ProcessMaker\Model\Consolidated; use ProcessMaker\Model\Delegation; @@ -15,14 +14,13 @@ use Tests\TestCase; */ class BatchRoutingTest extends TestCase { - use DatabaseTransactions; - /** * Method set up. */ public function setUp(): void { parent::setUp(); + $this->truncateNonInitialModels(); } /** @@ -32,8 +30,8 @@ class BatchRoutingTest extends TestCase */ public function createConsolidated() { - $consolidated = factory(Consolidated::class)->states('foreign_keys')->create(); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $consolidated = Consolidated::factory()->foreign_keys()->create(); + $delegation = Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'TAS_UID' => $consolidated->TAS_UID, ]); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/CanceledTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/CanceledTest.php index 1f10bc465..f5aae7829 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/CanceledTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/CanceledTest.php @@ -2,7 +2,6 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases; -use Illuminate\Foundation\Testing\DatabaseTransactions; use ProcessMaker\BusinessModel\Cases\Canceled; use ProcessMaker\Model\Application; use ProcessMaker\Model\Delegation; @@ -15,14 +14,13 @@ use Tests\TestCase; */ class CanceledTest extends TestCase { - use DatabaseTransactions; - /** * Method set up. */ public function setUp(): void { parent::setUp(); + $this->truncateNonInitialModels(); } /** @@ -32,8 +30,8 @@ class CanceledTest extends TestCase */ public function createCanceled() { - $application = factory(Application::class)->states('canceled')->create(); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->canceled()->create(); + $delegation = Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'CLOSED', 'DEL_INDEX' => 1, 'USR_UID' => $application->APP_INIT_USER, diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/CasesListTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/CasesListTest.php index a259bc05d..113f17de6 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/CasesListTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/CasesListTest.php @@ -2,7 +2,6 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases; -use Illuminate\Foundation\Testing\DatabaseTransactions; use ProcessMaker\BusinessModel\Cases\CasesList; use ProcessMaker\Model\Application; use ProcessMaker\Model\Delegation; @@ -15,14 +14,13 @@ use Tests\TestCase; */ class CasesListTest extends TestCase { - use DatabaseTransactions; - /** * Method set up. */ public function setUp(): void { parent::setUp(); + $this->truncateNonInitialModels(); } /** @@ -32,8 +30,8 @@ class CasesListTest extends TestCase */ public function createCases() { - $application = factory(Application::class)->states('completed')->create(); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->completed()->create(); + $delegation = Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'CLOSED', 'DEL_INDEX' => 1, 'USR_UID' => $application->APP_INIT_USER, @@ -64,7 +62,7 @@ class CasesListTest extends TestCase */ public function it_return_all_counters() { - $delegation = factory(Delegation::class)->states('foreign_keys')->create(); + $delegation = Delegation::factory()->foreign_keys()->create(); $count = new CasesList(); $result = $count->getAllCounters($delegation->USR_UID); $this->assertNotEmpty($result); @@ -88,7 +86,7 @@ class CasesListTest extends TestCase */ public function it_return_at_least_one() { - $delegation = factory(Delegation::class)->states('foreign_keys')->create(); + $delegation = Delegation::factory()->foreign_keys()->create(); $count = new CasesList(); $result = $count->atLeastOne($delegation->USR_UID); $this->assertNotEmpty($result); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/CompletedTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/CompletedTest.php index 2afdeb05b..abc4c7fe5 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/CompletedTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/CompletedTest.php @@ -2,7 +2,6 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases; -use Illuminate\Foundation\Testing\DatabaseTransactions; use ProcessMaker\BusinessModel\Cases\Completed; use ProcessMaker\Model\Application; use ProcessMaker\Model\Delegation; @@ -15,14 +14,13 @@ use Tests\TestCase; */ class CompletedTest extends TestCase { - use DatabaseTransactions; - /** * Method set up. */ public function setUp(): void { parent::setUp(); + $this->truncateNonInitialModels(); } /** @@ -32,8 +30,8 @@ class CompletedTest extends TestCase */ public function createCompleted() { - $application = factory(Application::class)->states('completed')->create(); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->completed()->create(); + $delegation = Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'CLOSED', 'DEL_INDEX' => 1, 'USR_UID' => $application->APP_INIT_USER, diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/DraftTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/DraftTest.php index 51c7fc92d..a000b7841 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/DraftTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/DraftTest.php @@ -4,7 +4,6 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases; use DateInterval; use Datetime; -use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Support\Facades\DB; use ProcessMaker\BusinessModel\Cases\Draft; use ProcessMaker\Model\AdditionalTables; @@ -22,16 +21,13 @@ use Tests\TestCase; */ class DraftTest extends TestCase { - use DatabaseTransactions; - /** * Method set up. */ public function setUp(): void { parent::setUp(); - Delegation::truncate(); - Application::truncate(); + $this->truncateNonInitialModels(); } /** @@ -43,8 +39,8 @@ class DraftTest extends TestCase */ public function createDraft() { - $application = factory(Application::class)->states('draft')->create(); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->draft()->create(); + $delegation = Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application->APP_INIT_USER, @@ -64,15 +60,15 @@ class DraftTest extends TestCase */ public function createManyDraft($cases) { - $user = factory(\ProcessMaker\Model\User::class)->create(); + $user = \ProcessMaker\Model\User::factory()->create(); for ($i = 0; $i < $cases; $i = $i + 1) { - $application = factory(Application::class)->states('draft')->create([ + $application = Application::factory()->draft()->create([ 'APP_INIT_USER' => $user->USR_UID, 'APP_INIT_USER_ID' => $user->USR_ID, 'APP_CUR_USER' => $user->USR_UID, ]); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $delegation = Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'APP_UID' => $application->APP_UID, @@ -341,18 +337,18 @@ class DraftTest extends TestCase */ public function it_should_test_get_counters_by_processes_method_no_filter() { - $process = factory(Process::class)->create(); - $process2 = factory(Process::class)->create(); - $user = factory(User::class)->create(); - $application1 = factory(Application::class)->states('draft')->create([ + $process = Process::factory()->create(); + $process2 = Process::factory()->create(); + $user = User::factory()->create(); + $application1 = Application::factory()->draft()->create([ 'APP_INIT_USER' => $user->USR_UID, 'APP_CUR_USER' => $user->USR_UID, ]); - $application2 = factory(Application::class)->states('draft')->create([ + $application2 = Application::factory()->draft()->create([ 'APP_INIT_USER' => $user->USR_UID, 'APP_CUR_USER' => $user->USR_UID, ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application1->APP_INIT_USER, @@ -362,7 +358,7 @@ class DraftTest extends TestCase 'PRO_ID' => $process->PRO_ID, 'PRO_UID' => $process->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application2->APP_INIT_USER, @@ -388,18 +384,18 @@ class DraftTest extends TestCase */ public function it_should_test_get_counters_by_processes_method_category() { - $process = factory(Process::class)->create([ + $process = Process::factory()->create([ 'CATEGORY_ID' => 1 ]); - $process2 = factory(Process::class)->create([ + $process2 = Process::factory()->create([ 'CATEGORY_ID' => 2 ]); - $user = factory(User::class)->create(); - $application = factory(Application::class, 5)->states('draft')->create([ + $user = User::factory()->create(); + $application = Application::factory(5)->draft()->create([ 'APP_INIT_USER' => $user->USR_UID, 'APP_CUR_USER' => $user->USR_UID, ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[0]->APP_INIT_USER, @@ -409,7 +405,7 @@ class DraftTest extends TestCase 'PRO_ID' => $process->PRO_ID, 'PRO_UID' => $process->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[1]->APP_INIT_USER, @@ -419,7 +415,7 @@ class DraftTest extends TestCase 'PRO_ID' => $process->PRO_ID, 'PRO_UID' => $process->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[2]->APP_INIT_USER, @@ -429,7 +425,7 @@ class DraftTest extends TestCase 'PRO_ID' => $process->PRO_ID, 'PRO_UID' => $process->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[3]->APP_INIT_USER, @@ -439,7 +435,7 @@ class DraftTest extends TestCase 'PRO_ID' => $process2->PRO_ID, 'PRO_UID' => $process2->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[4]->APP_INIT_USER, @@ -465,23 +461,23 @@ class DraftTest extends TestCase */ public function it_should_test_get_counters_by_processes_method_top_ten() { - $process1 = factory(Process::class)->create(); - $process2 = factory(Process::class)->create(); - $process3 = factory(Process::class)->create(); - $process4 = factory(Process::class)->create(); - $process5 = factory(Process::class)->create(); - $process6 = factory(Process::class)->create(); - $process7 = factory(Process::class)->create(); - $process8 = factory(Process::class)->create(); - $process9 = factory(Process::class)->create(); - $process10 = factory(Process::class)->create(); - $process11 = factory(Process::class)->create(); - $user = factory(User::class)->create(); - $application = factory(Application::class, 14)->states('draft')->create([ + $process1 = Process::factory()->create(); + $process2 = Process::factory()->create(); + $process3 = Process::factory()->create(); + $process4 = Process::factory()->create(); + $process5 = Process::factory()->create(); + $process6 = Process::factory()->create(); + $process7 = Process::factory()->create(); + $process8 = Process::factory()->create(); + $process9 = Process::factory()->create(); + $process10 = Process::factory()->create(); + $process11 = Process::factory()->create(); + $user = User::factory()->create(); + $application = Application::factory(14)->draft()->create([ 'APP_INIT_USER' => $user->USR_UID, 'APP_CUR_USER' => $user->USR_UID, ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[0]->APP_INIT_USER, @@ -491,7 +487,7 @@ class DraftTest extends TestCase 'PRO_ID' => $process1->PRO_ID, 'PRO_UID' => $process1->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[1]->APP_INIT_USER, @@ -501,7 +497,7 @@ class DraftTest extends TestCase 'PRO_ID' => $process1->PRO_ID, 'PRO_UID' => $process1->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[2]->APP_INIT_USER, @@ -511,7 +507,7 @@ class DraftTest extends TestCase 'PRO_ID' => $process1->PRO_ID, 'PRO_UID' => $process1->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[3]->APP_INIT_USER, @@ -521,7 +517,7 @@ class DraftTest extends TestCase 'PRO_ID' => $process2->PRO_ID, 'PRO_UID' => $process2->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[4]->APP_INIT_USER, @@ -531,7 +527,7 @@ class DraftTest extends TestCase 'PRO_ID' => $process2->PRO_ID, 'PRO_UID' => $process2->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[5]->APP_INIT_USER, @@ -541,7 +537,7 @@ class DraftTest extends TestCase 'PRO_ID' => $process3->PRO_ID, 'PRO_UID' => $process3->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[6]->APP_INIT_USER, @@ -551,7 +547,7 @@ class DraftTest extends TestCase 'PRO_ID' => $process4->PRO_ID, 'PRO_UID' => $process4->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[7]->APP_INIT_USER, @@ -561,7 +557,7 @@ class DraftTest extends TestCase 'PRO_ID' => $process5->PRO_ID, 'PRO_UID' => $process5->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[8]->APP_INIT_USER, @@ -571,7 +567,7 @@ class DraftTest extends TestCase 'PRO_ID' => $process6->PRO_ID, 'PRO_UID' => $process6->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[9]->APP_INIT_USER, @@ -581,7 +577,7 @@ class DraftTest extends TestCase 'PRO_ID' => $process7->PRO_ID, 'PRO_UID' => $process7->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[10]->APP_INIT_USER, @@ -591,7 +587,7 @@ class DraftTest extends TestCase 'PRO_ID' => $process8->PRO_ID, 'PRO_UID' => $process8->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[11]->APP_INIT_USER, @@ -601,7 +597,7 @@ class DraftTest extends TestCase 'PRO_ID' => $process9->PRO_ID, 'PRO_UID' => $process9->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[12]->APP_INIT_USER, @@ -611,7 +607,7 @@ class DraftTest extends TestCase 'PRO_ID' => $process10->PRO_ID, 'PRO_UID' => $process10->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[13]->APP_INIT_USER, @@ -636,14 +632,14 @@ class DraftTest extends TestCase */ public function it_should_test_get_counters_by_processes_method_processes() { - $process = factory(Process::class)->create(); - $process2 = factory(Process::class)->create(); - $user = factory(User::class)->create(); - $application = factory(Application::class, 14)->states('draft')->create([ + $process = Process::factory()->create(); + $process2 = Process::factory()->create(); + $user = User::factory()->create(); + $application = Application::factory(14)->draft()->create([ 'APP_INIT_USER' => $user->USR_UID, 'APP_CUR_USER' => $user->USR_UID, ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[0]->APP_INIT_USER, @@ -653,7 +649,7 @@ class DraftTest extends TestCase 'PRO_ID' => $process->PRO_ID, 'PRO_UID' => $process->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[1]->APP_INIT_USER, @@ -679,14 +675,14 @@ class DraftTest extends TestCase */ public function it_should_test_get_counters_by_range_method() { - $process1 = factory(Process::class)->create(); - $process2 = factory(Process::class)->create(); - $user = factory(User::class)->create(); - $application = factory(Application::class, 4)->states('draft')->create([ + $process1 = Process::factory()->create(); + $process2 = Process::factory()->create(); + $user = User::factory()->create(); + $application = Application::factory(4)->draft()->create([ 'APP_INIT_USER' => $user->USR_UID, 'APP_CUR_USER' => $user->USR_UID, ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[0]->APP_INIT_USER, @@ -697,7 +693,7 @@ class DraftTest extends TestCase 'PRO_UID' => $process1->PRO_UID, 'DEL_DELEGATE_DATE' => '2021-05-20 09:52:32' ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[1]->APP_INIT_USER, @@ -708,7 +704,7 @@ class DraftTest extends TestCase 'PRO_UID' => $process1->PRO_UID, 'DEL_DELEGATE_DATE' => '2021-05-21 09:52:32' ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[2]->APP_INIT_USER, @@ -719,7 +715,7 @@ class DraftTest extends TestCase 'PRO_UID' => $process1->PRO_UID, 'DEL_DELEGATE_DATE' => '2021-05-22 00:00:00' ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[3]->APP_INIT_USER, @@ -757,9 +753,8 @@ class DraftTest extends TestCase */ public function it_should_test_getCustomListCount_method() { - $this->markTestIncomplete('Illegal mix of collations'); $cases = $this->createManyDraft(3); - $additionalTables = factory(AdditionalTables::class)->create([ + $additionalTables = AdditionalTables::factory()->create([ 'PRO_UID' => $cases->PRO_UID ]); $query = "" @@ -771,10 +766,11 @@ class DraftTest extends TestCase . "`VAR2` varchar(255) DEFAULT NULL," . "`VAR3` varchar(255) DEFAULT NULL," . "PRIMARY KEY (`APP_UID`)," - . "KEY `indexTable` (`APP_UID`))"; + . "KEY `indexTable` (`APP_UID`)" + . ")ENGINE=InnoDB DEFAULT CHARSET='utf8'"; DB::statement($query); - $caseList = factory(CaseList::class)->create([ + $caseList = CaseList::factory()->create([ 'CAL_TYPE' => 'draft', 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID, 'USR_ID' => $cases->USR_ID @@ -809,13 +805,13 @@ class DraftTest extends TestCase $currentDate = $date->format('Y-m-d H:i:s'); $diff1Day = new DateInterval('P1D'); $diff2Days = new DateInterval('P2D'); - $process = factory(Process::class)->create(); - $user = factory(User::class)->create(); - $application = factory(Application::class, 14)->states('draft')->create([ + $process = Process::factory()->create(); + $user = User::factory()->create(); + $application = Application::factory(14)->draft()->create([ 'APP_INIT_USER' => $user->USR_UID, 'APP_CUR_USER' => $user->USR_UID, ]); - $del = factory(Delegation::class)->states('foreign_keys')->create([ + $del = Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[0]->APP_INIT_USER, @@ -846,13 +842,13 @@ class DraftTest extends TestCase $date = new DateTime('now'); $currentDate = $date->format('Y-m-d H:i:s'); $diff2Days = new DateInterval('P2D'); - $process = factory(Process::class)->create(); - $user = factory(User::class)->create(); - $application = factory(Application::class, 14)->states('draft')->create([ + $process = Process::factory()->create(); + $user = User::factory()->create(); + $application = Application::factory(14)->draft()->create([ 'APP_INIT_USER' => $user->USR_UID, 'APP_CUR_USER' => $user->USR_UID, ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[0]->APP_INIT_USER, @@ -883,13 +879,13 @@ class DraftTest extends TestCase $date = new DateTime('now'); $currentDate = $date->format('Y-m-d H:i:s'); $diff2Days = new DateInterval('P2D'); - $process = factory(Process::class)->create(); - $user = factory(User::class)->create(); - $application = factory(Application::class, 14)->states('draft')->create([ + $process = Process::factory()->create(); + $user = User::factory()->create(); + $application = Application::factory(14)->draft()->create([ 'APP_INIT_USER' => $user->USR_UID, 'APP_CUR_USER' => $user->USR_UID, ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application[0]->APP_INIT_USER, diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/HomeTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/HomeTest.php index 6f5e4f62a..8befc3035 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/HomeTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/HomeTest.php @@ -25,13 +25,13 @@ use Tests\TestCase; */ class HomeTest extends TestCase { - /** * setUp method. */ public function setUp(): void { parent::setUp(); + $this->truncateNonInitialModels(); } /** @@ -50,8 +50,8 @@ class HomeTest extends TestCase */ public function it_should_test_getDraft() { - $application = factory(Application::class)->states('draft')->create(); - factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->draft()->create(); + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application->APP_INIT_USER, @@ -73,8 +73,8 @@ class HomeTest extends TestCase */ public function it_should_test_getInbox() { - $application = factory(Application::class)->states('todo')->create(); - factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->todo()->create(); + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2 ]); @@ -93,30 +93,30 @@ class HomeTest extends TestCase */ public function it_should_test_getUnassigned() { - $user = factory(User::class)->create(); - $group = factory(Groupwf::class)->create(); - factory(GroupUser::class)->create([ + $user = User::factory()->create(); + $group = Groupwf::factory()->create(); + GroupUser::factory()->create([ 'GRP_UID' => $group->GRP_UID, 'GRP_ID' => $group->GRP_ID, 'USR_UID' => $user->USR_UID, ]); - $process = factory(Process::class)->create(); - $application = factory(Application::class)->create([ + $process = Process::factory()->create(); + $application = Application::factory()->create([ 'APP_STATUS_ID' => 2 ]); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID, 'PRO_ID' => $process->PRO_ID, ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, 'TU_TYPE' => 1 ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'PRO_ID' => $process->PRO_ID, @@ -139,17 +139,17 @@ class HomeTest extends TestCase */ public function it_should_test_getPaused() { - $user = factory(User::class)->create(); - $process1 = factory(Process::class)->create(); - $task = factory(Task::class)->create([ + $user = User::factory()->create(); + $process1 = Process::factory()->create(); + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => '', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process1->PRO_UID, 'TAS_TYPE' => 'NORMAL' ]); - $application1 = factory(Application::class)->create(); - $delegation1 = factory(Delegation::class)->create([ + $application1 = Application::factory()->create(); + $delegation1 = Delegation::factory()->create([ 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'CLOSED', @@ -161,9 +161,9 @@ class HomeTest extends TestCase 'DEL_INDEX' => 2 ]); - $process2 = factory(Process::class)->create(); - $application2 = factory(Application::class)->create(); - $delegation2 = factory(Delegation::class)->create([ + $process2 = Process::factory()->create(); + $application2 = Application::factory()->create(); + $delegation2 = Delegation::factory()->create([ 'APP_NUMBER' => $application2->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', @@ -174,7 +174,7 @@ class HomeTest extends TestCase 'DEL_PREVIOUS' => 1, 'DEL_INDEX' => 2 ]); - factory(AppDelay::class, 5)->create([ + AppDelay::factory(5)->create([ 'APP_DELEGATION_USER' => $user->USR_UID, 'PRO_UID' => $process2->PRO_UID, 'APP_NUMBER' => $delegation1->APP_NUMBER, @@ -182,7 +182,7 @@ class HomeTest extends TestCase 'APP_DISABLE_ACTION_USER' => 0, 'APP_TYPE' => 'PAUSE' ]); - factory(AppDelay::class, 5)->create([ + AppDelay::factory(5)->create([ 'APP_DELEGATION_USER' => $user->USR_UID, 'PRO_UID' => $process2->PRO_UID, 'APP_NUMBER' => $delegation2->APP_NUMBER, @@ -205,9 +205,8 @@ class HomeTest extends TestCase */ public function it_should_test_buildCustomCaseList() { - $this->markTestIncomplete('Illegal mix of collations'); - $user = factory(User::class)->create(); - $additionalTables = factory(AdditionalTables::class)->create(); + $user = User::factory()->create(); + $additionalTables = AdditionalTables::factory()->create(); $query = "" . "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` (" . "`APP_UID` varchar(32) NOT NULL," @@ -217,24 +216,25 @@ class HomeTest extends TestCase . "`VAR2` varchar(255) DEFAULT NULL," . "`VAR3` varchar(255) DEFAULT NULL," . "PRIMARY KEY (`APP_UID`)," - . "KEY `indexTable` (`APP_UID`))"; + . "KEY `indexTable` (`APP_UID`)" + . ")ENGINE=InnoDB DEFAULT CHARSET='utf8'"; DB::statement($query); - factory(Fields::class)->create([ + Fields::factory()->create([ 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID, 'FLD_NAME' => 'VAR1' ]); - factory(Fields::class)->create([ + Fields::factory()->create([ 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID, 'FLD_NAME' => 'VAR2' ]); - factory(Fields::class)->create([ + Fields::factory()->create([ 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID, 'FLD_NAME' => 'VAR3' ]); //for inbox $type = 'inbox'; - $caseList = factory(CaseList::class)->create([ + $caseList = CaseList::factory()->create([ 'CAL_TYPE' => $type, 'CAL_COLUMNS' => '[{"field":"case_number","enableFilter":false,"set":true},{"field":"case_title","enableFilter":false,"set":true},{"field":"process_name","enableFilter":false,"set":true},{"field":"task","enableFilter":false,"set":true},{"field":"send_by","enableFilter":false,"set":true},{"field":"due_date","enableFilter":false,"set":true},{"field":"delegation_date","enableFilter":false,"set":true},{"field":"priority","enableFilter":false,"set":true},{"field":"VAR1","enableFilter":false,"set":true},{"field":"VAR2","enableFilter":false,"set":true},{"field":"VAR3","enableFilter":false,"set":false}]', 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID, @@ -256,8 +256,7 @@ class HomeTest extends TestCase */ public function it_should_test_getCustomDraft() { - $this->markTestIncomplete('Illegal mix of collations'); - $additionalTables = factory(AdditionalTables::class)->create(); + $additionalTables = AdditionalTables::factory()->create(); $query = "" . "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` (" . "`APP_UID` varchar(32) NOT NULL," @@ -267,23 +266,24 @@ class HomeTest extends TestCase . "`VAR2` varchar(255) DEFAULT NULL," . "`VAR3` varchar(255) DEFAULT NULL," . "PRIMARY KEY (`APP_UID`)," - . "KEY `indexTable` (`APP_UID`))"; + . "KEY `indexTable` (`APP_UID`)" + . ")ENGINE=InnoDB DEFAULT CHARSET='utf8'"; DB::statement($query); - factory(Fields::class)->create([ + Fields::factory()->create([ 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID, 'FLD_NAME' => 'VAR1' ]); - factory(Fields::class)->create([ + Fields::factory()->create([ 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID, 'FLD_NAME' => 'VAR2' ]); - factory(Fields::class)->create([ + Fields::factory()->create([ 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID, 'FLD_NAME' => 'VAR3' ]); - $application = factory(Application::class)->states('draft')->create(); - factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->draft()->create(); + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application->APP_INIT_USER, @@ -291,7 +291,7 @@ class HomeTest extends TestCase 'APP_NUMBER' => $application->APP_NUMBER, ]); - $caseList = factory(CaseList::class)->create([ + $caseList = CaseList::factory()->create([ 'CAL_TYPE' => 'draft', 'CAL_COLUMNS' => '[{"field":"case_number","enableFilter":false,"set":true},{"field":"case_title","enableFilter":false,"set":true},{"field":"process_name","enableFilter":false,"set":true},{"field":"task","enableFilter":false,"set":true},{"field":"send_by","enableFilter":false,"set":true},{"field":"due_date","enableFilter":false,"set":true},{"field":"delegation_date","enableFilter":false,"set":true},{"field":"priority","enableFilter":false,"set":true},{"field":"VAR1","enableFilter":false,"set":true},{"field":"VAR2","enableFilter":false,"set":true},{"field":"VAR3","enableFilter":false,"set":false}]', 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID @@ -313,8 +313,7 @@ class HomeTest extends TestCase */ public function it_should_test_getCustomInbox() { - $this->markTestIncomplete('Illegal mix of collations'); - $additionalTables = factory(AdditionalTables::class)->create(); + $additionalTables = AdditionalTables::factory()->create(); $query = "" . "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` (" . "`APP_UID` varchar(32) NOT NULL," @@ -324,28 +323,29 @@ class HomeTest extends TestCase . "`VAR2` varchar(255) DEFAULT NULL," . "`VAR3` varchar(255) DEFAULT NULL," . "PRIMARY KEY (`APP_UID`)," - . "KEY `indexTable` (`APP_UID`))"; + . "KEY `indexTable` (`APP_UID`)" + . ")ENGINE=InnoDB DEFAULT CHARSET='utf8'"; DB::statement($query); - factory(Fields::class)->create([ + Fields::factory()->create([ 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID, 'FLD_NAME' => 'VAR1' ]); - factory(Fields::class)->create([ + Fields::factory()->create([ 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID, 'FLD_NAME' => 'VAR2' ]); - factory(Fields::class)->create([ + Fields::factory()->create([ 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID, 'FLD_NAME' => 'VAR3' ]); - $application = factory(Application::class)->states('todo')->create(); - factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->todo()->create(); + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2 ]); - $caseList = factory(CaseList::class)->create([ + $caseList = CaseList::factory()->create([ 'CAL_TYPE' => 'inbox', 'CAL_COLUMNS' => '[{"field":"case_number","enableFilter":false,"set":true},{"field":"case_title","enableFilter":false,"set":true},{"field":"process_name","enableFilter":false,"set":true},{"field":"task","enableFilter":false,"set":true},{"field":"send_by","enableFilter":false,"set":true},{"field":"due_date","enableFilter":false,"set":true},{"field":"delegation_date","enableFilter":false,"set":true},{"field":"priority","enableFilter":false,"set":true},{"field":"VAR1","enableFilter":false,"set":true},{"field":"VAR2","enableFilter":false,"set":true},{"field":"VAR3","enableFilter":false,"set":false}]', 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID @@ -367,8 +367,7 @@ class HomeTest extends TestCase */ public function it_should_test_getCustomUnassignedt() { - $this->markTestIncomplete('Illegal mix of collations'); - $additionalTables = factory(AdditionalTables::class)->create(); + $additionalTables = AdditionalTables::factory()->create(); $query = "" . "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` (" . "`APP_UID` varchar(32) NOT NULL," @@ -378,45 +377,46 @@ class HomeTest extends TestCase . "`VAR2` varchar(255) DEFAULT NULL," . "`VAR3` varchar(255) DEFAULT NULL," . "PRIMARY KEY (`APP_UID`)," - . "KEY `indexTable` (`APP_UID`))"; + . "KEY `indexTable` (`APP_UID`)" + . ")ENGINE=InnoDB DEFAULT CHARSET='utf8'"; DB::statement($query); - factory(Fields::class)->create([ + Fields::factory()->create([ 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID, 'FLD_NAME' => 'VAR1' ]); - factory(Fields::class)->create([ + Fields::factory()->create([ 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID, 'FLD_NAME' => 'VAR2' ]); - factory(Fields::class)->create([ + Fields::factory()->create([ 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID, 'FLD_NAME' => 'VAR3' ]); - $user = factory(User::class)->create(); - $group = factory(Groupwf::class)->create(); - factory(GroupUser::class)->create([ + $user = User::factory()->create(); + $group = Groupwf::factory()->create(); + GroupUser::factory()->create([ 'GRP_UID' => $group->GRP_UID, 'GRP_ID' => $group->GRP_ID, 'USR_UID' => $user->USR_UID, ]); - $process = factory(Process::class)->create(); - $application = factory(Application::class)->create([ + $process = Process::factory()->create(); + $application = Application::factory()->create([ 'APP_STATUS_ID' => 2 ]); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID, 'PRO_ID' => $process->PRO_ID, ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, 'TU_TYPE' => 1 ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'PRO_ID' => $process->PRO_ID, @@ -425,7 +425,7 @@ class HomeTest extends TestCase 'DEL_DELEGATE_DATE' => date('Y-m-d H:i:s', strtotime("-1 year")) ]); - $caseList = factory(CaseList::class)->create([ + $caseList = CaseList::factory()->create([ 'CAL_TYPE' => 'unassigned', 'CAL_COLUMNS' => '[{"field":"case_number","enableFilter":false,"set":true},{"field":"case_title","enableFilter":false,"set":true},{"field":"process_name","enableFilter":false,"set":true},{"field":"task","enableFilter":false,"set":true},{"field":"send_by","enableFilter":false,"set":true},{"field":"due_date","enableFilter":false,"set":true},{"field":"delegation_date","enableFilter":false,"set":true},{"field":"priority","enableFilter":false,"set":true},{"field":"VAR1","enableFilter":false,"set":true},{"field":"VAR2","enableFilter":false,"set":true},{"field":"VAR3","enableFilter":false,"set":false}]', 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID @@ -447,8 +447,7 @@ class HomeTest extends TestCase */ public function it_should_test_getCustomPaused() { - $this->markTestIncomplete('Illegal mix of collations'); - $additionalTables = factory(AdditionalTables::class)->create(); + $additionalTables = AdditionalTables::factory()->create(); $query = "" . "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` (" . "`APP_UID` varchar(32) NOT NULL," @@ -458,32 +457,33 @@ class HomeTest extends TestCase . "`VAR2` varchar(255) DEFAULT NULL," . "`VAR3` varchar(255) DEFAULT NULL," . "PRIMARY KEY (`APP_UID`)," - . "KEY `indexTable` (`APP_UID`))"; + . "KEY `indexTable` (`APP_UID`)" + . ")ENGINE=InnoDB DEFAULT CHARSET='utf8'"; DB::statement($query); - factory(Fields::class)->create([ + Fields::factory()->create([ 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID, 'FLD_NAME' => 'VAR1' ]); - factory(Fields::class)->create([ + Fields::factory()->create([ 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID, 'FLD_NAME' => 'VAR2' ]); - factory(Fields::class)->create([ + Fields::factory()->create([ 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID, 'FLD_NAME' => 'VAR3' ]); - $user = factory(User::class)->create(); - $process1 = factory(Process::class)->create(); - $task = factory(Task::class)->create([ + $user = User::factory()->create(); + $process1 = Process::factory()->create(); + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => '', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process1->PRO_UID, 'TAS_TYPE' => 'NORMAL' ]); - $application1 = factory(Application::class)->create(); - $delegation1 = factory(Delegation::class)->create([ + $application1 = Application::factory()->create(); + $delegation1 = Delegation::factory()->create([ 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'CLOSED', @@ -495,9 +495,9 @@ class HomeTest extends TestCase 'DEL_INDEX' => 2 ]); - $process2 = factory(Process::class)->create(); - $application2 = factory(Application::class)->create(); - $delegation2 = factory(Delegation::class)->create([ + $process2 = Process::factory()->create(); + $application2 = Application::factory()->create(); + $delegation2 = Delegation::factory()->create([ 'APP_NUMBER' => $application2->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', @@ -508,7 +508,7 @@ class HomeTest extends TestCase 'DEL_PREVIOUS' => 1, 'DEL_INDEX' => 2 ]); - factory(AppDelay::class, 5)->create([ + AppDelay::factory(5)->create([ 'APP_DELEGATION_USER' => $user->USR_UID, 'PRO_UID' => $process2->PRO_UID, 'APP_NUMBER' => $delegation1->APP_NUMBER, @@ -516,7 +516,7 @@ class HomeTest extends TestCase 'APP_DISABLE_ACTION_USER' => 0, 'APP_TYPE' => 'PAUSE' ]); - factory(AppDelay::class, 5)->create([ + AppDelay::factory(5)->create([ 'APP_DELEGATION_USER' => $user->USR_UID, 'PRO_UID' => $process2->PRO_UID, 'APP_NUMBER' => $delegation2->APP_NUMBER, @@ -525,7 +525,7 @@ class HomeTest extends TestCase 'APP_TYPE' => 'PAUSE' ]); - $caseList = factory(CaseList::class)->create([ + $caseList = CaseList::factory()->create([ 'CAL_TYPE' => 'paused', 'CAL_COLUMNS' => '[{"field":"case_number","enableFilter":false,"set":true},{"field":"case_title","enableFilter":false,"set":true},{"field":"process_name","enableFilter":false,"set":true},{"field":"task","enableFilter":false,"set":true},{"field":"send_by","enableFilter":false,"set":true},{"field":"due_date","enableFilter":false,"set":true},{"field":"delegation_date","enableFilter":false,"set":true},{"field":"priority","enableFilter":false,"set":true},{"field":"VAR1","enableFilter":false,"set":true},{"field":"VAR2","enableFilter":false,"set":true},{"field":"VAR3","enableFilter":false,"set":false}]', 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InboxTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InboxTest.php index 0c691f91d..d64ab12b8 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InboxTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InboxTest.php @@ -4,15 +4,12 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases; use DateInterval; use Datetime; -use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Support\Facades\DB; use ProcessMaker\BusinessModel\Cases\Inbox; use ProcessMaker\Model\AdditionalTables; -use ProcessMaker\Model\Application; use ProcessMaker\Model\CaseList; use ProcessMaker\Model\Delegation; use ProcessMaker\Model\Process; -use ProcessMaker\Model\Task; use ProcessMaker\Model\User; use Tests\TestCase; @@ -23,15 +20,13 @@ use Tests\TestCase; */ class InboxTest extends TestCase { - use DatabaseTransactions; - /** * Method set up. */ public function setUp(): void { parent::setUp(); - Delegation::truncate(); + $this->truncateNonInitialModels(); } /** @@ -51,7 +46,7 @@ class InboxTest extends TestCase */ public function createInbox() { - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $delegation = Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_PREVIOUS' => 1, 'DEL_INDEX' => 2, @@ -68,10 +63,10 @@ class InboxTest extends TestCase */ public function createMultipleInbox($cases) { - $user = factory(\ProcessMaker\Model\User::class)->create(); + $user = \ProcessMaker\Model\User::factory()->create(); for ($i = 0; $i < $cases; $i = $i + 1) { - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $delegation = Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -305,7 +300,7 @@ class InboxTest extends TestCase { // Create factories related to the to_do cases - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $delegation = Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_PREVIOUS' => 1, 'DEL_INDEX' => 2, @@ -340,7 +335,7 @@ class InboxTest extends TestCase // Create factories related to the to_do cases $cases = $this->createInbox(); // Create the previous thread with the same user - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $delegation = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $cases->APP_NUMBER, 'APP_UID' => $cases->APP_UID, 'USR_ID' => $cases->USR_ID, @@ -421,10 +416,10 @@ class InboxTest extends TestCase */ public function it_should_test_get_counters_by_processes_method_no_filter() { - $user = factory(User::class)->create(); - $process = factory(Process::class)->create(); - $process2 = factory(Process::class)->create(); - factory(Delegation::class)->states('foreign_keys')->create([ + $user = User::factory()->create(); + $process = Process::factory()->create(); + $process2 = Process::factory()->create(); + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -432,7 +427,7 @@ class InboxTest extends TestCase 'PRO_ID' => $process->PRO_ID, 'PRO_UID' => $process->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -455,14 +450,14 @@ class InboxTest extends TestCase */ public function it_should_test_get_counters_by_processes_method_category() { - $user = factory(User::class)->create(); - $process = factory(Process::class)->create([ + $user = User::factory()->create(); + $process = Process::factory()->create([ 'CATEGORY_ID' => 1 ]); - $process2 = factory(Process::class)->create([ + $process2 = Process::factory()->create([ 'CATEGORY_ID' => 2 ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -470,7 +465,7 @@ class InboxTest extends TestCase 'PRO_ID' => $process->PRO_ID, 'PRO_UID' => $process->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -478,7 +473,7 @@ class InboxTest extends TestCase 'PRO_ID' => $process->PRO_ID, 'PRO_UID' => $process->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -486,7 +481,7 @@ class InboxTest extends TestCase 'PRO_ID' => $process->PRO_ID, 'PRO_UID' => $process->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -494,7 +489,7 @@ class InboxTest extends TestCase 'PRO_ID' => $process2->PRO_ID, 'PRO_UID' => $process2->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -517,19 +512,19 @@ class InboxTest extends TestCase */ public function it_should_test_get_counters_by_processes_method_top_ten() { - $user = factory(User::class)->create(); - $process1 = factory(Process::class)->create(); - $process2 = factory(Process::class)->create(); - $process3 = factory(Process::class)->create(); - $process4 = factory(Process::class)->create(); - $process5 = factory(Process::class)->create(); - $process6 = factory(Process::class)->create(); - $process7 = factory(Process::class)->create(); - $process8 = factory(Process::class)->create(); - $process9 = factory(Process::class)->create(); - $process10 = factory(Process::class)->create(); - $process11 = factory(Process::class)->create(); - factory(Delegation::class)->states('foreign_keys')->create([ + $user = User::factory()->create(); + $process1 = Process::factory()->create(); + $process2 = Process::factory()->create(); + $process3 = Process::factory()->create(); + $process4 = Process::factory()->create(); + $process5 = Process::factory()->create(); + $process6 = Process::factory()->create(); + $process7 = Process::factory()->create(); + $process8 = Process::factory()->create(); + $process9 = Process::factory()->create(); + $process10 = Process::factory()->create(); + $process11 = Process::factory()->create(); + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -537,7 +532,7 @@ class InboxTest extends TestCase 'PRO_ID' => $process1->PRO_ID, 'PRO_UID' => $process1->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -545,7 +540,7 @@ class InboxTest extends TestCase 'PRO_ID' => $process1->PRO_ID, 'PRO_UID' => $process1->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -553,7 +548,7 @@ class InboxTest extends TestCase 'PRO_ID' => $process1->PRO_ID, 'PRO_UID' => $process1->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -561,7 +556,7 @@ class InboxTest extends TestCase 'PRO_ID' => $process2->PRO_ID, 'PRO_UID' => $process2->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -569,7 +564,7 @@ class InboxTest extends TestCase 'PRO_ID' => $process2->PRO_ID, 'PRO_UID' => $process2->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -577,7 +572,7 @@ class InboxTest extends TestCase 'PRO_ID' => $process3->PRO_ID, 'PRO_UID' => $process3->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -585,7 +580,7 @@ class InboxTest extends TestCase 'PRO_ID' => $process4->PRO_ID, 'PRO_UID' => $process4->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -593,7 +588,7 @@ class InboxTest extends TestCase 'PRO_ID' => $process5->PRO_ID, 'PRO_UID' => $process5->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -601,7 +596,7 @@ class InboxTest extends TestCase 'PRO_ID' => $process6->PRO_ID, 'PRO_UID' => $process6->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -609,7 +604,7 @@ class InboxTest extends TestCase 'PRO_ID' => $process7->PRO_ID, 'PRO_UID' => $process7->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -617,7 +612,7 @@ class InboxTest extends TestCase 'PRO_ID' => $process8->PRO_ID, 'PRO_UID' => $process8->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -625,7 +620,7 @@ class InboxTest extends TestCase 'PRO_ID' => $process9->PRO_ID, 'PRO_UID' => $process9->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -633,7 +628,7 @@ class InboxTest extends TestCase 'PRO_ID' => $process10->PRO_ID, 'PRO_UID' => $process10->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -656,10 +651,10 @@ class InboxTest extends TestCase */ public function it_should_test_get_counters_by_processes_method_processes() { - $user = factory(User::class)->create(); - $process = factory(Process::class)->create(); - $process2 = factory(Process::class)->create(); - factory(Delegation::class)->states('foreign_keys')->create([ + $user = User::factory()->create(); + $process = Process::factory()->create(); + $process2 = Process::factory()->create(); + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -667,7 +662,7 @@ class InboxTest extends TestCase 'PRO_ID' => $process->PRO_ID, 'PRO_UID' => $process->PRO_UID ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -690,10 +685,10 @@ class InboxTest extends TestCase */ public function it_should_test_get_counters_by_range_method() { - $user = factory(User::class)->create(); - $process = factory(Process::class)->create(); - $process2 = factory(Process::class)->create(); - factory(Delegation::class)->states('foreign_keys')->create([ + $user = User::factory()->create(); + $process = Process::factory()->create(); + $process2 = Process::factory()->create(); + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -702,7 +697,7 @@ class InboxTest extends TestCase 'PRO_UID' => $process->PRO_UID, 'DEL_DELEGATE_DATE' => '2021-05-20 09:52:32' ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -737,10 +732,9 @@ class InboxTest extends TestCase */ public function it_should_test_getCustomListCounts_method() { - $this->markTestIncomplete('Illegal mix of collations'); $cases = $this->createMultipleInbox(3); - $additionalTables = factory(AdditionalTables::class)->create([ + $additionalTables = AdditionalTables::factory()->create([ 'PRO_UID' => $cases->PRO_UID ]); $query = "" @@ -752,10 +746,11 @@ class InboxTest extends TestCase . "`VAR2` varchar(255) DEFAULT NULL," . "`VAR3` varchar(255) DEFAULT NULL," . "PRIMARY KEY (`APP_UID`)," - . "KEY `indexTable` (`APP_UID`))"; + . "KEY `indexTable` (`APP_UID`)" + . ")ENGINE=InnoDB DEFAULT CHARSET='utf8'"; DB::statement($query); - $caseList = factory(CaseList::class)->create([ + $caseList = CaseList::factory()->create([ 'CAL_TYPE' => 'inbox', 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID, 'USR_ID' => $cases->USR_ID @@ -790,9 +785,9 @@ class InboxTest extends TestCase $currentDate = $date->format('Y-m-d H:i:s'); $diff1Day = new DateInterval('P1D'); $diff2Days = new DateInterval('P2D'); - $user = factory(User::class)->create(); - $process = factory(Process::class)->create(); - factory(Delegation::class)->states('foreign_keys')->create([ + $user = User::factory()->create(); + $process = Process::factory()->create(); + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -821,9 +816,9 @@ class InboxTest extends TestCase $date = new DateTime('now'); $currentDate = $date->format('Y-m-d H:i:s'); $diff2Days = new DateInterval('P2D'); - $user = factory(User::class)->create(); - $process = factory(Process::class)->create(); - factory(Delegation::class)->states('foreign_keys')->create([ + $user = User::factory()->create(); + $process = Process::factory()->create(); + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, @@ -852,9 +847,9 @@ class InboxTest extends TestCase $date = new DateTime('now'); $currentDate = $date->format('Y-m-d H:i:s'); $diff2Days = new DateInterval('P2D'); - $user = factory(User::class)->create(); - $process = factory(Process::class)->create(); - factory(Delegation::class)->states('foreign_keys')->create([ + $user = User::factory()->create(); + $process = Process::factory()->create(); + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/ParticipatedTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/ParticipatedTest.php index 747dbf557..07fd71606 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/ParticipatedTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/ParticipatedTest.php @@ -2,7 +2,6 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases; -use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Support\Facades\DB; use ProcessMaker\BusinessModel\Cases\Participated; use ProcessMaker\Model\Application; @@ -16,16 +15,13 @@ use Tests\TestCase; */ class ParticipatedTest extends TestCase { - use DatabaseTransactions; - /** * Method set up. */ public function setUp(): void { parent::setUp(); - Delegation::truncate(); - Application::truncate(); + $this->truncateNonInitialModels(); } /** @@ -37,12 +33,12 @@ class ParticipatedTest extends TestCase */ public function createParticipated() { - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $delegation = Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'CLOSED', 'DEL_INDEX' => 1, 'DEL_LAST_INDEX' => 0, ]); - $delegation = factory(Delegation::class)->states('last_thread')->create([ + $delegation = Delegation::factory()->last_thread()->create([ 'APP_NUMBER' => $delegation->APP_NUMBER, 'TAS_ID' => $delegation->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', @@ -65,8 +61,8 @@ class ParticipatedTest extends TestCase */ public function createParticipatedDraft() { - $application = factory(Application::class)->states('draft')->create(); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->draft()->create(); + $delegation = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, 'DEL_THREAD_STATUS' => 'OPEN', @@ -86,15 +82,15 @@ class ParticipatedTest extends TestCase */ public function createParticipatedCompleted() { - $application = factory(Application::class)->states('completed')->create(); - $delegation = factory(Delegation::class)->states('first_thread')->create([ + $application = Application::factory()->completed()->create(); + $delegation = Delegation::factory()->first_thread()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, 'DEL_THREAD_STATUS' => 'CLOSED', 'DEL_INDEX' => 1, 'DEL_LAST_INDEX' => 0, ]); - $delegation = factory(Delegation::class)->states('last_thread')->create([ + $delegation = Delegation::factory()->last_thread()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, 'DEL_THREAD_STATUS' => 'CLOSED', @@ -116,17 +112,17 @@ class ParticipatedTest extends TestCase */ public function createMultipleParticipated($cases = 2) { - $user = factory(\ProcessMaker\Model\User::class)->create(); + $user = \ProcessMaker\Model\User::factory()->create(); for ($i = 0; $i < $cases; $i = $i + 1) { - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $delegation = Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'CLOSED', 'DEL_INDEX' => 1, 'USR_UID' => $user->USR_UID, 'USR_ID' => $user->USR_ID, 'DEL_LAST_INDEX' => 0, ]); - factory(Delegation::class)->states('last_thread')->create([ + Delegation::factory()->last_thread()->create([ 'APP_UID' => $delegation->APP_UID, 'APP_NUMBER' => $delegation->APP_NUMBER, 'TAS_ID' => $delegation->TAS_ID, diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/PausedTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/PausedTest.php index b1d4e35eb..627dc0366 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/PausedTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/PausedTest.php @@ -4,7 +4,6 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases; use DateInterval; use Datetime; -use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Support\Facades\DB; use ProcessMaker\BusinessModel\Cases\Paused; use ProcessMaker\Model\AdditionalTables; @@ -24,15 +23,13 @@ use Tests\TestCase; */ class PausedTest extends TestCase { - use DatabaseTransactions; - /** * Method set up. */ public function setUp(): void { parent::setUp(); - Delegation::truncate(); + $this->truncateNonInitialModels(); } /** @@ -45,29 +42,29 @@ class PausedTest extends TestCase public function createPaused() { //Create processes - $process1 = factory(Process::class)->create( + $process1 = Process::factory()->create( ['PRO_CATEGORY' => '1'] ); - $process2 = factory(Process::class)->create( + $process2 = Process::factory()->create( ['PRO_CATEGORY' => '2'] ); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create a task - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => '', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process1->PRO_UID, 'TAS_TYPE' => 'NORMAL' ]); - $application1 = factory(Application::class)->create(); - $application2 = factory(Application::class)->create(); + $application1 = Application::factory()->create(); + $application2 = Application::factory()->create(); //Create the register in delegation - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'CLOSED', @@ -78,7 +75,7 @@ class PausedTest extends TestCase 'DEL_PREVIOUS' => 0, 'DEL_INDEX' => 1 ]); - $delegation1 = factory(Delegation::class)->create([ + $delegation1 = Delegation::factory()->create([ 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'CLOSED', @@ -90,7 +87,7 @@ class PausedTest extends TestCase 'DEL_INDEX' => 2 ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application2->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', @@ -101,7 +98,7 @@ class PausedTest extends TestCase 'DEL_PREVIOUS' => 0, 'DEL_INDEX' => 1 ]); - $delegation2 = factory(Delegation::class)->create([ + $delegation2 = Delegation::factory()->create([ 'APP_NUMBER' => $application2->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', @@ -114,7 +111,7 @@ class PausedTest extends TestCase ]); //Create the registers in AppDelay - factory(AppDelay::class, 5)->create([ + AppDelay::factory(5)->create([ 'APP_DELEGATION_USER' => $user->USR_UID, 'PRO_UID' => $process2->PRO_UID, 'APP_NUMBER' => $delegation1->APP_NUMBER, @@ -123,7 +120,7 @@ class PausedTest extends TestCase 'APP_TYPE' => 'PAUSE' ]); //Create the registers in AppDelay - factory(AppDelay::class, 5)->create([ + AppDelay::factory(5)->create([ 'APP_DELEGATION_USER' => $user->USR_UID, 'PRO_UID' => $process2->PRO_UID, 'APP_NUMBER' => $delegation2->APP_NUMBER, @@ -144,24 +141,24 @@ class PausedTest extends TestCase public function createMultiplePaused($cases, $category = 1, $user = null) { if (is_null($user)) { - $user = factory(User::class)->create(); + $user = User::factory()->create(); } for ($i = 0; $i < $cases; $i = $i + 1) { - $process1 = factory(Process::class)->create( + $process1 = Process::factory()->create( ['PRO_CATEGORY' => 1, 'CATEGORY_ID' => $category] ); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => '', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process1->PRO_UID, 'TAS_TYPE' => 'NORMAL' ]); - $application1 = factory(Application::class)->create(); + $application1 = Application::factory()->create(); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application1->APP_UID, 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, @@ -173,7 +170,7 @@ class PausedTest extends TestCase 'DEL_PREVIOUS' => 0, 'DEL_INDEX' => 1 ]); - $delegation1 = factory(Delegation::class)->create([ + $delegation1 = Delegation::factory()->create([ 'APP_UID' => $application1->APP_UID, 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, @@ -186,7 +183,7 @@ class PausedTest extends TestCase 'DEL_INDEX' => 2 ]); - factory(AppDelay::class)->create([ + AppDelay::factory()->create([ 'APP_DELEGATION_USER' => $user->USR_UID, 'PRO_UID' => $process1->PRO_UID, 'APP_NUMBER' => $delegation1->APP_NUMBER, @@ -371,7 +368,7 @@ class PausedTest extends TestCase // Set the title $paused->setCaseTitle($cases->DEL_TITLE); $res = $paused->getData(); - $this->assertNotEmpty($res); + $this->assertTrue(!empty($res)); } /** @@ -488,7 +485,7 @@ class PausedTest extends TestCase */ public function it_should_test_get_counters_by_processes_method_category() { - $user = factory(User::class)->create(); + $user = User::factory()->create(); $this->createMultiplePaused(3, 2, $user); $this->createMultiplePaused(2, 3, $user); $paused = new Paused(); @@ -506,7 +503,7 @@ class PausedTest extends TestCase */ public function it_should_test_get_counters_by_processes_method_top_ten() { - $user = factory(User::class)->create(); + $user = User::factory()->create(); $this->createMultiplePaused(20, 2, $user); $paused = new Paused(); $paused->setUserId($user->USR_ID); @@ -523,19 +520,19 @@ class PausedTest extends TestCase */ public function it_should_test_get_counters_by_processes_method_processes_filter() { - $user = factory(User::class)->create(); - $process1 = factory(Process::class)->create(); + $user = User::factory()->create(); + $process1 = Process::factory()->create(); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => '', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process1->PRO_UID, 'TAS_TYPE' => 'NORMAL' ]); - $application1 = factory(Application::class)->create(); + $application1 = Application::factory()->create(); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application1->APP_UID, 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, @@ -547,7 +544,7 @@ class PausedTest extends TestCase 'DEL_PREVIOUS' => 0, 'DEL_INDEX' => 1 ]); - $delegation1 = factory(Delegation::class)->create([ + $delegation1 = Delegation::factory()->create([ 'APP_UID' => $application1->APP_UID, 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, @@ -560,7 +557,7 @@ class PausedTest extends TestCase 'DEL_INDEX' => 2 ]); - factory(AppDelay::class)->create([ + AppDelay::factory()->create([ 'APP_DELEGATION_USER' => $user->USR_UID, 'PRO_UID' => $process1->PRO_UID, 'APP_NUMBER' => $delegation1->APP_NUMBER, @@ -584,17 +581,17 @@ class PausedTest extends TestCase */ public function it_should_test_get_counters_by_range_method() { - $user = factory(User::class)->create(); - $process1 = factory(Process::class)->create(); - $task = factory(Task::class)->create([ + $user = User::factory()->create(); + $process1 = Process::factory()->create(); + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => '', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process1->PRO_UID, 'TAS_TYPE' => 'NORMAL' ]); - $application1 = factory(Application::class)->create(); - factory(Delegation::class)->create([ + $application1 = Application::factory()->create(); + Delegation::factory()->create([ 'APP_UID' => $application1->APP_UID, 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, @@ -606,7 +603,7 @@ class PausedTest extends TestCase 'DEL_PREVIOUS' => 0, 'DEL_INDEX' => 1 ]); - $delegation1 = factory(Delegation::class)->create([ + $delegation1 = Delegation::factory()->create([ 'APP_UID' => $application1->APP_UID, 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, @@ -619,7 +616,7 @@ class PausedTest extends TestCase 'DEL_INDEX' => 2, 'DEL_DELEGATE_DATE' => '2021-05-23 00:00:00' ]); - factory(AppDelay::class)->create([ + AppDelay::factory()->create([ 'APP_DELEGATION_USER' => $user->USR_UID, 'PRO_UID' => $process1->PRO_UID, 'APP_NUMBER' => $delegation1->APP_NUMBER, @@ -628,8 +625,8 @@ class PausedTest extends TestCase 'APP_TYPE' => 'PAUSE' ]); - $application2 = factory(Application::class)->create(); - factory(Delegation::class)->create([ + $application2 = Application::factory()->create(); + Delegation::factory()->create([ 'APP_UID' => $application2->APP_UID, 'APP_NUMBER' => $application2->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, @@ -641,7 +638,7 @@ class PausedTest extends TestCase 'DEL_PREVIOUS' => 0, 'DEL_INDEX' => 1 ]); - $delegation2 = factory(Delegation::class)->create([ + $delegation2 = Delegation::factory()->create([ 'APP_UID' => $application2->APP_UID, 'APP_NUMBER' => $application2->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, @@ -654,7 +651,7 @@ class PausedTest extends TestCase 'DEL_INDEX' => 2, 'DEL_DELEGATE_DATE' => '2021-05-24 09:52:32' ]); - factory(AppDelay::class)->create([ + AppDelay::factory()->create([ 'APP_DELEGATION_USER' => $user->USR_UID, 'PRO_UID' => $process1->PRO_UID, 'APP_NUMBER' => $delegation2->APP_NUMBER, @@ -689,10 +686,9 @@ class PausedTest extends TestCase */ public function it_should_test_getCustomListCounts_method() { - $this->markTestIncomplete('Illegal mix of collations'); $cases = $this->createMultiplePaused(3); - $additionalTables = factory(AdditionalTables::class)->create([ + $additionalTables = AdditionalTables::factory()->create([ 'PRO_UID' => $cases->PRO_UID ]); $query = "" @@ -704,10 +700,11 @@ class PausedTest extends TestCase . "`VAR2` varchar(255) DEFAULT NULL," . "`VAR3` varchar(255) DEFAULT NULL," . "PRIMARY KEY (`APP_UID`)," - . "KEY `indexTable` (`APP_UID`))"; + . "KEY `indexTable` (`APP_UID`)" + . ")ENGINE=InnoDB DEFAULT CHARSET='utf8'"; DB::statement($query); - $caseList = factory(CaseList::class)->create([ + $caseList = CaseList::factory()->create([ 'CAL_TYPE' => 'paused', 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID, 'USR_ID' => $cases->USR_ID @@ -742,19 +739,19 @@ class PausedTest extends TestCase $currentDate = $date->format('Y-m-d H:i:s'); $diff1Day = new DateInterval('P1D'); $diff2Days = new DateInterval('P2D'); - $user = factory(User::class)->create(); - $process1 = factory(Process::class)->create(); + $user = User::factory()->create(); + $process1 = Process::factory()->create(); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => '', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process1->PRO_UID, 'TAS_TYPE' => 'NORMAL' ]); - $application1 = factory(Application::class)->create(); + $application1 = Application::factory()->create(); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application1->APP_UID, 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, @@ -769,7 +766,7 @@ class PausedTest extends TestCase 'DEL_RISK_DATE' => $date->add($diff1Day), 'DEL_TASK_DUE_DATE' => $date->add($diff2Days) ]); - $delegation1 = factory(Delegation::class)->create([ + $delegation1 = Delegation::factory()->create([ 'APP_UID' => $application1->APP_UID, 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, @@ -785,7 +782,7 @@ class PausedTest extends TestCase 'DEL_TASK_DUE_DATE' => $date->add($diff2Days) ]); - factory(AppDelay::class)->create([ + AppDelay::factory()->create([ 'APP_DELEGATION_USER' => $user->USR_UID, 'PRO_UID' => $process1->PRO_UID, 'APP_NUMBER' => $delegation1->APP_NUMBER, @@ -812,19 +809,19 @@ class PausedTest extends TestCase $date = new DateTime('now'); $currentDate = $date->format('Y-m-d H:i:s'); $diff2Days = new DateInterval('P2D'); - $user = factory(User::class)->create(); - $process1 = factory(Process::class)->create(); + $user = User::factory()->create(); + $process1 = Process::factory()->create(); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => '', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process1->PRO_UID, 'TAS_TYPE' => 'NORMAL' ]); - $application1 = factory(Application::class)->create(); + $application1 = Application::factory()->create(); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application1->APP_UID, 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, @@ -839,7 +836,7 @@ class PausedTest extends TestCase 'DEL_RISK_DATE' => $currentDate, 'DEL_TASK_DUE_DATE' => $date->add($diff2Days) ]); - $delegation1 = factory(Delegation::class)->create([ + $delegation1 = Delegation::factory()->create([ 'APP_UID' => $application1->APP_UID, 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, @@ -855,7 +852,7 @@ class PausedTest extends TestCase 'DEL_TASK_DUE_DATE' => $date->add($diff2Days) ]); - factory(AppDelay::class)->create([ + AppDelay::factory()->create([ 'APP_DELEGATION_USER' => $user->USR_UID, 'PRO_UID' => $process1->PRO_UID, 'APP_NUMBER' => $delegation1->APP_NUMBER, @@ -882,19 +879,19 @@ class PausedTest extends TestCase $date = new DateTime('now'); $currentDate = $date->format('Y-m-d H:i:s'); $diff2Days = new DateInterval('P2D'); - $user = factory(User::class)->create(); - $process1 = factory(Process::class)->create(); + $user = User::factory()->create(); + $process1 = Process::factory()->create(); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => '', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process1->PRO_UID, 'TAS_TYPE' => 'NORMAL' ]); - $application1 = factory(Application::class)->create(); + $application1 = Application::factory()->create(); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application1->APP_UID, 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, @@ -909,7 +906,7 @@ class PausedTest extends TestCase 'DEL_RISK_DATE' => $currentDate, 'DEL_TASK_DUE_DATE' => $date->sub($diff2Days) ]); - $delegation1 = factory(Delegation::class)->create([ + $delegation1 = Delegation::factory()->create([ 'APP_UID' => $application1->APP_UID, 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, @@ -925,7 +922,7 @@ class PausedTest extends TestCase 'DEL_TASK_DUE_DATE' => $date->sub($diff2Days) ]); - factory(AppDelay::class)->create([ + AppDelay::factory()->create([ 'APP_DELEGATION_USER' => $user->USR_UID, 'PRO_UID' => $process1->PRO_UID, 'APP_NUMBER' => $delegation1->APP_NUMBER, diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/SearchTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/SearchTest.php index cd8aa42de..1a2b57f3c 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/SearchTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/SearchTest.php @@ -2,7 +2,6 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases; -use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Support\Facades\DB; use ProcessMaker\BusinessModel\Cases\Search; use ProcessMaker\Model\Application; @@ -16,16 +15,13 @@ use Tests\TestCase; */ class SearchTest extends TestCase { - use DatabaseTransactions; - /** * Set up function. */ public function setUp(): void { parent::setUp(); - Application::truncate(); - Delegation::truncate(); + $this->truncateNonInitialModels(); } /** @@ -37,7 +33,7 @@ class SearchTest extends TestCase */ public function createSearch($rows = 10) { - $delegation = factory(Delegation::class, $rows)->states('foreign_keys')->create(); + $delegation = Delegation::factory($rows)->foreign_keys()->create(); return $delegation; } @@ -213,7 +209,7 @@ class SearchTest extends TestCase // Get the data $res = $search->getData(); // Asserts - $this->assertNotEmpty($res); + $this->assertTrue(!empty($res)); } /** @@ -379,7 +375,7 @@ class SearchTest extends TestCase { // Create factories related to the delegation cases $cases = $this->createSearch(); - $casesNotSubmitted = factory(Delegation::class, 5)->states('web_entry')->create(); + $casesNotSubmitted = Delegation::factory(5)->web_entry()->create(); // Create new Search object $search = new Search(); $result = $search->getData(); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/SupervisingTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/SupervisingTest.php index c51495df6..fd21c11e5 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/SupervisingTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/SupervisingTest.php @@ -2,7 +2,6 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases; -use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Support\Facades\DB; use ProcessMaker\BusinessModel\Cases\Supervising; use ProcessMaker\Model\Application; @@ -21,14 +20,13 @@ use Tests\TestCase; */ class SupervisingTest extends TestCase { - use DatabaseTransactions; - /** * Method set up. */ public function setUp(): void { parent::setUp(); + $this->truncateNonInitialModels(); } /** @@ -42,11 +40,11 @@ class SupervisingTest extends TestCase public function createSupervising(int $cases = 2) { // Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); // Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); // Define this user like process supervisor - factory(ProcessUser::class)->create( + ProcessUser::factory()->create( [ 'PRO_UID' => $process->PRO_UID, 'USR_UID' => $user->USR_UID, @@ -54,12 +52,12 @@ class SupervisingTest extends TestCase ] ); // Create a task - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'NORMAL', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID, ]); - $task2 = factory(Task::class)->create([ + $task2 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'NORMAL', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID, @@ -68,13 +66,13 @@ class SupervisingTest extends TestCase $delegation = []; for ($i = 0; $i < $cases; $i = $i + 1) { // Create case - $app = factory(Application::class)->states('todo')->create([ + $app = Application::factory()->todo()->create([ 'PRO_UID' => $process->PRO_UID, 'APP_INIT_USER' => $user->USR_UID, 'APP_CUR_USER' => $user->USR_UID, ]); // Create two threads - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_UID' => $app['APP_UID'], 'TAS_ID' => $task->TAS_ID, 'TAS_UID' => $task->TAS_UID, @@ -88,7 +86,7 @@ class SupervisingTest extends TestCase 'DEL_PREVIOUS' => 0, 'DEL_LAST_INDEX' => 0 ]); - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_UID' => $app['APP_UID'], 'TAS_ID' => $task2->TAS_ID, 'TAS_UID' => $task2->TAS_UID, @@ -118,15 +116,15 @@ class SupervisingTest extends TestCase public function createGroupSupervising(int $cases = 2) { // Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); // Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); // Create group - $group = factory(GroupUser::class)->create([ + $group = GroupUser::factory()->create([ 'USR_UID' => $user->USR_UID, ]); // Define this group like process supervisor - factory(ProcessUser::class)->create( + ProcessUser::factory()->create( [ 'PRO_UID' => $process->PRO_UID, 'USR_UID' => $group->GRP_UID, @@ -134,12 +132,12 @@ class SupervisingTest extends TestCase ] ); // Create a task - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'NORMAL', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID, ]); - $task2 = factory(Task::class)->create([ + $task2 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'NORMAL', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID, @@ -148,13 +146,13 @@ class SupervisingTest extends TestCase $delegation = []; for ($i = 0; $i < $cases; $i = $i + 1) { // Create case - $app = factory(Application::class)->states('todo')->create([ + $app = Application::factory()->todo()->create([ 'PRO_UID' => $process->PRO_UID, 'APP_INIT_USER' => $user->USR_UID, 'APP_CUR_USER' => $user->USR_UID, ]); // Create two threads - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_UID' => $app['APP_UID'], 'TAS_ID' => $task->TAS_ID, 'TAS_UID' => $task->TAS_UID, @@ -168,7 +166,7 @@ class SupervisingTest extends TestCase 'DEL_PREVIOUS' => 0, 'DEL_LAST_INDEX' => 0 ]); - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_UID' => $app['APP_UID'], 'TAS_ID' => $task2->TAS_ID, 'TAS_UID' => $task2->TAS_UID, @@ -243,7 +241,7 @@ class SupervisingTest extends TestCase */ public function it_should_test_the_get_data_method_when_the_user_is_not_supervisor() { - $user = factory(User::class)->create(); + $user = User::factory()->create(); $cases = $this->createSupervising(); // Instance the Supervising object $supervising = new Supervising(); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/UnassignedTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/UnassignedTest.php index e20542125..7af50742e 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/UnassignedTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/Cases/UnassignedTest.php @@ -4,7 +4,6 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases; use DateInterval; use Datetime; -use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Support\Facades\DB; use ProcessMaker\BusinessModel\Cases\Unassigned; use ProcessMaker\Model\AdditionalTables; @@ -28,17 +27,13 @@ use Tests\TestCase; */ class UnassignedTest extends TestCase { - use DatabaseTransactions; - /** * Method set up. */ public function setUp(): void { parent::setUp(); - Delegation::truncate(); - Groupwf::truncate(); - Application::truncate(); + $this->truncateNonInitialModels(); } /** @@ -51,11 +46,11 @@ class UnassignedTest extends TestCase public function createSelfServiceUserOrGroup($relation = 1) { // Create user` - $user = factory(User::class)->create(); + $user = User::factory()->create(); // Create a group - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); // Assign a user in the group - factory(GroupUser::class)->create([ + GroupUser::factory()->create([ 'GRP_UID' => $group->GRP_UID, 'GRP_ID' => $group->GRP_ID, 'USR_UID' => $user->USR_UID, @@ -63,34 +58,34 @@ class UnassignedTest extends TestCase // Create self-services for ($i = 1; $i <= 2; $i++) { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create application - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 2 ]); //Create a task self service - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID, 'PRO_ID' => $process->PRO_ID, ]); //Assign a user in the task - $taskUser = factory(TaskUser::class)->create([ + $taskUser = TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => $relation, //Related to the user 'TU_TYPE' => 1 ]); //Create the previous delegation before self-service - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'PRO_ID' => $process->PRO_ID, 'DEL_THREAD_STATUS' => 'CLOSED', 'DEL_DELEGATE_DATE' => date('Y-m-d H:i:s', strtotime("-$i year")) ]); //Create the register in delegation relate to self-service - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'PRO_ID' => $process->PRO_ID, @@ -118,11 +113,11 @@ class UnassignedTest extends TestCase public function createSelfServiceByVariable($relation = 1, $userAssignee = true) { // Create user` - $user = factory(User::class)->create(); + $user = User::factory()->create(); // Create a group - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); // Assign a user in the group - factory(GroupUser::class)->create([ + GroupUser::factory()->create([ 'GRP_UID' => $group->GRP_UID, 'GRP_ID' => $group->GRP_ID, 'USR_UID' => $user->USR_UID, @@ -130,39 +125,39 @@ class UnassignedTest extends TestCase // Create self-services for ($i = 1; $i <= 2; $i++) { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create application - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 2 ]); //Create a task self service - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '@@ARRAY_OF_USERS', 'PRO_UID' => $process->PRO_UID, 'PRO_ID' => $process->PRO_ID, ]); //Create the relation for the value assigned in the TAS_GROUP_VARIABLE - $appSelfValueUser = factory(AppAssignSelfServiceValue::class)->create([ + $appSelfValueUser = AppAssignSelfServiceValue::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => 2, 'TAS_ID' => $task->TAS_ID ]); - $selfValueGroup = factory(AppAssignSelfServiceValueGroup::class)->create([ + $selfValueGroup = AppAssignSelfServiceValueGroup::factory()->create([ 'ID' => $appSelfValueUser->ID, 'GRP_UID' => $user->USR_UID, 'ASSIGNEE_ID' => ($userAssignee) ? $user->USR_ID : $group->GRP_ID, 'ASSIGNEE_TYPE' => $relation ]); //Create the previous delegation before self-service - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'PRO_ID' => $process->PRO_ID, 'DEL_THREAD_STATUS' => 'CLOSED', 'DEL_DELEGATE_DATE' => date('Y-m-d H:i:s', strtotime("-$i year")) ]); //Create the register in delegation relate to self-service - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => $appSelfValueUser->DEL_INDEX, 'TAS_ID' => $task->TAS_ID, @@ -189,26 +184,26 @@ class UnassignedTest extends TestCase */ public function createMultipleUnassigned($cases) { - $user = factory(\ProcessMaker\Model\User::class)->create(); + $user = \ProcessMaker\Model\User::factory()->create(); for ($i = 0; $i < $cases; $i = $i + 1) { - $process = factory(Process::class)->create(); - $application = factory(Application::class)->create([ + $process = Process::factory()->create(); + $application = Application::factory()->create([ 'APP_STATUS_ID' => 2 ]); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID, 'PRO_ID' => $process->PRO_ID, ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, //Related to the user 'TU_TYPE' => 1 ]); - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'PRO_ID' => $process->PRO_ID, @@ -516,7 +511,7 @@ class UnassignedTest extends TestCase // Get the data $res = $unassigned->getData(); // Asserts - $this->assertNotEmpty($res); + $this->assertTrue(!empty($res)); } /** @@ -594,29 +589,29 @@ class UnassignedTest extends TestCase */ public function it_should_test_get_counters_by_processes_method_category() { - $user = factory(User::class)->create(); - $process1 = factory(Process::class)->create([ + $user = User::factory()->create(); + $process1 = Process::factory()->create([ 'CATEGORY_ID' => 2 ]); - $process2 = factory(Process::class)->create([ + $process2 = Process::factory()->create([ 'CATEGORY_ID' => 3 ]); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 2 ]); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process1->PRO_UID, 'PRO_ID' => $process1->PRO_ID, ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, 'TU_TYPE' => 1 ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'PRO_ID' => $process1->PRO_ID, @@ -624,19 +619,19 @@ class UnassignedTest extends TestCase 'USR_ID' => 0, 'DEL_DELEGATE_DATE' => date('Y-m-d H:i:s', strtotime("-1 year")) ]); - $task2 = factory(Task::class)->create([ + $task2 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process2->PRO_UID, 'PRO_ID' => $process2->PRO_ID, ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task2->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, 'TU_TYPE' => 1 ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task2->TAS_ID, 'PRO_ID' => $process2->PRO_ID, @@ -675,29 +670,29 @@ class UnassignedTest extends TestCase */ public function it_should_test_get_counters_by_processes_method_processes() { - $user = factory(User::class)->create(); - $process1 = factory(Process::class)->create([ + $user = User::factory()->create(); + $process1 = Process::factory()->create([ 'CATEGORY_ID' => 2 ]); - $process2 = factory(Process::class)->create([ + $process2 = Process::factory()->create([ 'CATEGORY_ID' => 3 ]); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 2 ]); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process1->PRO_UID, 'PRO_ID' => $process1->PRO_ID, ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, 'TU_TYPE' => 1 ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'PRO_ID' => $process1->PRO_ID, @@ -705,19 +700,19 @@ class UnassignedTest extends TestCase 'USR_ID' => 0, 'DEL_DELEGATE_DATE' => date('Y-m-d H:i:s', strtotime("-1 year")) ]); - $task2 = factory(Task::class)->create([ + $task2 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process2->PRO_UID, 'PRO_ID' => $process2->PRO_ID, ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task2->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, 'TU_TYPE' => 1 ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task2->TAS_ID, 'PRO_ID' => $process2->PRO_ID, @@ -740,29 +735,29 @@ class UnassignedTest extends TestCase */ public function it_should_test_get_counters_by_range_method() { - $user = factory(User::class)->create(); - $process1 = factory(Process::class)->create([ + $user = User::factory()->create(); + $process1 = Process::factory()->create([ 'CATEGORY_ID' => 2 ]); - $process2 = factory(Process::class)->create([ + $process2 = Process::factory()->create([ 'CATEGORY_ID' => 3 ]); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 2 ]); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process1->PRO_UID, 'PRO_ID' => $process1->PRO_ID, ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, 'TU_TYPE' => 1 ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'PRO_ID' => $process1->PRO_ID, @@ -770,19 +765,19 @@ class UnassignedTest extends TestCase 'USR_ID' => 0, 'DEL_DELEGATE_DATE' => '2021-05-21 09:52:32' ]); - $task2 = factory(Task::class)->create([ + $task2 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process2->PRO_UID, 'PRO_ID' => $process2->PRO_ID, ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task2->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, 'TU_TYPE' => 1 ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task2->TAS_ID, 'PRO_ID' => $process2->PRO_ID, @@ -817,9 +812,8 @@ class UnassignedTest extends TestCase */ public function it_should_test_getCustomListCount_method() { - $this->markTestIncomplete('Illegal mix of collations'); $cases = $this->createMultipleUnassigned(1); - $additionalTables = factory(AdditionalTables::class)->create([ + $additionalTables = AdditionalTables::factory()->create([ 'PRO_UID' => $cases['delegation']->PRO_UID ]); $query = "" @@ -831,10 +825,11 @@ class UnassignedTest extends TestCase . "`VAR2` varchar(255) DEFAULT NULL," . "`VAR3` varchar(255) DEFAULT NULL," . "PRIMARY KEY (`APP_UID`)," - . "KEY `indexTable` (`APP_UID`))"; + . "KEY `indexTable` (`APP_UID`)" + . ")ENGINE=InnoDB DEFAULT CHARSET='utf8'"; DB::statement($query); - $caseList = factory(CaseList::class)->create([ + $caseList = CaseList::factory()->create([ 'CAL_TYPE' => 'unassigned', 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID, 'USR_ID' => $cases['taskUser']->USR_ID @@ -887,26 +882,26 @@ class UnassignedTest extends TestCase $currentDate = $date->format('Y-m-d H:i:s'); $diff1Day = new DateInterval('P1D'); $diff2Days = new DateInterval('P2D'); - $user = factory(User::class)->create(); - $process1 = factory(Process::class)->create([ + $user = User::factory()->create(); + $process1 = Process::factory()->create([ 'CATEGORY_ID' => 2 ]); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 2 ]); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process1->PRO_UID, 'PRO_ID' => $process1->PRO_ID, ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, 'TU_TYPE' => 1 ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'PRO_ID' => $process1->PRO_ID, @@ -935,26 +930,26 @@ class UnassignedTest extends TestCase $date = new DateTime('now'); $currentDate = $date->format('Y-m-d H:i:s'); $diff2Days = new DateInterval('P2D'); - $user = factory(User::class)->create(); - $process1 = factory(Process::class)->create([ + $user = User::factory()->create(); + $process1 = Process::factory()->create([ 'CATEGORY_ID' => 2 ]); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 2 ]); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process1->PRO_UID, 'PRO_ID' => $process1->PRO_ID, ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, 'TU_TYPE' => 1 ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'PRO_ID' => $process1->PRO_ID, @@ -983,26 +978,26 @@ class UnassignedTest extends TestCase $date = new DateTime('now'); $currentDate = $date->format('Y-m-d H:i:s'); $diff2Days = new DateInterval('P2D'); - $user = factory(User::class)->create(); - $process1 = factory(Process::class)->create([ + $user = User::factory()->create(); + $process1 = Process::factory()->create([ 'CATEGORY_ID' => 2 ]); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 2 ]); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process1->PRO_UID, 'PRO_ID' => $process1->PRO_ID, ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, 'TU_TYPE' => 1 ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'PRO_ID' => $process1->PRO_ID, diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/CasesTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/CasesTest.php index 944dc7a53..7d5dcdf60 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/CasesTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/CasesTest.php @@ -31,9 +31,7 @@ class CasesTest extends TestCase public function setUp(): void { parent::setUp(); - Delegation::truncate(); - Documents::truncate(); - Application::truncate(); + $this->truncateNonInitialModels(); User::where('USR_ID', '=', 1) ->where('USR_ID', '=', 2) ->delete(); @@ -55,9 +53,11 @@ class CasesTest extends TestCase $RBAC = RBAC::getSingleton(); $RBAC->initRBAC(); - $application = factory(Application::class)->create(['APP_INIT_USER' => G::generateUniqueID()]); + $application = Application::factory()->create(['APP_INIT_USER' => G::generateUniqueID()]); // Tried to delete case $case = new Cases(); + + $this->expectException('Exception'); $case->deleteCase($application->APP_UID, $_SESSION['USER_LOGGED']); } @@ -77,9 +77,11 @@ class CasesTest extends TestCase $RBAC = RBAC::getSingleton(); $RBAC->initRBAC(); - $application = factory(Application::class)->create(['APP_STATUS' => 'TO_DO']); + $application = Application::factory()->create(['APP_STATUS' => 'TO_DO']); // Tried to delete case $case = new Cases(); + + $this->expectException('Exception'); $case->deleteCase($application->APP_UID, $_SESSION['USER_LOGGED']); } @@ -99,9 +101,11 @@ class CasesTest extends TestCase $RBAC = RBAC::getSingleton(); $RBAC->initRBAC(); - $application = factory(Application::class)->create(['APP_INIT_USER' => G::generateUniqueID()]); + $application = Application::factory()->create(['APP_INIT_USER' => G::generateUniqueID()]); // Tried to delete case $case = new Cases(); + + $this->expectException('Exception'); $case->deleteCase($application->APP_UID, $_SESSION['USER_LOGGED']); } @@ -114,8 +118,8 @@ class CasesTest extends TestCase */ public function it_should_upload_files_related_case_note() { - $application = factory(Application::class)->create(); - factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->create(); + Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID ]); @@ -150,11 +154,11 @@ class CasesTest extends TestCase */ public function it_should_test_upload_files_method() { - $user = factory(User::class)->create(); - $application = factory(Application::class)->create([ + $user = User::factory()->create(); + $application = Application::factory()->create([ 'APP_CUR_USER' => $user->USR_UID ]); - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID ]); $varName = "/tmp/test.pdf"; @@ -189,11 +193,11 @@ class CasesTest extends TestCase */ public function it_should_test_exception_in_upload_files_method() { - $user = factory(User::class)->create(); - $application = factory(Application::class)->create([ + $user = User::factory()->create(); + $application = Application::factory()->create([ 'APP_CUR_USER' => $user->USR_UID ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_UID' => $application->APP_UID ]); $varName = "/tmp/test.pdf"; @@ -216,11 +220,11 @@ class CasesTest extends TestCase */ public function it_should_test_the_exception_in_upload_files_method() { - $user = factory(User::class)->create(); - $application = factory(Application::class)->create([ + $user = User::factory()->create(); + $application = Application::factory()->create([ 'APP_CUR_USER' => $user->USR_UID ]); - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID ]); $varName = "/tmp/test.pdf"; @@ -250,22 +254,21 @@ class CasesTest extends TestCase */ public function it_execute_trigger_from_cases_with_self_service_timeout_every_time() { - ListUnassigned::truncate(); // Define the Execute Trigger = EVERY_TIME - $application = factory(Application::class)->states('foreign_keys')->create(); + $application = Application::factory()->foreign_keys()->create(); // Create a trigger - $trigger = factory(Triggers::class)->create([ + $trigger = Triggers::factory()->create([ 'PRO_UID' => $application->PRO_UID, 'TRI_WEBBOT' => 'echo(1);' ]); // Create a task with the configuration trigger execution - $task = factory(Task::class)->states('sef_service_timeout')->create([ + $task = Task::factory()->sef_service_timeout()->create([ 'PRO_UID' => $application->PRO_UID, 'TAS_SELFSERVICE_EXECUTION' => 'EVERY_TIME', 'TAS_SELFSERVICE_TRIGGER_UID' => $trigger->TRI_UID ]); // Create a unassigned cases - factory(ListUnassigned::class)->create([ + ListUnassigned::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'TAS_ID' => $task->TAS_ID, 'APP_NUMBER' => $application->APP_NUMBER, @@ -289,22 +292,21 @@ class CasesTest extends TestCase */ public function it_execute_trigger_from_cases_with_self_service_timeout_once() { - ListUnassigned::truncate(); // Define the Execute Trigger = ONCE - $application = factory(Application::class)->states('foreign_keys')->create(); + $application = Application::factory()->foreign_keys()->create(); // Create a trigger - $trigger = factory(Triggers::class)->create([ + $trigger = Triggers::factory()->create([ 'PRO_UID' => $application->PRO_UID, 'TRI_WEBBOT' => 'echo(1);' ]); // Create a task with the configuration trigger execution - $task = factory(Task::class)->states('sef_service_timeout')->create([ + $task = Task::factory()->sef_service_timeout()->create([ 'PRO_UID' => $application->PRO_UID, 'TAS_SELFSERVICE_EXECUTION' => 'ONCE', 'TAS_SELFSERVICE_TRIGGER_UID' => $trigger->TRI_UID ]); // Create a unassigned cases - factory(ListUnassigned::class)->create([ + ListUnassigned::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'TAS_ID' => $task->TAS_ID, 'APP_NUMBER' => $application->APP_NUMBER, @@ -329,20 +331,20 @@ class CasesTest extends TestCase public function it_should_test_get_dynaforms_by_application() { // Create a process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); // Create a task related to the process - $task1 = factory(Task::class)->create([ + $task1 = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); // Created another task related to the process - $task2 = factory(Task::class)->create([ + $task2 = Task::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); // Created a step related to the first task - factory(Step::class)->create([ + Step::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $task1->TAS_UID, 'STEP_TYPE_OBJ' => 'DYNAFORM', @@ -352,7 +354,7 @@ class CasesTest extends TestCase // Created a step related to the second task and with a specific DynaForm Uid $dynUid = G::generateUniqueID(); - factory(Step::class)->create([ + Step::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $task2->TAS_UID, 'STEP_TYPE_OBJ' => 'DYNAFORM', @@ -361,7 +363,7 @@ class CasesTest extends TestCase ]); // Create an application related to the process in draft status - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'APP_STATUS' => 'DRAFT' ]); @@ -392,7 +394,7 @@ class CasesTest extends TestCase public function it_should_test_case_status_info() { // Get status info when the case is PAUSED - $table = factory(AppDelay::class)->states('paused_foreign_keys')->create(); + $table = AppDelay::factory()->paused_foreign_keys()->create(); $cases = new Cases(); $result = $cases->getStatusInfo($table->APP_UID, $table->APP_DEL_INDEX, $table->APP_DELEGATION_USER); $this->assertNotEmpty($result); @@ -401,7 +403,7 @@ class CasesTest extends TestCase $this->assertArrayHasKey('PRO_UID', $result); // Get status info when the case is UNASSIGNED // Get status info when the case is TO_DO - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $cases = new Cases(); $result = $cases->getStatusInfo($table->APP_UID, $table->DEL_INDEX, $table->USR_UID); $this->assertNotEmpty($result); @@ -409,8 +411,8 @@ class CasesTest extends TestCase $this->assertArrayHasKey('DEL_INDEX', $result); $this->assertArrayHasKey('PRO_UID', $result); // Get status info when the case is COMPLETED - $table = factory(Application::class)->states('completed')->create(); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $table = Application::factory()->completed()->create(); + $table = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $table->APP_NUMBER, 'APP_UID' => $table->APP_UID, ]); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/EmailServerTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/EmailServerTest.php index 7d140d50b..ebb5ee322 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/EmailServerTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/EmailServerTest.php @@ -117,7 +117,7 @@ class EmailServerTest extends TestCase $this->loadUserSession(); $faker = $this->faker; - $emailServer = factory(EmailServerModel::class)->create($this->getDataForEmailServerRegistry()); + $emailServer = EmailServerModel::factory()->create($this->getDataForEmailServerRegistry()); $data = $emailServer->toArray(); $this->emailServer->setContextLog([ @@ -255,7 +255,7 @@ class EmailServerTest extends TestCase $this->emailServer->setContextLog([ 'workspace' => 'workflow' ]); - $emailServer = factory(EmailServerModel::class)->create($this->getDataForEmailServerRegistry()); + $emailServer = EmailServerModel::factory()->create($this->getDataForEmailServerRegistry()); $emailServerUid = $emailServer->MESS_UID; $actual = $this->emailServer->getEmailServer($emailServerUid); $this->assertNotEmpty($actual); @@ -272,7 +272,7 @@ class EmailServerTest extends TestCase $this->emailServer->setContextLog([ 'workspace' => 'workflow' ]); - $emailServer = factory(EmailServerModel::class)->create($this->getDataForEmailServerRegistry()); + $emailServer = EmailServerModel::factory()->create($this->getDataForEmailServerRegistry()); $emailServerUid = $faker->regexify("/[a-zA-Z]{32}/"); $this->expectException(Exception::class); @@ -368,7 +368,7 @@ class EmailServerTest extends TestCase $emailServer = new EmailServer(); // This expects an exception message - $this->expectExceptionMessage("Undefined index: MESS_ENGINE"); + $this->expectExceptionMessage('Undefined array key "MESS_ENGINE"'); // Call the sendTestMail method $emailServer->sendTestMail($data); @@ -382,7 +382,7 @@ class EmailServerTest extends TestCase */ public function it_should_test_the_delete_method() { - $email = factory(EmailServerModel::class)->create(); + $email = EmailServerModel::factory()->create(); $emailServer = new EmailServer(); $res = $emailServer->delete($email['MESS_UID']); @@ -401,7 +401,7 @@ class EmailServerTest extends TestCase */ public function it_should_test_the_delete_method_with_imap() { - $email = factory(EmailServerModel::class)->create([ + $email = EmailServerModel::factory()->create([ 'MESS_ENGINE' => 'IMAP' ]); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/FilesManagerTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/FilesManagerTest.php index 7593c6e4f..19f2a0b1f 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/FilesManagerTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/FilesManagerTest.php @@ -46,9 +46,9 @@ class FilesManagerTest extends TestCase */ public function it_should_deleted_public_files_when_not_exist() { - $processFiles = factory(ProcessFilesModel::class)->create(); + $processFiles = ProcessFilesModel::factory()->create(); - $emailEvent = factory(EmailEventModel::class)->create([ + $emailEvent = EmailEventModel::factory()->create([ 'PRF_UID' => $processFiles->PRF_UID ]); @@ -77,11 +77,11 @@ class FilesManagerTest extends TestCase */ public function it_should_deleted_a_template_file($type, $separator) { - $user = factory(UserModel::class)->create([ + $user = UserModel::factory()->create([ 'USR_UID' => G::generateUniqueID() ]); - $process = factory(ProcessModel::class)->create([ + $process = ProcessModel::factory()->create([ 'PRO_UID' => G::generateUniqueID() ]); @@ -105,7 +105,7 @@ class FilesManagerTest extends TestCase $path = $directory . "/" . $fileName; file_put_contents($path, $this->faker->randomHtml()); - $processFiles = factory(ProcessFilesModel::class)->create([ + $processFiles = ProcessFilesModel::factory()->create([ 'PRF_UID' => G::generateUniqueID(), 'PRO_UID' => $process->PRO_UID, 'USR_UID' => $user->USR_UID, @@ -131,11 +131,11 @@ class FilesManagerTest extends TestCase */ public function it_should_deleted_a_public_file($type, $separator) { - $user = factory(UserModel::class)->create([ + $user = UserModel::factory()->create([ 'USR_UID' => G::generateUniqueID() ]); - $process = factory(ProcessModel::class)->create([ + $process = ProcessModel::factory()->create([ 'PRO_UID' => G::generateUniqueID() ]); @@ -159,7 +159,7 @@ class FilesManagerTest extends TestCase $path = $directory . "/" . $fileName; file_put_contents($path, $this->faker->randomHtml()); - $processFiles = factory(ProcessFilesModel::class)->create([ + $processFiles = ProcessFilesModel::factory()->create([ 'PRF_UID' => G::generateUniqueID(), 'PRO_UID' => $process->PRO_UID, 'USR_UID' => $user->USR_UID, @@ -185,22 +185,22 @@ class FilesManagerTest extends TestCase */ public function it_should_deleted_public_files_with_event_relation() { - $user = factory(UserModel::class)->create([ + $user = UserModel::factory()->create([ 'USR_UID' => G::generateUniqueID() ]); - $process = factory(ProcessModel::class)->create([ + $process = ProcessModel::factory()->create([ 'PRO_UID' => G::generateUniqueID() ]); - $processFiles = factory(ProcessFilesModel::class)->create([ + $processFiles = ProcessFilesModel::factory()->create([ 'PRF_UID' => G::generateUniqueID(), 'PRO_UID' => $process->PRO_UID, 'USR_UID' => $user->USR_UID, 'PRF_PATH' => '/' ]); - $emailEvent = factory(EmailEventModel::class)->create([ + $emailEvent = EmailEventModel::factory()->create([ 'PRF_UID' => $processFiles->PRF_UID ]); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/GroupTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/GroupTest.php index b3f77bd0f..12ac6f79b 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/GroupTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/GroupTest.php @@ -51,7 +51,7 @@ class GroupTest extends TestCase * * @return array Definition Data Group */ - public function testDataGroup() + public function dataGroup() { $response = [ 'GRP_TITLE' => 'Group Test Unit', @@ -63,14 +63,13 @@ class GroupTest extends TestCase /** * Create group * - * @depends testDataGroup - * * @param array $dataGroup Information Group - * + * * @return string group Uid */ - public function testCreate($dataGroup) + public function testCreate(): string { + $dataGroup = $this->dataGroup(); $response = $this->getInstanceGroup()->create($dataGroup); $this->assertArrayHasKey('GRP_UID', $response); @@ -86,7 +85,7 @@ class GroupTest extends TestCase */ public function testGetUsersOfGroup($groupUid) { - $response = $this->getInstanceGroup()->getUsers('USERS', $groupUid); + $response = $this->group->getUsers('USERS', $groupUid); $this->assertCount(0, $response); } @@ -99,12 +98,12 @@ class GroupTest extends TestCase public function testGetUsersAvailable($groupUid) { $result = \ProcessMaker\Model\User::where('USERS.USR_STATUS', '<>', 'CLOSED') - ->whereNotIn('USERS.USR_UID', ['00000000000000000000000000000002']) - ->leftJoin('GROUP_USER', function($query) { - $query->on('GROUP_USER.USR_UID', '=', 'USERS.USR_UID'); - }) - ->get() - ->toArray(); + ->whereNotIn('USERS.USR_UID', ['00000000000000000000000000000002']) + ->leftJoin('GROUP_USER', function ($query) { + $query->on('GROUP_USER.USR_UID', '=', 'USERS.USR_UID'); + }) + ->get() + ->toArray(); $response = $this->getInstanceGroup()->getUsers('AVAILABLE-USERS', $groupUid); $this->assertCount(count($result), $response); @@ -127,12 +126,13 @@ class GroupTest extends TestCase * * @depends testCreate * @expectedException Exception - * * @param string $groupUid Uid Group */ public function testDelete($groupUid) { + $this->expectException('Exception'); $this->getInstanceGroup()->delete($groupUid); $this->getInstanceGroup()->getGroup($groupUid); } + } diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/ListsTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/ListsTest.php index 7afc0137e..1561318fd 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/ListsTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/ListsTest.php @@ -19,7 +19,7 @@ class ListsTest extends TestCase */ public function it_should_test_the_lists_construct() { - $user = factory(User::class)->create(); + $user = User::factory()->create(); $list = new Lists(); $res = $list->getList('inbox', ['userId' => $user->USR_UID]); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/TableTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/TableTest.php index af187440b..db7a2fc54 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/TableTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/TableTest.php @@ -14,7 +14,7 @@ class TableTest extends TestCase public function setUp(): void { parent::setUp(); - AdditionalTables::truncate(); + $this->truncateNonInitialModels(); } /** @@ -32,7 +32,7 @@ class TableTest extends TestCase */ public function it_should_test_getTables_method() { - $additionalTables = factory(AdditionalTables::class) + $additionalTables = AdditionalTables::factory() ->create(); $proUid = $additionalTables->PRO_UID; diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/TaskSchedulerBMTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/TaskSchedulerBMTest.php index ce454371a..0ec6773ea 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/TaskSchedulerBMTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/TaskSchedulerBMTest.php @@ -8,6 +8,16 @@ use Tests\TestCase; class TaskSchedulerBMTest extends TestCase { + /** + * Set up method. + * @return void + */ + public function setUp(): void + { + parent::setUp(); + $this->truncateNonInitialModels(); + } + /** * Test getSchedule method * @@ -16,13 +26,12 @@ class TaskSchedulerBMTest extends TestCase */ public function it_should_test_get_schedule_method() { - TaskScheduler::truncate(); $obj = new TaskSchedulerBM(); $res = $obj->getSchedule('emails_notifications'); $this->assertNotEmpty($res); - factory(TaskScheduler::class)->create(); + TaskScheduler::factory()->create(); $res = $obj->getSchedule('emails_notifications'); $this->assertNotEmpty(1, $res); @@ -50,7 +59,7 @@ class TaskSchedulerBMTest extends TestCase { $obj = new TaskSchedulerBM(); - $scheduler = factory(TaskScheduler::class)->create(); + $scheduler = TaskScheduler::factory()->create(); $request_data = [ "id" => $scheduler->id, @@ -85,7 +94,6 @@ class TaskSchedulerBMTest extends TestCase */ public function it_should_test_generate_initial_data_method() { - TaskScheduler::truncate(); $r = TaskScheduler::all()->toArray(); $this->assertEmpty($r); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/ValidatorTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/ValidatorTest.php index dbbc875d6..1ff24b80c 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/ValidatorTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/ValidatorTest.php @@ -55,9 +55,10 @@ class ValidatorTest extends TestCase */ public function it_test_exception_dep_uid_exist() { - $table = factory(Department::class)->create(); + $table = Department::factory()->create(); DB::commit(); $result = Validator::depUid($table->DEP_UID); + $this->assertNotEmpty($result); } /** @@ -107,7 +108,7 @@ class ValidatorTest extends TestCase */ public function it_test_exception_usr_uid_exist() { - $table = factory(User::class)->create(); + $table = User::factory()->create(); DB::commit(); $result = Validator::usrUid($table->USR_UID); $this->assertNotEmpty($result); @@ -158,7 +159,7 @@ class ValidatorTest extends TestCase */ public function it_test_exception_app_uid_exist() { - $table = factory(Application::class)->create(); + $table = Application::factory()->create(); DB::commit(); $result = Validator::appUid($table->APP_UID); $this->assertNotEmpty($result); @@ -197,7 +198,7 @@ class ValidatorTest extends TestCase */ public function it_test_exception_tri_uid_exist() { - $table = factory(Triggers::class)->create(); + $table = Triggers::factory()->create(); DB::commit(); $result = Validator::triUid($table->TRI_UID); $this->assertNotEmpty($result); @@ -236,7 +237,7 @@ class ValidatorTest extends TestCase */ public function it_test_exception_pro_uid_exist() { - $table = factory(Process::class)->create(); + $table = Process::factory()->create(); DB::commit(); $result = Validator::proUid($table->PRO_UID); $this->assertNotEmpty($result); @@ -275,7 +276,7 @@ class ValidatorTest extends TestCase */ public function it_test_exception_cat_uid_exist() { - $table = factory(ProcessCategory::class)->create(); + $table = ProcessCategory::factory()->create(); DB::commit(); $result = Validator::catUid($table->CATEGORY_UID); $this->assertNotEmpty($result); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/VariableTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/VariableTest.php index b1c738a3b..9676228c7 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/VariableTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/VariableTest.php @@ -23,9 +23,6 @@ class VariableTest extends TestCase */ public function setUp(): void { - if (version_compare(phpversion(), 7.3, '>') ) { - $this->markTestSkipped('Illegal mix of collations'); - } parent::setUp(); } @@ -37,9 +34,9 @@ class VariableTest extends TestCase */ public function it_create_variable_by_process() { - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); - factory(ProcessVariables::class)->create([ + ProcessVariables::factory()->create([ 'PRJ_UID' => $process->PRO_UID, 'PRO_ID' => $process->PRO_ID, ]); @@ -83,8 +80,8 @@ class VariableTest extends TestCase */ public function it_return_an_exception_when_var_name_is_empty() { - $process = factory(Process::class)->create(); - factory(ProcessVariables::class)->create([ + $process = Process::factory()->create(); + ProcessVariables::factory()->create([ 'PRJ_UID' => $process->PRO_UID, 'PRO_ID' => $process->PRO_ID, ]); @@ -114,8 +111,8 @@ class VariableTest extends TestCase */ public function it_return_an_exception_when_var_field_type_is_empty() { - $process = factory(Process::class)->create(); - factory(ProcessVariables::class)->create([ + $process = Process::factory()->create(); + ProcessVariables::factory()->create([ 'PRJ_UID' => $process->PRO_UID, 'PRO_ID' => $process->PRO_ID, ]); @@ -145,8 +142,8 @@ class VariableTest extends TestCase */ public function it_return_an_exception_when_var_label_is_empty() { - $process = factory(Process::class)->create(); - factory(ProcessVariables::class)->create([ + $process = Process::factory()->create(); + ProcessVariables::factory()->create([ 'PRJ_UID' => $process->PRO_UID, 'PRO_ID' => $process->PRO_ID, ]); @@ -176,9 +173,9 @@ class VariableTest extends TestCase */ public function it_list_variables_by_process() { - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); - factory(ProcessVariables::class)->create([ + ProcessVariables::factory()->create([ 'PRJ_UID' => $process->PRO_UID, 'PRO_ID' => $process->PRO_ID, ]); @@ -209,11 +206,11 @@ class VariableTest extends TestCase */ public function it_list_variables_by_type_related_a_process() { - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); $varType = 'integer'; $varTypeId = 2; for ($x = 1; $x <= 5; $x++) { - $processVar = factory(ProcessVariables::class)->states('foreign_keys')->create([ + $processVar = ProcessVariables::factory()->foreign_keys()->create([ 'PRO_ID' => $process->PRO_ID, 'PRJ_UID' => $process->PRO_UID, 'VAR_FIELD_TYPE' => $varType, @@ -251,10 +248,10 @@ class VariableTest extends TestCase $data = file_get_contents($pathData); $json = json_decode($data); - $dynaform = factory(Dynaform::class)->create([ + $dynaform = Dynaform::factory()->create([ 'DYN_CONTENT' => $data ]); - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); $proUid = ''; $params = [ @@ -295,15 +292,15 @@ class VariableTest extends TestCase //assert $this->expectException(Exception::class); // Create process variable - $variable = factory(ProcessVariables::class)->create(); + $variable = ProcessVariables::factory()->create(); $result = ProcessVariables::getVariable($variable->VAR_UID); $this->assertNotEmpty($result); // Create tables - $table = factory(AdditionalTables::class)->create([ + $table = AdditionalTables::factory()->create([ 'PRO_UID' => $variable->PRO_UID, ]); // Create fields - $fields = factory(Fields::class)->create([ + $fields = Fields::factory()->create([ 'ADD_TAB_UID' => $table->ADD_TAB_UID, 'FLD_NAME' => $variable->VAR_NAME, ]); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryTest.php index f3cf9fb9f..d4e59c62b 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryTest.php @@ -29,7 +29,7 @@ class WebEntryTest extends TestCase $webEntryFilename = G::generateUniqueID(); // Create a Web Entry - $webEntry = factory(WebEntry::class)->create(['WE_DATA' => $webEntryFilename . $phpExtension]); + $webEntry = WebEntry::factory()->create(['WE_DATA' => $webEntryFilename . $phpExtension]); // Post file is from a valid Web Entry? $isWebEntry = BmWebEntry::isWebEntry($webEntry->PRO_UID, $webEntryFilename . $postFileExtension); @@ -55,7 +55,7 @@ class WebEntryTest extends TestCase $webEntryFilename = 'My_Custom_Form'; // Create a Web Entry - $webEntry = factory(WebEntry::class)->create(['WE_DATA' => $webEntryFilename . $phpExtension]); + $webEntry = WebEntry::factory()->create(['WE_DATA' => $webEntryFilename . $phpExtension]); // Post file is from a valid Web Entry? $isWebEntry = BmWebEntry::isWebEntry($webEntry->PRO_UID, $webEntryFilename . $postFileExtension); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Cases/CasesTraitTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Cases/CasesTraitTest.php index 0f68fe95f..1e9617867 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Cases/CasesTraitTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Cases/CasesTraitTest.php @@ -43,26 +43,26 @@ class CasesTraitTest extends TestCase { $user = User::where('USR_ID', '=', 1)->get()->first(); - $process = factory(Process::class)->create([ + $process = Process::factory()->create([ 'PRO_CREATE_USER' => $user->USR_UID ]); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'BALANCED', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, 'TU_TYPE' => 1 ]); - $task2 = factory(Task::class)->create([ + $task2 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'BALANCED', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task2->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, @@ -70,17 +70,17 @@ class CasesTraitTest extends TestCase ]); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $appDelegation = factory(Delegation::class)->create([ + $appDelegation = Delegation::factory()->create([ 'USR_UID' => $user->USR_UID, 'PRO_UID' => $process->PRO_UID, 'APP_UID' => $application->APP_UID, 'TAS_UID' => $task->TAS_UID, 'DEL_INDEX' => 1, ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'USR_UID' => $user->USR_UID, 'PRO_UID' => $process->PRO_UID, 'APP_UID' => $application->APP_UID, @@ -88,13 +88,13 @@ class CasesTraitTest extends TestCase 'DEL_INDEX' => 2, 'DEL_PREVIOUS' => $appDelegation->DEL_INDEX ]); - factory(Route::class)->create([ + Route::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'ROU_NEXT_TASK' => $task2->TAS_UID, 'PRO_UID' => $process->PRO_UID ]); - $step = factory(Step::class)->create([ + $step = Step::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TAS_UID' => $appDelegation->TAS_UID, 'STEP_POSITION' => 2, @@ -102,11 +102,11 @@ class CasesTraitTest extends TestCase ]); - $triggers = factory(Triggers::class)->create([ + $triggers = Triggers::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TRI_WEBBOT' => '$a = 0;' ]); - factory(StepTrigger::class)->create([ + StepTrigger::factory()->create([ 'STEP_UID' => -2, 'TAS_UID' => $task->TAS_UID, 'TRI_UID' => $triggers->TRI_UID, @@ -115,11 +115,11 @@ class CasesTraitTest extends TestCase ]); - $triggers = factory(Triggers::class)->create([ + $triggers = Triggers::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'TRI_WEBBOT' => '$b = 0;' ]); - factory(StepTrigger::class)->create([ + StepTrigger::factory()->create([ 'STEP_UID' => -2, 'TAS_UID' => $task->TAS_UID, 'TRI_UID' => $triggers->TRI_UID, @@ -304,49 +304,49 @@ class CasesTraitTest extends TestCase { $user = User::where('USR_ID', '=', 1)->get()->first(); - $process = factory(Process::class)->create([ + $process = Process::factory()->create([ 'PRO_CREATE_USER' => $user->USR_UID ]); - $dynaform = factory(Dynaform::class)->create([ + $dynaform = Dynaform::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $inpuDocument = factory(InputDocument::class)->create([ + $inpuDocument = InputDocument::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'BALANCED', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, 'TU_TYPE' => 1 ]); - $task2 = factory(Task::class)->create([ + $task2 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'BALANCED', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task2->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, 'TU_TYPE' => 1 ]); - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $delegation1 = factory(Delegation::class)->create([ + $delegation1 = Delegation::factory()->create([ 'USR_UID' => $user->USR_UID, 'PRO_UID' => $process->PRO_UID, 'APP_UID' => $application->APP_UID, 'TAS_UID' => $task->TAS_UID, 'DEL_INDEX' => 1, ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'USR_UID' => $user->USR_UID, 'PRO_UID' => $process->PRO_UID, 'APP_UID' => $application->APP_UID, @@ -354,14 +354,14 @@ class CasesTraitTest extends TestCase 'DEL_INDEX' => 2, 'DEL_PREVIOUS' => $delegation1->DEL_INDEX ]); - factory(Route::class)->create([ + Route::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'ROU_NEXT_TASK' => $task2->TAS_UID, 'PRO_UID' => $process->PRO_UID ]); - $emailServer = factory(EmailServerModel::class)->create(); - $abeConfiguration = factory(AbeConfiguration::class)->create([ + $emailServer = EmailServerModel::factory()->create(); + $abeConfiguration = AbeConfiguration::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'DYN_UID' => $dynaform->DYN_UID, 'TAS_UID' => $task2->TAS_UID, @@ -369,7 +369,7 @@ class CasesTraitTest extends TestCase 'ABE_TYPE' => 'LINK', 'ABE_CASE_NOTE_IN_RESPONSE' => 1, ]); - $abeRequest = factory(AbeRequest::class)->create([ + $abeRequest = AbeRequest::factory()->create([ 'ABE_UID' => $abeConfiguration->ABE_UID, 'APP_UID' => $application->APP_UID, 'DEL_INDEX' => $delegation1->DEL_INDEX, @@ -410,9 +410,9 @@ class CasesTraitTest extends TestCase */ public function it_should_verify_if_abe_has_not_completed() { - $delegation1 = factory(Delegation::class)->state('closed')->create(); - $abeRequest = factory(AbeRequest::class)->create(); - $dynaform = factory(Dynaform::class)->create([ + $delegation1 = Delegation::factory()->closed()->create(); + $abeRequest = AbeRequest::factory()->create(); + $dynaform = Dynaform::factory()->create([ 'PRO_UID' => $delegation1->PRO_UID ]); @@ -437,9 +437,9 @@ class CasesTraitTest extends TestCase */ public function it_should_test_an_exception_if_the_case_throws_an_incorrect_state() { - $delegation1 = factory(Delegation::class)->create(); - $abeRequest = factory(AbeRequest::class)->create(); - $dynaform = factory(Dynaform::class)->create([ + $delegation1 = Delegation::factory()->create(); + $abeRequest = AbeRequest::factory()->create(); + $dynaform = Dynaform::factory()->create([ 'PRO_UID' => $delegation1->PRO_UID ]); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Core/SystemTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Core/SystemTest.php index 9ea32a456..2e7446db0 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Core/SystemTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Core/SystemTest.php @@ -17,6 +17,7 @@ class SystemTest extends TestCase public function setUp(): void { parent::setUp(); + $this->truncateNonInitialModels(); } /** @@ -26,8 +27,6 @@ class SystemTest extends TestCase */ public function it_should_init_laravel_configurations() { - $this->markTestIncomplete("@todo: Please correct this unit test"); - $object = new System(); $object->initLaravel(); @@ -48,12 +47,11 @@ class SystemTest extends TestCase $system = new System(); //default values - EmailServerModel::truncate(); $actual = $system->getEmailConfiguration(); $this->assertEmpty($actual); //new instance - $emailServer = factory(EmailServerModel::class)->create([ + $emailServer = EmailServerModel::factory()->create([ 'MESS_DEFAULT' => 1 ]); $actual = $system->getEmailConfiguration(); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Importer/ImporterTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Importer/ImporterTest.php index 8d991e848..e5d73431c 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Importer/ImporterTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Importer/ImporterTest.php @@ -52,7 +52,7 @@ class ImporterTest extends TestCase public function it_should_test_the_import_method_when_importing_a_process_with_a_new_uid() { // Create the existing process - $process = factory(Process::class)->create( + $process = Process::factory()->create( ['PRO_CREATE_DATE' => '2019-07-10 10:00:00'] ); @@ -276,7 +276,7 @@ class ImporterTest extends TestCase // Mock the load method $importer->method("load") ->willReturn($array); - $importer->setData("usr_uid", factory(User::class)->create()->USR_UID); + $importer->setData("usr_uid", User::factory()->create()->USR_UID); // Call the import method $res = $importer->import(Importer::IMPORT_OPTION_KEEP_WITHOUT_CHANGING_AND_CREATE_NEW, @@ -301,10 +301,10 @@ class ImporterTest extends TestCase public function it_should_test_the_import_method_when_importing_a_process_without_change_the_uid() { // Create the existing process - $process = factory(Process::class)->create( + $process = Process::factory()->create( ['PRO_CREATE_DATE' => '2019-07-10 10:00:00'] ); - factory(BpmnProject::class)->create( + BpmnProject::factory()->create( ['PRJ_UID' => $process['PRO_UID']] ); @@ -528,7 +528,7 @@ class ImporterTest extends TestCase // Mock the load method $importer->method("load") ->willReturn($array); - $importer->setData("usr_uid", factory(User::class)->create()->USR_UID); + $importer->setData("usr_uid", User::factory()->create()->USR_UID); // Call the setProtectedProperty method $this->setProtectedProperty($importer, 'metadata', ['uid' => $process['PRO_UID']]); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Importer/XmlImporterTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Importer/XmlImporterTest.php index 994c16e40..6f04a79c8 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Importer/XmlImporterTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Importer/XmlImporterTest.php @@ -22,7 +22,7 @@ class XmlImporterTest extends TestCase public function setUp(): void { parent::setUp(); - $this->user = factory(User::class)->create(); + $this->user = User::factory()->create(); Groupwf::truncate(); $cached = ["jXsSi94bkRUcVZyRStNVExlTXhEclVadGRRcG9xbjNvTWVFQUF3cklKQVBiVT0=" => 1]; @@ -52,10 +52,10 @@ class XmlImporterTest extends TestCase */ public function it_should_matter_with_import_option_keep_without_changing_and_create_new_and_group_import_option_merge_preexistent() { - factory(\ProcessMaker\Model\Groupwf::class)->create([ + \ProcessMaker\Model\Groupwf::factory()->create([ 'GRP_TITLE' => 'group1' ]); - factory(\ProcessMaker\Model\Groupwf::class)->create([ + \ProcessMaker\Model\Groupwf::factory()->create([ 'GRP_TITLE' => 'group2' ]); $regenerateUids = false; @@ -74,10 +74,10 @@ class XmlImporterTest extends TestCase */ public function it_should_matter_with_import_option_overwrite_and_group_import_option_rename() { - factory(\ProcessMaker\Model\Groupwf::class)->create([ + \ProcessMaker\Model\Groupwf::factory()->create([ 'GRP_TITLE' => 'group1' ]); - factory(\ProcessMaker\Model\Groupwf::class)->create([ + \ProcessMaker\Model\Groupwf::factory()->create([ 'GRP_TITLE' => 'group2' ]); $filename = PATH_TRUNK . "tests/resources/p1normal-1.pmx"; @@ -196,10 +196,10 @@ class XmlImporterTest extends TestCase */ public function it_should_matter_with_import_option_overwrite_and_group_import_option_create_new_with_groups() { - factory(\ProcessMaker\Model\Groupwf::class)->create([ + \ProcessMaker\Model\Groupwf::factory()->create([ 'GRP_TITLE' => 'group1' ]); - factory(\ProcessMaker\Model\Groupwf::class)->create([ + \ProcessMaker\Model\Groupwf::factory()->create([ 'GRP_TITLE' => 'group2' ]); $filename = PATH_TRUNK . "tests/resources/p1normal-1.pmx"; @@ -237,7 +237,7 @@ class XmlImporterTest extends TestCase */ public function it_should_matter_with_import_option_create_new_and_group_import_option_create_new_try_rename_title() { - factory(\ProcessMaker\Model\Process::class)->create([ + \ProcessMaker\Model\Process::factory()->create([ 'PRO_TITLE' => 'p1normalWithoutTitle' ]); @@ -249,7 +249,7 @@ class XmlImporterTest extends TestCase $result = $importer->import(XmlImporter::IMPORT_OPTION_CREATE_NEW, XmlImporter::GROUP_IMPORT_OPTION_CREATE_NEW, false); $this->assertNotNull($result); - factory(\ProcessMaker\Model\Process::class)->create([ + \ProcessMaker\Model\Process::factory()->create([ 'PRO_TITLE' => 'p1normalWithoutTitle2' ]); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/AbeConfigurationTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/AbeConfigurationTest.php index fbefff920..9c32cc755 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/AbeConfigurationTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/AbeConfigurationTest.php @@ -45,21 +45,21 @@ class AbeConfigurationTest extends TestCase public function it_should_test_the_get_abe_request_method() { //Create the Task factory - factory(Task::class)->create(); + Task::factory()->create(); //Create the Process factory - factory(Process::class)->create(); + Process::factory()->create(); //Create the Dynaform factory - factory(Dynaform::class)->create(); + Dynaform::factory()->create(); //Create the EmailServerModel factory - factory(EmailServerModel::class)->create(); + EmailServerModel::factory()->create(); //Create the Application factory - factory(Application::class)->create(); + Application::factory()->create(); //Create the Delegation factory - $delegation = factory(Delegation::class)->create(); + $delegation = Delegation::factory()->create(); //Create the AbeConfiguration factory - $abeConfiguration = factory(AbeConfiguration::class)->create(); + $abeConfiguration = AbeConfiguration::factory()->create(); //Create the AbeConfiguration factory - factory(AbeRequest::class)->create([ + AbeRequest::factory()->create([ 'ABE_UID' => $abeConfiguration->ABE_UID, 'APP_UID' => $delegation->APP_UID, 'DEL_INDEX' => $delegation->DEL_INDEX, @@ -84,21 +84,21 @@ class AbeConfigurationTest extends TestCase public function it_should_test_the_get_abe_request_method_when_the_result_is_empty() { //Creates the Task factory - factory(Task::class)->create(); + Task::factory()->create(); //Creates the Process factory - factory(Process::class)->create(); + Process::factory()->create(); //Creates the Dynaform factory - factory(Dynaform::class)->create(); + Dynaform::factory()->create(); //Creates the EmailServer factory - factory(EmailServerModel::class)->create(); + EmailServerModel::factory()->create(); //Creates the Application factory - factory(Application::class)->create(); + Application::factory()->create(); //Creates the Delegation factory - $delegation = factory(Delegation::class)->create(); + $delegation = Delegation::factory()->create(); //Creates the AbeConfiguration factory - $abeConfiguration = factory(AbeConfiguration::class)->create(); + $abeConfiguration = AbeConfiguration::factory()->create(); //Creates the AbeConfiguration factory - factory(AbeRequest::class)->create([ + AbeRequest::factory()->create([ 'ABE_UID' => $abeConfiguration->ABE_UID, 'APP_UID' => $delegation->APP_UID, 'DEL_INDEX' => $delegation->DEL_INDEX, @@ -120,9 +120,9 @@ class AbeConfigurationTest extends TestCase */ public function it_should_test_the_update_abe_configuration_receiver_uid_method() { - $emailServer = factory(EmailServerModel::class)->create(); + $emailServer = EmailServerModel::factory()->create(); - $abeConfigurationFactory = factory(AbeConfiguration::class)->create([ + $abeConfigurationFactory = AbeConfiguration::factory()->create([ 'ABE_EMAIL_SERVER_UID' => $emailServer['MESS_UID'] ]); @@ -145,9 +145,9 @@ class AbeConfigurationTest extends TestCase public function it_should_test_the_update_abe_configuration_email_server_uid_method_when_there_is_not_a_default_server() { EmailServerModel::query()->delete(); - $emailServer = factory(EmailServerModel::class)->create(); + $emailServer = EmailServerModel::factory()->create(); - $abeConfigurationFactory = factory(AbeConfiguration::class)->create([ + $abeConfigurationFactory = AbeConfiguration::factory()->create([ 'ABE_EMAIL_SERVER_UID' => $emailServer['MESS_UID'] ]); @@ -170,13 +170,13 @@ class AbeConfigurationTest extends TestCase public function it_should_test_the_update_abe_configuration_email_server_uid_method_when_there_is_a_default_server() { EmailServerModel::query()->delete(); - $emailServer = factory(EmailServerModel::class)->create(); + $emailServer = EmailServerModel::factory()->create(); - $defaultServer = factory(EmailServerModel::class)->create([ + $defaultServer = EmailServerModel::factory()->create([ 'MESS_DEFAULT' => 1 ]); - $abeConfigurationFactory = factory(AbeConfiguration::class)->create([ + $abeConfigurationFactory = AbeConfiguration::factory()->create([ 'ABE_EMAIL_SERVER_UID' => $emailServer['MESS_UID'] ]); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/AbeRequestTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/AbeRequestTest.php index b1518c4e3..31e7f619a 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/AbeRequestTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/AbeRequestTest.php @@ -25,9 +25,9 @@ class AbeRequestTest extends TestCase */ public function it_has_one_application() { - $table = factory(AbeRequest::class)->create([ + $table = AbeRequest::factory()->create([ 'APP_UID' => function () { - return factory(Application::class)->create()->APP_UID; + return Application::factory()->create()->APP_UID; } ]); $this->assertInstanceOf(Application::class, $table->application); @@ -41,9 +41,9 @@ class AbeRequestTest extends TestCase */ public function it_has_one_abe_configuration() { - $table = factory(AbeRequest::class)->create([ + $table = AbeRequest::factory()->create([ 'ABE_UID' => function () { - return factory(AbeConfiguration::class)->create()->ABE_UID; + return AbeConfiguration::factory()->create()->ABE_UID; } ]); $this->assertInstanceOf(AbeConfiguration::class, $table->abeConfiguration); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/AdditionalTablesTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/AdditionalTablesTest.php index 6ff4e3f4a..57d8b140e 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/AdditionalTablesTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/AdditionalTablesTest.php @@ -21,9 +21,9 @@ class AdditionalTablesTest extends TestCase */ public function it_has_a_columns_defined() { - $table = factory(AdditionalTables::class)->create([ + $table = AdditionalTables::factory()->create([ 'ADD_TAB_UID' => function () { - return factory(Fields::class)->create()->ADD_TAB_UID; + return Fields::factory()->create()->ADD_TAB_UID; } ]); $this->assertInstanceOf(Fields::class, $table->columns); @@ -37,8 +37,8 @@ class AdditionalTablesTest extends TestCase */ public function it_filter_offline_table() { - factory(AdditionalTables::class)->create(['ADD_TAB_OFFLINE' => 0]); - $table = factory(AdditionalTables::class)->create([ + AdditionalTables::factory()->create(['ADD_TAB_OFFLINE' => 0]); + $table = AdditionalTables::factory()->create([ 'ADD_TAB_OFFLINE' => 1 ]); $this->assertCount(1, $table->offline([$table->ADD_TAB_OFFLINE])->get()); @@ -52,7 +52,7 @@ class AdditionalTablesTest extends TestCase */ public function it_filter_process() { - $table = factory(AdditionalTables::class)->create(); + $table = AdditionalTables::factory()->create(); $this->assertCount(1, $table->process($table->PRO_UID)->get()); } @@ -64,7 +64,7 @@ class AdditionalTablesTest extends TestCase */ public function it_get_tables_related_to_process() { - $table = factory(AdditionalTables::class)->create(); + $table = AdditionalTables::factory()->create(); $result = AdditionalTables::getTables($table->PRO_UID); $this->assertNotEmpty($result); } @@ -77,7 +77,7 @@ class AdditionalTablesTest extends TestCase */ public function it_get_structure_from_offline_tables() { - factory(Fields::class)->states('foreign_keys')->create(); + Fields::factory()->foreign_keys()->create(); $results = AdditionalTables::getTablesOfflineStructure(); $this->assertNotEmpty($results); foreach ($results as $row) { @@ -97,7 +97,7 @@ class AdditionalTablesTest extends TestCase */ public function it_get_data_from_offline_tables() { - factory(Fields::class)->states('foreign_keys')->create(); + Fields::factory()->foreign_keys()->create(); $results = AdditionalTables::getTablesOfflineData(); $this->assertNotEmpty($results); foreach ($results as $row) { @@ -117,7 +117,7 @@ class AdditionalTablesTest extends TestCase */ public function it_update_property_offline() { - $pmTable = factory(AdditionalTables::class)->create(['ADD_TAB_OFFLINE' => 0]); + $pmTable = AdditionalTables::factory()->create(['ADD_TAB_OFFLINE' => 0]); $results = AdditionalTables::updatePropertyOffline([$pmTable->ADD_TAB_UID], 1); // Check the update $pmTableQuery = AdditionalTables::query()->select(['ADD_TAB_OFFLINE']); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/AppAssignSelfServiceValueGroupTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/AppAssignSelfServiceValueGroupTest.php index 93fbd3aab..cb22e3c55 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/AppAssignSelfServiceValueGroupTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/AppAssignSelfServiceValueGroupTest.php @@ -24,9 +24,9 @@ class AppAssignSelfServiceValueGroupTest extends TestCase */ public function it_has_a_id_defined() { - $table = factory(AppAssignSelfServiceValueGroup::class)->create([ + $table = AppAssignSelfServiceValueGroup::factory()->create([ 'ID' => function () { - return factory(AppAssignSelfServiceValue::class)->create()->ID; + return AppAssignSelfServiceValue::factory()->create()->ID; } ]); $this->assertInstanceOf(AppAssignSelfServiceValue::class, $table->appSelfService); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/AppAssignSelfServiceValueTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/AppAssignSelfServiceValueTest.php index 9211574e0..fe829d114 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/AppAssignSelfServiceValueTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/AppAssignSelfServiceValueTest.php @@ -30,9 +30,9 @@ class AppAssignSelfServiceValueTest extends TestCase */ public function it_belong_app_number() { - $table = factory(AppAssignSelfServiceValue::class)->create([ + $table = AppAssignSelfServiceValue::factory()->create([ 'APP_NUMBER' => function () { - return factory(Delegation::class)->create()->APP_NUMBER; + return Delegation::factory()->create()->APP_NUMBER; } ]); $this->assertInstanceOf(Delegation::class, $table->appNumber); @@ -46,9 +46,9 @@ class AppAssignSelfServiceValueTest extends TestCase */ public function it_belong_index() { - $table = factory(AppAssignSelfServiceValue::class)->create([ + $table = AppAssignSelfServiceValue::factory()->create([ 'DEL_INDEX' => function () { - return factory(Delegation::class)->create()->DEL_INDEX; + return Delegation::factory()->create()->DEL_INDEX; } ]); $this->assertInstanceOf(Delegation::class, $table->index); @@ -62,9 +62,9 @@ class AppAssignSelfServiceValueTest extends TestCase */ public function it_belong_task() { - $table = factory(AppAssignSelfServiceValue::class)->create([ + $table = AppAssignSelfServiceValue::factory()->create([ 'TAS_ID' => function () { - return factory(Task::class)->create()->TAS_ID; + return Task::factory()->create()->TAS_ID; } ]); $this->assertInstanceOf(Task::class, $table->task); @@ -79,22 +79,22 @@ class AppAssignSelfServiceValueTest extends TestCase public function it_should_self_service_by_value() { // Assign user in a group - $rbacUser = factory(RbacUsers::class)->create(); - $user = factory(User::class)->create([ + $rbacUser = RbacUsers::factory()->create(); + $user = User::factory()->create([ 'USR_UID' => $rbacUser['USR_UID'] ]); - $group = factory(Groupwf::class)->create(); - $table = factory(GroupUser::class)->create([ + $group = Groupwf::factory()->create(); + $table = GroupUser::factory()->create([ 'GRP_UID' => $group['GRP_UID'], 'GRP_ID' => $group['GRP_ID'], 'USR_UID' => $user['USR_UID'], 'USR_ID' => $user['USR_ID'], ]); // Create the selfservice - $self = factory(AppAssignSelfServiceValue::class)->create([ + $self = AppAssignSelfServiceValue::factory()->create([ 'GRP_UID' => $group['GRP_UID'], ]); - $table = factory(AppAssignSelfServiceValueGroup::class)->create([ + $table = AppAssignSelfServiceValueGroup::factory()->create([ 'ID' => $self['ID'], 'GRP_UID' => $group['GRP_UID'], 'ASSIGNEE_ID' => $group['GRP_ID'], diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/AppDelayTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/AppDelayTest.php index 0ebe25973..71ac1209d 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/AppDelayTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/AppDelayTest.php @@ -2,7 +2,6 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\Model; -use Illuminate\Foundation\Testing\DatabaseTransactions; use ProcessMaker\Model\AppDelay; use Tests\TestCase; @@ -13,15 +12,13 @@ use Tests\TestCase; */ class AppDelayTest extends TestCase { - use DatabaseTransactions; - /** * Set up function. */ public function setUp(): void { parent::setUp(); - AppDelay::truncate(); + $this->truncateNonInitialModels(); } /** @@ -32,7 +29,7 @@ class AppDelayTest extends TestCase */ public function it_return_scope_type() { - $table = factory(AppDelay::class)->states('paused_foreign_keys')->create(); + $table = AppDelay::factory()->paused_foreign_keys()->create(); $this->assertCount(1, $table->type('PAUSE')->get()); } @@ -44,7 +41,7 @@ class AppDelayTest extends TestCase */ public function it_return_scope_not_action_disable() { - $table = factory(AppDelay::class)->states('paused_foreign_keys')->create(); + $table = AppDelay::factory()->paused_foreign_keys()->create(); $this->assertCount(1, $table->notDisabled()->get()); } @@ -56,7 +53,7 @@ class AppDelayTest extends TestCase */ public function it_return_scope_case() { - $table = factory(AppDelay::class)->states('paused_foreign_keys')->create(); + $table = AppDelay::factory()->paused_foreign_keys()->create(); $this->assertCount(1, $table->case($table->APP_NUMBER)->get()); } @@ -68,7 +65,7 @@ class AppDelayTest extends TestCase */ public function it_return_scope_index() { - $table = factory(AppDelay::class)->states('paused_foreign_keys')->create(); + $table = AppDelay::factory()->paused_foreign_keys()->create(); $this->assertCount(1, $table->index($table->APP_DEL_INDEX)->get()); } @@ -80,7 +77,7 @@ class AppDelayTest extends TestCase */ public function it_return_scope_delegate_user() { - $table = factory(AppDelay::class)->states('paused_foreign_keys')->create(); + $table = AppDelay::factory()->paused_foreign_keys()->create(); $this->assertCount(1, $table->delegateUser($table->APP_DELEGATION_USER)->get()); } @@ -95,7 +92,7 @@ class AppDelayTest extends TestCase */ public function it_return_paused_threads() { - $table = factory(AppDelay::class)->states('paused_foreign_keys')->create(); + $table = AppDelay::factory()->paused_foreign_keys()->create(); $result = AppDelay::getPaused($table->APP_NUMBER, $table->APP_DEL_INDEX, $table->APP_DELEGATION_USER); $this->assertNotEmpty($result); } diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/AppNotesTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/AppNotesTest.php index 9c0f1fd0b..c75007aa1 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/AppNotesTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/AppNotesTest.php @@ -25,8 +25,8 @@ class AppNotesTest extends TestCase */ public function createCaseNotes($rows = 10) { - $application = factory(Application::class)->create(); - $notes = factory(AppNotes::class, $rows)->states('foreign_keys')->create([ + $application = Application::factory()->create(); + $notes = AppNotes::factory($rows)->foreign_keys()->create([ 'APP_UID' => $application->APP_UID, 'APP_NUMBER' => $application->APP_NUMBER ]); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/AppThreadTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/AppThreadTest.php index e5709f9ba..94f642646 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/AppThreadTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/AppThreadTest.php @@ -31,7 +31,7 @@ class AppThreadTest extends TestCase */ public function it_return_scope_app_uid() { - $table = factory(AppThread::class)->create(); + $table = AppThread::factory()->create(); $this->assertCount(1, $table->appUid($table->APP_UID)->get()); } @@ -43,7 +43,7 @@ class AppThreadTest extends TestCase */ public function it_return_scope_index() { - $table = factory(AppThread::class)->create(); + $table = AppThread::factory()->create(); $this->assertCount(1, $table->index($table->DEL_INDEX)->get()); } @@ -57,7 +57,7 @@ class AppThreadTest extends TestCase */ public function it_return_thread() { - $table = factory(AppThread::class)->create(); + $table = AppThread::factory()->create(); $result = AppThread::getThread($table->APP_UID, $table->DEL_INDEX); $this->assertNotEmpty($result); } diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/AppTimeoutActionTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/AppTimeoutActionTest.php index a5c7057f8..d67ebe3a0 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/AppTimeoutActionTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/AppTimeoutActionTest.php @@ -24,8 +24,8 @@ class AppTimeoutActionTest extends TestCase */ public function it_set_get_case_uid() { - factory(AppTimeoutAction::class)->create(); - $timeout = factory(AppTimeoutAction::class)->create(); + AppTimeoutAction::factory()->create(); + $timeout = AppTimeoutAction::factory()->create(); $timeout->setCaseUid($timeout->APP_UID); $this->assertEquals($timeout->getCaseUid(), $timeout->APP_UID); } @@ -39,8 +39,8 @@ class AppTimeoutActionTest extends TestCase */ public function it_set_get_index() { - factory(AppTimeoutAction::class)->create(); - $timeout = factory(AppTimeoutAction::class)->create(); + AppTimeoutAction::factory()->create(); + $timeout = AppTimeoutAction::factory()->create(); $timeout->setIndex($timeout->DEL_INDEX); $this->assertEquals($timeout->getIndex(), $timeout->DEL_INDEX); } @@ -53,8 +53,8 @@ class AppTimeoutActionTest extends TestCase */ public function it_filter_a_specific_case() { - factory(AppTimeoutAction::class)->create(); - $timeout = factory(AppTimeoutAction::class)->create(); + AppTimeoutAction::factory()->create(); + $timeout = AppTimeoutAction::factory()->create(); $this->assertCount(1, $timeout->case($timeout->APP_UID)->get()); } @@ -66,8 +66,8 @@ class AppTimeoutActionTest extends TestCase */ public function it_filter_a_specific_index() { - factory(AppTimeoutAction::class)->create(); - $timeout = factory(AppTimeoutAction::class)->create(); + AppTimeoutAction::factory()->create(); + $timeout = AppTimeoutAction::factory()->create(); $this->assertCount(1, $timeout->case($timeout->APP_UID)->index($timeout->DEL_INDEX)->get()); } @@ -79,7 +79,7 @@ class AppTimeoutActionTest extends TestCase */ public function it_return_the_case_executed_once_one_thread() { - $records = factory(AppTimeoutAction::class, 5)->create(); + $records = AppTimeoutAction::factory(5)->create(); foreach ($records as $row) { $appUid = $row->APP_UID; $delIndex = $row->DEL_INDEX; @@ -100,13 +100,13 @@ class AppTimeoutActionTest extends TestCase */ public function it_return_the_case_executed_once_more_than_one_thread() { - $records = factory(AppTimeoutAction::class, 5)->create(); + $records = AppTimeoutAction::factory(5)->create(); foreach ($records as $row) { $appUid = $row->APP_UID; $delIndex = $row->DEL_INDEX; } // Create other thread in the same case - factory(AppTimeoutAction::class)->create([ + AppTimeoutAction::factory()->create([ 'APP_UID' => $appUid, 'DEL_INDEX' => $delIndex + 1, ]); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/ApplicationTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/ApplicationTest.php index 5b4b9e8e5..af820fc3a 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/ApplicationTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/ApplicationTest.php @@ -3,7 +3,6 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\Model; use G; -use Illuminate\Foundation\Testing\DatabaseTransactions; use ProcessMaker\Model\Application; use ProcessMaker\Model\Delegation; use ProcessMaker\Model\Process; @@ -17,15 +16,13 @@ use Tests\TestCase; */ class ApplicationTest extends TestCase { - use DatabaseTransactions; - /** * Set up function. */ public function setUp(): void { parent::setUp(); - Application::truncate(); + $this->truncateNonInitialModels(); } /** @@ -36,9 +33,9 @@ class ApplicationTest extends TestCase */ public function it_has_a_current_user() { - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_CUR_USER' => function () { - return factory(User::class)->create()->USR_UID; + return User::factory()->create()->USR_UID; } ]); $this->assertInstanceOf(User::class, $application->currentUser); @@ -52,9 +49,9 @@ class ApplicationTest extends TestCase */ public function it_has_a_creator_user() { - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_INIT_USER' => function () { - return factory(User::class)->create()->USR_UID; + return User::factory()->create()->USR_UID; } ]); $this->assertInstanceOf(User::class, $application->creatorUser); @@ -68,9 +65,9 @@ class ApplicationTest extends TestCase */ public function it_has_a_init_user() { - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_INIT_USER' => function () { - return factory(User::class)->create()->USR_UID; + return User::factory()->create()->USR_UID; } ]); $this->assertInstanceOf(User::class, $application->creatoruser); @@ -85,9 +82,9 @@ class ApplicationTest extends TestCase */ public function it_return_scope_user_id() { - $table = factory(Application::class)->states('foreign_keys')->create(); + $table = Application::factory()->foreign_keys()->create(); $usrId = User::getId($table->APP_INIT_USER); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'APP_UID' => $table->APP_UID, 'APP_NUMBER' => $table->APP_NUMBER, 'USR_ID' => $usrId, @@ -103,7 +100,7 @@ class ApplicationTest extends TestCase */ public function it_return_scope_creator() { - $table = factory(Application::class)->states('foreign_keys')->create(); + $table = Application::factory()->foreign_keys()->create(); $this->assertCount(1, $table->creator($table->APP_INIT_USER_ID)->get()); } @@ -115,7 +112,7 @@ class ApplicationTest extends TestCase */ public function it_return_scope_case_uids() { - $table = factory(Application::class)->states('foreign_keys')->create(); + $table = Application::factory()->foreign_keys()->create(); $this->assertCount(1, $table->specificCasesByUid([$table->APP_UID])->get()); } @@ -127,7 +124,7 @@ class ApplicationTest extends TestCase */ public function it_return_scope_case() { - $table = factory(Application::class)->states('foreign_keys')->create(); + $table = Application::factory()->foreign_keys()->create(); $this->assertCount(1, $table->case($table->APP_NUMBER)->get()); } @@ -139,7 +136,7 @@ class ApplicationTest extends TestCase */ public function it_return_scope_positive_cases() { - $table = factory(Application::class)->states('foreign_keys')->create(); + $table = Application::factory()->foreign_keys()->create(); $this->assertCount(1, $table->positiveCases()->get()); } @@ -151,7 +148,7 @@ class ApplicationTest extends TestCase */ public function it_return_scope_specific_case_numbers() { - $table = factory(Application::class)->states('foreign_keys')->create(); + $table = Application::factory()->foreign_keys()->create(); $this->assertCount(1, $table->specificCases([$table->APP_NUMBER])->get()); } @@ -163,7 +160,7 @@ class ApplicationTest extends TestCase */ public function it_return_scope_range_of_cases() { - $table = factory(Application::class)->states('foreign_keys')->create(); + $table = Application::factory()->foreign_keys()->create(); $this->assertCount(1, $table->rangeOfCases([$table->APP_NUMBER.'-'.$table->APP_NUMBER])->get()); } @@ -175,7 +172,7 @@ class ApplicationTest extends TestCase */ public function it_return_scope_cases_or_range_of_cases() { - $table = factory(Application::class)->states('foreign_keys')->create(); + $table = Application::factory()->foreign_keys()->create(); $cases = [$table->APP_NUMBER]; $rangeCases = [$table->APP_NUMBER.'-'.$table->APP_NUMBER]; $this->assertCount(1, $table->casesOrRangeOfCases($cases, $rangeCases)->get()); @@ -189,7 +186,7 @@ class ApplicationTest extends TestCase */ public function it_return_scope_case_from() { - $table = factory(Application::class)->states('foreign_keys')->create(); + $table = Application::factory()->foreign_keys()->create(); $this->assertCount(1, $table->casesFrom($table->APP_NUMBER)->get()); } @@ -201,7 +198,7 @@ class ApplicationTest extends TestCase */ public function it_return_scope_case_to() { - $table = factory(Application::class)->states('foreign_keys')->create(); + $table = Application::factory()->foreign_keys()->create(); $this->assertCount(1, $table->casesTo($table->APP_NUMBER)->get()); } @@ -213,7 +210,7 @@ class ApplicationTest extends TestCase */ public function it_return_cases_by_status_id() { - $table = factory(Application::class)->create(); + $table = Application::factory()->create(); $this->assertCount(1, $table->statusId($table->APP_STATUS_ID)->get()); } @@ -225,7 +222,7 @@ class ApplicationTest extends TestCase */ public function it_return_cases_by_status_ids() { - $table = factory(Application::class)->create(); + $table = Application::factory()->create(); $this->assertCount(1, $table->statusIds([$table->APP_STATUS_ID])->get()); } @@ -237,7 +234,7 @@ class ApplicationTest extends TestCase */ public function it_return_start_date_from() { - $table = factory(Application::class)->create(); + $table = Application::factory()->create(); $this->assertCount(1, $table->startDateFrom($table->APP_CREATE_DATE->format("Y-m-d H:i:s"))->get()); } @@ -249,7 +246,7 @@ class ApplicationTest extends TestCase */ public function it_return_start_date_to() { - $table = factory(Application::class)->create(); + $table = Application::factory()->create(); $this->assertCount(1, $table->startDateTo($table->APP_CREATE_DATE->format("Y-m-d H:i:s"))->get()); } @@ -261,7 +258,7 @@ class ApplicationTest extends TestCase */ public function it_return_finish_date_from() { - $table = factory(Application::class)->create(); + $table = Application::factory()->create(); $this->assertCount(1, $table->finishCaseFrom($table->APP_FINISH_DATE->format("Y-m-d H:i:s"))->get()); } @@ -273,7 +270,7 @@ class ApplicationTest extends TestCase */ public function it_return_finish_date_to() { - $table = factory(Application::class)->create(); + $table = Application::factory()->create(); $this->assertCount(1, $table->finishCaseTo($table->APP_FINISH_DATE->format("Y-m-d H:i:s"))->get()); } @@ -286,8 +283,8 @@ class ApplicationTest extends TestCase */ public function it_return_scope_task() { - $table = factory(Application::class)->create(); - $tableJoin = factory(Delegation::class)->states('foreign_keys')->create([ + $table = Application::factory()->create(); + $tableJoin = Delegation::factory()->foreign_keys()->create([ 'APP_UID' => $table->APP_UID, 'APP_NUMBER' => $table->APP_NUMBER, ]); @@ -303,7 +300,7 @@ class ApplicationTest extends TestCase */ public function it_return_scope_join_process() { - $table = factory(Application::class)->create(); + $table = Application::factory()->create(); $this->assertCount(1, $table->joinProcess()->get()); } @@ -316,8 +313,8 @@ class ApplicationTest extends TestCase */ public function it_return_cases_by_process() { - $process = factory(Process::class)->create(); - factory(Application::class, 5)->create(['PRO_UID' => $process->PRO_UID]); + $process = Process::factory()->create(); + Application::factory(5)->create(['PRO_UID' => $process->PRO_UID]); $cases = Application::getByProUid($process->PRO_UID); foreach ($cases as $case) { $this->assertEquals($case->PRO_UID, $process->PRO_UID); @@ -333,7 +330,7 @@ class ApplicationTest extends TestCase */ public function it_return_case_information() { - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); $result = Application::getCase($application->APP_UID); $this->assertArrayHasKey('APP_STATUS', $result); $this->assertArrayHasKey('APP_INIT_USER', $result); @@ -347,7 +344,7 @@ class ApplicationTest extends TestCase */ public function it_get_case_number() { - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); $result = Application::getCaseNumber($application->APP_UID); // When the application exist $this->assertEquals($result, $application->APP_NUMBER); @@ -366,22 +363,22 @@ class ApplicationTest extends TestCase public function it_update_columns() { // No column will be updated - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); $result = Application::updateColumns($application->APP_UID, []); $this->isEmpty($result); // Tried to update APP_ROUTING_DATA - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); $result = Application::updateColumns($application->APP_UID, ['APP_ROUTING_DATA' => '']); $this->assertArrayHasKey('APP_ROUTING_DATA', $result); // We can not update with a empty user - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); $result = Application::updateColumns($application->APP_UID, ['APP_CUR_USER' => '']); $this->assertArrayNotHasKey('APP_CUR_USER', $result); // Tried to update APP_CUR_USER - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); $result = Application::updateColumns($application->APP_UID, ['APP_CUR_USER' => '00000000000000000000000000000001']); $this->assertArrayHasKey('APP_CUR_USER', $result); } @@ -397,8 +394,8 @@ class ApplicationTest extends TestCase */ public function it_count_cases_by_process() { - $process = factory(Process::class)->create(); - factory(Application::class, 5)->create(['PRO_UID' => $process->PRO_UID]); + $process = Process::factory()->create(); + Application::factory(5)->create(['PRO_UID' => $process->PRO_UID]); $result = Application::getCountByProUid($process->PRO_UID); $this->assertEquals($result, 5); } diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/BpmnProjectTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/BpmnProjectTest.php index 976098fed..2d861bcaa 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/BpmnProjectTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/BpmnProjectTest.php @@ -23,7 +23,7 @@ class BpmnProjectTest extends TestCase */ public function it_is_bpmn_process() { - $table = factory(BpmnProject::class)->create(); + $table = BpmnProject::factory()->create(); $result = BpmnProject::isBpmnProcess($table->PRJ_UID); $this->assertEquals($result, 1); } diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/CaseListTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/CaseListTest.php index 3b344b058..0bf6d2024 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/CaseListTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/CaseListTest.php @@ -19,6 +19,7 @@ class CaseListTest extends TestCase public function setUp(): void { parent::setUp(); + $this->truncateNonInitialModels(); } /** @@ -262,8 +263,6 @@ class CaseListTest extends TestCase */ public function it_should_test_getSetting() { - CaseList::truncate(); - $data = [ 'type' => 'inbox', 'name' => 'test1', @@ -322,7 +321,7 @@ class CaseListTest extends TestCase */ public function it_should_test_import() { - $additionalTables = factory(AdditionalTables::class)->create(); + $additionalTables = AdditionalTables::factory()->create(); $data = [ 'type' => 'inbox', 'name' => 'test1', @@ -370,7 +369,6 @@ class CaseListTest extends TestCase */ public function it_should_test_export() { - CaseList::truncate(); $data = [ 'type' => 'inbox', 'name' => 'test export', @@ -406,25 +404,25 @@ class CaseListTest extends TestCase */ public function it_should_test_formattingColumns() { - $additionalTables = factory(\ProcessMaker\Model\AdditionalTables::class)->create(); + $additionalTables = \ProcessMaker\Model\AdditionalTables::factory()->create(); - $fields = factory(\ProcessMaker\Model\Fields::class, 5)->create([ + $fields = \ProcessMaker\Model\Fields::factory(5)->create([ 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID ]); - factory(CaseList::class)->create([ + CaseList::factory()->create([ 'CAL_TYPE' => 'inbox', 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID ]); - factory(CaseList::class)->create([ + CaseList::factory()->create([ 'CAL_TYPE' => 'draft', 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID ]); - factory(CaseList::class)->create([ + CaseList::factory()->create([ 'CAL_TYPE' => 'paused', 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID ]); - factory(CaseList::class)->create([ + CaseList::factory()->create([ 'CAL_TYPE' => 'unassigned', 'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID ]); @@ -490,8 +488,7 @@ class CaseListTest extends TestCase */ public function it_should_test_getReportTables() { - AdditionalTables::truncate(); - $additionalTables = factory(AdditionalTables::class, 10)->create(); + $additionalTables = AdditionalTables::factory(10)->create(); $search = ''; $result = CaseList::getReportTables($search); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/ConsolidatedTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/ConsolidatedTest.php index 7532cc285..2ff7cbf3d 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/ConsolidatedTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/ConsolidatedTest.php @@ -33,9 +33,9 @@ class ConsolidatedTest extends TestCase */ public function it_has_a_task() { - $table = factory(Consolidated::class)->create([ + $table = Consolidated::factory()->create([ 'TAS_UID' => function () { - return factory(Task::class)->create()->TAS_UID; + return Task::factory()->create()->TAS_UID; } ]); $this->assertInstanceOf(Task::class, $table->task); @@ -48,8 +48,8 @@ class ConsolidatedTest extends TestCase */ public function createConsolidated() { - $consolidated = factory(Consolidated::class)->states('foreign_keys')->create(); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $consolidated = Consolidated::factory()->foreign_keys()->create(); + $delegation = Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'TAS_UID' => $consolidated->TAS_UID, ]); @@ -102,7 +102,7 @@ class ConsolidatedTest extends TestCase */ public function it_should_test_scope_join_process() { - $query = factory(Consolidated::class)->states('foreign_keys')->create(); + $query = Consolidated::factory()->foreign_keys()->create(); $consolidated = new Consolidated(); $this->assertCount(1, $consolidated->scopeJoinProcess($query)->get()); } @@ -115,7 +115,7 @@ class ConsolidatedTest extends TestCase */ public function it_should_test_scope_join_task() { - $query = factory(Consolidated::class)->states('foreign_keys')->create(); + $query = Consolidated::factory()->foreign_keys()->create(); $consolidated = new Consolidated(); $this->assertCount(1, $consolidated->scopeJoinTask($query)->get()); } diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/DelegationTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/DelegationTest.php index 68e1786f0..c77530bf2 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/DelegationTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/DelegationTest.php @@ -5,7 +5,6 @@ namespace Tests\unit\workflow\src\ProcessMaker\Model; use DateInterval; use Datetime; use G; -use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Support\Facades\DB; use ProcessMaker\Model\AppAssignSelfServiceValue; use ProcessMaker\Model\AppAssignSelfServiceValueGroup; @@ -30,17 +29,22 @@ use Tests\TestCase; */ class DelegationTest extends TestCase { - use DatabaseTransactions; - /** * Set up function. */ public function setUp(): void { parent::setUp(); - Delegation::truncate(); - AppThread::truncate(); - Application::truncate(); + $this->truncateNonInitialModels(); + } + + /** + * Tear down function. + * @return void + */ + public function tearDown(): void + { + parent::tearDown(); } /** @@ -51,9 +55,9 @@ class DelegationTest extends TestCase */ public function it_has_an_application() { - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_UID' => function () { - return factory(Application::class)->create()->APP_UID; + return Application::factory()->create()->APP_UID; } ]); $this->assertInstanceOf(Application::class, $delegation->application); @@ -67,9 +71,9 @@ class DelegationTest extends TestCase */ public function it_has_an_user() { - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'USR_ID' => function () { - return factory(User::class)->create()->USR_ID; + return User::factory()->create()->USR_ID; } ]); $this->assertInstanceOf(User::class, $delegation->user); @@ -83,9 +87,9 @@ class DelegationTest extends TestCase */ public function it_has_a_task() { - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'TAS_ID' => function () { - return factory(Task::class)->create()->TAS_ID; + return Task::factory()->create()->TAS_ID; } ]); $this->assertInstanceOf(Task::class, $delegation->task); @@ -99,9 +103,9 @@ class DelegationTest extends TestCase */ public function it_has_a_process() { - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'PRO_ID' => function () { - return factory(Process::class)->create()->PRO_ID; + return Process::factory()->create()->PRO_ID; } ]); $this->assertInstanceOf(Process::class, $delegation->process); @@ -115,7 +119,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_priority() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->priority($table->DEL_PRIORITY)->get()); } @@ -127,7 +131,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_priorities() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->priorities([$table->DEL_PRIORITY])->get()); } @@ -139,7 +143,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_thread_open() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->threadOpen()->get()); } @@ -151,7 +155,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_thread_pause() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(0, $table->threadPause()->get()); } /** @@ -162,7 +166,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_thread_open_and_pause() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->openAndPause()->get()); } @@ -174,7 +178,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_case_started() { - $table = factory(Delegation::class)->states('first_thread')->create(); + $table = Delegation::factory()->first_thread()->create(); $this->assertCount(1, $table->caseStarted($table->DEL_INDEX)->get()); } @@ -186,7 +190,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_case_in_progress() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->joinApplication()->casesInProgress([2])->get()); } @@ -198,7 +202,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_case_done() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->joinApplication()->casesDone([2])->get()); } @@ -210,7 +214,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_index() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->index($table->DEL_INDEX)->get()); } @@ -222,8 +226,8 @@ class DelegationTest extends TestCase */ public function it_return_scope_case_to_do() { - $application = factory(Application::class)->states('todo')->create(); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->todo()->create(); + $table = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); @@ -238,8 +242,8 @@ class DelegationTest extends TestCase */ public function it_return_scope_case_completed() { - $application = factory(Application::class)->states('completed')->create(); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->completed()->create(); + $table = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); @@ -254,8 +258,8 @@ class DelegationTest extends TestCase */ public function it_return_scope_case_canceled() { - $application = factory(Application::class)->states('canceled')->create(); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->canceled()->create(); + $table = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); @@ -270,8 +274,8 @@ class DelegationTest extends TestCase */ public function it_return_scope_status() { - $application = factory(Application::class)->states('todo')->create(); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->todo()->create(); + $table = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); @@ -286,8 +290,8 @@ class DelegationTest extends TestCase */ public function it_return_scope_status_ids() { - $application = factory(Application::class)->states('todo')->create(); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->todo()->create(); + $table = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); @@ -302,8 +306,8 @@ class DelegationTest extends TestCase */ public function it_return_scope_start_date_from() { - $application = factory(Application::class)->states('todo')->create(); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->todo()->create(); + $table = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); @@ -318,8 +322,8 @@ class DelegationTest extends TestCase */ public function it_return_scope_start_date_to() { - $application = factory(Application::class)->states('todo')->create(); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->todo()->create(); + $table = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); @@ -334,8 +338,8 @@ class DelegationTest extends TestCase */ public function it_return_scope_finish_case_date_from() { - $application = factory(Application::class)->states('todo')->create(); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->todo()->create(); + $table = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); @@ -350,8 +354,8 @@ class DelegationTest extends TestCase */ public function it_return_scope_finish_case_date_to() { - $application = factory(Application::class)->states('todo')->create(); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->todo()->create(); + $table = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); @@ -366,7 +370,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_delegate_date_from() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->delegateDateFrom($table->DEL_DELEGATE_DATE->format("Y-m-d H:i:s"))->get()); } @@ -378,7 +382,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_delegate_date_to() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->delegateDateTo($table->DEL_DELEGATE_DATE->format("Y-m-d H:i:s"))->get()); } @@ -390,7 +394,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_finish_date_from() { - $table = factory(Delegation::class)->states('closed')->create(); + $table = Delegation::factory()->closed()->create(); $this->assertCount(1, $table->finishDateFrom($table->DEL_FINISH_DATE)->get()); } @@ -402,7 +406,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_finish_date_to() { - $table = factory(Delegation::class)->states('closed')->create(); + $table = Delegation::factory()->closed()->create(); $this->assertCount(1, $table->finishDateTo($table->DEL_FINISH_DATE)->get()); } @@ -414,7 +418,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_due_date_from() { - $table = factory(Delegation::class)->states('closed')->create(); + $table = Delegation::factory()->closed()->create(); $this->assertCount(1, $table->dueFrom($table->DEL_TASK_DUE_DATE)->get()); } @@ -426,7 +430,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_due_date_to() { - $table = factory(Delegation::class)->states('closed')->create(); + $table = Delegation::factory()->closed()->create(); $this->assertCount(1, $table->dueTo($table->DEL_TASK_DUE_DATE)->get()); } @@ -438,7 +442,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_on_time() { - $table = factory(Delegation::class)->states('closed')->create(); + $table = Delegation::factory()->closed()->create(); $this->assertCount(1, $table->onTime($table->DEL_DELEGATE_DATE)->get()); } @@ -454,7 +458,7 @@ class DelegationTest extends TestCase $currentDate = $date->format('Y-m-d H:i:s'); $diff2Days = new DateInterval('P2D'); - $table = factory(Delegation::class)->create([ + $table = Delegation::factory()->create([ 'DEL_THREAD_STATUS' => 'CLOSED', 'DEL_DELEGATE_DATE' => $currentDate, 'DEL_RISK_DATE' => $currentDate, @@ -475,7 +479,7 @@ class DelegationTest extends TestCase $currentDate = $date->format('Y-m-d H:i:s'); $diff2Days = new DateInterval('P2D'); - $table = factory(Delegation::class)->create([ + $table = Delegation::factory()->create([ 'DEL_THREAD_STATUS' => 'CLOSED', 'DEL_DELEGATE_DATE' => $currentDate, 'DEL_RISK_DATE' => $currentDate, @@ -492,7 +496,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_case() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->case($table->APP_NUMBER)->get()); } @@ -504,7 +508,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_specific_cases() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->specificCases([$table->APP_NUMBER])->get()); } @@ -516,7 +520,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_cases_from() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->casesFrom($table->APP_NUMBER)->get()); } @@ -528,7 +532,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_cases_to() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->casesTo($table->APP_NUMBER)->get()); } @@ -540,7 +544,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_positive_cases() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->positiveCases()->get()); } @@ -552,7 +556,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_cases_and_range_of_cases() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $cases = [$table->APP_NUMBER]; $rangeCases = [$table->APP_NUMBER . '-' . $table->APP_NUMBER]; $this->assertCount(1, $table->casesOrRangeOfCases($cases, $rangeCases)->get()); @@ -566,7 +570,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_range_of_cases() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->rangeOfCases([$table->APP_NUMBER . '-' . $table->APP_NUMBER])->get()); } @@ -578,7 +582,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_app_uid() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->appUid($table->APP_UID)->get()); } @@ -590,7 +594,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_last_thread() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->lastThread()->get()); } @@ -602,7 +606,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_specific_cases_uid() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->specificCasesByUid([$table->APP_UID])->get()); } @@ -614,7 +618,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_user_id() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->userId($table->USR_ID)->get()); } @@ -626,7 +630,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_without_user_id() { - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $table = Delegation::factory()->foreign_keys()->create([ 'USR_ID' => 0 ]); $this->assertCount(1, $table->withoutUserId($table->TAS_ID)->get()); @@ -640,7 +644,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_process_id() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->processId($table->PRO_ID)->get()); } @@ -652,7 +656,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_task_id() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->task($table->TAS_ID)->get()); } @@ -664,7 +668,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_task() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->task($table->TAS_ID)->get()); } @@ -676,7 +680,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_specific_tasks() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->specificTasks([$table->TAS_ID])->get()); } @@ -688,7 +692,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_assign_type() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->taskAssignType('NORMAL')->get()); } @@ -700,7 +704,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_exclude_tas_types() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertNotEmpty($table->excludeTaskTypes(['ADHOC'])->get()); } @@ -712,7 +716,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_specific_tas_types() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->specificTaskTypes(['NORMAL'])->get()); } @@ -724,11 +728,11 @@ class DelegationTest extends TestCase */ public function it_return_scope_status_id() { - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 2, 'APP_STATUS' => 'TO_DO' ]); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $table = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER ]); $this->assertCount(1, $table->appStatusId()->get()); @@ -742,8 +746,8 @@ class DelegationTest extends TestCase */ public function it_return_scope_process_in_list() { - $process = factory(Process::class)->create(); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $process = Process::factory()->create(); + $table = Delegation::factory()->foreign_keys()->create([ 'PRO_ID' => $process->PRO_ID ]); $this->assertCount(1, $table->joinProcess()->processInList([$table->PRO_ID])->get()); @@ -757,7 +761,7 @@ class DelegationTest extends TestCase */ public function it_return_scope_participated() { - $table = factory(Delegation::class)->states('foreign_keys')->create(); + $table = Delegation::factory()->foreign_keys()->create(); $this->assertCount(1, $table->participated($table->USR_ID)->get()); } @@ -769,8 +773,8 @@ class DelegationTest extends TestCase */ public function it_return_scope_category() { - $process = factory(Process::class)->create(); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $process = Process::factory()->create(); + $table = Delegation::factory()->foreign_keys()->create([ 'PRO_ID' => $process->PRO_ID ]); $this->assertCount(1, $table->joinProcess()->categoryId($process->CATEGORY_ID)->get()); @@ -784,11 +788,11 @@ class DelegationTest extends TestCase */ public function it_return_scope_join_category_process() { - $category = factory(ProcessCategory::class)->create(); - $process = factory(Process::class)->create([ + $category = ProcessCategory::factory()->create(); + $process = Process::factory()->create([ 'PRO_CATEGORY' => $category->CATEGORY_UID ]); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $table = Delegation::factory()->foreign_keys()->create([ 'PRO_ID' => $process->PRO_ID ]); $this->assertCount(1, $table->joinCategoryProcess($category->CATEGORY_UID)->get()); @@ -802,8 +806,8 @@ class DelegationTest extends TestCase */ public function it_return_scope_join_previous_index() { - $previous = factory(Delegation::class)->states('foreign_keys')->create(); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $previous = Delegation::factory()->foreign_keys()->create(); + $table = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $previous->APP_NUMBER, 'DEL_INDEX' => $previous->DEL_INDEX + 1, 'DEL_PREVIOUS' => $previous->DEL_INDEX @@ -819,8 +823,8 @@ class DelegationTest extends TestCase */ public function it_return_scope_join_process() { - $process = factory(Process::class)->create(); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $process = Process::factory()->create(); + $table = Delegation::factory()->foreign_keys()->create([ 'PRO_ID' => $process->PRO_ID ]); $this->assertCount(1, $table->joinProcess()->get()); @@ -834,8 +838,8 @@ class DelegationTest extends TestCase */ public function it_return_scope_join_task() { - $task = factory(Task::class)->create(); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $task = Task::factory()->create(); + $table = Delegation::factory()->foreign_keys()->create([ 'TAS_ID' => $task->TAS_ID ]); $this->assertCount(1, $table->joinTask()->get()); @@ -849,8 +853,8 @@ class DelegationTest extends TestCase */ public function it_return_scope_join_user() { - $user = factory(User::class)->create(); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $user = User::factory()->create(); + $table = Delegation::factory()->foreign_keys()->create([ 'USR_ID' => $user->USR_ID ]); $this->assertCount(1, $table->joinUser()->get()); @@ -864,8 +868,8 @@ class DelegationTest extends TestCase */ public function it_return_scope_join_application() { - $application = factory(Application::class)->create(); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->create(); + $table = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER ]); $this->assertCount(1, $table->joinApplication()->get()); @@ -880,13 +884,13 @@ class DelegationTest extends TestCase */ public function it_return_scope_join_app_delay_pause() { - $user = factory(User::class)->create(); - $delay = factory(AppDelay::class)->create([ + $user = User::factory()->create(); + $delay = AppDelay::factory()->create([ 'APP_TYPE' => 'PAUSE', 'APP_DISABLE_ACTION_USER' => '0', 'APP_DELEGATION_USER' => $user->USR_UID, ]); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $table = Delegation::factory()->foreign_keys()->create([ 'USR_ID' => $user->USR_ID, 'USR_UID' => $user->USR_UID, 'APP_NUMBER' => $delay->APP_NUMBER, @@ -903,7 +907,7 @@ class DelegationTest extends TestCase */ public function it_should_return_pages_of_data() { - factory(Delegation::class, 51)->states('foreign_keys')->create(); + Delegation::factory(51)->foreign_keys()->create(); // Get first page, which is 25 $results = Delegation::search(null, 0, 25, null, null, null, null, null, null, null, null, 'APP_NUMBER'); $this->assertCount(25, $results['data']); @@ -923,8 +927,8 @@ class DelegationTest extends TestCase */ public function it_should_return_pages_of_data_unassigned() { - factory(Delegation::class, 50)->states('foreign_keys')->create(); - factory(Delegation::class, 1)->states('foreign_keys')->create([ + Delegation::factory(50)->foreign_keys()->create(); + Delegation::factory(1)->foreign_keys()->create([ 'USR_ID' => 0 // A self service delegation ]); // Get first page, which is 25 @@ -947,8 +951,8 @@ class DelegationTest extends TestCase public function it_should_return_process_of_data() { - $process = factory(Process::class)->create(); - factory(Delegation::class, 51)->states('foreign_keys')->create([ + $process = Process::factory()->create(); + Delegation::factory(51)->foreign_keys()->create([ 'PRO_ID' => $process->PRO_ID ]); // Get first page, which is 25 @@ -971,11 +975,11 @@ class DelegationTest extends TestCase */ public function it_should_return_status_draft_of_data() { - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 1, 'APP_STATUS' => 'DRAFT' ]); - factory(Delegation::class, 51)->states('foreign_keys')->create([ + Delegation::factory(51)->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER ]); // Review the filter by status DRAFT @@ -999,11 +1003,11 @@ class DelegationTest extends TestCase */ public function it_should_return_status_todo_of_data() { - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 2, 'APP_STATUS' => 'TO_DO' ]); - factory(Delegation::class, 51)->states('foreign_keys')->create([ + Delegation::factory(51)->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER ]); // Review the filter by status TO_DO @@ -1027,11 +1031,11 @@ class DelegationTest extends TestCase */ public function it_should_return_status_completed_of_data() { - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 3, 'APP_STATUS' => 'COMPLETED', ]); - factory(Delegation::class, 51)->states('foreign_keys')->create([ + Delegation::factory(51)->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_LAST_INDEX' => 1 ]); @@ -1056,11 +1060,11 @@ class DelegationTest extends TestCase */ public function it_should_return_status_cancelled_of_data() { - $application = factory(Application::class)->create([ + $application = Application::factory()->create([ 'APP_STATUS_ID' => 4, 'APP_STATUS' => 'CANCELLED' ]); - factory(Delegation::class, 51)->states('foreign_keys')->create([ + Delegation::factory(51)->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_LAST_INDEX' => 1 ]); @@ -1085,9 +1089,9 @@ class DelegationTest extends TestCase public function it_should_return_one_result_for_specified_user() { // Create our unique user, with a unique username - $user = factory(User::class)->create(); + $user = User::factory()->create(); // Create a new delegation, but for this specific user - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'USR_UID' => $user->USR_UID, 'USR_ID' => $user->USR_ID ]); @@ -1106,8 +1110,8 @@ class DelegationTest extends TestCase public function it_should_search_and_filter_by_app_number() { for ($x = 1; $x <= 10; $x++) { - $application = factory(Application::class)->create(); - factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->create(); + Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_THREAD_STATUS' => 'OPEN' ]); @@ -1156,9 +1160,9 @@ class DelegationTest extends TestCase */ public function it_should_search_and_filter_by_app_title() { - $delegations = factory(Delegation::class, 1)->states('foreign_keys')->create([ + $delegations = Delegation::factory(1)->foreign_keys()->create([ 'APP_NUMBER' => function () { - return factory(Application::class)->create()->APP_NUMBER; + return Application::factory()->create()->APP_NUMBER; } ]); $title = $delegations->last()->DEL_TITLE; @@ -1209,13 +1213,13 @@ class DelegationTest extends TestCase */ public function it_should_search_and_order_by_task_title() { - factory(Delegation::class, 5)->states('foreign_keys')->create([ + Delegation::factory(5)->foreign_keys()->create([ 'TAS_ID' => function () { - return factory(Task::class)->create()->TAS_ID; + return Task::factory()->create()->TAS_ID; } ]); - $task = factory(Task::class)->create(); - factory(Delegation::class)->states('foreign_keys')->create([ + $task = Task::factory()->create(); + Delegation::factory()->foreign_keys()->create([ 'TAS_ID' => $task->TAS_ID ]); // Get the order taskTitle in ASC mode @@ -1293,7 +1297,7 @@ class DelegationTest extends TestCase */ public function it_should_sort_by_case_id() { - factory(Delegation::class, 2)->states('foreign_keys')->create(); + Delegation::factory(2)->foreign_keys()->create(); // Get first page, the minor case id $results = Delegation::search(null, 0, 2, null, null, null, 'ASC', 'APP_NUMBER'); $this->assertCount(2, $results['data']); @@ -1312,7 +1316,7 @@ class DelegationTest extends TestCase */ public function it_should_sort_by_case_title() { - factory(Delegation::class, 2)->states('foreign_keys')->create(); + Delegation::factory(2)->foreign_keys()->create(); // Get first page, the minor case title $results = Delegation::search(null, 0, 2, null, null, null, 'ASC', 'APP_TITLE'); $this->assertCount(2, $results['data']); @@ -1331,9 +1335,9 @@ class DelegationTest extends TestCase */ public function it_should_sort_by_process() { - factory(Delegation::class, 3)->states('foreign_keys')->create([ + Delegation::factory(3)->foreign_keys()->create([ 'PRO_ID' => function () { - return factory(Process::class)->create()->PRO_ID; + return Process::factory()->create()->PRO_ID; } ]); // Get first page, all process ordering ASC @@ -1354,9 +1358,9 @@ class DelegationTest extends TestCase */ public function it_should_sort_by_task_title() { - factory(Delegation::class, 2)->states('foreign_keys')->create([ + Delegation::factory(2)->foreign_keys()->create([ 'TAS_ID' => function () { - return factory(Task::class)->create()->TAS_ID; + return Task::factory()->create()->TAS_ID; } ]); // Get first page, all titles ordering ASC @@ -1377,9 +1381,9 @@ class DelegationTest extends TestCase */ public function it_should_sort_by_user() { - factory(Delegation::class, 2)->states('foreign_keys')->create([ + Delegation::factory(2)->foreign_keys()->create([ 'USR_ID' => function () { - return factory(User::class)->create()->USR_ID; + return User::factory()->create()->USR_ID; } ]); // Get first page, order by User ordering ASC @@ -1400,9 +1404,9 @@ class DelegationTest extends TestCase */ public function it_should_sort_by_last_modified() { - factory(Delegation::class, 2)->states('foreign_keys')->create([ + Delegation::factory(2)->foreign_keys()->create([ 'APP_NUMBER' => function () { - return factory(Application::class)->create()->APP_NUMBER; + return Application::factory()->create()->APP_NUMBER; } ]); // Get first page, the minor last modified @@ -1423,7 +1427,7 @@ class DelegationTest extends TestCase */ public function it_should_sort_by_due_date() { - factory(Delegation::class, 10)->states('foreign_keys')->create(); + Delegation::factory(10)->foreign_keys()->create(); // Get first page, the minor due date $results = Delegation::search(null, 0, 10, null, null, null, 'ASC', 'DEL_TASK_DUE_DATE'); $this->assertCount(10, $results['data']); @@ -1442,27 +1446,27 @@ class DelegationTest extends TestCase */ public function it_should_sort_by_status() { - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => function () { - return factory(Application::class)->create(['APP_STATUS' => 'DRAFT', 'APP_STATUS_ID' => 1])->APP_NUMBER; + return Application::factory()->create(['APP_STATUS' => 'DRAFT', 'APP_STATUS_ID' => 1])->APP_NUMBER; } ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => function () { - return factory(Application::class)->create(['APP_STATUS' => 'TO_DO', 'APP_STATUS_ID' => 2])->APP_NUMBER; + return Application::factory()->create(['APP_STATUS' => 'TO_DO', 'APP_STATUS_ID' => 2])->APP_NUMBER; } ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => function () { - return factory(Application::class)->create([ + return Application::factory()->create([ 'APP_STATUS' => 'COMPLETED', 'APP_STATUS_ID' => 3 ])->APP_NUMBER; } ]); - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => function () { - return factory(Application::class)->create([ + return Application::factory()->create([ 'APP_STATUS' => 'CANCELLED', 'APP_STATUS_ID' => 4 ])->APP_NUMBER; @@ -1485,21 +1489,21 @@ class DelegationTest extends TestCase public function it_should_return_data_filtered_by_process_category() { // Dummy Processes - factory(ProcessCategory::class, 4)->create(); - factory(Process::class, 4)->create([ + ProcessCategory::factory(4)->create(); + Process::factory(4)->create([ 'PRO_CATEGORY' => ProcessCategory::all()->random()->CATEGORY_UID ]); // Dummy Delegations - factory(Delegation::class, 100)->create([ + Delegation::factory(100)->create([ 'PRO_ID' => Process::all()->random()->PRO_ID ]); // Process with the category to search - $category = factory(ProcessCategory::class)->create(); - $processSearch = factory(Process::class)->create([ + $category = ProcessCategory::factory()->create(); + $processSearch = Process::factory()->create([ 'PRO_CATEGORY' => $category->CATEGORY_UID ]); // Delegations to found - factory(Delegation::class, 51)->states('foreign_keys')->create([ + Delegation::factory(51)->foreign_keys()->create([ 'PRO_ID' => $processSearch->PRO_ID ]); // Get first page, which is 25 @@ -1521,16 +1525,16 @@ class DelegationTest extends TestCase */ public function it_should_return_right_data_between_two_dates() { - factory(Delegation::class, 10)->states('foreign_keys')->create([ + Delegation::factory(10)->foreign_keys()->create([ 'DEL_DELEGATE_DATE' => '2019-01-02 00:00:00' ]); - factory(Delegation::class, 10)->states('foreign_keys')->create([ + Delegation::factory(10)->foreign_keys()->create([ 'DEL_DELEGATE_DATE' => '2019-01-03 00:00:00' ]); - factory(Delegation::class, 10)->states('foreign_keys')->create([ + Delegation::factory(10)->foreign_keys()->create([ 'DEL_DELEGATE_DATE' => '2019-01-04 00:00:00' ]); - factory(Delegation::class, 10)->states('foreign_keys')->create([ + Delegation::factory(10)->foreign_keys()->create([ 'DEL_DELEGATE_DATE' => '2019-01-05 00:00:00' ]); $results = Delegation::search( @@ -1550,7 +1554,7 @@ class DelegationTest extends TestCase foreach ($results['data'] as $value) { $this->assertGreaterThanOrEqual('2019-01-02 00:00:00', $value['DEL_DELEGATE_DATE']); $this->assertLessThanOrEqual('2019-01-03 00:00:00', $value['DEL_DELEGATE_DATE']); - $this->assertRegExp('(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) ', $value['DEL_DELEGATE_DATE']); + $this->assertMatchesRegularExpression('(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) ', $value['DEL_DELEGATE_DATE']); } } @@ -1562,16 +1566,16 @@ class DelegationTest extends TestCase */ public function it_should_return_right_data_with_filters_dates_parameter() { - factory(Delegation::class, 10)->states('foreign_keys')->create([ + Delegation::factory(10)->foreign_keys()->create([ 'DEL_DELEGATE_DATE' => '2019-01-02 00:00:00' ]); - factory(Delegation::class, 10)->states('foreign_keys')->create([ + Delegation::factory(10)->foreign_keys()->create([ 'DEL_DELEGATE_DATE' => '2019-01-03 00:00:00' ]); - factory(Delegation::class, 10)->states('foreign_keys')->create([ + Delegation::factory(10)->foreign_keys()->create([ 'DEL_DELEGATE_DATE' => '2019-01-04 00:00:00' ]); - factory(Delegation::class, 10)->states('foreign_keys')->create([ + Delegation::factory(10)->foreign_keys()->create([ 'DEL_DELEGATE_DATE' => '2019-01-05 00:00:00' ]); // Search setting only from @@ -1590,7 +1594,7 @@ class DelegationTest extends TestCase $this->assertCount(40, $results['data']); foreach ($results['data'] as $value) { $this->assertGreaterThanOrEqual('2019-01-02 00:00:00', $value['DEL_DELEGATE_DATE']); - $this->assertRegExp('(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) ', $value['DEL_DELEGATE_DATE']); + $this->assertMatchesRegularExpression('(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) ', $value['DEL_DELEGATE_DATE']); } // Search setting only to $results = Delegation::search( @@ -1608,7 +1612,7 @@ class DelegationTest extends TestCase ); foreach ($results['data'] as $value) { $this->assertLessThanOrEqual('2019-01-04 00:00:00', $value['DEL_DELEGATE_DATE']); - $this->assertRegExp('(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) ', $value['DEL_DELEGATE_DATE']); + $this->assertMatchesRegularExpression('(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) ', $value['DEL_DELEGATE_DATE']); } } @@ -1621,13 +1625,13 @@ class DelegationTest extends TestCase public function it_should_return_empty_when_parallel_tasks_has_threads_closed() { // Create a process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); // Create a task - $parallelTask = factory(Task::class)->create(); + $parallelTask = Task::factory()->create(); // Create a case - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); // Create the threads for a parallel process - factory(Delegation::class, 5)->states('foreign_keys')->create([ + Delegation::factory(5)->foreign_keys()->create([ 'PRO_ID' => $process->PRO_ID, 'TAS_ID' => $parallelTask->TAS_ID, 'APP_NUMBER' => $application->APP_NUMBER, @@ -1641,7 +1645,7 @@ class DelegationTest extends TestCase $application->APP_NUMBER, null, null, - null, + 'asc', 'TAS_TITLE', null, null, @@ -1660,13 +1664,13 @@ class DelegationTest extends TestCase public function it_should_return_data_when_parallel_tasks_has_threads_open() { // Create a process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); // Create a task - $parallelTask = factory(Task::class)->create(); + $parallelTask = Task::factory()->create(); // Create a case - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); // Create the threads for a parallel process - factory(Delegation::class, 5)->states('foreign_keys')->create([ + Delegation::factory(5)->foreign_keys()->create([ 'PRO_ID' => $process->PRO_ID, 'TAS_ID' => $parallelTask->TAS_ID, 'APP_NUMBER' => $application->APP_NUMBER, @@ -1687,13 +1691,13 @@ class DelegationTest extends TestCase public function it_should_return_data_in_sequential_tasks_with_intermediate_dummy_task() { // Create a process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); // Create a task - $parallelTask = factory(Task::class)->create(); + $parallelTask = Task::factory()->create(); // Create a case - $application = factory(Application::class)->create(['APP_STATUS_ID' => 2]); + $application = Application::factory()->create(['APP_STATUS_ID' => 2]); // Create the threads for a parallel process closed - factory(Delegation::class)->states('closed')->create([ + Delegation::factory()->closed()->create([ 'PRO_ID' => $process->PRO_ID, 'PRO_UID' => $process->PRO_UID, 'TAS_ID' => $parallelTask->TAS_ID, @@ -1701,7 +1705,7 @@ class DelegationTest extends TestCase 'DEL_INDEX' => 1 ]); // Create the threads for a parallel process closed - factory(Delegation::class)->states('open')->create([ + Delegation::factory()->open()->create([ 'PRO_ID' => $process->PRO_ID, 'PRO_UID' => $process->PRO_UID, 'TAS_ID' => $parallelTask->TAS_ID, @@ -1735,9 +1739,9 @@ class DelegationTest extends TestCase */ public function it_should_return_status_empty() { - factory(Delegation::class, 5)->states('foreign_keys')->create([ + Delegation::factory(5)->foreign_keys()->create([ 'APP_NUMBER' => function () { - return factory(Application::class)->create(['APP_STATUS' => ''])->APP_NUMBER; + return Application::factory()->create(['APP_STATUS' => ''])->APP_NUMBER; } ]); // Review the filter by status empty @@ -1754,15 +1758,15 @@ class DelegationTest extends TestCase public function it_should_return_empty_when_process_and_category_does_not_have_a_relation() { // Create a categories - $category = factory(ProcessCategory::class, 2)->create(); + $category = ProcessCategory::factory(2)->create(); //Create a process with category - $processWithCat = factory(Process::class)->create(['PRO_CATEGORY' => $category[0]->CATEGORY_UID]); - factory(Delegation::class)->states('foreign_keys')->create([ + $processWithCat = Process::factory()->create(['PRO_CATEGORY' => $category[0]->CATEGORY_UID]); + Delegation::factory()->foreign_keys()->create([ 'PRO_ID' => $processWithCat->PRO_ID ]); // Create a process without category - $processWithoutCat = factory(Process::class)->create(['PRO_CATEGORY' => '']); - factory(Delegation::class, 5)->states('foreign_keys')->create([ + $processWithoutCat = Process::factory()->create(['PRO_CATEGORY' => '']); + Delegation::factory(5)->foreign_keys()->create([ 'PRO_ID' => $processWithoutCat->PRO_ID ]); // Search the cases when the process has related to the category and search by another category @@ -1828,23 +1832,25 @@ class DelegationTest extends TestCase public function it_should_return_data_when_process_and_category_does_have_a_relation() { //Create a category - $category = factory(ProcessCategory::class)->create(); + $category = ProcessCategory::factory()->create(); //Define a process related with he previous category - $processWithCat = factory(Process::class)->create([ + $processWithCat = Process::factory()->create([ 'PRO_CATEGORY' => $category->CATEGORY_UID ]); //Create a delegation related to this process - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'PRO_ID' => $processWithCat->PRO_ID ]); //Define a process related with he previous category - $process = factory(Process::class)->create([ + $process = Process::factory()->create([ 'PRO_CATEGORY' => '' ]); //Create a delegation related to other process - factory(Delegation::class, 5)->create([ + $delegation = Delegation::factory(5)->create([ 'PRO_ID' => $process->PRO_ID, ]); + + $this->assertEquals($process->PRO_ID, $delegation[0]->PRO_ID); } /** @@ -1856,17 +1862,17 @@ class DelegationTest extends TestCase public function it_should_return_participation_info() { // Creating one application with two delegations - factory(User::class, 100)->create(); - $process = factory(Process::class)->create(); - $application = factory(Application::class)->create([ + User::factory(100)->create(); + $process = Process::factory()->create(); + $application = Application::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'APP_UID' => G::generateUniqueID() ]); - factory(Delegation::class)->states('closed')->create([ + Delegation::factory()->closed()->create([ 'PRO_UID' => $process->PRO_UID, 'APP_UID' => $application->APP_UID ]); - factory(Delegation::class)->states('open')->create([ + Delegation::factory()->open()->create([ 'PRO_UID' => $process->PRO_UID, 'APP_UID' => $application->APP_UID, 'DEL_INDEX' => 2 @@ -1903,24 +1909,24 @@ class DelegationTest extends TestCase public function it_should_get_query_cases_by_user_with_self_service_user_assigned() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create a task self service - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, //Related to the user 'TU_TYPE' => 1 ]); //Create the register in delegation relate to self-service - factory(Delegation::class, 25)->create([ + Delegation::factory(25)->create([ 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, @@ -1940,31 +1946,31 @@ class DelegationTest extends TestCase public function it_should_get_query_cases_by_user_with_self_service_value_based_usr_uid() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create a case - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create a task self service value based - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '@@ARRAY_OF_USERS', 'PRO_UID' => $process->PRO_UID ]); //Create the relation for the value assigned in the TAS_GROUP_VARIABLE - $appSelfValue = factory(AppAssignSelfServiceValue::class)->create([ + $appSelfValue = AppAssignSelfServiceValue::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => 2, 'TAS_ID' => $task->TAS_ID ]); - factory(AppAssignSelfServiceValueGroup::class)->create([ + AppAssignSelfServiceValueGroup::factory()->create([ 'ID' => $appSelfValue->ID, 'GRP_UID' => $user->USR_UID, 'ASSIGNEE_ID' => $user->USR_ID, //The usrId or grpId 'ASSIGNEE_TYPE' => 1 //Related to the user=1 related to the group=2 ]); //Create the register in self-service - factory(Delegation::class, 25)->create([ + Delegation::factory(25)->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => $appSelfValue->DEL_INDEX, 'TAS_ID' => $task->TAS_ID, @@ -1985,32 +1991,32 @@ class DelegationTest extends TestCase public function it_should_get_query_cases_by_user_with_self_service_group_assigned() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create group - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Assign a user in the group - factory(GroupUser::class)->create([ + GroupUser::factory()->create([ 'GRP_UID' => $group->GRP_UID, 'GRP_ID' => $group->GRP_ID, 'USR_UID' => $user->USR_UID ]); //Create a task self service - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 2, //Related to the group 'TU_TYPE' => 1 ]); //Create the register in self-service - factory(Delegation::class, 25)->create([ + Delegation::factory(25)->create([ 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, @@ -2030,44 +2036,44 @@ class DelegationTest extends TestCase public function it_should_get_query_cases_by_user_with_self_service_value_based_grp_uid() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create a task self service value based - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '@@ARRAY_OF_USERS', 'PRO_UID' => $process->PRO_UID ]); //Create a case - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); //Create group - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); //Create user - $user = factory(User::class)->create([ + $user = User::factory()->create([ 'USR_USERNAME' => 'gary', 'USR_LASTNAME' => 'Gary', 'USR_FIRSTNAME' => 'Bailey', ]); //Assign a user in the group - factory(GroupUser::class)->create([ + GroupUser::factory()->create([ 'GRP_UID' => $group->GRP_UID, 'GRP_ID' => $group->GRP_ID, 'USR_UID' => $user->USR_UID, ]); //Create the relation for the value assigned in the TAS_GROUP_VARIABLE - $appSelfValue = factory(AppAssignSelfServiceValue::class)->create([ + $appSelfValue = AppAssignSelfServiceValue::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, 'DEL_INDEX' => 2, 'TAS_ID' => $task->TAS_ID ]); - factory(AppAssignSelfServiceValueGroup::class)->create([ + AppAssignSelfServiceValueGroup::factory()->create([ 'ID' => $appSelfValue->ID, 'GRP_UID' => $group->GRP_UID, 'ASSIGNEE_ID' => $group->GRP_ID, //The usrId or grpId 'ASSIGNEE_TYPE' => 2 //Related to the user=1 related to the group=2 ]); //Create the register in self-service - factory(Delegation::class, 25)->create([ + Delegation::factory(25)->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => 2, 'TAS_ID' => $task->TAS_ID, @@ -2088,62 +2094,62 @@ class DelegationTest extends TestCase public function it_should_get_query_cases_by_user_with_self_service_and_self_service_value_based() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create group - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Assign a user in the group - factory(GroupUser::class)->create([ + GroupUser::factory()->create([ 'GRP_UID' => $group->GRP_UID, 'GRP_ID' => $group->GRP_ID, 'USR_UID' => $user->USR_UID ]); //Create a task self service - $taskSelfService = factory(Task::class)->create([ + $taskSelfService = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $taskSelfService->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, //Related to the user 'TU_TYPE' => 1 ]); //Create the register in self service - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'TAS_ID' => $taskSelfService->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, ]); //Create a task self service value based - $taskSelfServiceByVariable = factory(Task::class)->create([ + $taskSelfServiceByVariable = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $taskSelfServiceByVariable->TAS_UID, 'USR_UID' => $group->GRP_UID, 'TU_RELATION' => 2, //Related to the group 'TU_TYPE' => 1 ]); //Create the relation for the value assigned in the TAS_GROUP_VARIABLE - $appAssignSelfService = factory(AppAssignSelfServiceValue::class)->create([ + $appAssignSelfService = AppAssignSelfServiceValue::factory()->create([ 'TAS_ID' => $taskSelfServiceByVariable->TAS_ID ]); - factory(AppAssignSelfServiceValueGroup::class)->create([ + AppAssignSelfServiceValueGroup::factory()->create([ 'ID' => $appAssignSelfService->ID, 'GRP_UID' => $group->GRP_UID, 'ASSIGNEE_ID' => $group->GRP_ID, //The usrId or grpId 'ASSIGNEE_TYPE' => 2 //Related to the user=1 related to the group=2 ]); //Create the register in self service value based - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $appAssignSelfService->APP_NUMBER, 'DEL_INDEX' => $appAssignSelfService->DEL_INDEX, 'TAS_ID' => $taskSelfServiceByVariable->TAS_ID, @@ -2165,89 +2171,89 @@ class DelegationTest extends TestCase public function it_should_get_query_cases_by_user_with_self_service_user_and_group_assigned_parallel_task() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create group - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Assign a user in the group - factory(GroupUser::class)->create([ + GroupUser::factory()->create([ 'GRP_UID' => $group->GRP_UID, 'GRP_ID' => $group->GRP_ID, 'USR_UID' => $user->USR_UID ]); //Create a task self service - $task1 = factory(Task::class)->create([ + $task1 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task1 - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task1->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, //Related to the user 'TU_TYPE' => 1 ]); //Create a task self service - $task2 = factory(Task::class)->create([ + $task2 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task2 - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task2->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, //Related to the user 'TU_TYPE' => 1 ]); //Create a task self service - $task3 = factory(Task::class)->create([ + $task3 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task3->TAS_UID, 'USR_UID' => $group->GRP_UID, 'TU_RELATION' => 2, //Related to the group 'TU_TYPE' => 1 ]); //Create a task self service - $task4 = factory(Task::class)->create([ + $task4 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task4->TAS_UID, 'USR_UID' => $group->GRP_UID, 'TU_RELATION' => 2, //Related to the group 'TU_TYPE' => 1 ]); //Create the register in self-service related to the task1 - factory(Delegation::class, 10)->create([ + Delegation::factory(10)->create([ 'TAS_ID' => $task1->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, ]); //Create the register in self-service related to the task2 - factory(Delegation::class, 10)->create([ + Delegation::factory(10)->create([ 'TAS_ID' => $task2->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, ]); //Create the register in self-service related to the task3 - factory(Delegation::class, 10)->create([ + Delegation::factory(10)->create([ 'TAS_ID' => $task3->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, ]); //Create the register in self-service related to the task4 - factory(Delegation::class, 10)->create([ + Delegation::factory(10)->create([ 'TAS_ID' => $task4->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, @@ -2267,30 +2273,30 @@ class DelegationTest extends TestCase public function it_should_get_query_cases_by_user_with_self_service_value_based_usr_uid_and_grp_uid() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create a case - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create a task1 self service value based - $task1 = factory(Task::class)->create([ + $task1 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '@@ARRAY_OF_USERS', 'PRO_UID' => $process->PRO_UID ]); //Create the relation for the value assigned in the TAS_GROUP_VARIABLE - $appSelfValue = factory(AppAssignSelfServiceValue::class)->create([ + $appSelfValue = AppAssignSelfServiceValue::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task1->TAS_ID ]); - factory(AppAssignSelfServiceValueGroup::class)->create([ + AppAssignSelfServiceValueGroup::factory()->create([ 'ID' => $appSelfValue->ID, 'GRP_UID' => $user->USR_UID, 'ASSIGNEE_ID' => $user->USR_ID, //The usrId or grpId 'ASSIGNEE_TYPE' => 1 //Related to the user=1 related to the group=2 ]); //Create the register in self-service - factory(Delegation::class, 10)->create([ + Delegation::factory(10)->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => $appSelfValue->DEL_INDEX, 'TAS_ID' => $task1->TAS_ID, @@ -2298,24 +2304,24 @@ class DelegationTest extends TestCase 'USR_ID' => 0, ]); //Create a task2 self service value based - $task2 = factory(Task::class)->create([ + $task2 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '@@ARRAY_OF_USERS', 'PRO_UID' => $process->PRO_UID ]); //Create the relation for the value assigned in the TAS_GROUP_VARIABLE - $appSelfValue = factory(AppAssignSelfServiceValue::class)->create([ + $appSelfValue = AppAssignSelfServiceValue::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task2->TAS_ID ]); - factory(AppAssignSelfServiceValueGroup::class)->create([ + AppAssignSelfServiceValueGroup::factory()->create([ 'ID' => $appSelfValue->ID, 'GRP_UID' => $user->USR_UID, 'ASSIGNEE_ID' => $user->USR_ID, //The usrId or grpId 'ASSIGNEE_TYPE' => 1 //Related to the user=1 related to the group=2 ]); //Create the register in self-service - factory(Delegation::class, 15)->create([ + Delegation::factory(15)->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => $appSelfValue->DEL_INDEX, 'TAS_ID' => $task2->TAS_ID, @@ -2336,24 +2342,24 @@ class DelegationTest extends TestCase public function it_should_get_cases_by_user_with_self_service_user_assigned() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create a task self service - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, //Related to the user 'TU_TYPE' => 1 ]); //Create the register in delegation relate to self-service - factory(Delegation::class, 25)->create([ + Delegation::factory(25)->create([ 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, @@ -2375,31 +2381,31 @@ class DelegationTest extends TestCase public function it_should_get_cases_by_user_with_self_service_value_based_usr_uid() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create a case - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create a task self service value based - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '@@ARRAY_OF_USERS', 'PRO_UID' => $process->PRO_UID ]); //Create the relation for the value assigned in the TAS_GROUP_VARIABLE - $appSelfValue = factory(AppAssignSelfServiceValue::class)->create([ + $appSelfValue = AppAssignSelfServiceValue::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => 2, 'TAS_ID' => $task->TAS_ID ]); - factory(AppAssignSelfServiceValueGroup::class)->create([ + AppAssignSelfServiceValueGroup::factory()->create([ 'ID' => $appSelfValue->ID, 'GRP_UID' => $user->USR_UID, 'ASSIGNEE_ID' => $user->USR_ID, //The usrId or grpId 'ASSIGNEE_TYPE' => 1 //Related to the user=1 related to the group=2 ]); //Create the register in self-service - factory(Delegation::class, 25)->create([ + Delegation::factory(25)->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => $appSelfValue->DEL_INDEX, 'TAS_ID' => $task->TAS_ID, @@ -2420,32 +2426,32 @@ class DelegationTest extends TestCase public function it_should_get_cases_by_user_with_self_service_group_assigned() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create group - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Assign a user in the group - factory(GroupUser::class)->create([ + GroupUser::factory()->create([ 'GRP_UID' => $group->GRP_UID, 'GRP_ID' => $group->GRP_ID, 'USR_UID' => $user->USR_UID ]); //Create a task self service - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 2, //Related to the group 'TU_TYPE' => 1 ]); //Create the register in self-service - factory(Delegation::class, 25)->create([ + Delegation::factory(25)->create([ 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, @@ -2465,44 +2471,44 @@ class DelegationTest extends TestCase public function it_should_get_cases_by_user_with_self_service_value_based_grp_uid() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create a task self service value based - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '@@ARRAY_OF_USERS', 'PRO_UID' => $process->PRO_UID ]); //Create a case - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); //Create group - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); //Create user - $user = factory(User::class)->create([ + $user = User::factory()->create([ 'USR_USERNAME' => 'gary', 'USR_LASTNAME' => 'Gary', 'USR_FIRSTNAME' => 'Bailey', ]); //Assign a user in the group - factory(GroupUser::class)->create([ + GroupUser::factory()->create([ 'GRP_UID' => $group->GRP_UID, 'GRP_ID' => $group->GRP_ID, 'USR_UID' => $user->USR_UID, ]); //Create the relation for the value assigned in the TAS_GROUP_VARIABLE - $appSelfValue = factory(AppAssignSelfServiceValue::class)->create([ + $appSelfValue = AppAssignSelfServiceValue::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, 'DEL_INDEX' => 2, 'TAS_ID' => $task->TAS_ID ]); - factory(AppAssignSelfServiceValueGroup::class)->create([ + AppAssignSelfServiceValueGroup::factory()->create([ 'ID' => $appSelfValue->ID, 'GRP_UID' => $group->GRP_UID, 'ASSIGNEE_ID' => $group->GRP_ID, //The usrId or grpId 'ASSIGNEE_TYPE' => 2 //Related to the user=1 related to the group=2 ]); //Create the register in self-service - factory(Delegation::class, 25)->create([ + Delegation::factory(25)->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => 2, 'TAS_ID' => $task->TAS_ID, @@ -2523,62 +2529,62 @@ class DelegationTest extends TestCase public function it_should_get_cases_by_user_with_self_service_and_self_service_value_based() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create group - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Assign a user in the group - factory(GroupUser::class)->create([ + GroupUser::factory()->create([ 'GRP_UID' => $group->GRP_UID, 'GRP_ID' => $group->GRP_ID, 'USR_UID' => $user->USR_UID ]); //Create a task self service - $taskSelfService = factory(Task::class)->create([ + $taskSelfService = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $taskSelfService->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, //Related to the user 'TU_TYPE' => 1 ]); //Create the register in self service - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'TAS_ID' => $taskSelfService->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, ]); //Create a task self service value based - $taskSelfServiceByVariable = factory(Task::class)->create([ + $taskSelfServiceByVariable = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $taskSelfServiceByVariable->TAS_UID, 'USR_UID' => $group->GRP_UID, 'TU_RELATION' => 2, //Related to the group 'TU_TYPE' => 1 ]); //Create the relation for the value assigned in the TAS_GROUP_VARIABLE - $appAssignSelfService = factory(AppAssignSelfServiceValue::class)->create([ + $appAssignSelfService = AppAssignSelfServiceValue::factory()->create([ 'TAS_ID' => $taskSelfServiceByVariable->TAS_ID ]); - factory(AppAssignSelfServiceValueGroup::class)->create([ + AppAssignSelfServiceValueGroup::factory()->create([ 'ID' => $appAssignSelfService->ID, 'GRP_UID' => $group->GRP_UID, 'ASSIGNEE_ID' => $group->GRP_ID, //The usrId or grpId 'ASSIGNEE_TYPE' => 2 //Related to the user=1 related to the group=2 ]); //Create the register in self service value based - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $appAssignSelfService->APP_NUMBER, 'DEL_INDEX' => $appAssignSelfService->DEL_INDEX, 'TAS_ID' => $taskSelfServiceByVariable->TAS_ID, @@ -2600,89 +2606,89 @@ class DelegationTest extends TestCase public function it_should_get_cases_by_user_with_self_service_user_and_group_assigned_parallel_task() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create group - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Assign a user in the group - factory(GroupUser::class)->create([ + GroupUser::factory()->create([ 'GRP_UID' => $group->GRP_UID, 'GRP_ID' => $group->GRP_ID, 'USR_UID' => $user->USR_UID ]); //Create a task self service - $task1 = factory(Task::class)->create([ + $task1 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task1 - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task1->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, //Related to the user 'TU_TYPE' => 1 ]); //Create a task self service - $task2 = factory(Task::class)->create([ + $task2 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task2 - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task2->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, //Related to the user 'TU_TYPE' => 1 ]); //Create a task self service - $task3 = factory(Task::class)->create([ + $task3 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task3->TAS_UID, 'USR_UID' => $group->GRP_UID, 'TU_RELATION' => 2, //Related to the group 'TU_TYPE' => 1 ]); //Create a task self service - $task4 = factory(Task::class)->create([ + $task4 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task4->TAS_UID, 'USR_UID' => $group->GRP_UID, 'TU_RELATION' => 2, //Related to the group 'TU_TYPE' => 1 ]); //Create the register in self-service related to the task1 - factory(Delegation::class, 10)->create([ + Delegation::factory(10)->create([ 'TAS_ID' => $task1->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, ]); //Create the register in self-service related to the task2 - factory(Delegation::class, 10)->create([ + Delegation::factory(10)->create([ 'TAS_ID' => $task2->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, ]); //Create the register in self-service related to the task3 - factory(Delegation::class, 10)->create([ + Delegation::factory(10)->create([ 'TAS_ID' => $task3->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, ]); //Create the register in self-service related to the task4 - factory(Delegation::class, 10)->create([ + Delegation::factory(10)->create([ 'TAS_ID' => $task4->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, @@ -2702,30 +2708,30 @@ class DelegationTest extends TestCase public function it_should_get_cases_by_user_with_self_service_value_based_usr_uid_and_grp_uid() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create a case - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create a task1 self service value based - $task1 = factory(Task::class)->create([ + $task1 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '@@ARRAY_OF_USERS', 'PRO_UID' => $process->PRO_UID ]); //Create the relation for the value assigned in the TAS_GROUP_VARIABLE - $appSelfValue = factory(AppAssignSelfServiceValue::class)->create([ + $appSelfValue = AppAssignSelfServiceValue::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task1->TAS_ID ]); - factory(AppAssignSelfServiceValueGroup::class)->create([ + AppAssignSelfServiceValueGroup::factory()->create([ 'ID' => $appSelfValue->ID, 'GRP_UID' => $user->USR_UID, 'ASSIGNEE_ID' => $user->USR_ID, //The usrId or grpId 'ASSIGNEE_TYPE' => 1 //Related to the user=1 related to the group=2 ]); //Create the register in self-service - factory(Delegation::class, 10)->create([ + Delegation::factory(10)->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => $appSelfValue->DEL_INDEX, 'TAS_ID' => $task1->TAS_ID, @@ -2733,24 +2739,24 @@ class DelegationTest extends TestCase 'USR_ID' => 0, ]); //Create a task2 self service value based - $task2 = factory(Task::class)->create([ + $task2 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '@@ARRAY_OF_USERS', 'PRO_UID' => $process->PRO_UID ]); //Create the relation for the value assigned in the TAS_GROUP_VARIABLE - $appSelfValue = factory(AppAssignSelfServiceValue::class)->create([ + $appSelfValue = AppAssignSelfServiceValue::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task2->TAS_ID ]); - factory(AppAssignSelfServiceValueGroup::class)->create([ + AppAssignSelfServiceValueGroup::factory()->create([ 'ID' => $appSelfValue->ID, 'GRP_UID' => $user->USR_UID, 'ASSIGNEE_ID' => $user->USR_ID, //The usrId or grpId 'ASSIGNEE_TYPE' => 1 //Related to the user=1 related to the group=2 ]); //Create the register in self-service - factory(Delegation::class, 15)->create([ + Delegation::factory(15)->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => $appSelfValue->DEL_INDEX, 'TAS_ID' => $task2->TAS_ID, @@ -2771,24 +2777,24 @@ class DelegationTest extends TestCase public function it_should_count_cases_by_user_with_self_service_user_assigned() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create a task self service - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, //Related to the user 'TU_TYPE' => 1 ]); //Create the register in delegation relate to self-service - factory(Delegation::class, 25)->create([ + Delegation::factory(25)->create([ 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, @@ -2808,31 +2814,31 @@ class DelegationTest extends TestCase public function it_should_count_cases_by_user_with_self_service_value_based_usr_uid() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create a case - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create a task self service value based - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '@@ARRAY_OF_USERS', 'PRO_UID' => $process->PRO_UID ]); //Create the relation for the value assigned in the TAS_GROUP_VARIABLE - $appSelfValue = factory(AppAssignSelfServiceValue::class)->create([ + $appSelfValue = AppAssignSelfServiceValue::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => 2, 'TAS_ID' => $task->TAS_ID ]); - factory(AppAssignSelfServiceValueGroup::class)->create([ + AppAssignSelfServiceValueGroup::factory()->create([ 'ID' => $appSelfValue->ID, 'GRP_UID' => $user->USR_UID, 'ASSIGNEE_ID' => $user->USR_ID, //The usrId or grpId 'ASSIGNEE_TYPE' => 1 //Related to the user=1 related to the group=2 ]); //Create the register in self-service - factory(Delegation::class, 25)->create([ + Delegation::factory(25)->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => $appSelfValue->DEL_INDEX, 'TAS_ID' => $task->TAS_ID, @@ -2853,32 +2859,32 @@ class DelegationTest extends TestCase public function it_should_count_cases_by_user_with_self_service_group_assigned() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create group - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Assign a user in the group - factory(GroupUser::class)->create([ + GroupUser::factory()->create([ 'GRP_UID' => $group->GRP_UID, 'GRP_ID' => $group->GRP_ID, 'USR_UID' => $user->USR_UID ]); //Create a task self service - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 2, //Related to the group 'TU_TYPE' => 1 ]); //Create the register in self-service - factory(Delegation::class, 25)->create([ + Delegation::factory(25)->create([ 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, @@ -2898,44 +2904,44 @@ class DelegationTest extends TestCase public function it_should_count_cases_by_user_with_self_service_value_based_grp_uid() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create a task self service value based - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '@@ARRAY_OF_USERS', 'PRO_UID' => $process->PRO_UID ]); //Create a case - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); //Create group - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); //Create user - $user = factory(User::class)->create([ + $user = User::factory()->create([ 'USR_USERNAME' => 'gary', 'USR_LASTNAME' => 'Gary', 'USR_FIRSTNAME' => 'Bailey', ]); //Assign a user in the group - factory(GroupUser::class)->create([ + GroupUser::factory()->create([ 'GRP_UID' => $group->GRP_UID, 'GRP_ID' => $group->GRP_ID, 'USR_UID' => $user->USR_UID, ]); //Create the relation for the value assigned in the TAS_GROUP_VARIABLE - $appSelfValue = factory(AppAssignSelfServiceValue::class)->create([ + $appSelfValue = AppAssignSelfServiceValue::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, 'DEL_INDEX' => 2, 'TAS_ID' => $task->TAS_ID ]); - factory(AppAssignSelfServiceValueGroup::class)->create([ + AppAssignSelfServiceValueGroup::factory()->create([ 'ID' => $appSelfValue->ID, 'GRP_UID' => $group->GRP_UID, 'ASSIGNEE_ID' => $group->GRP_ID, //The usrId or grpId 'ASSIGNEE_TYPE' => 2 //Related to the user=1 related to the group=2 ]); //Create the register in self-service - factory(Delegation::class, 25)->create([ + Delegation::factory(25)->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => 2, 'TAS_ID' => $task->TAS_ID, @@ -2956,62 +2962,62 @@ class DelegationTest extends TestCase public function it_should_count_cases_by_user_with_self_service_and_self_service_value_based() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create group - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Assign a user in the group - factory(GroupUser::class)->create([ + GroupUser::factory()->create([ 'GRP_UID' => $group->GRP_UID, 'GRP_ID' => $group->GRP_ID, 'USR_UID' => $user->USR_UID ]); //Create a task self service - $taskSelfService = factory(Task::class)->create([ + $taskSelfService = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $taskSelfService->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, //Related to the user 'TU_TYPE' => 1 ]); //Create the register in self service - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'TAS_ID' => $taskSelfService->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, ]); //Create a task self service value based - $taskSelfServiceByVariable = factory(Task::class)->create([ + $taskSelfServiceByVariable = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $taskSelfServiceByVariable->TAS_UID, 'USR_UID' => $group->GRP_UID, 'TU_RELATION' => 2, //Related to the group 'TU_TYPE' => 1 ]); //Create the relation for the value assigned in the TAS_GROUP_VARIABLE - $appAssignSelfService = factory(AppAssignSelfServiceValue::class)->create([ + $appAssignSelfService = AppAssignSelfServiceValue::factory()->create([ 'TAS_ID' => $taskSelfServiceByVariable->TAS_ID ]); - factory(AppAssignSelfServiceValueGroup::class)->create([ + AppAssignSelfServiceValueGroup::factory()->create([ 'ID' => $appAssignSelfService->ID, 'GRP_UID' => $group->GRP_UID, 'ASSIGNEE_ID' => $group->GRP_ID, //The usrId or grpId 'ASSIGNEE_TYPE' => 2 //Related to the user=1 related to the group=2 ]); //Create the register in self service value based - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $appAssignSelfService->APP_NUMBER, 'DEL_INDEX' => $appAssignSelfService->DEL_INDEX, 'TAS_ID' => $taskSelfServiceByVariable->TAS_ID, @@ -3033,89 +3039,89 @@ class DelegationTest extends TestCase public function it_should_count_cases_by_user_with_self_service_user_and_group_assigned_parallel_task() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create group - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Assign a user in the group - factory(GroupUser::class)->create([ + GroupUser::factory()->create([ 'GRP_UID' => $group->GRP_UID, 'GRP_ID' => $group->GRP_ID, 'USR_UID' => $user->USR_UID ]); //Create a task self service - $task1 = factory(Task::class)->create([ + $task1 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task1 - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task1->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, //Related to the user 'TU_TYPE' => 1 ]); //Create a task self service - $task2 = factory(Task::class)->create([ + $task2 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task2 - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task2->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, //Related to the user 'TU_TYPE' => 1 ]); //Create a task self service - $task3 = factory(Task::class)->create([ + $task3 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task3->TAS_UID, 'USR_UID' => $group->GRP_UID, 'TU_RELATION' => 2, //Related to the group 'TU_TYPE' => 1 ]); //Create a task self service - $task4 = factory(Task::class)->create([ + $task4 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task4->TAS_UID, 'USR_UID' => $group->GRP_UID, 'TU_RELATION' => 2, //Related to the group 'TU_TYPE' => 1 ]); //Create the register in self-service related to the task1 - factory(Delegation::class, 10)->create([ + Delegation::factory(10)->create([ 'TAS_ID' => $task1->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, ]); //Create the register in self-service related to the task2 - factory(Delegation::class, 10)->create([ + Delegation::factory(10)->create([ 'TAS_ID' => $task2->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, ]); //Create the register in self-service related to the task3 - factory(Delegation::class, 10)->create([ + Delegation::factory(10)->create([ 'TAS_ID' => $task3->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, ]); //Create the register in self-service related to the task4 - factory(Delegation::class, 10)->create([ + Delegation::factory(10)->create([ 'TAS_ID' => $task4->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', 'USR_ID' => 0, @@ -3135,30 +3141,30 @@ class DelegationTest extends TestCase public function it_should_count_cases_by_user_with_self_service_value_based_usr_uid_and_grp_uid() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create a case - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create a task1 self service value based - $task1 = factory(Task::class)->create([ + $task1 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '@@ARRAY_OF_USERS', 'PRO_UID' => $process->PRO_UID ]); //Create the relation for the value assigned in the TAS_GROUP_VARIABLE - $appSelfValue = factory(AppAssignSelfServiceValue::class)->create([ + $appSelfValue = AppAssignSelfServiceValue::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task1->TAS_ID ]); - factory(AppAssignSelfServiceValueGroup::class)->create([ + AppAssignSelfServiceValueGroup::factory()->create([ 'ID' => $appSelfValue->ID, 'GRP_UID' => $user->USR_UID, 'ASSIGNEE_ID' => $user->USR_ID, //The usrId or grpId 'ASSIGNEE_TYPE' => 1 //Related to the user=1 related to the group=2 ]); //Create the register in self-service - factory(Delegation::class, 10)->create([ + Delegation::factory(10)->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => $appSelfValue->DEL_INDEX, 'TAS_ID' => $task1->TAS_ID, @@ -3166,24 +3172,24 @@ class DelegationTest extends TestCase 'USR_ID' => 0, ]); //Create a task2 self service value based - $task2 = factory(Task::class)->create([ + $task2 = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '@@ARRAY_OF_USERS', 'PRO_UID' => $process->PRO_UID ]); //Create the relation for the value assigned in the TAS_GROUP_VARIABLE - $appSelfValue = factory(AppAssignSelfServiceValue::class)->create([ + $appSelfValue = AppAssignSelfServiceValue::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task2->TAS_ID ]); - factory(AppAssignSelfServiceValueGroup::class)->create([ + AppAssignSelfServiceValueGroup::factory()->create([ 'ID' => $appSelfValue->ID, 'GRP_UID' => $user->USR_UID, 'ASSIGNEE_ID' => $user->USR_ID, //The usrId or grpId 'ASSIGNEE_TYPE' => 1 //Related to the user=1 related to the group=2 ]); //Create the register in self-service - factory(Delegation::class, 15)->create([ + Delegation::factory(15)->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => $appSelfValue->DEL_INDEX, 'TAS_ID' => $task2->TAS_ID, @@ -3204,19 +3210,19 @@ class DelegationTest extends TestCase public function it_should_return_current_user_for_thread_open() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create a case - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create a delegation - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, 'USR_UID' => $user->USR_UID, ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_THREAD_STATUS' => 'CLOSED', 'DEL_INDEX' => 1, @@ -3237,19 +3243,19 @@ class DelegationTest extends TestCase public function it_should_return_current_user_for_thread_closed() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create a case - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create a delegation - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_THREAD_STATUS' => 'CLOSED', 'DEL_INDEX' => 1, 'USR_UID' => $user->USR_UID, ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, @@ -3270,19 +3276,19 @@ class DelegationTest extends TestCase public function it_should_return_empty_when_row_does_not_exist() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create a case - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create a delegation - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_THREAD_STATUS' => 'CLOSED', 'DEL_INDEX' => 1, 'USR_UID' => $user->USR_UID, ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 2, @@ -3306,15 +3312,15 @@ class DelegationTest extends TestCase public function it_should_return_thread_open() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create a case - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create task - $task = factory(Task::class)->create(); + $task = Task::factory()->create(); //Create a delegation - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_FINISH_DATE' => null, 'APP_NUMBER' => $application->APP_NUMBER, @@ -3333,13 +3339,13 @@ class DelegationTest extends TestCase public function it_should_return_empty_when_thread_is_closed() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create a case - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); //Create task - $task = factory(Task::class)->create(); + $task = Task::factory()->create(); //Create a delegation - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'DEL_THREAD_STATUS' => 'CLOSED', 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_UID' => $task->TAS_UID, @@ -3357,15 +3363,15 @@ class DelegationTest extends TestCase public function it_should_return_empty_when_thread_finish_date_is_not_null() { //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Create a case - $application = factory(Application::class)->create(); + $application = Application::factory()->create(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create task - $task = factory(Task::class)->create(); + $task = Task::factory()->create(); //Create a delegation - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'DEL_THREAD_STATUS' => 'CLOSED', 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_UID' => $task->TAS_UID, @@ -3382,12 +3388,12 @@ class DelegationTest extends TestCase */ public function it_when_the_user_does_have_participation() { - factory(Process::class)->create(); + Process::factory()->create(); //Create user - $user = factory(User::class)->create(); - $application = factory(Application::class)->create(); + $user = User::factory()->create(); + $application = Application::factory()->create(); //Create a delegation - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, 'USR_ID' => $user->USR_ID, @@ -3405,12 +3411,12 @@ class DelegationTest extends TestCase */ public function it_when_the_user_does_not_have_participation() { - factory(Process::class)->create(); + Process::factory()->create(); //Create user - $user = factory(User::class)->create(); - $application = factory(Application::class)->create(); + $user = User::factory()->create(); + $application = Application::factory()->create(); //Create a delegation - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID ]); @@ -3426,7 +3432,7 @@ class DelegationTest extends TestCase */ public function it_get_thread_title() { - $delegation = factory(Delegation::class)->states('foreign_keys')->create(); + $delegation = Delegation::factory()->foreign_keys()->create(); $result = Delegation::getThreadTitle($delegation->TAS_UID, $delegation->APP_NUMBER, $delegation->DEL_PREVIOUS, []); $this->assertNotEmpty($result); } @@ -3439,7 +3445,7 @@ class DelegationTest extends TestCase */ public function it_get_thread_info() { - $delegation = factory(Delegation::class)->states('foreign_keys')->create(); + $delegation = Delegation::factory()->foreign_keys()->create(); $result = Delegation::getThreadInfo($delegation->APP_NUMBER, $delegation->DEL_INDEX); $this->assertNotEmpty($result); } @@ -3452,7 +3458,7 @@ class DelegationTest extends TestCase */ public function it_get_thread_dates() { - $delegation = factory(Delegation::class)->states('foreign_keys')->create(); + $delegation = Delegation::factory()->foreign_keys()->create(); $task = new Task(); $taskInfo = $task->load($delegation->TAS_UID); $taskInfo = head($taskInfo); @@ -3474,7 +3480,7 @@ class DelegationTest extends TestCase */ public function it_get_threads_pending() { - $delegation = factory(Delegation::class)->states('foreign_keys')->create(); + $delegation = Delegation::factory()->foreign_keys()->create(); $result = Delegation::getPendingThreads($delegation->APP_NUMBER); $this->assertNotEmpty($result); $result = Delegation::getPendingThreads($delegation->APP_NUMBER, false); @@ -3489,7 +3495,7 @@ class DelegationTest extends TestCase */ public function it_get_task_pending() { - $delegation = factory(Delegation::class)->states('foreign_keys')->create(); + $delegation = Delegation::factory()->foreign_keys()->create(); $result = Delegation::getPendingTask($delegation->APP_NUMBER); $this->assertNotEmpty($result); } @@ -3502,7 +3508,7 @@ class DelegationTest extends TestCase */ public function it_get_last_thread() { - $delegation = factory(Delegation::class)->states('foreign_keys')->create(); + $delegation = Delegation::factory()->foreign_keys()->create(); $result = Delegation::getLastThread($delegation->APP_NUMBER); $this->assertNotEmpty($result); } @@ -3515,7 +3521,7 @@ class DelegationTest extends TestCase */ public function it_should_test_the_get_del_title_method() { - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'DEL_TITLE' => "test" ]); $result = Delegation::getDeltitle($delegation->APP_NUMBER, $delegation->DEL_INDEX); @@ -3531,24 +3537,24 @@ class DelegationTest extends TestCase */ public function it_should_test_the_has_active_parents_cases_method() { - $process = factory(Process::class)->create(); - $processParent = factory(Process::class, 3)->create(); - factory(SubProcess::class)->create([ + $process = Process::factory()->create(); + $processParent = Process::factory(3)->create(); + SubProcess::factory()->create([ 'PRO_UID' => $process['PRO_UID'], 'PRO_PARENT' => $processParent[0]['PRO_UID'] ]); - factory(SubProcess::class)->create([ + SubProcess::factory()->create([ 'PRO_UID' => $process['PRO_UID'], 'PRO_PARENT' => $processParent[1]['PRO_UID'] ]); - factory(SubProcess::class)->create([ + SubProcess::factory()->create([ 'PRO_UID' => $process['PRO_UID'], 'PRO_PARENT' => $processParent[2]['PRO_UID'] ]); $parents = SubProcess::getProParents($process['PRO_UID']); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'PRO_UID' => $parents[0]['PRO_PARENT'], 'TAS_UID' => $parents[0]['TAS_PARENT'], 'DEL_THREAD_STATUS' => 'OPEN' @@ -3568,7 +3574,7 @@ class DelegationTest extends TestCase */ public function it_get_cases_completed_by_specific_user() { - $delegation = factory(Delegation::class)->states('last_thread')->create(); + $delegation = Delegation::factory()->last_thread()->create(); $result = Delegation::casesCompletedBy($delegation->USR_ID); $this->assertNotEmpty($result); } @@ -3581,7 +3587,7 @@ class DelegationTest extends TestCase */ public function it_get_cases_started_by_specific_user() { - $delegation = factory(Delegation::class)->states('first_thread')->create(); + $delegation = Delegation::factory()->first_thread()->create(); $result = Delegation::casesStartedBy($delegation->USR_ID); $this->assertNotEmpty($result); } @@ -3594,9 +3600,9 @@ class DelegationTest extends TestCase */ public function it_get_cases_thread_title() { - $delegation = factory(Delegation::class)->states('foreign_keys')->create(); + $delegation = Delegation::factory()->foreign_keys()->create(); $result = Delegation::casesThreadTitle($delegation->DEL_TITLE); - $this->assertNotEmpty($result); + $this->assertTrue(isset($result[0])); } /** @@ -3607,8 +3613,8 @@ class DelegationTest extends TestCase */ public function it_return_scope_participated_user() { - $application = factory(Application::class)->states('completed')->create(); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->completed()->create(); + $table = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); @@ -3624,8 +3630,8 @@ class DelegationTest extends TestCase */ public function it_tests_scope_inbox_metrics() { - $application = factory(Application::class)->states('todo')->create(); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->todo()->create(); + $table = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); @@ -3641,8 +3647,8 @@ class DelegationTest extends TestCase */ public function it_tests_scope_draft_metrics() { - $application = factory(Application::class)->states('draft')->create(); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $application = Application::factory()->draft()->create(); + $table = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); @@ -3658,12 +3664,12 @@ class DelegationTest extends TestCase */ public function it_tests_scope_paused_metrics() { - $application = factory(Application::class)->states('paused')->create(); - $appDelay = factory(AppDelay::class)->states('paused_foreign_keys')->create([ + $application = Application::factory()->paused()->create(); + $appDelay = AppDelay::factory()->paused_foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, ]); - $table = factory(Delegation::class)->states('foreign_keys')->create([ + $table = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, 'DEL_INDEX' => $appDelay->APP_DEL_INDEX, @@ -3680,11 +3686,11 @@ class DelegationTest extends TestCase */ public function it_tests_scope_self_service_metrics() { - $application = factory(Application::class)->states('paused')->create(); - $task = factory(Task::class)->create([ + $application = Application::factory()->paused()->create(); + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', ]); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $delegation = Delegation::factory()->foreign_keys()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'APP_UID' => $application->APP_UID, 'TAS_ID' => $task->TAS_ID, diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/DocumentsTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/DocumentsTest.php index f47de791e..af49f7982 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/DocumentsTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/DocumentsTest.php @@ -23,7 +23,7 @@ class DocumentsTest extends TestCase */ public function it_test_get_case_note_files() { - $appDoc = factory(Documents::class)->states('case_notes')->create(); + $appDoc =Documents::factory()->case_notes()->create(); $doc = new Documents(); $res = $doc->getAppFiles($appDoc->APP_UID, Documents::DOC_TYPE_CASE_NOTE); $this->assertNotEmpty($res); @@ -37,8 +37,8 @@ class DocumentsTest extends TestCase */ public function it_should_test_get_attached_files_from_the_casenote() { - $appNote = factory(AppNotes::class)->create(); - $appDocument = factory(Documents::class)->create([ + $appNote =AppNotes::factory()->create(); + $appDocument =Documents::factory()->create([ 'DOC_ID' => $appNote->NOTE_ID ]); @@ -57,8 +57,8 @@ class DocumentsTest extends TestCase */ public function it_should_test_get_files() { - $appNote = factory(AppNotes::class)->create(); - $appDocument = factory(Documents::class)->create([ + $appNote =AppNotes::factory()->create(); + $appDocument =Documents::factory()->create([ 'DOC_ID' => $appNote->NOTE_ID ]); $result = Documents::getFiles($appDocument->DOC_ID); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/DynaformTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/DynaformTest.php index 2fd887566..ff4fbd05a 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/DynaformTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/DynaformTest.php @@ -31,9 +31,9 @@ class DynaformTest extends TestCase */ public function it_has_a_process() { - $dynaForm = factory(Dynaform::class)->create([ + $dynaForm =Dynaform::factory()->create([ 'PRO_UID' => function () { - return factory(Process::class)->create()->PRO_UID; + return Process::factory()->create()->PRO_UID; } ]); $this->assertInstanceOf(Process::class, $dynaForm->process); @@ -47,7 +47,7 @@ class DynaformTest extends TestCase */ public function it_tests_get_by_pro_uid() { - $dynaForm = factory(Dynaform::class)->states('foreign_keys')->create(); + $dynaForm = Dynaform::factory()->foreign_keys()->create(); $result = Dynaform::getByProUid($dynaForm->PRO_UID); $this->assertNotEmpty($result); } @@ -60,7 +60,7 @@ class DynaformTest extends TestCase */ public function it_tests_get_by_dyn_uid() { - $dynaForm = factory(Dynaform::class)->states('foreign_keys')->create(); + $dynaForm = Dynaform::factory()->foreign_keys()->create(); $result = Dynaform::getByDynUid($dynaForm->DYN_UID); $this->assertNotEmpty($result); } @@ -73,7 +73,7 @@ class DynaformTest extends TestCase */ public function it_tests_get_by_process_exclude_dyn_uid() { - $dynaForm = factory(Dynaform::class)->states('foreign_keys')->create(); + $dynaForm = Dynaform::factory()->foreign_keys()->create(); $result = Dynaform::getByProUidExceptDynUid($dynaForm->PRO_UID, $dynaForm->DYN_UID); $this->assertEmpty($result); } @@ -86,23 +86,23 @@ class DynaformTest extends TestCase */ public function it_should_test_process_scope_in_dynaform_model() { - $process = factory(Process::class, 3)->create(); + $process = Process::factory(3)->create(); - factory(Dynaform::class)->create( + Dynaform::factory()->create( [ 'PRO_UID' => $process[0]['PRO_UID'], 'DYN_CONTENT' => '{"name":"2","description":"","items":[{"type":"form","variable":"","var_uid":"","dataType":"","id":"6170264265d1b544bebdbd5098250194","name":"2","description":"","mode":"edit","script":"","language":"en","externalLibs":"","printable":false,"items":[[{"type":"title","id":"title0000000001","label":"title_1","colSpan":12}],[{"type":"text","variable":"textVar002","var_uid":"9778460595d1b545088dd69091601043","dataType":"string","protectedValue":false,"id":"textVar002","name":"textVar002","label":"text_1","defaultValue":"","placeholder":"","hint":"","required":false,"requiredFieldErrorMessage":"","textTransform":"none","validate":"","validateMessage":"","maxLength":1000,"formula":"","mode":"parent","operation":"","dbConnection":"workflow","dbConnectionLabel":"PM Database","sql":"","var_name":"textVar002","colSpan":12}],[{"type":"textarea","variable":"textareaVar001","var_uid":"2934510045d1b5453f21373072798412","dataType":"string","protectedValue":false,"id":"textareaVar001","name":"textareaVar001","label":"textarea_1","defaultValue":"","placeholder":"","hint":"","required":false,"requiredFieldErrorMessage":"","validate":"","validateMessage":"","mode":"parent","dbConnection":"workflow","dbConnectionLabel":"PM Database","sql":"","rows":"5","var_name":"textareaVar001","colSpan":12}],[{"type":"datetime","variable":"datetimeVar001","var_uid":"9780823375d1b5455e9c3a2064729484","dataType":"datetime","protectedValue":false,"id":"datetimeVar001","name":"datetimeVar001","label":"datetime_1","placeholder":"","hint":"","required":false,"requiredFieldErrorMessage":"","mode":"parent","format":"YYYY-MM-DD","dayViewHeaderFormat":"MMMM YYYY","extraFormats":false,"stepping":1,"minDate":"","maxDate":"","useCurrent":"false","collapse":true,"locale":"","defaultDate":"","disabledDates":false,"enabledDates":false,"icons":{"time":"glyphicon glyphicon-time","date":"glyphicon glyphicon-calendar","up":"glyphicon glyphicon-chevron-up","down":"glyphicon glyphicon-chevron-down","previous":"glyphicon glyphicon-chevron-left","next":"glyphicon glyphicon-chevron-right","today":"glyphicon glyphicon-screenshot","clear":"glyphicon glyphicon-trash"},"useStrict":false,"sideBySide":false,"daysOfWeekDisabled":false,"calendarWeeks":false,"viewMode":"days","toolbarPlacement":"default","showTodayButton":false,"showClear":"false","widgetPositioning":{"horizontal":"auto","vertical":"auto"},"widgetParent":null,"keepOpen":false,"var_name":"datetimeVar001","colSpan":12}],[{"type":"submit","id":"submit0000000001","name":"submit0000000001","label":"submit_1","colSpan":12}]],"variables":[{"var_uid":"9778460595d1b545088dd69091601043","prj_uid":"5139642915ccb3fca429a36061714972","var_name":"textVar002","var_field_type":"string","var_field_size":10,"var_label":"string","var_dbconnection":"workflow","var_dbconnection_label":"PM Database","var_sql":"","var_null":0,"var_default":"","var_accepted_values":"[]","inp_doc_uid":""},{"var_uid":"2934510045d1b5453f21373072798412","prj_uid":"5139642915ccb3fca429a36061714972","var_name":"textareaVar001","var_field_type":"string","var_field_size":10,"var_label":"string","var_dbconnection":"workflow","var_dbconnection_label":"PM Database","var_sql":"","var_null":0,"var_default":"","var_accepted_values":"[]","inp_doc_uid":""},{"var_uid":"9780823375d1b5455e9c3a2064729484","prj_uid":"5139642915ccb3fca429a36061714972","var_name":"datetimeVar001","var_field_type":"datetime","var_field_size":10,"var_label":"datetime","var_dbconnection":"workflow","var_dbconnection_label":"PM Database","var_sql":"","var_null":0,"var_default":"","var_accepted_values":"[]","inp_doc_uid":""}]}]}' ] ); - factory(Dynaform::class)->create( + Dynaform::factory()->create( [ 'PRO_UID' => $process[1]['PRO_UID'], 'DYN_CONTENT' => '{"name":"1","description":"","items":[{"type":"form","variable":"","var_uid":"","dataType":"","id":"6817532755d16225629cb05061521548","name":"1","description":"","mode":"edit","script":"","language":"en","externalLibs":"","printable":false,"items":[[{"type":"text","variable":"textVar001","var_uid":"4746221155d1622658943d1014840579","dataType":"string","protectedValue":false,"id":"textVar001","name":"textVar001","label":"text_1","defaultValue":"","placeholder":"","hint":"","required":false,"requiredFieldErrorMessage":"","textTransform":"none","validate":"","validateMessage":"","maxLength":1000,"formula":"","mode":"parent","operation":"","dbConnection":"workflow","dbConnectionLabel":"PM Database","sql":"SELECT * FROM USERS WHERE \nUSR_UID=\'$UID\' UNION SELECT * from PROCESS","var_name":"textVar001","colSpan":12}]],"variables":[{"var_uid":"4746221155d1622658943d1014840579","prj_uid":"5139642915ccb3fca429a36061714972","var_name":"textVar001","var_field_type":"string","var_field_size":10,"var_label":"string","var_dbconnection":"workflow","var_dbconnection_label":"PM Database","var_sql":"","var_null":0,"var_default":"","var_accepted_values":"[]","inp_doc_uid":""}]}]}' ] ); - factory(Dynaform::class)->create( + Dynaform::factory()->create( [ 'PRO_UID' => $process[2]['PRO_UID'], 'DYN_CONTENT' => '{"name":"1","description":"","items":[{"type":"form","variable":"","var_uid":"","dataType":"","id":"6817532755d16225629cb05061521548","name":"1","description":"","mode":"edit","script":"","language":"en","externalLibs":"","printable":false,"items":[[{"type":"text","variable":"textVar001","var_uid":"4746221155d1622658943d1014840579","dataType":"string","protectedValue":false,"id":"textVar001","name":"textVar001","label":"text_1","defaultValue":"","placeholder":"","hint":"","required":false,"requiredFieldErrorMessage":"","textTransform":"none","validate":"","validateMessage":"","maxLength":1000,"formula":"","mode":"parent","operation":"","dbConnection":"workflow","dbConnectionLabel":"PM Database","sql":"SELECT * FROM USERS WHERE \nUSR_UID=\'$UID\' UNION SELECT * from PROCESS","var_name":"textVar001","colSpan":12}]],"variables":[{"var_uid":"4746221155d1622658943d1014840579","prj_uid":"5139642915ccb3fca429a36061714972","var_name":"textVar001","var_field_type":"string","var_field_size":10,"var_label":"string","var_dbconnection":"workflow","var_dbconnection_label":"PM Database","var_sql":"","var_null":0,"var_default":"","var_accepted_values":"[]","inp_doc_uid":""}]}]}' diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/EmailEventTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/EmailEventTest.php index 139721110..4674851cb 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/EmailEventTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/EmailEventTest.php @@ -38,8 +38,8 @@ class EmailEventTest extends TestCase public function it_should_test_the_update_event_method() { EmailServerModel::query()->delete(); - $emailServer = factory(EmailServerModel::class)->create(); - $emailEventFactory = factory(EmailEvent::class)->create([ + $emailServer = EmailServerModel::factory()->create(); + $emailEventFactory = EmailEvent::factory()->create([ 'EMAIL_SERVER_UID' => $emailServer['MESS_UID'] ]); @@ -62,11 +62,11 @@ class EmailEventTest extends TestCase public function it_should_test_the_update_event_method_with_a_default_email_server() { EmailServerModel::query()->delete(); - $emailServer = factory(EmailServerModel::class)->create(); - $emailServerDefault = factory(EmailServerModel::class)->create([ + $emailServer = EmailServerModel::factory()->create(); + $emailServerDefault = EmailServerModel::factory()->create([ 'MESS_DEFAULT' => 1 ]); - $emailEventFactory = factory(EmailEvent::class)->create([ + $emailEventFactory = EmailEvent::factory()->create([ 'EMAIL_SERVER_UID' => $emailServer['MESS_UID'] ]); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/EmailServerModelTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/EmailServerModelTest.php index d2b27f506..601c9c7a4 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/EmailServerModelTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/EmailServerModelTest.php @@ -37,7 +37,7 @@ class EmailServerModelTest extends TestCase public function it_should_test_the_get_email_server_method() { //Create the EmailServerModel factory - $emailServer = factory(EmailServerModel::class)->create(); + $emailServer = EmailServerModel::factory()->create(); //Create the EmailServerModel object $email = new EmailServerModel(); @@ -59,7 +59,7 @@ class EmailServerModelTest extends TestCase public function it_should_test_the_get_email_server_method_with_an_empty_result() { //Create the EmailServerModel factory - $emailServer = factory(EmailServerModel::class)->create(); + $emailServer = EmailServerModel::factory()->create(); //Create the EmailServerModel object $email = new EmailServerModel(); @@ -79,7 +79,7 @@ class EmailServerModelTest extends TestCase public function it_should_test_the_get_email_server_default() { //Create the EmailServer factory - $emailServer = factory(EmailServerModel::class)->create([ + $emailServer = EmailServerModel::factory()->create([ 'MESS_DEFAULT' => 1 ]); @@ -101,7 +101,7 @@ class EmailServerModelTest extends TestCase public function it_should_test_the_is_imap_method_when_there_is_an_imap_server() { EmailServerModel::query()->delete(); - $emailServer = factory(EmailServerModel::class)->create([ + $emailServer = EmailServerModel::factory()->create([ 'MESS_ENGINE' => 'IMAP' ]); $emailServerModel = new EmailServerModel(); @@ -119,7 +119,7 @@ class EmailServerModelTest extends TestCase public function it_should_test_the_is_imap_method_when_there_is_not_an_imap_server() { EmailServerModel::query()->delete(); - $emailServer = factory(EmailServerModel::class)->create(); + $emailServer = EmailServerModel::factory()->create(); $emailServerModel = new EmailServerModel(); $r = $emailServerModel->isImap($emailServer['MESS_UID']); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/FieldsTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/FieldsTest.php index 4bac32be7..64c5b81c0 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/FieldsTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/FieldsTest.php @@ -21,9 +21,9 @@ class FieldsTest extends TestCase */ public function it_has_a_columns_defined() { - $tableColumns = factory(Fields::class)->create([ + $tableColumns = Fields::factory()->create([ 'ADD_TAB_UID' => function () { - return factory(AdditionalTables::class)->create()->ADD_TAB_UID; + return AdditionalTables::factory()->create()->ADD_TAB_UID; } ]); $this->assertInstanceOf(AdditionalTables::class, $tableColumns->table); @@ -38,7 +38,7 @@ class FieldsTest extends TestCase */ public function it_get_fields_from_specific_table() { - $fields = factory(Fields::class)->create(); + $fields = Fields::factory()->create(); $result = Fields::getFields($fields->ADD_TAB_UID); $this->assertNotEmpty($result); } @@ -53,7 +53,7 @@ class FieldsTest extends TestCase */ public function it_search_field() { - $fields = factory(Fields::class)->create(); + $fields = Fields::factory()->create(); $result = Fields::searchVariable($fields->ADD_TAB_UID, $fields->FLD_NAME); $this->assertNotEmpty($result); } diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/GroupUserTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/GroupUserTest.php index 73a3e0bb3..c85920fea 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/GroupUserTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/GroupUserTest.php @@ -2,7 +2,6 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\Model; -use Illuminate\Foundation\Testing\DatabaseTransactions; use ProcessMaker\Model\GroupUser; use ProcessMaker\Model\Groupwf; use ProcessMaker\Model\RbacUsers; @@ -16,15 +15,13 @@ use Tests\TestCase; */ class GroupUserTest extends TestCase { - use DatabaseTransactions; - /** * Method set up. */ public function setUp(): void { parent::setUp(); - GroupUser::truncate(); + $this->truncateNonInitialModels(); } /** @@ -35,9 +32,9 @@ class GroupUserTest extends TestCase */ public function it_belong_user() { - $table = factory(GroupUser::class)->create([ + $table = GroupUser::factory()->create([ 'USR_UID' => function () { - return factory(User::class)->create()->USR_UID; + return User::factory()->create()->USR_UID; } ]); $this->assertInstanceOf(User::class, $table->user); @@ -51,9 +48,9 @@ class GroupUserTest extends TestCase */ public function it_belong_group() { - $table = factory(GroupUser::class)->create([ + $table = GroupUser::factory()->create([ 'GRP_ID' => function () { - return factory(Groupwf::class)->create()->GRP_ID; + return Groupwf::factory()->create()->GRP_ID; } ]); $this->assertInstanceOf(Groupwf::class, $table->groupsWf); @@ -67,7 +64,7 @@ class GroupUserTest extends TestCase */ public function it_return_scope_user() { - $table = factory(GroupUser::class)->states('foreign_keys')->create(); + $table = GroupUser::factory()->foreign_keys()->create(); $this->assertNotEmpty($table->user($table->USR_UID)->get()); } @@ -80,24 +77,24 @@ class GroupUserTest extends TestCase public function it_should_test_message() { // When the user does not exist - $user = factory(User::class)->create(); - $group = factory(Groupwf::class)->create(); + $user = User::factory()->create(); + $group = Groupwf::factory()->create(); $result = GroupUser::assignUserToGroup('', 0, '', 0); $this->assertNotEmpty($result); // When the group does not exist - $rbacUser = factory(RbacUsers::class)->create(); - $user = factory(User::class)->create([ + $rbacUser = RbacUsers::factory()->create(); + $user = User::factory()->create([ 'USR_UID' => $rbacUser['USR_UID'] ]); - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); $result = GroupUser::assignUserToGroup($user['USR_UID'], 0, '', 0); $this->assertNotEmpty($result); // When the user already exist in a group - $rbacUser = factory(RbacUsers::class)->create(); - $user = factory(User::class)->create([ + $rbacUser = RbacUsers::factory()->create(); + $user = User::factory()->create([ 'USR_UID' => $rbacUser['USR_UID'] ]); - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); GroupUser::assignUserToGroup($user['USR_UID'], $user['USR_ID'], $group['GRP_UID'], $group['GRP_ID']); $result = GroupUser::assignUserToGroup($user['USR_UID'], $user['USR_ID'], $group['GRP_UID'], $group['GRP_ID']); $this->assertNotEmpty($result); @@ -111,8 +108,8 @@ class GroupUserTest extends TestCase */ public function it_should_test_the_assign_user_to_group_method() { - $rbacUser = factory(RbacUsers::class)->create(); - $user = factory(User::class)->create([ + $rbacUser = RbacUsers::factory()->create(); + $user = User::factory()->create([ 'USR_UID' => $rbacUser['USR_UID'], 'USR_USERNAME' => $rbacUser['USR_USERNAME'], 'USR_PASSWORD' => $rbacUser['USR_PASSWORD'], @@ -120,7 +117,7 @@ class GroupUserTest extends TestCase 'USR_LASTNAME' => $rbacUser['USR_LASTNAME'], 'USR_EMAIL' => $rbacUser['USR_EMAIL'], ]); - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); GroupUser::assignUserToGroup($rbacUser['USR_UID'], $user['USR_ID'], $group['GRP_UID'], $group['GRP_ID']); @@ -138,8 +135,8 @@ class GroupUserTest extends TestCase */ public function it_should_test_the_verify_user_is_in_group_method() { - $rbacUser = factory(RbacUsers::class)->create(); - $user = factory(User::class)->create([ + $rbacUser = RbacUsers::factory()->create(); + $user = User::factory()->create([ 'USR_UID' => $rbacUser['USR_UID'], 'USR_USERNAME' => $rbacUser['USR_USERNAME'], 'USR_PASSWORD' => $rbacUser['USR_PASSWORD'], @@ -147,7 +144,7 @@ class GroupUserTest extends TestCase 'USR_LASTNAME' => $rbacUser['USR_LASTNAME'], 'USR_EMAIL' => $rbacUser['USR_EMAIL'], ]); - $group = factory(Groupwf::class)->create(); + $group = Groupwf::factory()->create(); $res = GroupUser::verifyUserIsInGroup($user['USR_ID'], $group['GRP_ID']); $this->assertFalse($res); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/GroupwfTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/GroupwfTest.php index 537286fd0..77b4f22af 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/GroupwfTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/GroupwfTest.php @@ -2,7 +2,6 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\Model; -use Illuminate\Foundation\Testing\DatabaseTransactions; use ProcessMaker\Model\GroupUser; use ProcessMaker\Model\Groupwf; use Tests\TestCase; @@ -14,15 +13,13 @@ use Tests\TestCase; */ class GroupwfTest extends TestCase { - use DatabaseTransactions; - /** * Method set up. */ public function setUp(): void { parent::setUp(); - Groupwf::truncate(); + $this->truncateNonInitialModels(); } /** @@ -33,9 +30,9 @@ class GroupwfTest extends TestCase */ public function it_belong_group() { - $table = factory(Groupwf::class)->create([ + $table = Groupwf::factory()->create([ 'GRP_ID' => function () { - return factory(GroupUser::class)->create()->GRP_ID; + return GroupUser::factory()->create()->GRP_ID; } ]); $this->assertInstanceOf(GroupUser::class, $table->groupUsers); @@ -49,7 +46,7 @@ class GroupwfTest extends TestCase */ public function it_return_scope_active() { - $table = factory(Groupwf::class)->create(); + $table = Groupwf::factory()->create(); $this->assertNotEmpty($table->active()->get()); } @@ -60,7 +57,7 @@ class GroupwfTest extends TestCase */ public function it_should_test_the_verify_group_exists_method() { - $groupWf = factory(Groupwf::class)->create(); + $groupWf = Groupwf::factory()->create(); $res = Groupwf::verifyGroupExists($groupWf['GRP_UID']); $this->assertTrue($res); @@ -76,7 +73,7 @@ class GroupwfTest extends TestCase */ public function it_should_test_the_get_group_id_method() { - $groupWf = factory(Groupwf::class)->create(); + $groupWf = Groupwf::factory()->create(); $res = Groupwf::getGroupId($groupWf['GRP_UID']); $this->assertNotEmpty($res); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/InputDocumentTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/InputDocumentTest.php index 912ef35c6..38edff54a 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/InputDocumentTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/InputDocumentTest.php @@ -24,9 +24,9 @@ class InputDocumentTest extends TestCase */ public function it_has_a_process_defined() { - $table = factory(InputDocument::class)->create([ + $table = InputDocument::factory()->create([ 'PRO_UID' => function () { - return factory(Process::class)->create()->PRO_UID; + return Process::factory()->create()->PRO_UID; } ]); $this->assertInstanceOf(Process::class, $table->process); @@ -40,7 +40,7 @@ class InputDocumentTest extends TestCase */ public function it_get_by_process() { - $table = factory(InputDocument::class)->create(); + $table = InputDocument::factory()->create(); $result = InputDocument::getByProUid($table->PRO_UID); $this->assertNotEmpty($result); } @@ -53,7 +53,7 @@ class InputDocumentTest extends TestCase */ public function it_get_by_uid() { - $table = factory(InputDocument::class)->create(); + $table = InputDocument::factory()->create(); $result = InputDocument::getByInpDocUid($table->INP_DOC_UID); $this->assertNotEmpty($result); } diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/OutputDocumentTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/OutputDocumentTest.php index a32aa8329..28a9fe1a6 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/OutputDocumentTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/OutputDocumentTest.php @@ -24,9 +24,9 @@ class OutputDocumentTest extends TestCase */ public function it_has_a_process_defined() { - $table = factory(OutputDocument::class)->create([ + $table = OutputDocument::factory()->create([ 'PRO_UID' => function () { - return factory(Process::class)->create()->PRO_UID; + return Process::factory()->create()->PRO_UID; } ]); $this->assertInstanceOf(Process::class, $table->process); @@ -40,7 +40,7 @@ class OutputDocumentTest extends TestCase */ public function it_get_by_process() { - $table = factory(OutputDocument::class)->create(); + $table = OutputDocument::factory()->create(); $result = OutputDocument::getByProUid($table->PRO_UID); $this->assertNotEmpty($result); } @@ -53,7 +53,7 @@ class OutputDocumentTest extends TestCase */ public function it_get_by_uid() { - $table = factory(OutputDocument::class)->create(); + $table = OutputDocument::factory()->create(); $result = OutputDocument::getByOutDocUid($table->OUT_DOC_UID); $this->assertNotEmpty($result); } diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/ProcessCategoryTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/ProcessCategoryTest.php index 3388ac061..da3d1ccf8 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/ProcessCategoryTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/ProcessCategoryTest.php @@ -32,7 +32,7 @@ class ProcessCategoryTest extends TestCase */ public function it_tests_get_categories() { - $processCategory = factory(ProcessCategory::class)->create(); + $processCategory = ProcessCategory::factory()->create(); $result = ProcessCategory::getCategories(); $this->assertNotEmpty($result); @@ -47,16 +47,16 @@ class ProcessCategoryTest extends TestCase */ public function it_tests_get_process_categories_method_without_paremeters() { - factory(ProcessCategory::class)->create([ + ProcessCategory::factory()->create([ 'CATEGORY_ID' => 1 ]); - factory(ProcessCategory::class)->create([ + ProcessCategory::factory()->create([ 'CATEGORY_ID' => 2 ]); - factory(ProcessCategory::class)->create([ + ProcessCategory::factory()->create([ 'CATEGORY_ID' => 3 ]); - factory(ProcessCategory::class)->create([ + ProcessCategory::factory()->create([ 'CATEGORY_ID' => 4 ]); $result = ProcessCategory::getProcessCategories(); @@ -73,19 +73,19 @@ class ProcessCategoryTest extends TestCase */ public function it_tests_get_process_categories_method_filter_by_name() { - factory(ProcessCategory::class)->create([ + ProcessCategory::factory()->create([ 'CATEGORY_ID' => 1, 'CATEGORY_NAME' => 'Category1' ]); - factory(ProcessCategory::class)->create([ + ProcessCategory::factory()->create([ 'CATEGORY_ID' => 2, 'CATEGORY_NAME' => 'Category2' ]); - factory(ProcessCategory::class)->create([ + ProcessCategory::factory()->create([ 'CATEGORY_ID' => 3, 'CATEGORY_NAME' => 'Category3' ]); - factory(ProcessCategory::class)->create([ + ProcessCategory::factory()->create([ 'CATEGORY_ID' => 4, 'CATEGORY_NAME' => 'Category4' ]); @@ -103,16 +103,16 @@ class ProcessCategoryTest extends TestCase */ public function it_tests_get_process_categories_method_with_start_limit() { - factory(ProcessCategory::class)->create([ + ProcessCategory::factory()->create([ 'CATEGORY_ID' => 1, ]); - factory(ProcessCategory::class)->create([ + ProcessCategory::factory()->create([ 'CATEGORY_ID' => 2, ]); - factory(ProcessCategory::class)->create([ + ProcessCategory::factory()->create([ 'CATEGORY_ID' => 3, ]); - factory(ProcessCategory::class)->create([ + ProcessCategory::factory()->create([ 'CATEGORY_ID' => 4, ]); $result = ProcessCategory::getProcessCategories(null, 1, 3); @@ -128,7 +128,7 @@ class ProcessCategoryTest extends TestCase */ public function it_tests_get_category_id_method() { - $processCategory = factory(ProcessCategory::class)->create(); + $processCategory = ProcessCategory::factory()->create(); $result = ProcessCategory::getCategoryId($processCategory->CATEGORY_UID); $this->assertEquals($processCategory->CATEGORY_ID, $result); @@ -143,7 +143,7 @@ class ProcessCategoryTest extends TestCase */ public function it_tests_get_category() { - $processCategory = factory(ProcessCategory::class)->create(); + $processCategory = ProcessCategory::factory()->create(); $result = ProcessCategory::getCategory($processCategory->CATEGORY_ID); $this->assertNotEmpty($result); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/ProcessTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/ProcessTest.php index 13290f2c4..57bbd44df 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/ProcessTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/ProcessTest.php @@ -37,8 +37,8 @@ class ProcessTest extends TestCase */ public function it_has_tasks() { - $process = factory(Process::class)->create(); - factory(Task::class)->create([ + $process = Process::factory()->create(); + Task::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'PRO_ID' => $process->PRO_ID ]); @@ -53,9 +53,9 @@ class ProcessTest extends TestCase */ public function it_has_a_creator() { - $process = factory(Process::class)->create([ + $process = Process::factory()->create([ 'PRO_CREATE_USER' => function () { - return factory(User::class)->create()->USR_UID; + return User::factory()->create()->USR_UID; } ]); $this->assertInstanceOf(User::class, $process->creator); @@ -69,9 +69,9 @@ class ProcessTest extends TestCase */ public function it_has_an_category() { - $process = factory(Process::class)->create([ + $process = Process::factory()->create([ 'PRO_CATEGORY' => function () { - return factory(ProcessCategory::class)->create()->CATEGORY_UID; + return ProcessCategory::factory()->create()->CATEGORY_UID; } ]); $this->assertInstanceOf(ProcessCategory::class, $process->category); @@ -86,7 +86,7 @@ class ProcessTest extends TestCase public function it_should_return_all_the_processes_for_an_specific_user() { //Create process - $process = factory(Process::class, 2)->states('foreign_keys')->create([]); + $process = Process::factory(2)->foreign_keys()->create([]); //Create a Process object $pro = new Process(); //Call the getProcessList() method @@ -111,13 +111,13 @@ class ProcessTest extends TestCase $catUid2 = G::generateUniqueID(); //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create process - $process1 = factory(Process::class)->create([ + $process1 = Process::factory()->create([ 'PRO_CREATE_USER' => $user['USR_UID'], 'PRO_CATEGORY' => $catUid1 ]); - $process2 = factory(Process::class)->create([ + $process2 = Process::factory()->create([ 'PRO_CREATE_USER' => $user['USR_UID'], 'PRO_CATEGORY' => $catUid2 ]); @@ -146,7 +146,7 @@ class ProcessTest extends TestCase public function it_should_return_empty_if_no_processes_where_found() { //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create a Process object $process = new Process(); //Call the getProcessList() method @@ -165,17 +165,17 @@ class ProcessTest extends TestCase public function it_should_return_all_the_processes_in_status_active() { //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create process - $process1 = factory(Process::class)->create([ + $process1 = Process::factory()->create([ 'PRO_CREATE_USER' => $user['USR_UID'], 'PRO_STATUS' => 'ACTIVE' ]); - $process2 = factory(Process::class)->create([ + $process2 = Process::factory()->create([ 'PRO_CREATE_USER' => $user['USR_UID'], 'PRO_STATUS' => 'INACTIVE' ]); - $process3 = factory(Process::class)->create([ + $process3 = Process::factory()->create([ 'PRO_CREATE_USER' => $user['USR_UID'], 'PRO_STATUS' => 'DISABLED' ]); @@ -205,10 +205,10 @@ class ProcessTest extends TestCase public function it_should_test_the_get_process_private_list_by_user_method() { //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create process - factory(Process::class)->create([ + Process::factory()->create([ 'PRO_CREATE_USER' => $user['USR_UID'], 'PRO_STATUS' => 'ACTIVE', 'PRO_TYPE_PROCESS' => 'PRIVATE', @@ -233,10 +233,10 @@ class ProcessTest extends TestCase public function it_should_test_the_convert_private_processes_to_public_method() { //Create user - $user = factory(User::class)->create(); + $user = User::factory()->create(); //Create process - $pro = factory(Process::class)->create([ + $pro = Process::factory()->create([ 'PRO_CREATE_USER' => $user['USR_UID'], 'PRO_STATUS' => 'ACTIVE', 'PRO_TYPE_PROCESS' => 'PRIVATE', @@ -288,7 +288,7 @@ class ProcessTest extends TestCase */ public function it_should_test_process_without_filter() { - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); $result = Process::getProcessesFilter( null, null, @@ -311,16 +311,16 @@ class ProcessTest extends TestCase */ public function it_should_test_process_with_category_filter() { - $process = factory(Process::class)->create([ + $process = Process::factory()->create([ 'PRO_CATEGORY' => function () { - return factory(ProcessCategory::class)->create()->CATEGORY_UID; + return ProcessCategory::factory()->create()->CATEGORY_UID; } ]); $result = Process::getProcessesFilter($process->PRO_CATEGORY); // Assert with the specific category $this->assertEquals($process->PRO_CATEGORY, $result[0]['PRO_CATEGORY']); - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); $result = Process::getProcessesFilter('NONE'); // Assert when the category is empty $this->assertEmpty($result); @@ -338,7 +338,7 @@ class ProcessTest extends TestCase */ public function it_should_test_process_with_process_filter() { - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); $result = Process::getProcessesFilter( null, $process->PRO_UID @@ -358,7 +358,7 @@ class ProcessTest extends TestCase */ public function it_should_test_process_with_title_filter() { - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); $result = Process::getProcessesFilter( null, null, @@ -379,7 +379,7 @@ class ProcessTest extends TestCase */ public function it_should_test_process_subprocess_filter() { - $process = factory(Process::class)->create([ + $process = Process::factory()->create([ 'PRO_SUBPROCESS' => 1 ]); $result = Process::getProcessesFilter( @@ -406,7 +406,7 @@ class ProcessTest extends TestCase */ public function it_should_test_count_process() { - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); $total = Process::getCounter($process->PRO_CREATE_USER); $this->assertEquals(1, $total); } @@ -422,26 +422,26 @@ class ProcessTest extends TestCase public function it_should_test_get_processes_for_home() { // Create a process category - $processCategory = factory(ProcessCategory::class)->create(); + $processCategory = ProcessCategory::factory()->create(); // Create five processes (4 active, 1 inactive) - factory(Process::class)->create([ + Process::factory()->create([ 'PRO_TITLE' => 'My Process 1', 'PRO_CATEGORY' => $processCategory->CATEGORY_UID, 'CATEGORY_ID' => $processCategory->CATEGORY_ID ]); - factory(Process::class)->create([ + Process::factory()->create([ 'PRO_TITLE' => 'My Process 2', 'PRO_CATEGORY' => $processCategory->CATEGORY_UID, 'CATEGORY_ID' => $processCategory->CATEGORY_ID ]); - factory(Process::class)->create([ + Process::factory()->create([ 'PRO_TITLE' => 'My Process 3', ]); - factory(Process::class)->create([ + Process::factory()->create([ 'PRO_TITLE' => 'Another Process', ]); - factory(Process::class)->create([ + Process::factory()->create([ 'PRO_TITLE' => 'Inactive Process', 'PRO_STATUS' => 'INACTIVE' ]); @@ -462,7 +462,7 @@ class ProcessTest extends TestCase */ public function it_should_test_get_id() { - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); $result = Process::getIds($process->PRO_UID, 'PRO_UID'); $this->assertEquals($process->PRO_ID, $result[0]['PRO_ID']); } @@ -475,7 +475,7 @@ class ProcessTest extends TestCase */ public function it_should_test_is_active() { - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); $total = Process::isActive($process->PRO_ID); $this->assertEquals(1, $total); } diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/ProcessUserTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/ProcessUserTest.php index 23a0e3762..01a136d12 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/ProcessUserTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/ProcessUserTest.php @@ -26,7 +26,7 @@ class ProcessUserTest extends TestCase */ public function it_get_process_of_supervisor() { - $table = factory(ProcessUser::class)->states('foreign_keys')->create(); + $table = ProcessUser::factory()->foreign_keys()->create(); $result = ProcessUser::getProcessesOfSupervisor($table->USR_UID); $this->assertNotEmpty($result); } diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/ProcessVariablesTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/ProcessVariablesTest.php index bbe19a0c4..54343a203 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/ProcessVariablesTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/ProcessVariablesTest.php @@ -19,23 +19,23 @@ class ProcessVariablesTest extends TestCase */ public function it_should_test_process_scope_in_process_variables_model() { - $process = factory(Process::class, 2)->create(); + $process = Process::factory(2)->create(); - factory(ProcessVariables::class)->create( + ProcessVariables::factory()->create( [ 'PRJ_UID' => $process[0]['PRO_UID'], 'VAR_SQL' => 'SELECT * FROM USERS WHERE USR_UID="213" UNION SELECT * from PROCESS' ] ); - factory(ProcessVariables::class)->create( + ProcessVariables::factory()->create( [ 'PRJ_UID' => $process[1]['PRO_UID'], 'VAR_SQL' => '' ] ); - factory(ProcessVariables::class)->create( + ProcessVariables::factory()->create( [ 'PRJ_UID' => $process[0]['PRO_UID'], 'VAR_SQL' => '' @@ -62,7 +62,7 @@ class ProcessVariablesTest extends TestCase */ public function it_get_variable() { - $table = factory(ProcessVariables::class)->create(); + $table = ProcessVariables::factory()->create(); $result = ProcessVariables::getVariable($table->VAR_UID); $this->assertNotEmpty($result); } @@ -75,9 +75,9 @@ class ProcessVariablesTest extends TestCase */ public function it_list_variables_by_process() { - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); - factory(ProcessVariables::class)->create([ + ProcessVariables::factory()->create([ 'PRJ_UID' => $process->PRO_UID, 'PRO_ID' => $process->PRO_ID, ] @@ -96,11 +96,11 @@ class ProcessVariablesTest extends TestCase */ public function it_list_variables_type_by_process() { - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); $varType = 'integer'; $varTypeId = 2; for ($x = 1; $x <= 5; $x++) { - $processVar = factory(ProcessVariables::class)->states('foreign_keys')->create([ + $processVar = ProcessVariables::factory()->foreign_keys()->create([ 'PRO_ID' => $process->PRO_ID, 'PRJ_UID' => $process->PRO_UID, 'VAR_FIELD_TYPE' => $varType, diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/RbacRolesTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/RbacRolesTest.php index 8e0945b79..e4f9fc93b 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/RbacRolesTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/RbacRolesTest.php @@ -22,7 +22,7 @@ class RbacRolesTest extends TestCase */ public function it_should_test_the_get_rol_uid_by_code_method() { - $rol1 = factory(RbacRoles::class)->create([ + $rol1 = RbacRoles::factory()->create([ 'ROL_CODE' => 'TEST_ROLE' ]); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/RbacUsersTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/RbacUsersTest.php index 9779caee5..2ae1454e0 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/RbacUsersTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/RbacUsersTest.php @@ -24,7 +24,7 @@ class RbacUsersTest extends TestCase */ public function it_should_test_the_verify_username_exists_method() { - $rbacUser = factory(RbacUsers::class)->create([ + $rbacUser = RbacUsers::factory()->create([ 'USR_USERNAME' => 'test' ]); @@ -42,7 +42,7 @@ class RbacUsersTest extends TestCase */ public function it_should_test_the_create_user_method() { - $roles = factory(RbacRoles::class)->create(); + $roles = RbacRoles::factory()->create(); $data = [ 'USR_UID' => G::generateUniqueID(), 'USR_USERNAME' => 'test', @@ -71,7 +71,7 @@ class RbacUsersTest extends TestCase */ public function it_should_test_the_verify_user_exists_method() { - $rbacUser = factory(RbacUsers::class)->create(); + $rbacUser = RbacUsers::factory()->create(); $res = RbacUsers::verifyUserExists($rbacUser['USR_UID']); $this->assertTrue($res); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/StepTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/StepTest.php index b83832dfc..bf62b3576 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/StepTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/StepTest.php @@ -23,7 +23,7 @@ class StepTest extends TestCase */ public function it_get_specific_step() { - $table = factory(Step::class)->create(); + $table = Step::factory()->create(); $result = Step::getByProcessTaskAndStepType( $table->PRO_UID, $table->TAS_UID, diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/SubProcessTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/SubProcessTest.php index a5e6585da..3cbf5c7c8 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/SubProcessTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/SubProcessTest.php @@ -32,17 +32,17 @@ class SubProcessTest extends TestCase */ public function it_should_test_the_get_pro_parents_method() { - $process = factory(Process::class)->create(); - $processParent = factory(Process::class, 3)->create(); - factory(SubProcess::class)->create([ + $process = Process::factory()->create(); + $processParent = Process::factory(3)->create(); + SubProcess::factory()->create([ 'PRO_UID' => $process['PRO_UID'], 'PRO_PARENT' => $processParent[0]['PRO_UID'] ]); - factory(SubProcess::class)->create([ + SubProcess::factory()->create([ 'PRO_UID' => $process['PRO_UID'], 'PRO_PARENT' => $processParent[1]['PRO_UID'] ]); - factory(SubProcess::class)->create([ + SubProcess::factory()->create([ 'PRO_UID' => $process['PRO_UID'], 'PRO_PARENT' => $processParent[2]['PRO_UID'] ]); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/TaskTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/TaskTest.php index c6b294bd2..3170cf0f3 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/TaskTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/TaskTest.php @@ -3,7 +3,6 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\Model; use G; -use Illuminate\Foundation\Testing\DatabaseTransactions; use ProcessMaker\Model\Delegation; use ProcessMaker\Model\ElementTaskRelation; use ProcessMaker\Model\Process; @@ -18,7 +17,15 @@ use Tests\TestCase; class TaskTest extends TestCase { - use DatabaseTransactions; + /** + * Set up method. + * @return void + */ + public function setUp(): void + { + parent::setUp(); + $this->truncateNonInitialModels(); + } /** * It tests the get taskId @@ -28,7 +35,7 @@ class TaskTest extends TestCase */ public function it_get_task() { - $task = factory(Task::class)->create(); + $task = Task::factory()->create(); $result = Task::getTask($task->TAS_ID); $this->assertNotEmpty($result); } @@ -41,7 +48,7 @@ class TaskTest extends TestCase */ public function it_scope_exclude_tasks() { - $table = factory(Task::class)->create(); + $table = Task::factory()->create(); $this->assertNotEmpty($table->excludedTasks()->get()); } @@ -54,7 +61,7 @@ class TaskTest extends TestCase public function it_should_return_title_of_event_task() { // Intermediate email event - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_TITLE' => 'INTERMEDIATE-THROW-EMAIL-EVENT', 'TAS_TYPE' => 'INTERMEDIATE-THROW-EMAIL-EVENT' ]); @@ -62,7 +69,7 @@ class TaskTest extends TestCase $title = $taskInstance->title($task->TAS_ID); $this->assertEquals($title['title'], G::LoadTranslation('ID_INTERMEDIATE_THROW_EMAIL_EVENT')); // Intermediate throw message event - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_TITLE' => 'INTERMEDIATE-THROW-MESSAGE-EVENT', 'TAS_TYPE' => 'INTERMEDIATE-THROW-MESSAGE-EVENT' ]); @@ -70,7 +77,7 @@ class TaskTest extends TestCase $title = $taskInstance->title($task->TAS_ID); $this->assertEquals($title['title'], G::LoadTranslation('ID_INTERMEDIATE_THROW_MESSAGE_EVENT')); // Intermediate catch message event - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_TITLE' => 'INTERMEDIATE-CATCH-MESSAGE-EVENT', 'TAS_TYPE' => 'INTERMEDIATE-CATCH-MESSAGE-EVENT' ]); @@ -78,7 +85,7 @@ class TaskTest extends TestCase $title = $taskInstance->title($task->TAS_ID); $this->assertEquals($title['title'], G::LoadTranslation('ID_INTERMEDIATE_CATCH_MESSAGE_EVENT')); // Intermediate timer event - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_TITLE' => 'INTERMEDIATE-CATCH-TIMER-EVENT', 'TAS_TYPE' => 'INTERMEDIATE-CATCH-TIMER-EVENT' ]); @@ -86,7 +93,7 @@ class TaskTest extends TestCase $title = $taskInstance->title($task->TAS_ID); $this->assertEquals($title['title'], G::LoadTranslation('ID_INTERMEDIATE_CATCH_TIMER_EVENT')); // Script task - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_TITLE' => 'SCRIPT-TASK', 'TAS_TYPE' => 'SCRIPT-TASK' ]); @@ -94,7 +101,7 @@ class TaskTest extends TestCase $title = $taskInstance->title($task->TAS_ID); $this->assertEquals($title['title'], G::LoadTranslation('ID_SCRIPT_TASK_UNTITLED')); // Service task - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_TITLE' => 'SERVICE-TASK', 'TAS_TYPE' => 'SERVICE-TASK' ]); @@ -102,7 +109,7 @@ class TaskTest extends TestCase $title = $taskInstance->title($task->TAS_ID); $this->assertEquals($title['title'], G::LoadTranslation('ID_SERVICE_TASK_UNTITLED')); // None - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_TITLE' => 'SUBPROCESS', 'TAS_TYPE' => 'SUBPROCESS' ]); @@ -119,7 +126,7 @@ class TaskTest extends TestCase */ public function it_should_return_task() { - $task = factory(Task::class)->create(); + $task = Task::factory()->create(); $taskInstance = new Task(); $properties = $taskInstance->load($task->TAS_UID); @@ -134,10 +141,10 @@ class TaskTest extends TestCase */ public function it_should_return_task_information_from_user_task() { - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_TYPE' => 'NORMAL' ]); - $del = factory(Delegation::class)->states('closed')->create([ + $del = Delegation::factory()->closed()->create([ 'PRO_UID' => $task->PRO_UID, 'TAS_ID' => $task->TAS_ID, 'TAS_UID' => $task->TAS_UID, @@ -161,10 +168,10 @@ class TaskTest extends TestCase */ public function it_should_return_task_information_from_automatic_task() { - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_TYPE' => 'SCRIPT-TASK' ]); - $del = factory(Delegation::class)->states('closed')->create([ + $del = Delegation::factory()->closed()->create([ 'PRO_UID' => $task->PRO_UID, 'TAS_ID' => $task->TAS_ID, 'TAS_UID' => $task->TAS_UID, @@ -188,11 +195,11 @@ class TaskTest extends TestCase */ public function it_should_test_set_task_title_method() { - $project = factory(Process::class)->create(); - $task = factory(Task::class)->create([ + $project = Process::factory()->create(); + $task = Task::factory()->create([ 'TAS_DEF_TITLE' => 'something' ]); - $elementTask = factory(ElementTaskRelation::class)->create([ + $elementTask = ElementTaskRelation::factory()->create([ 'PRJ_UID' => $project->PRO_UID, 'TAS_UID' => $task->TAS_UID, ]); @@ -212,11 +219,11 @@ class TaskTest extends TestCase */ public function it_should_test_get_task_def_title_method() { - $project = factory(Process::class)->create(); - $task = factory(Task::class)->create([ + $project = Process::factory()->create(); + $task = Task::factory()->create([ 'TAS_DEF_TITLE' => 'something' ]); - $elementTask = factory(ElementTaskRelation::class)->create([ + $elementTask = ElementTaskRelation::factory()->create([ 'PRJ_UID' => $project->PRO_UID, 'TAS_UID' => $task->TAS_UID, ]); @@ -234,7 +241,7 @@ class TaskTest extends TestCase */ public function it_get_case_title() { - $task = factory(Task::class)->create(); + $task = Task::factory()->create(); $tas = new Task(); $result = $tas->taskCaseTitle($task->TAS_UID); $this->assertNotEmpty($result); @@ -250,30 +257,27 @@ class TaskTest extends TestCase */ public function it_should_test_get_tasks_for_home_method() { - Task::truncate(); - Process::truncate(); - - $process1 = factory(Process::class)->create(); - $process2 = factory(Process::class)->create(); + $process1 = Process::factory()->create(); + $process2 = Process::factory()->create(); - factory(Task::class)->create([ + Task::factory()->create([ 'PRO_UID' => $process1->PRO_UID, 'TAS_TITLE' => 'Task 1' ]); - factory(Task::class)->create([ + Task::factory()->create([ 'PRO_UID' => $process1->PRO_UID, 'TAS_TITLE' => 'Task 2' ]); - factory(Task::class)->create([ + Task::factory()->create([ 'PRO_UID' => $process1->PRO_UID, 'TAS_TITLE' => 'Task 3' ]); - factory(Task::class)->create([ + Task::factory()->create([ 'PRO_UID' => $process2->PRO_UID, 'TAS_TITLE' => 'Task 1' ]); - factory(Task::class)->create([ + Task::factory()->create([ 'PRO_UID' => $process2->PRO_UID, 'TAS_TITLE' => 'Task 2' ]); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/TaskUserTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/TaskUserTest.php index add792ba9..54e05f014 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/TaskUserTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/TaskUserTest.php @@ -29,15 +29,15 @@ class TaskUserTest extends TestCase { if ($type === 'NORMAL'){ if ($relation === 'USER'){ - $assigment = factory(TaskUser::class)->states('normal_assigment_user')->create(); + $assigment = TaskUser::factory()->normal_assigment_user()->create(); } else { - $assigment = factory(TaskUser::class)->states('normal_assigment_group')->create(); + $assigment = TaskUser::factory()->normal_assigment_group()->create(); } } else { if ($relation === 'USER'){ - $assigment = factory(TaskUser::class)->states('adhoc_assigment_user')->create(); + $assigment = TaskUser::factory()->adhoc_assigment_user()->create(); } else { - $assigment = factory(TaskUser::class)->states('adhoc_assigment_group')->create(); + $assigment = TaskUser::factory()->adhoc_assigment_group()->create(); } } @@ -51,9 +51,9 @@ class TaskUserTest extends TestCase */ public function it_has_a_task() { - $assigment = factory(TaskUser::class)->create([ + $assigment = TaskUser::factory()->create([ 'TAS_UID' => function () { - return factory(Task::class)->create()->TAS_UID; + return Task::factory()->create()->TAS_UID; } ]); $this->assertInstanceOf(Task::class, $assigment->task); @@ -67,9 +67,9 @@ class TaskUserTest extends TestCase */ public function it_has_a_user() { - $assigment = factory(TaskUser::class)->create([ + $assigment = TaskUser::factory()->create([ 'USR_UID' => function () { - return factory(User::class)->create()->USR_UID; + return User::factory()->create()->USR_UID; } ]); $this->assertInstanceOf(User::class, $assigment->user); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/TriggersTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/TriggersTest.php index dfc1b5df2..7663354b3 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/TriggersTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/TriggersTest.php @@ -26,8 +26,8 @@ class TriggersTest extends TestCase */ public function it_set_get_trigger() { - factory(Triggers::class)->create(); - $trigger = factory(Triggers::class)->create(); + Triggers::factory()->create(); + $trigger = Triggers::factory()->create(); $trigger->setTrigger($trigger->TRI_UID); $this->assertEquals($trigger->getTrigger(), $trigger->TRI_UID); } @@ -40,8 +40,8 @@ class TriggersTest extends TestCase */ public function it_should_test_process_scope_in_trigger_model() { - $process = factory(Process::class, 3)->create(); - factory(Triggers::class)->create( + $process = Process::factory(3)->create(); + Triggers::factory()->create( [ 'PRO_UID' => $process[0]['PRO_UID'], 'TRI_WEBBOT' => '$text=222; @@ -68,21 +68,21 @@ class TriggersTest extends TestCase ] ); - factory(Triggers::class)->create( + Triggers::factory()->create( [ 'PRO_UID' => $process[1]['PRO_UID'], 'TRI_WEBBOT' => 'die();' ] ); - factory(Triggers::class)->create( + Triggers::factory()->create( [ 'PRO_UID' => $process[2]['PRO_UID'], 'TRI_WEBBOT' => 'executeQuery("select * from USERS");' ] ); - factory(Triggers::class)->create( + Triggers::factory()->create( [ 'PRO_UID' => $process[2]['PRO_UID'], 'TRI_WEBBOT' => 'executeQuery();' @@ -109,8 +109,8 @@ class TriggersTest extends TestCase */ public function it_filter_specific_tasks() { - factory(Triggers::class)->create(); - $trigger = factory(Triggers::class)->create(); + Triggers::factory()->create(); + $trigger = Triggers::factory()->create(); $this->assertCount(1, $trigger->trigger($trigger->TRI_UID)->get()); } @@ -122,7 +122,7 @@ class TriggersTest extends TestCase */ public function it_return_specific_trigger_information() { - $triggers = factory(Triggers::class, 5)->create(); + $triggers = Triggers::factory(5)->create(); $trigger = new Triggers(); $trigger->setTrigger($triggers[0]->TRI_UID); $triggersList = $trigger->triggers(); @@ -138,7 +138,7 @@ class TriggersTest extends TestCase */ public function it_return_empty_when_the_trigger_not_exist() { - factory(Triggers::class)->create(); + Triggers::factory()->create(); $trigger = new Triggers(); $trigger->setTrigger(G::generateUniqueID()); $triggersList = $trigger->triggers(); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/UserConfigTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/UserConfigTest.php index 38d752124..9688498a2 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/UserConfigTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/UserConfigTest.php @@ -19,7 +19,7 @@ class UserConfigTest extends TestCase public function setUp(): void { parent::setUp(); - UserConfig::truncate(); + $this->truncateNonInitialModels(); } /** diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/UserTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/UserTest.php index 4d85743e7..ce8b0593f 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Model/UserTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/UserTest.php @@ -32,7 +32,7 @@ class UserTest extends TestCase */ public function it_should_test_the_users_filters_scope_with_usr_uid() { - $user = factory(User::class, 4)->create(); + $user = User::factory(4)->create(); $filters = ['USR_UID' => $user[0]['USR_UID']]; $userQuery = User::query()->select(); @@ -54,7 +54,7 @@ class UserTest extends TestCase */ public function it_should_test_the_users_filters_scope_with_usr_id() { - $user = factory(User::class, 4)->create(); + $user = User::factory(4)->create(); $filters = ['USR_ID' => $user[0]['USR_ID']]; $userQuery = User::query()->select(); $userQuery->userFilters($filters); @@ -76,7 +76,7 @@ class UserTest extends TestCase */ public function it_should_test_the_exception_in_users_filters_scope() { - factory(User::class, 4)->create(); + User::factory(4)->create(); $filters = []; $userQuery = User::query()->select(); @@ -98,28 +98,28 @@ class UserTest extends TestCase public function it_should_test_get_users_for_home() { // Create five users (3 active, 1 on vacation, 1 inactive) - factory(User::class)->create([ + User::factory()->create([ 'USR_USERNAME' => 'jsmith', 'USR_FIRSTNAME' => 'John', 'USR_LASTNAME' => 'Smith', ]); - factory(User::class)->create([ + User::factory()->create([ 'USR_USERNAME' => 'asmith', 'USR_FIRSTNAME' => 'Adam', 'USR_LASTNAME' => 'Smith', ]); - factory(User::class)->create([ + User::factory()->create([ 'USR_USERNAME' => 'wsmith', 'USR_FIRSTNAME' => 'Will', 'USR_LASTNAME' => 'Smith', ]); - factory(User::class)->create([ + User::factory()->create([ 'USR_USERNAME' => 'wwallace', 'USR_FIRSTNAME' => 'Williams', 'USR_LASTNAME' => 'Wallace', 'USR_STATUS' => 'VACATION', ]); - factory(User::class)->create([ + User::factory()->create([ 'USR_USERNAME' => 'msmith', 'USR_FIRSTNAME' => 'Marcus', 'USR_LASTNAME' => 'Smith', @@ -146,7 +146,7 @@ class UserTest extends TestCase */ public function it_get_usr_id() { - $user = factory(User::class)->create(); + $user = User::factory()->create(); // When the user exist $results = User::getId($user->USR_UID); $this->assertGreaterThan(0, $results); @@ -164,7 +164,7 @@ class UserTest extends TestCase */ public function it_get_information() { - $user = factory(User::class)->create(); + $user = User::factory()->create(); // When the user exist $results = User::getInformation($user->USR_ID); $this->assertNotEmpty($results); @@ -184,7 +184,7 @@ class UserTest extends TestCase */ public function it_get_all_information() { - $user = factory(User::class)->create(); + $user = User::factory()->create(); // When the user exist $results = User::getAllInformation($user->USR_ID); $this->assertNotEmpty($results); @@ -223,6 +223,6 @@ class UserTest extends TestCase 'ROL_CODE' => 0 ]; $res = User::createUser($usrData); - $this->assertInternalType('integer', $res); + $this->assertIsInt($res); } } \ No newline at end of file diff --git a/tests/unit/workflow/engine/src/ProcessMaker/PDF/BasicStructTest.php b/tests/unit/workflow/engine/src/ProcessMaker/PDF/BasicStructTest.php index 1dbbc9f75..a6e53549d 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/PDF/BasicStructTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/PDF/BasicStructTest.php @@ -26,7 +26,7 @@ class BasicStructTest extends TestCase /** * setUp method. */ - public function setUp() + public function setUp(): void { parent::setUp(); $this->faker = Factory::create(); @@ -36,7 +36,7 @@ class BasicStructTest extends TestCase /** * tearDown method. */ - public function tearDown() + public function tearDown(): void { parent::tearDown(); } diff --git a/tests/unit/workflow/engine/src/ProcessMaker/PDF/FooterStructTest.php b/tests/unit/workflow/engine/src/ProcessMaker/PDF/FooterStructTest.php index 11f82d0fa..a8b6538aa 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/PDF/FooterStructTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/PDF/FooterStructTest.php @@ -26,7 +26,7 @@ class FooterStructTest extends TestCase /** * setUp method. */ - public function setUp() + public function setUp(): void { parent::setUp(); $this->faker = Factory::create(); @@ -36,7 +36,7 @@ class FooterStructTest extends TestCase /** * tearDown method. */ - public function tearDown() + public function tearDown(): void { parent::tearDown(); } diff --git a/tests/unit/workflow/engine/src/ProcessMaker/PDF/HeaderStructTest.php b/tests/unit/workflow/engine/src/ProcessMaker/PDF/HeaderStructTest.php index 6d018d8b4..dcfea30fc 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/PDF/HeaderStructTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/PDF/HeaderStructTest.php @@ -20,7 +20,7 @@ class HeaderStructTest extends TestCase /** * setUp method. */ - public function setUp() + public function setUp(): void { parent::setUp(); $this->faker = Factory::create(); @@ -30,7 +30,7 @@ class HeaderStructTest extends TestCase /** * tearDown method. */ - public function tearDown() + public function tearDown(): void { parent::tearDown(); } diff --git a/tests/unit/workflow/engine/src/ProcessMaker/PDF/TCPDFHeaderFooterTest.php b/tests/unit/workflow/engine/src/ProcessMaker/PDF/TCPDFHeaderFooterTest.php index 86270cd5d..1b5731048 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/PDF/TCPDFHeaderFooterTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/PDF/TCPDFHeaderFooterTest.php @@ -20,7 +20,7 @@ class TCPDFHeaderFooterTest extends TestCase /** * setUp method. */ - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->object = new TCPDFHeaderFooter('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); @@ -36,7 +36,7 @@ class TCPDFHeaderFooterTest extends TestCase /** * tearDown method. */ - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); } diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflowTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflowTest.php index b5a7c4bc6..8681d7a3f 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflowTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflowTest.php @@ -22,8 +22,8 @@ class BpmnWorkflowTest extends TestCase public function setUp(): void { parent::setUp(); - $this->user = factory(User::class)->create(); - Process::truncate(); + $this->truncateNonInitialModels(); + $this->user = User::factory()->create(); } /** @@ -79,7 +79,7 @@ class BpmnWorkflowTest extends TestCase { $faker = Factory::create(); $title = $faker->title; - factory(\ProcessMaker\Model\Process::class)->create([ + \ProcessMaker\Model\Process::factory()->create([ 'PRO_TITLE' => $title ]); @@ -115,7 +115,9 @@ class BpmnWorkflowTest extends TestCase $projectData["process"]["pro_id"] = $faker->randomDigit; $bpmnWorkflow = new BpmnWorkflow(); - $bpmnWorkflow->createFromStruct($projectData, true, null); + $result = $bpmnWorkflow->createFromStruct($projectData, true, null); + $result = json_encode($result); + $this->assertStringContainsString($projectData['prj_uid'], $result); } /** @@ -158,11 +160,11 @@ class BpmnWorkflowTest extends TestCase $bpmnWorkflow = new BpmnWorkflow(); - factory(\ProcessMaker\Model\BpmnProject::class)->create([ + \ProcessMaker\Model\BpmnProject::factory()->create([ 'PRJ_NAME' => $projectData['prj_name'] ]); - factory(\ProcessMaker\Model\Process::class)->create([ + \ProcessMaker\Model\Process::factory()->create([ 'PRO_TITLE' => $projectData['prj_name'] ]); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Project/WorkflowTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Project/WorkflowTest.php index 095132178..9d3dd1184 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Project/WorkflowTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Project/WorkflowTest.php @@ -51,11 +51,11 @@ class WorkflowTest extends TestCase */ public function it_should_return_the_data_when_the_project_id_is_valid() { - $process = factory(Process::class)->create(); - $dynaforms = factory(Dynaform::class, 5)->create([ + $process = Process::factory()->create(); + $dynaforms = Dynaform::factory(5)->create([ 'PRO_UID' => $process->PRO_UID ]); - factory(WebEntry::class, 5)->create([ + WebEntry::factory(5)->create([ 'PRO_UID' => $process->PRO_UID ]); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Report/ReportingTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Report/ReportingTest.php index b4c3cc692..546c12481 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Report/ReportingTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Report/ReportingTest.php @@ -45,7 +45,7 @@ class ReportingTest extends TestCase $dateInit = date("YYYY-MM-DD"); $dateFinish = date("YYYY-MM-DD"); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'DEL_DELEGATE_DATE' => $dateInit ]); @@ -81,7 +81,7 @@ class ReportingTest extends TestCase $dateInit = date("YYYY-MM-DD"); $dateFinish = date("YYYY-MM-DD"); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'DEL_DELEGATE_DATE' => $dateInit ]); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Services/Api/CasesTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Services/Api/CasesTest.php index 39aa594aa..d04c961d2 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Services/Api/CasesTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Services/Api/CasesTest.php @@ -66,7 +66,7 @@ class CasesTest extends TestCase */ public function it_should_test_isAllowed_method_try_exception() { - $user = factory(\ProcessMaker\Model\User::class)->create(); + $user = \ProcessMaker\Model\User::factory()->create(); $rest = $this->initializeRestApi($user->USR_UID); //assert exception @@ -84,21 +84,21 @@ class CasesTest extends TestCase */ public function it_should_test_isAllowed_method_doGetCaseVariables_option() { - $user = factory(\ProcessMaker\Model\User::class)->create(); - $process = factory(\ProcessMaker\Model\Process::class)->create(); - $task = factory(\ProcessMaker\Model\Task::class)->create([ + $user = \ProcessMaker\Model\User::factory()->create(); + $process = \ProcessMaker\Model\Process::factory()->create(); + $task = \ProcessMaker\Model\Task::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'PRO_ID' => $process->PRO_ID ]); - $dynaform = factory(\ProcessMaker\Model\Dynaform::class)->create([ + $dynaform = \ProcessMaker\Model\Dynaform::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $application = factory(\ProcessMaker\Model\Application::class)->create([ + $application = \ProcessMaker\Model\Application::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'APP_INIT_USER' => $user->USR_UID, 'APP_CUR_USER' => $user->USR_UID ]); - $delegation = factory(\ProcessMaker\Model\Delegation::class)->create([ + $delegation = \ProcessMaker\Model\Delegation::factory()->create([ 'APP_UID' => $application->APP_UID, 'APP_NUMBER' => $application->APP_NUMBER, 'DEL_INDEX' => 1, @@ -138,16 +138,16 @@ class CasesTest extends TestCase */ public function it_should_test_isAllowed_method_doGetCaseVariables_option_without_delegation_user() { - $user = factory(\ProcessMaker\Model\User::class)->create(); - $process = factory(\ProcessMaker\Model\Process::class)->create(); - $task = factory(\ProcessMaker\Model\Task::class)->create([ + $user = \ProcessMaker\Model\User::factory()->create(); + $process = \ProcessMaker\Model\Process::factory()->create(); + $task = \ProcessMaker\Model\Task::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'PRO_ID' => $process->PRO_ID ]); - $dynaform = factory(\ProcessMaker\Model\Dynaform::class)->create([ + $dynaform = \ProcessMaker\Model\Dynaform::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $application = factory(\ProcessMaker\Model\Application::class)->create([ + $application = \ProcessMaker\Model\Application::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'APP_INIT_USER' => $user->USR_UID, 'APP_CUR_USER' => $user->USR_UID @@ -181,16 +181,16 @@ class CasesTest extends TestCase */ public function it_should_test_isAllowed_method_doGetCaseVariables_option_with_guest_user() { - $user = factory(\ProcessMaker\Model\User::class)->create(); - $process = factory(\ProcessMaker\Model\Process::class)->create(); - $task = factory(\ProcessMaker\Model\Task::class)->create([ + $user = \ProcessMaker\Model\User::factory()->create(); + $process = \ProcessMaker\Model\Process::factory()->create(); + $task = \ProcessMaker\Model\Task::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'PRO_ID' => $process->PRO_ID ]); - $dynaform = factory(\ProcessMaker\Model\Dynaform::class)->create([ + $dynaform = \ProcessMaker\Model\Dynaform::factory()->create([ 'PRO_UID' => $process->PRO_UID ]); - $application = factory(\ProcessMaker\Model\Application::class)->create([ + $application = \ProcessMaker\Model\Application::factory()->create([ 'PRO_UID' => $process->PRO_UID, 'APP_INIT_USER' => $user->USR_UID, 'APP_CUR_USER' => $user->USR_UID @@ -225,11 +225,11 @@ class CasesTest extends TestCase */ public function test_upload_document_to_case_method() { - $user = factory(User::class)->create(); - $application = factory(Application::class)->create([ + $user = User::factory()->create(); + $application = Application::factory()->create([ 'APP_CUR_USER' => $user->USR_UID ]); - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID ]); $varName = "/tmp/test.pdf"; @@ -266,11 +266,11 @@ class CasesTest extends TestCase */ public function test_exception_upload_document_to_case_method() { - $user = factory(User::class)->create(); - $application = factory(Application::class)->create([ + $user = User::factory()->create(); + $application = Application::factory()->create([ 'APP_CUR_USER' => $user->USR_UID ]); - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_UID' => $application->APP_UID ]); $varName = "/tmp/test.pdf"; diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Services/Api/LightTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Services/Api/LightTest.php index bf3c16bb2..3aa3a5590 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Services/Api/LightTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Services/Api/LightTest.php @@ -35,6 +35,7 @@ class LightTest extends TestCase public function setUp(): void { parent::setUp(); + $this->truncateNonInitialModels(); $this->workspace = env("DB_DATABASE", "test"); $this->clientId = config("oauthClients.pm.clientId"); $this->clientSecret = config("oauthClients.pm.clientSecret"); @@ -126,7 +127,7 @@ class LightTest extends TestCase $faker = $faker = Factory::create(); //Create process - $process = factory(Process::class)->create(); + $process = Process::factory()->create(); //Tasks created in the factory process are cleaned because it does not meet the test rules Task::where('PRO_UID', $process->PRO_UID)->delete(); @@ -137,14 +138,14 @@ class LightTest extends TestCase ->first(); //Create a task self service - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID ]); //Assign a user in the task - factory(TaskUser::class, 1)->create([ + TaskUser::factory(1)->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, //Related to the user @@ -155,7 +156,7 @@ class LightTest extends TestCase ListUnassigned::truncate(); //Create a record in list unassigned - $listUnassigned = factory(ListUnassigned::class, 15)->create([ + $listUnassigned = ListUnassigned::factory(15)->create([ 'TAS_ID' => $task->TAS_ID, 'DEL_PREVIOUS_USR_UID' => $user->USR_UID ]); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Services/Api/MetricsTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Services/Api/MetricsTest.php index bf0ac10c1..324ba808e 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Services/Api/MetricsTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Services/Api/MetricsTest.php @@ -2,7 +2,6 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\Services\Api; -use Illuminate\Foundation\Testing\DatabaseTransactions; use Luracast\Restler\Data\ApiMethodInfo; use Luracast\Restler\Defaults; use Luracast\Restler\HumanReadableCache; @@ -30,15 +29,13 @@ use Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases\UnassignedTe */ class MetricsTest extends TestCase { - use DatabaseTransactions; - /** * Method set up. */ public function setUp(): void { parent::setUp(); - Delegation::truncate(); + $this->truncateNonInitialModels(); } /** * Initialize Rest API. @@ -88,9 +85,7 @@ class MetricsTest extends TestCase */ public function it_tests_get_counters_list_method_empty_lists() { - ApplicationModel::truncate(); - - $user = factory(\ProcessMaker\Model\User::class)->create(); + $user = \ProcessMaker\Model\User::factory()->create(); $this->initializeRestApi($user->USR_UID); $metrics = new Metrics(); @@ -172,7 +167,7 @@ class MetricsTest extends TestCase */ public function it_tests_get_process_total_cases_inbox() { - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_PREVIOUS' => 1, 'DEL_INDEX' => 2, @@ -189,8 +184,8 @@ class MetricsTest extends TestCase */ public function it_tests_get_process_total_cases_draft() { - $application = factory(ApplicationModel::class)->states('draft')->create(); - factory(Delegation::class)->states('foreign_keys')->create([ + $application = ApplicationModel::factory()->draft()->create(); + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application->APP_INIT_USER, @@ -210,22 +205,22 @@ class MetricsTest extends TestCase */ public function it_tests_get_process_total_cases_paused() { - $process1 = factory(Process::class)->create( + $process1 = Process::factory()->create( ['PRO_CATEGORY' => '1'] ); - $process2 = factory(Process::class)->create( + $process2 = Process::factory()->create( ['PRO_CATEGORY' => '2'] ); - $user = factory(User::class)->create(); - $task = factory(Task::class)->create([ + $user = User::factory()->create(); + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => '', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process1->PRO_UID, 'TAS_TYPE' => 'NORMAL' ]); - $application1 = factory(ApplicationModel::class)->create(); - $application2 = factory(ApplicationModel::class)->create(); - factory(Delegation::class)->create([ + $application1 = ApplicationModel::factory()->create(); + $application2 = ApplicationModel::factory()->create(); + Delegation::factory()->create([ 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'CLOSED', @@ -236,7 +231,7 @@ class MetricsTest extends TestCase 'DEL_PREVIOUS' => 0, 'DEL_INDEX' => 1 ]); - $delegation1 = factory(Delegation::class)->create([ + $delegation1 = Delegation::factory()->create([ 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'CLOSED', @@ -247,7 +242,7 @@ class MetricsTest extends TestCase 'DEL_PREVIOUS' => 1, 'DEL_INDEX' => 2 ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application2->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', @@ -258,7 +253,7 @@ class MetricsTest extends TestCase 'DEL_PREVIOUS' => 0, 'DEL_INDEX' => 1 ]); - $delegation2 = factory(Delegation::class)->create([ + $delegation2 = Delegation::factory()->create([ 'APP_NUMBER' => $application2->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', @@ -269,7 +264,7 @@ class MetricsTest extends TestCase 'DEL_PREVIOUS' => 1, 'DEL_INDEX' => 2 ]); - factory(AppDelay::class, 5)->create([ + AppDelay::factory(5)->create([ 'APP_DELEGATION_USER' => $user->USR_UID, 'PRO_UID' => $process2->PRO_UID, 'APP_NUMBER' => $delegation1->APP_NUMBER, @@ -277,7 +272,7 @@ class MetricsTest extends TestCase 'APP_DISABLE_ACTION_USER' => 0, 'APP_TYPE' => 'PAUSE' ]); - factory(AppDelay::class, 5)->create([ + AppDelay::factory(5)->create([ 'APP_DELEGATION_USER' => $user->USR_UID, 'PRO_UID' => $process2->PRO_UID, 'APP_NUMBER' => $delegation2->APP_NUMBER, @@ -297,24 +292,24 @@ class MetricsTest extends TestCase */ public function it_tests_get_process_total_cases_unassigned() { - $user = factory(\ProcessMaker\Model\User::class)->create(); - $process = factory(Process::class)->create(); - $application = factory(ApplicationModel::class)->create([ + $user = \ProcessMaker\Model\User::factory()->create(); + $process = Process::factory()->create(); + $application = ApplicationModel::factory()->create([ 'APP_STATUS_ID' => 2 ]); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID, 'PRO_ID' => $process->PRO_ID, ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, 'TU_TYPE' => 1 ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'PRO_ID' => $process->PRO_ID, @@ -334,7 +329,7 @@ class MetricsTest extends TestCase */ public function it_tests_get_total_cases_by_range_inbox() { - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_PREVIOUS' => 1, 'DEL_INDEX' => 2, @@ -351,8 +346,8 @@ class MetricsTest extends TestCase */ public function it_tests_get_total_cases_by_range_draft() { - $application = factory(ApplicationModel::class)->states('draft')->create(); - factory(Delegation::class)->states('foreign_keys')->create([ + $application = ApplicationModel::factory()->draft()->create(); + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application->APP_INIT_USER, @@ -372,22 +367,22 @@ class MetricsTest extends TestCase */ public function it_tests_get_total_cases_by_range_paused() { - $process1 = factory(Process::class)->create( + $process1 = Process::factory()->create( ['PRO_CATEGORY' => '1'] ); - $process2 = factory(Process::class)->create( + $process2 = Process::factory()->create( ['PRO_CATEGORY' => '2'] ); - $user = factory(User::class)->create(); - $task = factory(Task::class)->create([ + $user = User::factory()->create(); + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => '', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process1->PRO_UID, 'TAS_TYPE' => 'NORMAL' ]); - $application1 = factory(ApplicationModel::class)->create(); - $application2 = factory(ApplicationModel::class)->create(); - factory(Delegation::class)->create([ + $application1 = ApplicationModel::factory()->create(); + $application2 = ApplicationModel::factory()->create(); + Delegation::factory()->create([ 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'CLOSED', @@ -398,7 +393,7 @@ class MetricsTest extends TestCase 'DEL_PREVIOUS' => 0, 'DEL_INDEX' => 1 ]); - $delegation1 = factory(Delegation::class)->create([ + $delegation1 = Delegation::factory()->create([ 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'CLOSED', @@ -409,7 +404,7 @@ class MetricsTest extends TestCase 'DEL_PREVIOUS' => 1, 'DEL_INDEX' => 2 ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application2->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', @@ -420,7 +415,7 @@ class MetricsTest extends TestCase 'DEL_PREVIOUS' => 0, 'DEL_INDEX' => 1 ]); - $delegation2 = factory(Delegation::class)->create([ + $delegation2 = Delegation::factory()->create([ 'APP_NUMBER' => $application2->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', @@ -431,7 +426,7 @@ class MetricsTest extends TestCase 'DEL_PREVIOUS' => 1, 'DEL_INDEX' => 2 ]); - factory(AppDelay::class, 5)->create([ + AppDelay::factory(5)->create([ 'APP_DELEGATION_USER' => $user->USR_UID, 'PRO_UID' => $process2->PRO_UID, 'APP_NUMBER' => $delegation1->APP_NUMBER, @@ -439,7 +434,7 @@ class MetricsTest extends TestCase 'APP_DISABLE_ACTION_USER' => 0, 'APP_TYPE' => 'PAUSE' ]); - factory(AppDelay::class, 5)->create([ + AppDelay::factory(5)->create([ 'APP_DELEGATION_USER' => $user->USR_UID, 'PRO_UID' => $process2->PRO_UID, 'APP_NUMBER' => $delegation2->APP_NUMBER, @@ -459,24 +454,24 @@ class MetricsTest extends TestCase */ public function it_tests_get_total_cases_by_range_unassigned() { - $user = factory(\ProcessMaker\Model\User::class)->create(); - $process = factory(Process::class)->create(); - $application = factory(ApplicationModel::class)->create([ + $user = \ProcessMaker\Model\User::factory()->create(); + $process = Process::factory()->create(); + $application = ApplicationModel::factory()->create([ 'APP_STATUS_ID' => 2 ]); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID, 'PRO_ID' => $process->PRO_ID, ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, 'TU_TYPE' => 1 ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'PRO_ID' => $process->PRO_ID, @@ -496,8 +491,8 @@ class MetricsTest extends TestCase */ public function it_tests_get_cases_risk_by_process_inbox() { - $process = factory(Process::class)->create(); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $process = Process::factory()->create(); + $delegation = Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_PREVIOUS' => 1, 'DEL_INDEX' => 2, @@ -517,9 +512,9 @@ class MetricsTest extends TestCase */ public function it_tests_get_cases_risk_by_process_draft() { - $process = factory(Process::class)->create(); - $application = factory(ApplicationModel::class)->states('draft')->create(); - $delegation = factory(Delegation::class)->states('foreign_keys')->create([ + $process = Process::factory()->create(); + $application = ApplicationModel::factory()->draft()->create(); + $delegation = Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_INDEX' => 1, 'USR_UID' => $application->APP_INIT_USER, @@ -542,22 +537,22 @@ class MetricsTest extends TestCase */ public function it_tests_get_cases_risk_by_process_paused() { - $process1 = factory(Process::class)->create( + $process1 = Process::factory()->create( ['PRO_CATEGORY' => '1'] ); - $process2 = factory(Process::class)->create( + $process2 = Process::factory()->create( ['PRO_CATEGORY' => '2'] ); - $user = factory(User::class)->create(); - $task = factory(Task::class)->create([ + $user = User::factory()->create(); + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => '', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process1->PRO_UID, 'TAS_TYPE' => 'NORMAL' ]); - $application1 = factory(ApplicationModel::class)->create(); - $application2 = factory(ApplicationModel::class)->create(); - factory(Delegation::class)->create([ + $application1 = ApplicationModel::factory()->create(); + $application2 = ApplicationModel::factory()->create(); + Delegation::factory()->create([ 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'CLOSED', @@ -570,7 +565,7 @@ class MetricsTest extends TestCase 'DEL_RISK_DATE' => date('Y-m-d H:i:s'), 'DEL_TASK_DUE_DATE' => date('Y-m-d H:i:s', strtotime("+1 hour")) ]); - $delegation1 = factory(Delegation::class)->create([ + $delegation1 = Delegation::factory()->create([ 'APP_NUMBER' => $application1->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'CLOSED', @@ -583,7 +578,7 @@ class MetricsTest extends TestCase 'DEL_RISK_DATE' => date('Y-m-d H:i:s'), 'DEL_TASK_DUE_DATE' => date('Y-m-d H:i:s', strtotime("+1 hour")) ]); - factory(Delegation::class)->create([ + Delegation::factory()->create([ 'APP_NUMBER' => $application2->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', @@ -596,7 +591,7 @@ class MetricsTest extends TestCase 'DEL_RISK_DATE' => date('Y-m-d H:i:s'), 'DEL_TASK_DUE_DATE' => date('Y-m-d H:i:s', strtotime("+1 hour")) ]); - $delegation2 = factory(Delegation::class)->create([ + $delegation2 = Delegation::factory()->create([ 'APP_NUMBER' => $application2->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'DEL_THREAD_STATUS' => 'OPEN', @@ -609,7 +604,7 @@ class MetricsTest extends TestCase 'DEL_RISK_DATE' => date('Y-m-d H:i:s'), 'DEL_TASK_DUE_DATE' => date('Y-m-d H:i:s', strtotime("+1 hour")) ]); - factory(AppDelay::class, 5)->create([ + AppDelay::factory(5)->create([ 'APP_DELEGATION_USER' => $user->USR_UID, 'PRO_UID' => $process2->PRO_UID, 'APP_NUMBER' => $delegation1->APP_NUMBER, @@ -617,7 +612,7 @@ class MetricsTest extends TestCase 'APP_DISABLE_ACTION_USER' => 0, 'APP_TYPE' => 'PAUSE' ]); - factory(AppDelay::class, 5)->create([ + AppDelay::factory(5)->create([ 'APP_DELEGATION_USER' => $user->USR_UID, 'PRO_UID' => $process2->PRO_UID, 'APP_NUMBER' => $delegation2->APP_NUMBER, @@ -637,24 +632,24 @@ class MetricsTest extends TestCase */ public function it_tests_get_cases_risk_by_process_unassigned() { - $user = factory(\ProcessMaker\Model\User::class)->create(); - $process = factory(Process::class)->create(); - $application = factory(ApplicationModel::class)->create([ + $user = \ProcessMaker\Model\User::factory()->create(); + $process = Process::factory()->create(); + $application = ApplicationModel::factory()->create([ 'APP_STATUS_ID' => 2 ]); - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'TAS_ASSIGN_TYPE' => 'SELF_SERVICE', 'TAS_GROUP_VARIABLE' => '', 'PRO_UID' => $process->PRO_UID, 'PRO_ID' => $process->PRO_ID, ]); - factory(TaskUser::class)->create([ + TaskUser::factory()->create([ 'TAS_UID' => $task->TAS_UID, 'USR_UID' => $user->USR_UID, 'TU_RELATION' => 1, 'TU_TYPE' => 1 ]); - $delegation = factory(Delegation::class)->create([ + $delegation = Delegation::factory()->create([ 'APP_NUMBER' => $application->APP_NUMBER, 'TAS_ID' => $task->TAS_ID, 'PRO_ID' => $process->PRO_ID, @@ -677,13 +672,13 @@ class MetricsTest extends TestCase */ public function it_tests_get_process_total_cases_exception() { - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_PREVIOUS' => 1, 'DEL_INDEX' => 2, ]); $metrics = new Metrics(); - $this->expectExceptionMessage("Undefined variable: list"); + $this->expectExceptionMessage('Undefined variable $list'); $metrics->getProcessTotalCases(12, 123, "asda"); } @@ -694,13 +689,13 @@ class MetricsTest extends TestCase */ public function it_tests_get_total_cases_by_range_exception() { - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_PREVIOUS' => 1, 'DEL_INDEX' => 2, ]); $metrics = new Metrics(); - $this->expectExceptionMessage("Undefined variable: list"); + $this->expectExceptionMessage('Undefined variable $list'); $metrics->getTotalCasesByRange(12, 123, "asda"); } @@ -711,13 +706,13 @@ class MetricsTest extends TestCase */ public function it_tests_get_counters_list_exception() { - factory(Delegation::class)->states('foreign_keys')->create([ + Delegation::factory()->foreign_keys()->create([ 'DEL_THREAD_STATUS' => 'OPEN', 'DEL_PREVIOUS' => 1, 'DEL_INDEX' => 2, ]); $metrics = new Metrics(); - $this->expectExceptionMessage("Undefined variable: list"); + $this->expectExceptionMessage('Undefined variable $list'); $metrics->getCasesRiskByProcess(12, 123, "asda"); } } diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Services/Api/ProjectTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Services/Api/ProjectTest.php index 7ebcf7cc0..f844d318c 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Services/Api/ProjectTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Services/Api/ProjectTest.php @@ -18,7 +18,7 @@ class ProjectTest extends TestCase public function setUp(): void { parent::setUp(); - $this->user = factory(User::class)->create(); + $this->user = User::factory()->create(); } /** @@ -51,10 +51,9 @@ class ProjectTest extends TestCase */ public function it_should_test_the_do_get_process_method() { - $this->expectException(RestException::class); //Create user - $user = factory(User::class)->create(); - factory(RbacUsers::class)->create([ + $user = User::factory()->create(); + RbacUsers::factory()->create([ 'USR_UID' => $user->USR_UID, 'USR_USERNAME' => $user->USR_USERNAME, 'USR_FIRSTNAME' => $user->USR_FIRSTNAME, @@ -62,7 +61,7 @@ class ProjectTest extends TestCase ]); //Create process - $process = factory(Process::class)->create([ + $process = Process::factory()->create([ 'PRO_CREATE_USER' => $user->USR_UID, 'PRO_STATUS' => 'ACTIVE', 'PRO_TYPE_PROCESS' => 'PRIVATE', diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Services/OAuth2/ServerTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Services/OAuth2/ServerTest.php index 2488aeaf5..6e5f5e58a 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Services/OAuth2/ServerTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Services/OAuth2/ServerTest.php @@ -43,7 +43,7 @@ class ServerTest extends TestCase public function it_should_test_post_token_with_valid_credentials() { $user = User::where('USR_ID', '=', 1)->get()->first(); - $oauthClients = factory(OauthClients::class)->create([ + $oauthClients = OauthClients::factory()->create([ "USR_UID" => $user->USR_UID ]); @@ -81,7 +81,7 @@ class ServerTest extends TestCase public function it_should_test_post_token_with_return_handle_token() { $user = User::where('USR_ID', '=', 1)->get()->first(); - $oauthClients = factory(OauthClients::class)->create([ + $oauthClients = OauthClients::factory()->create([ "USR_UID" => $user->USR_UID ]); @@ -117,7 +117,7 @@ class ServerTest extends TestCase public function it_should_test_post_token_with_empty_client_id() { $user = User::where('USR_ID', '=', 1)->get()->first(); - $oauthClients = factory(OauthClients::class)->create([ + $oauthClients = OauthClients::factory()->create([ "USR_UID" => $user->USR_UID ]); @@ -202,7 +202,7 @@ class ServerTest extends TestCase file_put_contents($filename, $data); LicenseManager::truncate(); - factory(LicenseManager::class)->create([ + LicenseManager::factory()->create([ "LICENSE_DATA" => $data, "LICENSE_PATH" => $filename, "LICENSE_WORKSPACE" => env('MAIN_SYS_SYS') diff --git a/tests/unit/workflow/engine/src/ProcessMaker/TaskScheduler/TaskTest.php b/tests/unit/workflow/engine/src/ProcessMaker/TaskScheduler/TaskTest.php index 5411eda35..53b789972 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/TaskScheduler/TaskTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/TaskScheduler/TaskTest.php @@ -25,14 +25,9 @@ class TaskTest extends TestCase */ public function setUp(): void { - if (version_compare(phpversion(), 7.3, '>') ) { - $this->markTestSkipped('The changes in third party are not available'); - } parent::setUp(); + $this->truncateNonInitialModels(); $this->faker = Factory::create(); - Delegation::truncate(); - AppThread::truncate(); - Application::truncate(); } /** @@ -72,7 +67,7 @@ class TaskTest extends TestCase //assert if message is contained in output buffer if ($asynchronous === false) { - $this->assertRegExp("/{$message}/", $printing); + $this->assertMatchesRegularExpression("/{$message}/", $printing); } //assert if not showing message if ($asynchronous === true) { @@ -97,7 +92,7 @@ class TaskTest extends TestCase $printing = ob_get_clean(); //assert if message is contained in output buffer if ($asynchronous === false) { - $this->assertRegExp("/{$message}/", $printing); + $this->assertMatchesRegularExpression("/{$message}/", $printing); } //assert if not showing message if ($asynchronous === true) { @@ -109,7 +104,7 @@ class TaskTest extends TestCase $printing = ob_get_clean(); //assert if message is contained in output buffer if ($asynchronous === false) { - $this->assertRegExp("/{$message}/", $printing); + $this->assertMatchesRegularExpression("/{$message}/", $printing); } //assert if not showing message if ($asynchronous === true) { @@ -121,7 +116,7 @@ class TaskTest extends TestCase $printing = ob_get_clean(); //assert if message is contained in output buffer if ($asynchronous === false) { - $this->assertRegExp("/{$message}/", $printing); + $this->assertMatchesRegularExpression("/{$message}/", $printing); } //assert if not showing message if ($asynchronous === true) { @@ -149,7 +144,7 @@ class TaskTest extends TestCase $task->saveLog('', '', $description); $contentLog = file_get_contents($file); - $this->assertRegExp("/{$description}/", $contentLog); + $this->assertMatchesRegularExpression("/{$description}/", $contentLog); } if ($asynchronous === true) { $description = $this->faker->paragraph; @@ -157,7 +152,7 @@ class TaskTest extends TestCase $task->saveLog('', '', $description); $contentLog = file_get_contents($file); - $this->assertNotRegExp("/{$description}/", $contentLog); + $this->assertDoesNotMatchRegularExpression("/{$description}/", $contentLog); } } @@ -178,7 +173,7 @@ class TaskTest extends TestCase ob_start(); $task->resendEmails('', $dateSystem); $printing = ob_get_clean(); - $this->assertRegExp("/DONE/", $printing); + $this->assertMatchesRegularExpression("/DONE/", $printing); } //assert asynchronous for job process @@ -204,16 +199,16 @@ class TaskTest extends TestCase //assert synchronous for cron file if ($asynchronous === false) { ob_start(); - $task->unpauseApplications(''); + $task->unpauseApplications(date('Y-m-d')); $printing = ob_get_clean(); - $this->assertRegExp("/DONE/", $printing); + $this->assertMatchesRegularExpression("/DONE/", $printing); } //assert asynchronous for job process if ($asynchronous === true) { Queue::fake(); Queue::assertNothingPushed(); - $task->unpauseApplications(''); + $task->unpauseApplications(date('Y-m-d')); Queue::assertPushed(TaskScheduler::class); } } @@ -234,7 +229,7 @@ class TaskTest extends TestCase ob_start(); $task->calculateDuration(); $printing = ob_get_clean(); - $this->assertRegExp("/DONE/", $printing); + $this->assertMatchesRegularExpression("/DONE/", $printing); } //assert asynchronous for job process @@ -261,7 +256,7 @@ class TaskTest extends TestCase ob_start(); $task->executeCaseSelfService(); $printing = ob_get_clean(); - $this->assertRegExp("/Unassigned case/", $printing); + $this->assertMatchesRegularExpression("/Unassigned case/", $printing); } // Assert asynchronous for job process @@ -289,7 +284,7 @@ class TaskTest extends TestCase ob_start(); $task->calculateAppDuration(); $printing = ob_get_clean(); - $this->assertRegExp("/DONE/", $printing); + $this->assertMatchesRegularExpression("/DONE/", $printing); } //assert asynchronous for job process @@ -317,7 +312,7 @@ class TaskTest extends TestCase ob_start(); $task->cleanSelfServiceTables(); $printing = ob_get_clean(); - $this->assertRegExp("/DONE/", $printing); + $this->assertMatchesRegularExpression("/DONE/", $printing); } //assert asynchronous for job process @@ -345,7 +340,7 @@ class TaskTest extends TestCase ob_start(); $task->executePlugins(); $printing = ob_get_clean(); - $this->assertRegExp("/plugins/", $printing); + $this->assertMatchesRegularExpression("/plugins/", $printing); } //assert asynchronous for job process @@ -375,7 +370,7 @@ class TaskTest extends TestCase ob_start(); $task->fillReportByUser($dateInit, $dateFinish); $printing = ob_get_clean(); - $this->assertRegExp("/User Reporting/", $printing); + $this->assertMatchesRegularExpression("/User Reporting/", $printing); } //assert asynchronous for job process @@ -405,7 +400,7 @@ class TaskTest extends TestCase ob_start(); $task->fillReportByProcess($dateInit, $dateFinish); $printing = ob_get_clean(); - $this->assertRegExp("/Process Reporting/", $printing); + $this->assertMatchesRegularExpression("/Process Reporting/", $printing); } //assert asynchronous for job process @@ -433,7 +428,7 @@ class TaskTest extends TestCase ob_start(); $task->ldapcron(false); $printing = ob_get_clean(); - $this->assertRegExp("/\+---/", $printing); + $this->assertMatchesRegularExpression("/\+---/", $printing); } //assert asynchronous for job process @@ -461,7 +456,7 @@ class TaskTest extends TestCase ob_start(); $task->sendNotifications(); $printing = ob_get_clean(); - $this->assertRegExp("/Resending Notifications/", $printing); + $this->assertMatchesRegularExpression("/Resending Notifications/", $printing); } //assert asynchronous for job process @@ -517,7 +512,7 @@ class TaskTest extends TestCase ob_start(); $task->messageeventcron(); $printing = ob_get_clean(); - $this->assertRegExp("/Message-Events/", $printing); + $this->assertMatchesRegularExpression("/Message-Events/", $printing); } //assert asynchronous for job process @@ -550,7 +545,7 @@ class TaskTest extends TestCase //Gets the result $printing = ob_get_clean(); //Asserts the result is printing that there is no exisiting records to continue a case in the determined date - $this->assertRegExp('/There are no records to start new cases, on date "' . $date . '/', $printing); + $this->assertMatchesRegularExpression('/There are no records to start new cases, on date "' . $date . '/', $printing); } //assert asynchronous for job process if ($asynchronous === true) { diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Util/Helpers/UpdateUserLastLoginTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Util/Helpers/UpdateUserLastLoginTest.php index e29379f34..1cbb8fc56 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Util/Helpers/UpdateUserLastLoginTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Util/Helpers/UpdateUserLastLoginTest.php @@ -14,7 +14,7 @@ class UpdateUserLastLoginTest extends TestCase */ public function it_should_test_the_update_last_login_date_function_when_it_does_not_fail() { - $user = factory(User::class)->create(); + $user = User::factory()->create(); $userLog = ['USR_UID' => $user['USR_UID'], 'LOG_INIT_DATE' => date('Y-m-d H:i:s')]; @@ -32,12 +32,12 @@ class UpdateUserLastLoginTest extends TestCase */ public function it_should_test_the_update_last_login_date_function_when_it_fails() { - $user = factory(User::class)->create(); + $user = User::factory()->create(); $userLog = ['USR_UID' => $user['USR_UID']]; // Assert the expected exception - $this->expectExceptionMessage("Undefined index: LOG_INIT_DATE"); + $this->expectExceptionMessage('Undefined array key "LOG_INIT_DATE"'); // Call the updateUserLastLogin function updateUserLastLogin($userLog); diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Validation/MySQL57Test.php b/tests/unit/workflow/engine/src/ProcessMaker/Validation/MySQL57Test.php index cd0a35877..49ab2fec7 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/Validation/MySQL57Test.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/Validation/MySQL57Test.php @@ -21,16 +21,16 @@ class MySQL57Test extends TestCase */ public function it_should_test_incompatibilities_with_dynaforms() { - $process = factory(Process::class, 2)->create(); + $process = Process::factory(2)->create(); - factory(Dynaform::class)->create( + Dynaform::factory()->create( [ 'PRO_UID' => $process[0]['PRO_UID'], 'DYN_CONTENT' => '{"name":"2","description":"","items":[{"type":"form","variable":"","var_uid":"","dataType":"","id":"6170264265d1b544bebdbd5098250194","name":"2","description":"","mode":"edit","script":"","language":"en","externalLibs":"","printable":false,"items":[[{"type":"title","id":"title0000000001","label":"title_1","colSpan":12}],[{"type":"text","variable":"textVar002","var_uid":"9778460595d1b545088dd69091601043","dataType":"string","protectedValue":false,"id":"textVar002","name":"textVar002","label":"text_1","defaultValue":"","placeholder":"","hint":"","required":false,"requiredFieldErrorMessage":"","textTransform":"none","validate":"","validateMessage":"","maxLength":1000,"formula":"","mode":"parent","operation":"","dbConnection":"workflow","dbConnectionLabel":"PM Database","sql":"","var_name":"textVar002","colSpan":12}],[{"type":"textarea","variable":"textareaVar001","var_uid":"2934510045d1b5453f21373072798412","dataType":"string","protectedValue":false,"id":"textareaVar001","name":"textareaVar001","label":"textarea_1","defaultValue":"","placeholder":"","hint":"","required":false,"requiredFieldErrorMessage":"","validate":"","validateMessage":"","mode":"parent","dbConnection":"workflow","dbConnectionLabel":"PM Database","sql":"","rows":"5","var_name":"textareaVar001","colSpan":12}],[{"type":"datetime","variable":"datetimeVar001","var_uid":"9780823375d1b5455e9c3a2064729484","dataType":"datetime","protectedValue":false,"id":"datetimeVar001","name":"datetimeVar001","label":"datetime_1","placeholder":"","hint":"","required":false,"requiredFieldErrorMessage":"","mode":"parent","format":"YYYY-MM-DD","dayViewHeaderFormat":"MMMM YYYY","extraFormats":false,"stepping":1,"minDate":"","maxDate":"","useCurrent":"false","collapse":true,"locale":"","defaultDate":"","disabledDates":false,"enabledDates":false,"icons":{"time":"glyphicon glyphicon-time","date":"glyphicon glyphicon-calendar","up":"glyphicon glyphicon-chevron-up","down":"glyphicon glyphicon-chevron-down","previous":"glyphicon glyphicon-chevron-left","next":"glyphicon glyphicon-chevron-right","today":"glyphicon glyphicon-screenshot","clear":"glyphicon glyphicon-trash"},"useStrict":false,"sideBySide":false,"daysOfWeekDisabled":false,"calendarWeeks":false,"viewMode":"days","toolbarPlacement":"default","showTodayButton":false,"showClear":"false","widgetPositioning":{"horizontal":"auto","vertical":"auto"},"widgetParent":null,"keepOpen":false,"var_name":"datetimeVar001","colSpan":12}],[{"type":"submit","id":"submit0000000001","name":"submit0000000001","label":"submit_1","colSpan":12}]],"variables":[{"var_uid":"9778460595d1b545088dd69091601043","prj_uid":"5139642915ccb3fca429a36061714972","var_name":"textVar002","var_field_type":"string","var_field_size":10,"var_label":"string","var_dbconnection":"workflow","var_dbconnection_label":"PM Database","var_sql":"","var_null":0,"var_default":"","var_accepted_values":"[]","inp_doc_uid":""},{"var_uid":"2934510045d1b5453f21373072798412","prj_uid":"5139642915ccb3fca429a36061714972","var_name":"textareaVar001","var_field_type":"string","var_field_size":10,"var_label":"string","var_dbconnection":"workflow","var_dbconnection_label":"PM Database","var_sql":"","var_null":0,"var_default":"","var_accepted_values":"[]","inp_doc_uid":""},{"var_uid":"9780823375d1b5455e9c3a2064729484","prj_uid":"5139642915ccb3fca429a36061714972","var_name":"datetimeVar001","var_field_type":"datetime","var_field_size":10,"var_label":"datetime","var_dbconnection":"workflow","var_dbconnection_label":"PM Database","var_sql":"","var_null":0,"var_default":"","var_accepted_values":"[]","inp_doc_uid":""}]}]}' ] ); - factory(Dynaform::class)->create( + Dynaform::factory()->create( [ 'PRO_UID' => $process[1]['PRO_UID'], 'DYN_CONTENT' => '{"name":"1","description":"","items":[{"type":"form","variable":"","var_uid":"","dataType":"","id":"6817532755d16225629cb05061521548","name":"1","description":"","mode":"edit","script":"","language":"en","externalLibs":"","printable":false,"items":[[{"type":"text","variable":"textVar001","var_uid":"4746221155d1622658943d1014840579","dataType":"string","protectedValue":false,"id":"textVar001","name":"textVar001","label":"text_1","defaultValue":"","placeholder":"","hint":"","required":false,"requiredFieldErrorMessage":"","textTransform":"none","validate":"","validateMessage":"","maxLength":1000,"formula":"","mode":"parent","operation":"","dbConnection":"workflow","dbConnectionLabel":"PM Database","sql":"SELECT * FROM USERS WHERE \nUSR_UID=\'$UID\' UNION SELECT * from PROCESS","var_name":"textVar001","colSpan":12}]],"variables":[{"var_uid":"4746221155d1622658943d1014840579","prj_uid":"5139642915ccb3fca429a36061714972","var_name":"textVar001","var_field_type":"string","var_field_size":10,"var_label":"string","var_dbconnection":"workflow","var_dbconnection_label":"PM Database","var_sql":"","var_null":0,"var_default":"","var_accepted_values":"[]","inp_doc_uid":""}]}]}' @@ -68,16 +68,16 @@ class MySQL57Test extends TestCase */ public function it_should_test_incompatibilities_with_variables() { - $process = factory(Process::class, 2)->create(); + $process = Process::factory(2)->create(); - factory(ProcessVariables::class)->create( + ProcessVariables::factory()->create( [ 'PRJ_UID' => $process[0]['PRO_UID'], 'VAR_SQL' => 'SELECT * FROM USERS WHERE USR_UID="213" UNION SELECT * from PROCESS', ] ); - $variables = factory(ProcessVariables::class)->create( + $variables = ProcessVariables::factory()->create( [ 'PRJ_UID' => $process[1]['PRO_UID'], 'VAR_SQL' => '', @@ -119,8 +119,8 @@ class MySQL57Test extends TestCase */ public function it_should_test_incompatibilities_with_triggers() { - $process = factory(Process::class, 3)->create(); - factory(Triggers::class)->create( + $process = Process::factory(3)->create(); + Triggers::factory()->create( [ 'PRO_UID' => $process[0]['PRO_UID'], 'TRI_WEBBOT' => '$text=222; @@ -147,14 +147,14 @@ class MySQL57Test extends TestCase ] ); - factory(Triggers::class)->create( + Triggers::factory()->create( [ 'PRO_UID' => $process[1]['PRO_UID'], 'TRI_WEBBOT' => 'die();' ] ); - factory(Triggers::class)->create( + Triggers::factory()->create( [ 'PRO_UID' => $process[2]['PRO_UID'], 'TRI_WEBBOT' => 'executeQuery("select * from USERS");' diff --git a/workflow/engine/bin/tasks/cliWorkspaces.php b/workflow/engine/bin/tasks/cliWorkspaces.php index d632bb816..c6e8dd78e 100644 --- a/workflow/engine/bin/tasks/cliWorkspaces.php +++ b/workflow/engine/bin/tasks/cliWorkspaces.php @@ -1431,7 +1431,9 @@ function run_check_queries_incompatibilities($args) function check_queries_incompatibilities($wsName) { Bootstrap::setConstantsRelatedWs($wsName); - require_once(PATH_DB . $wsName . '/db.php'); + if (!defined('DB_ADAPTER')) { + require_once(PATH_DB . $wsName . '/db.php'); + } System::initLaravel(); $query = Process::query()->select('PRO_UID', 'PRO_TITLE'); diff --git a/workflow/engine/classes/PmDynaform.php b/workflow/engine/classes/PmDynaform.php index 07789d721..aeebed6ce 100644 --- a/workflow/engine/classes/PmDynaform.php +++ b/workflow/engine/classes/PmDynaform.php @@ -1596,7 +1596,7 @@ class PmDynaform $this->record["DYN_CONTENT"] = G::json_encode($json); } - private function jsonReplace(&$json, $id, $for = "id", $update) + private function jsonReplace(&$json, $id, $for = "id", $update = null) { foreach ($json as $key => &$value) { $sw1 = is_array($value); diff --git a/workflow/engine/classes/ReportTables.php b/workflow/engine/classes/ReportTables.php index 363e17967..e5099cfc8 100644 --- a/workflow/engine/classes/ReportTables.php +++ b/workflow/engine/classes/ReportTables.php @@ -324,7 +324,7 @@ class ReportTables * @param array $fields * @return string */ - private function buildFieldsSection(string $fieldsSection = "", array $fields): string + private function buildFieldsSection(string $fieldsSection = "", array $fields = []): string { foreach ($fields as $field) { $fieldsSection = $fieldsSection . ", `{$field['sFieldName']}`"; @@ -341,7 +341,7 @@ class ReportTables * @param MySQLiConnection $connection * @return string */ - private function buildValuesSection(string $valuesSection = "", array $fields, array $appData, MySQLiConnection $connection): string + private function buildValuesSection(string $valuesSection = "", array $fields = [], array $appData = [], MySQLiConnection $connection = null): string { foreach ($fields as $field) { switch ($field['sType']) { diff --git a/workflow/engine/classes/SpoolRun.php b/workflow/engine/classes/SpoolRun.php index a5a03a896..c6cfda6dd 100644 --- a/workflow/engine/classes/SpoolRun.php +++ b/workflow/engine/classes/SpoolRun.php @@ -620,9 +620,9 @@ class SpoolRun } $phpMailer->Body = $msBody; //Attachments - $attachment = @unserialize($this->fileData['attachments']); - if ($attachment === false) { - $attachment = $this->fileData['attachments']; + $attachment = $this->fileData['attachments']; + if (is_string($attachment)) { + $attachment = @unserialize($attachment); } if (is_array($attachment)) { foreach ($attachment as $key => $fileAttach) { diff --git a/workflow/engine/classes/WorkspaceTools.php b/workflow/engine/classes/WorkspaceTools.php index 4dbea4a64..9ad5a1a21 100644 --- a/workflow/engine/classes/WorkspaceTools.php +++ b/workflow/engine/classes/WorkspaceTools.php @@ -1779,7 +1779,7 @@ class WorkspaceTools * @param int $versionBackupEngine * @param string $connection */ - public function executeSQLScript($database, $filename, $parameters, $versionBackupEngine = 1, $connection) + public function executeSQLScript($database, $filename, $parameters, $versionBackupEngine = 1, $connection = '') { DB::connection($connection) ->statement('CREATE DATABASE IF NOT EXISTS ' . $database); diff --git a/workflow/engine/classes/model/Users.php b/workflow/engine/classes/model/Users.php index 97617f7a4..32f066452 100644 --- a/workflow/engine/classes/model/Users.php +++ b/workflow/engine/classes/model/Users.php @@ -367,13 +367,13 @@ class Users extends BaseUsers $arrayData["birthday"] = $fields["USR_BIRTHDAY"]; $arrayData["position"] = $fields["USR_POSITION"]; $arrayData["replacedby"] = $fields["USR_REPLACED_BY"]; - if(strlen($arrayData["replacedby"] != 0)) { + if(strlen($arrayData["replacedby"]) != 0) { $oUser = UsersPeer::retrieveByPK($arrayData["replacedby"]); $arrayData["replacedbyfullname"] = $oUser->getUsrFirstname() . ' ' . $oUser->getUsrLastname(); } $arrayData["duedate"] = $fields["USR_DUE_DATE"]; $arrayData["calendar"] = $fields["USR_CALENDAR"]; - if(strlen($fields["USR_CALENDAR"] != 0)) { + if(strlen($fields["USR_CALENDAR"]) != 0) { $arrayData["calendarname"] = $calendar->calendarName($fields["USR_CALENDAR"]); } $arrayData["status"] = $fields["USR_STATUS"]; diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index a2ec5e0ca..59c2399ab 100755 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -4305,6 +4305,10 @@ + + + + diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index 6573beb31..ff5889e50 100644 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -2309,7 +2309,7 @@ CREATE TABLE `PROCESS_VARIABLES` `VAR_LABEL` VARCHAR(255) default '', `VAR_DBCONNECTION` VARCHAR(32), `VAR_SQL` MEDIUMTEXT, - `VAR_NULL` TINYINT(32) default 0, + `VAR_NULL` TINYINT default 0, `VAR_DEFAULT` VARCHAR(32) default '', `VAR_ACCEPTED_VALUES` MEDIUMTEXT, `INP_DOC_UID` VARCHAR(32) default '', @@ -2317,7 +2317,7 @@ CREATE TABLE `PROCESS_VARIABLES` UNIQUE KEY `VAR_ID` (`VAR_ID`), KEY `indexPrjUidVarName`(`PRJ_UID`, `VAR_NAME`), KEY `INDEX_PRO_ID`(`PRO_ID`) -)ENGINE=InnoDB ; +)ENGINE=InnoDB DEFAULT CHARSET='utf8'; #----------------------------------------------------------------------------- #-- APP_TIMEOUT_ACTION_EXECUTED #----------------------------------------------------------------------------- @@ -3321,10 +3321,10 @@ CREATE TABLE `JOBS_PENDING` `id` BIGINT(20) NOT NULL AUTO_INCREMENT, `queue` VARCHAR(255) NOT NULL, `payload` MEDIUMTEXT NOT NULL, - `attempts` TINYINT(3) NOT NULL, - `reserved_at` BIGINT(10), - `available_at` BIGINT(10) NOT NULL, - `created_at` BIGINT(10) NOT NULL, + `attempts` TINYINT NOT NULL, + `reserved_at` BIGINT(20), + `available_at` BIGINT(20) NOT NULL, + `created_at` BIGINT(20) NOT NULL, PRIMARY KEY (`id`), KEY `jobs_queue_index`(`queue`) )ENGINE=InnoDB DEFAULT CHARSET='utf8'; @@ -3366,9 +3366,9 @@ CREATE TABLE `SCHEDULER` `body` VARCHAR(255), `type` VARCHAR(255), `category` VARCHAR(255), - `system` TINYINT(3), + `system` TINYINT, `timezone` VARCHAR(255), - `enable` TINYINT(3), + `enable` TINYINT, `creation_date` DATETIME, `last_update` DATETIME, PRIMARY KEY (`id`) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php index f8d63d494..f479989d5 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php @@ -1970,7 +1970,7 @@ class Cases * @return void * @throws Exception */ - public function setCaseVariables($app_uid, $app_data, $dyn_uid = null, $usr_uid, $del_index = 0) + public function setCaseVariables($app_uid, $app_data, $dyn_uid = null, $usr_uid = '', $del_index = 0) { Validator::isString($app_uid, '$app_uid'); Validator::appUid($app_uid, '$app_uid'); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/AbstractCases.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/AbstractCases.php index 967b241cd..4e9120ef9 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/AbstractCases.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/AbstractCases.php @@ -1644,7 +1644,7 @@ class AbstractCases implements CasesInterface * * @return array */ - public function getCasesRisk($processId, $dateFrom = null, $dateTo = null, $riskStatus = 'ON_TIME', $topCases = null) + public function getCasesRisk($processId = '', $dateFrom = null, $dateTo = null, $riskStatus = 'ON_TIME', $topCases = null) { $date = new DateTime('now'); $currentDate = $date->format('Y-m-d H:i:s'); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/User.php b/workflow/engine/src/ProcessMaker/BusinessModel/User.php index e29da0761..3891a3bb5 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/User.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/User.php @@ -1579,7 +1579,7 @@ class User * @return User * @throws Exception */ - public function checkPermissionForEdit($userUid, $arrayPermission = array(), $form) + public function checkPermissionForEdit($userUid, $arrayPermission = [], $form = []) { try { foreach ($arrayPermission as $key => $value) { diff --git a/workflow/engine/src/ProcessMaker/Core/System.php b/workflow/engine/src/ProcessMaker/Core/System.php index b03f4ce46..ed86b10d7 100644 --- a/workflow/engine/src/ProcessMaker/Core/System.php +++ b/workflow/engine/src/ProcessMaker/Core/System.php @@ -1464,7 +1464,7 @@ class System * * @return array */ - public static function checkPermissionsDbUser($adapter = 'mysql', $serverName, $port = 3306, $userName, $pass, $dbName = '') + public static function checkPermissionsDbUser($adapter = 'mysql', $serverName = '', $port = 3306, $userName = '', $pass = '', $dbName = '') { if (empty($port)) { //setting defaults ports diff --git a/workflow/engine/src/ProcessMaker/Model/AbeConfiguration.php b/workflow/engine/src/ProcessMaker/Model/AbeConfiguration.php index 5c6bf85a7..7103ec91d 100644 --- a/workflow/engine/src/ProcessMaker/Model/AbeConfiguration.php +++ b/workflow/engine/src/ProcessMaker/Model/AbeConfiguration.php @@ -2,11 +2,14 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\DB; class AbeConfiguration extends model { + use HasFactory; + protected $table = "ABE_CONFIGURATION"; // We do not have create/update timestamps for this table public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/AbeRequest.php b/workflow/engine/src/ProcessMaker/Model/AbeRequest.php index e2e98508d..6a2e820ea 100644 --- a/workflow/engine/src/ProcessMaker/Model/AbeRequest.php +++ b/workflow/engine/src/ProcessMaker/Model/AbeRequest.php @@ -2,11 +2,14 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\DB; class AbeRequest extends Model { + use HasFactory; + protected $table = "ABE_REQUESTS"; public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/AdditionalTables.php b/workflow/engine/src/ProcessMaker/Model/AdditionalTables.php index c9e77ab40..c2b8185be 100644 --- a/workflow/engine/src/ProcessMaker/Model/AdditionalTables.php +++ b/workflow/engine/src/ProcessMaker/Model/AdditionalTables.php @@ -2,11 +2,14 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use AdditionalTables as ModelAdditionalTables; use Illuminate\Database\Eloquent\Model; class AdditionalTables extends Model { + use HasFactory; + protected $table = 'ADDITIONAL_TABLES'; public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/AppAssignSelfServiceValue.php b/workflow/engine/src/ProcessMaker/Model/AppAssignSelfServiceValue.php index e6eb6796e..5677519f9 100644 --- a/workflow/engine/src/ProcessMaker/Model/AppAssignSelfServiceValue.php +++ b/workflow/engine/src/ProcessMaker/Model/AppAssignSelfServiceValue.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class AppAssignSelfServiceValue extends Model { + use HasFactory; + protected $table = 'APP_ASSIGN_SELF_SERVICE_VALUE'; protected $primaryKey = 'ID'; // We do not have create/update timestamps for this table diff --git a/workflow/engine/src/ProcessMaker/Model/AppAssignSelfServiceValueGroup.php b/workflow/engine/src/ProcessMaker/Model/AppAssignSelfServiceValueGroup.php index 4b2a0696e..3ca83f02d 100644 --- a/workflow/engine/src/ProcessMaker/Model/AppAssignSelfServiceValueGroup.php +++ b/workflow/engine/src/ProcessMaker/Model/AppAssignSelfServiceValueGroup.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class AppAssignSelfServiceValueGroup extends Model { + use HasFactory; + protected $table = 'APP_ASSIGN_SELF_SERVICE_VALUE_GROUP'; // We do not have create/update timestamps for this table public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/AppDelay.php b/workflow/engine/src/ProcessMaker/Model/AppDelay.php index 20018aaeb..8835eb84f 100644 --- a/workflow/engine/src/ProcessMaker/Model/AppDelay.php +++ b/workflow/engine/src/ProcessMaker/Model/AppDelay.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class AppDelay extends Model { + use HasFactory; + protected $table = 'APP_DELAY'; public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/AppMessage.php b/workflow/engine/src/ProcessMaker/Model/AppMessage.php index 1eef530c4..cf783a48a 100644 --- a/workflow/engine/src/ProcessMaker/Model/AppMessage.php +++ b/workflow/engine/src/ProcessMaker/Model/AppMessage.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class AppMessage extends Model { + use HasFactory; + protected $table = 'APP_MESSAGE'; public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/AppNotes.php b/workflow/engine/src/ProcessMaker/Model/AppNotes.php index 4aaca765f..ef2d43896 100644 --- a/workflow/engine/src/ProcessMaker/Model/AppNotes.php +++ b/workflow/engine/src/ProcessMaker/Model/AppNotes.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class AppNotes extends Model { + use HasFactory; + // Set our table name protected $table = 'APP_NOTES'; // No timestamps diff --git a/workflow/engine/src/ProcessMaker/Model/AppThread.php b/workflow/engine/src/ProcessMaker/Model/AppThread.php index 5762ca151..63027861a 100644 --- a/workflow/engine/src/ProcessMaker/Model/AppThread.php +++ b/workflow/engine/src/ProcessMaker/Model/AppThread.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class AppThread extends Model { + use HasFactory; + protected $table = 'APP_THREAD'; // We do not have create/update timestamps for this table public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/AppTimeoutAction.php b/workflow/engine/src/ProcessMaker/Model/AppTimeoutAction.php index 29e16ab99..34d25309c 100644 --- a/workflow/engine/src/ProcessMaker/Model/AppTimeoutAction.php +++ b/workflow/engine/src/ProcessMaker/Model/AppTimeoutAction.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class AppTimeoutAction extends Model { + use HasFactory; + protected $table = 'APP_TIMEOUT_ACTION_EXECUTED'; // We do not have create/update timestamps for this table public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/Application.php b/workflow/engine/src/ProcessMaker/Model/Application.php index a5a6ef413..c151d37b3 100644 --- a/workflow/engine/src/ProcessMaker/Model/Application.php +++ b/workflow/engine/src/ProcessMaker/Model/Application.php @@ -2,11 +2,14 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\DB; class Application extends Model { + use HasFactory; + protected $table = "APPLICATION"; protected $primaryKey = 'APP_NUMBER'; public $incrementing = false; diff --git a/workflow/engine/src/ProcessMaker/Model/BpmnDiagram.php b/workflow/engine/src/ProcessMaker/Model/BpmnDiagram.php index 08ce8a4c8..e494f697e 100644 --- a/workflow/engine/src/ProcessMaker/Model/BpmnDiagram.php +++ b/workflow/engine/src/ProcessMaker/Model/BpmnDiagram.php @@ -2,11 +2,14 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\DB; class BpmnDiagram extends Model { + use HasFactory; + protected $table = 'BPMN_DIAGRAM'; public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/BpmnEvent.php b/workflow/engine/src/ProcessMaker/Model/BpmnEvent.php index 03c7f670e..fc944cdf6 100644 --- a/workflow/engine/src/ProcessMaker/Model/BpmnEvent.php +++ b/workflow/engine/src/ProcessMaker/Model/BpmnEvent.php @@ -2,11 +2,14 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\DB; class BpmnEvent extends Model { + use HasFactory; + protected $table = 'BPMN_EVENT'; public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/BpmnProcess.php b/workflow/engine/src/ProcessMaker/Model/BpmnProcess.php index 5005f7e94..f5ed83f64 100644 --- a/workflow/engine/src/ProcessMaker/Model/BpmnProcess.php +++ b/workflow/engine/src/ProcessMaker/Model/BpmnProcess.php @@ -2,11 +2,14 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\DB; class BpmnProcess extends Model { + use HasFactory; + protected $table = 'BPMN_PROCESS'; public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/BpmnProject.php b/workflow/engine/src/ProcessMaker/Model/BpmnProject.php index 6779969f5..0d402dbd7 100644 --- a/workflow/engine/src/ProcessMaker/Model/BpmnProject.php +++ b/workflow/engine/src/ProcessMaker/Model/BpmnProject.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class BpmnProject extends Model { + use HasFactory; + // Set our table name protected $table = 'BPMN_PROJECT'; protected $primaryKey = 'PRJ_UID'; diff --git a/workflow/engine/src/ProcessMaker/Model/CaseList.php b/workflow/engine/src/ProcessMaker/Model/CaseList.php index 818311e1c..5d7ea0d7d 100644 --- a/workflow/engine/src/ProcessMaker/Model/CaseList.php +++ b/workflow/engine/src/ProcessMaker/Model/CaseList.php @@ -2,6 +2,7 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Exception; use G; use ProcessMaker\BusinessModel\Table; @@ -13,6 +14,8 @@ use Illuminate\Database\Eloquent\Model; class CaseList extends Model { + use HasFactory; + /** * The table associated with the model. * @var string diff --git a/workflow/engine/src/ProcessMaker/Model/Configuration.php b/workflow/engine/src/ProcessMaker/Model/Configuration.php index cc2244235..9e14a2c88 100644 --- a/workflow/engine/src/ProcessMaker/Model/Configuration.php +++ b/workflow/engine/src/ProcessMaker/Model/Configuration.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Configuration extends Model { + use HasFactory; + // Set our table name protected $table = 'CONFIGURATION'; // Set the PK diff --git a/workflow/engine/src/ProcessMaker/Model/Consolidated.php b/workflow/engine/src/ProcessMaker/Model/Consolidated.php index 21afa7074..7f4a2bf0e 100644 --- a/workflow/engine/src/ProcessMaker/Model/Consolidated.php +++ b/workflow/engine/src/ProcessMaker/Model/Consolidated.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Consolidated extends Model { + use HasFactory; + // Set our table name protected $table = 'CASE_CONSOLIDATED'; // Set the PK diff --git a/workflow/engine/src/ProcessMaker/Model/DbSource.php b/workflow/engine/src/ProcessMaker/Model/DbSource.php index 31e3b8c41..401473762 100644 --- a/workflow/engine/src/ProcessMaker/Model/DbSource.php +++ b/workflow/engine/src/ProcessMaker/Model/DbSource.php @@ -2,6 +2,7 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; /** @@ -12,6 +13,8 @@ use Illuminate\Database\Eloquent\Model; */ class DbSource extends Model { + use HasFactory; + // Set our table name protected $table = 'DB_SOURCE'; // We do not store timestamps diff --git a/workflow/engine/src/ProcessMaker/Model/Delegation.php b/workflow/engine/src/ProcessMaker/Model/Delegation.php index 320ed211e..8badad420 100644 --- a/workflow/engine/src/ProcessMaker/Model/Delegation.php +++ b/workflow/engine/src/ProcessMaker/Model/Delegation.php @@ -2,6 +2,7 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Cases; use DateTime; use G; @@ -13,6 +14,8 @@ use ProcessMaker\Model\Task; class Delegation extends Model { + use HasFactory; + // Class constants const PRIORITIES_MAP = [1 => 'VL', 2 => 'L', 3 => 'N', 4 => 'H', 5 => 'VH']; diff --git a/workflow/engine/src/ProcessMaker/Model/Department.php b/workflow/engine/src/ProcessMaker/Model/Department.php index 3894a6d6a..5ba819b13 100644 --- a/workflow/engine/src/ProcessMaker/Model/Department.php +++ b/workflow/engine/src/ProcessMaker/Model/Department.php @@ -2,6 +2,7 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; /** @@ -10,6 +11,8 @@ use Illuminate\Database\Eloquent\Model; */ class Department extends Model { + use HasFactory; + // Set our table name protected $table = 'DEPARTMENT'; // We do not store timestamps diff --git a/workflow/engine/src/ProcessMaker/Model/Documents.php b/workflow/engine/src/ProcessMaker/Model/Documents.php index 8a42abde3..443d7aab1 100644 --- a/workflow/engine/src/ProcessMaker/Model/Documents.php +++ b/workflow/engine/src/ProcessMaker/Model/Documents.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Documents extends Model { + use HasFactory; + // Set our table name protected $table = 'APP_DOCUMENT'; // No timestamps diff --git a/workflow/engine/src/ProcessMaker/Model/Dynaform.php b/workflow/engine/src/ProcessMaker/Model/Dynaform.php index e7b40a950..a1228ced1 100644 --- a/workflow/engine/src/ProcessMaker/Model/Dynaform.php +++ b/workflow/engine/src/ProcessMaker/Model/Dynaform.php @@ -2,6 +2,7 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\DB; @@ -13,6 +14,8 @@ use Illuminate\Support\Facades\DB; */ class Dynaform extends Model { + use HasFactory; + protected $table = 'DYNAFORM'; protected $primaryKey = "DYN_ID"; public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/ElementTaskRelation.php b/workflow/engine/src/ProcessMaker/Model/ElementTaskRelation.php index 18fc35a26..9557ee1ea 100644 --- a/workflow/engine/src/ProcessMaker/Model/ElementTaskRelation.php +++ b/workflow/engine/src/ProcessMaker/Model/ElementTaskRelation.php @@ -2,11 +2,14 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use G; use Illuminate\Database\Eloquent\Model; class ElementTaskRelation extends Model { + use HasFactory; + protected $table = 'ELEMENT_TASK_RELATION'; protected $primaryKey = 'ETR_UID'; // We do not have create/update timestamps for this table diff --git a/workflow/engine/src/ProcessMaker/Model/EmailEvent.php b/workflow/engine/src/ProcessMaker/Model/EmailEvent.php index e4c34fbe8..665f246e1 100644 --- a/workflow/engine/src/ProcessMaker/Model/EmailEvent.php +++ b/workflow/engine/src/ProcessMaker/Model/EmailEvent.php @@ -2,11 +2,14 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use ProcessMaker\Model\EmailServerModel; class EmailEvent extends Model { + use HasFactory; + protected $table = 'EMAIL_EVENT'; public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/EmailServerModel.php b/workflow/engine/src/ProcessMaker/Model/EmailServerModel.php index ffaa9f705..044d2bc40 100644 --- a/workflow/engine/src/ProcessMaker/Model/EmailServerModel.php +++ b/workflow/engine/src/ProcessMaker/Model/EmailServerModel.php @@ -2,11 +2,14 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\Crypt; class EmailServerModel extends Model { + use HasFactory; + protected $table = 'EMAIL_SERVER'; public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/Fields.php b/workflow/engine/src/ProcessMaker/Model/Fields.php index e5841b8d6..c4ebda1d3 100644 --- a/workflow/engine/src/ProcessMaker/Model/Fields.php +++ b/workflow/engine/src/ProcessMaker/Model/Fields.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Fields extends Model { + use HasFactory; + protected $table = 'FIELDS'; public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/GroupUser.php b/workflow/engine/src/ProcessMaker/Model/GroupUser.php index 313485723..8dec9855f 100644 --- a/workflow/engine/src/ProcessMaker/Model/GroupUser.php +++ b/workflow/engine/src/ProcessMaker/Model/GroupUser.php @@ -2,6 +2,7 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Exception; use G; use Illuminate\Database\Eloquent\Model; @@ -10,6 +11,8 @@ use ProcessMaker\Model\RbacUsers; class GroupUser extends Model { + use HasFactory; + protected $table = 'GROUP_USER'; // We do not have create/update timestamps for this table public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/Groupwf.php b/workflow/engine/src/ProcessMaker/Model/Groupwf.php index 899b90153..4486e8340 100644 --- a/workflow/engine/src/ProcessMaker/Model/Groupwf.php +++ b/workflow/engine/src/ProcessMaker/Model/Groupwf.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Groupwf extends Model { + use HasFactory; + protected $table = 'GROUPWF'; protected $primaryKey = 'GRP_ID'; // We do not have create/update timestamps for this table diff --git a/workflow/engine/src/ProcessMaker/Model/InputDocument.php b/workflow/engine/src/ProcessMaker/Model/InputDocument.php index b7b38f443..fbc630285 100644 --- a/workflow/engine/src/ProcessMaker/Model/InputDocument.php +++ b/workflow/engine/src/ProcessMaker/Model/InputDocument.php @@ -2,6 +2,7 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\DB; @@ -10,6 +11,8 @@ use Illuminate\Support\Facades\DB; */ class InputDocument extends Model { + use HasFactory; + protected $table = 'INPUT_DOCUMENT'; protected $primaryKey = 'INP_DOC_ID'; public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/LicenseManager.php b/workflow/engine/src/ProcessMaker/Model/LicenseManager.php index 3cc3cf362..b9c9a817e 100644 --- a/workflow/engine/src/ProcessMaker/Model/LicenseManager.php +++ b/workflow/engine/src/ProcessMaker/Model/LicenseManager.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class LicenseManager extends Model { + use HasFactory; + protected $table = "LICENSE_MANAGER"; protected $primaryKey = "LICENSE_UID"; public $incrementing = false; diff --git a/workflow/engine/src/ProcessMaker/Model/ListUnassigned.php b/workflow/engine/src/ProcessMaker/Model/ListUnassigned.php index 6444d2d30..6525a7ca0 100644 --- a/workflow/engine/src/ProcessMaker/Model/ListUnassigned.php +++ b/workflow/engine/src/ProcessMaker/Model/ListUnassigned.php @@ -2,6 +2,7 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use ListUnassigned as PropelListUnassigned; @@ -12,6 +13,8 @@ use ListUnassigned as PropelListUnassigned; */ class ListUnassigned extends Model { + use HasFactory; + protected $table = "LIST_UNASSIGNED"; // No timestamps public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/OauthClients.php b/workflow/engine/src/ProcessMaker/Model/OauthClients.php index 9069cf4d4..72b68138c 100644 --- a/workflow/engine/src/ProcessMaker/Model/OauthClients.php +++ b/workflow/engine/src/ProcessMaker/Model/OauthClients.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class OauthClients extends Model { + use HasFactory; + protected $table = "OAUTH_CLIENTS"; protected $primaryKey = "CLIENT_ID"; public $incrementing = false; diff --git a/workflow/engine/src/ProcessMaker/Model/ObjectPermission.php b/workflow/engine/src/ProcessMaker/Model/ObjectPermission.php index 823366ebb..ee408a871 100644 --- a/workflow/engine/src/ProcessMaker/Model/ObjectPermission.php +++ b/workflow/engine/src/ProcessMaker/Model/ObjectPermission.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class ObjectPermission extends Model { + use HasFactory; + protected $table = "OBJECT_PERMISSION"; protected $primaryKey = 'OP_UID'; public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/OutputDocument.php b/workflow/engine/src/ProcessMaker/Model/OutputDocument.php index 7bae462f4..590dcfa4b 100644 --- a/workflow/engine/src/ProcessMaker/Model/OutputDocument.php +++ b/workflow/engine/src/ProcessMaker/Model/OutputDocument.php @@ -2,6 +2,7 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\DB; @@ -10,6 +11,8 @@ use Illuminate\Support\Facades\DB; */ class OutputDocument extends Model { + use HasFactory; + protected $table = 'OUTPUT_DOCUMENT'; protected $primaryKey = 'OUT_DOC_ID'; public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/Process.php b/workflow/engine/src/ProcessMaker/Model/Process.php index 6871071a6..2af46ed48 100644 --- a/workflow/engine/src/ProcessMaker/Model/Process.php +++ b/workflow/engine/src/ProcessMaker/Model/Process.php @@ -2,6 +2,7 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Configurations; use Exception; use G; @@ -10,6 +11,8 @@ use RBAC; class Process extends Model { + use HasFactory; + // Set our table name protected $table = 'PROCESS'; protected $primaryKey = 'PRO_ID'; diff --git a/workflow/engine/src/ProcessMaker/Model/ProcessCategory.php b/workflow/engine/src/ProcessMaker/Model/ProcessCategory.php index f22c7bca4..c7ad8cdda 100644 --- a/workflow/engine/src/ProcessMaker/Model/ProcessCategory.php +++ b/workflow/engine/src/ProcessMaker/Model/ProcessCategory.php @@ -2,6 +2,7 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; /** @@ -12,6 +13,8 @@ use Illuminate\Database\Eloquent\Model; */ class ProcessCategory extends Model { + use HasFactory; + // Set our table name protected $table = 'PROCESS_CATEGORY'; diff --git a/workflow/engine/src/ProcessMaker/Model/ProcessFiles.php b/workflow/engine/src/ProcessMaker/Model/ProcessFiles.php index 5fb77e55e..0ac92575f 100644 --- a/workflow/engine/src/ProcessMaker/Model/ProcessFiles.php +++ b/workflow/engine/src/ProcessMaker/Model/ProcessFiles.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class ProcessFiles extends Model { + use HasFactory; + protected $table = 'PROCESS_FILES'; protected $primaryKey = 'PRF_UID'; public $incrementing = false; diff --git a/workflow/engine/src/ProcessMaker/Model/ProcessUser.php b/workflow/engine/src/ProcessMaker/Model/ProcessUser.php index 59d79b927..78e4c94ae 100644 --- a/workflow/engine/src/ProcessMaker/Model/ProcessUser.php +++ b/workflow/engine/src/ProcessMaker/Model/ProcessUser.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class ProcessUser extends Model { + use HasFactory; + protected $table = 'PROCESS_USER'; protected $primaryKey = 'PU_UID'; // We do not have create/update timestamps for this table diff --git a/workflow/engine/src/ProcessMaker/Model/ProcessVariables.php b/workflow/engine/src/ProcessMaker/Model/ProcessVariables.php index 53cd4d7d2..8c97d7941 100644 --- a/workflow/engine/src/ProcessMaker/Model/ProcessVariables.php +++ b/workflow/engine/src/ProcessMaker/Model/ProcessVariables.php @@ -2,11 +2,14 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\DB; class ProcessVariables extends Model { + use HasFactory; + // Set our table name protected $table = 'PROCESS_VARIABLES'; // No timestamps diff --git a/workflow/engine/src/ProcessMaker/Model/RbacAuthenticationSource.php b/workflow/engine/src/ProcessMaker/Model/RbacAuthenticationSource.php index fc8c64068..af57edf4d 100644 --- a/workflow/engine/src/ProcessMaker/Model/RbacAuthenticationSource.php +++ b/workflow/engine/src/ProcessMaker/Model/RbacAuthenticationSource.php @@ -2,11 +2,14 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\DB; class RbacAuthenticationSource extends Model { + use HasFactory; + protected $table = "RBAC_AUTHENTICATION_SOURCE"; public $incrementing = false; public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/RbacRoles.php b/workflow/engine/src/ProcessMaker/Model/RbacRoles.php index 53cd91d7b..00da73c0b 100644 --- a/workflow/engine/src/ProcessMaker/Model/RbacRoles.php +++ b/workflow/engine/src/ProcessMaker/Model/RbacRoles.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class RbacRoles extends Model { + use HasFactory; + protected $table = 'RBAC_ROLES'; public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/RbacUsers.php b/workflow/engine/src/ProcessMaker/Model/RbacUsers.php index 4a93744a8..7f5756928 100644 --- a/workflow/engine/src/ProcessMaker/Model/RbacUsers.php +++ b/workflow/engine/src/ProcessMaker/Model/RbacUsers.php @@ -2,12 +2,15 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Exception; use Illuminate\Database\Eloquent\Model; use ProcessMaker\Model\RbacUsersRoles; class RbacUsers extends Model { + use HasFactory; + protected $table = 'RBAC_USERS'; public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/RbacUsersRoles.php b/workflow/engine/src/ProcessMaker/Model/RbacUsersRoles.php index 141af77e6..89a1756f1 100644 --- a/workflow/engine/src/ProcessMaker/Model/RbacUsersRoles.php +++ b/workflow/engine/src/ProcessMaker/Model/RbacUsersRoles.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class RbacUsersRoles extends Model { + use HasFactory; + protected $table = 'RBAC_USERS_ROLES'; public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/Route.php b/workflow/engine/src/ProcessMaker/Model/Route.php index 6be408ac0..1eb74c6ee 100644 --- a/workflow/engine/src/ProcessMaker/Model/Route.php +++ b/workflow/engine/src/ProcessMaker/Model/Route.php @@ -2,6 +2,7 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; /** @@ -12,6 +13,8 @@ use Illuminate\Database\Eloquent\Model; */ class Route extends Model { + use HasFactory; + // Set our table name protected $table = 'ROUTE'; diff --git a/workflow/engine/src/ProcessMaker/Model/Step.php b/workflow/engine/src/ProcessMaker/Model/Step.php index cebe88841..c367efd1e 100644 --- a/workflow/engine/src/ProcessMaker/Model/Step.php +++ b/workflow/engine/src/ProcessMaker/Model/Step.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Step extends Model { + use HasFactory; + protected $table = "STEP"; public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/StepTrigger.php b/workflow/engine/src/ProcessMaker/Model/StepTrigger.php index 5285cd179..b2e2501d2 100644 --- a/workflow/engine/src/ProcessMaker/Model/StepTrigger.php +++ b/workflow/engine/src/ProcessMaker/Model/StepTrigger.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class StepTrigger extends Model { + use HasFactory; + protected $table = 'STEP_TRIGGER'; protected $primaryKey = 'STEP_UID'; public $incrementing = false; diff --git a/workflow/engine/src/ProcessMaker/Model/SubApplication.php b/workflow/engine/src/ProcessMaker/Model/SubApplication.php index a50cbf80e..35c8713c1 100644 --- a/workflow/engine/src/ProcessMaker/Model/SubApplication.php +++ b/workflow/engine/src/ProcessMaker/Model/SubApplication.php @@ -2,6 +2,7 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; /** @@ -12,6 +13,8 @@ use Illuminate\Database\Eloquent\Model; */ class SubApplication extends Model { + use HasFactory; + // Set our table name protected $table = 'SUB_APPLICATION'; // No timestamps diff --git a/workflow/engine/src/ProcessMaker/Model/SubProcess.php b/workflow/engine/src/ProcessMaker/Model/SubProcess.php index e7ec2421e..c223781dc 100644 --- a/workflow/engine/src/ProcessMaker/Model/SubProcess.php +++ b/workflow/engine/src/ProcessMaker/Model/SubProcess.php @@ -2,11 +2,14 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use ProcessMaker\Model\Application; class SubProcess extends Model { + use HasFactory; + protected $table = 'SUB_PROCESS'; protected $primaryKey = 'SP_UID'; // We do not have create/update timestamps for this table diff --git a/workflow/engine/src/ProcessMaker/Model/Task.php b/workflow/engine/src/ProcessMaker/Model/Task.php index b554c2661..0abad411c 100644 --- a/workflow/engine/src/ProcessMaker/Model/Task.php +++ b/workflow/engine/src/ProcessMaker/Model/Task.php @@ -2,11 +2,14 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use G; use Illuminate\Database\Eloquent\Model; class Task extends Model { + use HasFactory; + protected $table = 'TASK'; protected $primaryKey = 'TAS_ID'; // We do not have create/update timestamps for this table diff --git a/workflow/engine/src/ProcessMaker/Model/TaskScheduler.php b/workflow/engine/src/ProcessMaker/Model/TaskScheduler.php index 4de504e52..9ed155931 100755 --- a/workflow/engine/src/ProcessMaker/Model/TaskScheduler.php +++ b/workflow/engine/src/ProcessMaker/Model/TaskScheduler.php @@ -2,7 +2,8 @@ namespace ProcessMaker\Model; -use \Illuminate\Database\Eloquent\Model; +use App\Factories\HasFactory; +use Illuminate\Database\Eloquent\Model; /** * Class TaskScheduler @@ -12,6 +13,8 @@ use \Illuminate\Database\Eloquent\Model; */ class TaskScheduler extends Model { + use HasFactory; + protected $table = 'SCHEDULER'; public $timestamps = true; const CREATED_AT = 'creation_date'; diff --git a/workflow/engine/src/ProcessMaker/Model/TaskUser.php b/workflow/engine/src/ProcessMaker/Model/TaskUser.php index d28692c08..d61e967fc 100644 --- a/workflow/engine/src/ProcessMaker/Model/TaskUser.php +++ b/workflow/engine/src/ProcessMaker/Model/TaskUser.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class TaskUser extends Model { + use HasFactory; + protected $table = 'TASK_USER'; public $timestamps = false; diff --git a/workflow/engine/src/ProcessMaker/Model/Translation.php b/workflow/engine/src/ProcessMaker/Model/Translation.php index 6288ee433..f3dd8eeea 100644 --- a/workflow/engine/src/ProcessMaker/Model/Translation.php +++ b/workflow/engine/src/ProcessMaker/Model/Translation.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Translation extends Model { + use HasFactory; + protected $table = 'TRANSLATION'; protected $primaryKey = ['TRN_CATEGORY', 'TRN_ID', 'TRN_LANG']; public $incrementing = false; diff --git a/workflow/engine/src/ProcessMaker/Model/Triggers.php b/workflow/engine/src/ProcessMaker/Model/Triggers.php index 0bc920b27..ed5f5146b 100644 --- a/workflow/engine/src/ProcessMaker/Model/Triggers.php +++ b/workflow/engine/src/ProcessMaker/Model/Triggers.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Triggers extends Model { + use HasFactory; + // Set our table name protected $table = 'TRIGGERS'; // No timestamps diff --git a/workflow/engine/src/ProcessMaker/Model/User.php b/workflow/engine/src/ProcessMaker/Model/User.php index 65aa68684..a83b6a6ef 100644 --- a/workflow/engine/src/ProcessMaker/Model/User.php +++ b/workflow/engine/src/ProcessMaker/Model/User.php @@ -2,6 +2,7 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Configurations; use Illuminate\Database\Eloquent\Model; use Exception; @@ -9,6 +10,8 @@ use RBAC; class User extends Model { + use HasFactory; + protected $table = "USERS"; protected $primaryKey = 'USR_ID'; // Our custom timestamp columns diff --git a/workflow/engine/src/ProcessMaker/Model/UserConfig.php b/workflow/engine/src/ProcessMaker/Model/UserConfig.php index a2ebfd4f9..a3bd539ef 100644 --- a/workflow/engine/src/ProcessMaker/Model/UserConfig.php +++ b/workflow/engine/src/ProcessMaker/Model/UserConfig.php @@ -2,11 +2,14 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use stdClass; class UserConfig extends Model { + use HasFactory; + /** * Bind table. * @var string diff --git a/workflow/engine/src/ProcessMaker/Model/UserExtendedAttributes.php b/workflow/engine/src/ProcessMaker/Model/UserExtendedAttributes.php index 03b1f3995..c4dfa4966 100644 --- a/workflow/engine/src/ProcessMaker/Model/UserExtendedAttributes.php +++ b/workflow/engine/src/ProcessMaker/Model/UserExtendedAttributes.php @@ -2,10 +2,13 @@ namespace ProcessMaker\Model; +use App\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class UserExtendedAttributes extends Model { + use HasFactory; + protected $table = "USER_EXTENDED_ATTRIBUTES"; protected $primaryKey = "UEA_ID"; public $incrementing = true; diff --git a/workflow/engine/src/ProcessMaker/Model/UserReporting.php b/workflow/engine/src/ProcessMaker/Model/UserReporting.php index 1dab3cfd6..cdd8ce33f 100644 --- a/workflow/engine/src/ProcessMaker/Model/UserReporting.php +++ b/workflow/engine/src/ProcessMaker/Model/UserReporting.php @@ -1,13 +1,14 @@