From 0fead8d32bb25b1f40c01108318d70ba52cb6880 Mon Sep 17 00:00:00 2001 From: Lucas Pirola Date: Wed, 22 May 2024 12:53:15 -0300 Subject: [PATCH] =?UTF-8?q?Atualiza=20ambiente=20de=20testes=20unit=C3=A1r?= =?UTF-8?q?ios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yml | 8 +- .gitignore | 7 +- composer.json | 34 +- composer.lock | 1572 ++++++++++++++--- phpunit.xml | 17 + tests/{src => }/api-queries.json | 0 tests/bootstrap.php | 101 ++ tests/config.php | 50 + tests/docker/config.php | 52 - .../files/.gitignore => integration/.gitkeep} | 0 tests/src/ModuleAgendaSingleTest.php | 21 - tests/src/RoutesTest.php | 62 - tests/src/bootstrap.php | 47 - tests/{src => unit}/APITest.php | 71 +- tests/unit/AgendaSingleTest.php | 22 + tests/{src => unit}/AgentTest.php | 56 +- tests/{src => unit}/AuthTest.php | 33 +- .../CreateEntitiesForDoctrineProxyTest.php | 25 +- tests/{src => unit}/DoctrineFunctionTest.php | 35 +- .../EntityTest.php => unit/EntityTests.php} | 33 +- tests/{src => unit}/EventTest.php | 66 +- tests/{src => unit}/FilesTest.php | 10 +- tests/{src => unit}/HooksTest.php | 27 +- .../MetadataTests.php} | 87 +- tests/{src => unit}/PermissionsTest.php | 261 +-- .../ProjectTest.php => unit/ProjectTests.php} | 19 +- tests/unit/RoutesTest.php | 69 + tests/{src => unit}/SealTest.php | 47 +- .../TaxonomiesTests.php} | 89 +- tests/{src => unit}/WorkflowTest.php | 90 +- tests/{src => unit}/classes/TestCase.php | 106 +- .../classes/TestEntity.php} | 11 +- tests/{src => unit}/classes/TestFactory.php | 118 +- tests/unit/files/.gitignore | 0 34 files changed, 2294 insertions(+), 952 deletions(-) create mode 100644 phpunit.xml rename tests/{src => }/api-queries.json (100%) create mode 100644 tests/bootstrap.php create mode 100644 tests/config.php delete mode 100644 tests/docker/config.php rename tests/{src/files/.gitignore => integration/.gitkeep} (100%) delete mode 100644 tests/src/ModuleAgendaSingleTest.php delete mode 100644 tests/src/RoutesTest.php delete mode 100644 tests/src/bootstrap.php rename tests/{src => unit}/APITest.php (79%) create mode 100644 tests/unit/AgendaSingleTest.php rename tests/{src => unit}/AgentTest.php (83%) rename tests/{src => unit}/AuthTest.php (86%) rename tests/{src => unit}/CreateEntitiesForDoctrineProxyTest.php (87%) rename tests/{src => unit}/DoctrineFunctionTest.php (69%) rename tests/{src/EntityTest.php => unit/EntityTests.php} (90%) rename tests/{src => unit}/EventTest.php (87%) rename tests/{src => unit}/FilesTest.php (75%) rename tests/{src => unit}/HooksTest.php (68%) rename tests/{src/MetadataTest.php => unit/MetadataTests.php} (84%) rename tests/{src => unit}/PermissionsTest.php (81%) rename tests/{src/ProjectTest.php => unit/ProjectTests.php} (91%) create mode 100644 tests/unit/RoutesTest.php rename tests/{src => unit}/SealTest.php (81%) rename tests/{src/TaxonomiesTest.php => unit/TaxonomiesTests.php} (79%) rename tests/{src => unit}/WorkflowTest.php (76%) rename tests/{src => unit}/classes/TestCase.php (72%) rename tests/{src/Entity.inc.TestEntities.php => unit/classes/TestEntity.php} (86%) rename tests/{src => unit}/classes/TestFactory.php (76%) create mode 100644 tests/unit/files/.gitignore diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6fa4ab80ac..85e3a39496 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,20 +20,20 @@ jobs: run: | sudo echo "127.0.0.1 db" | sudo tee -a /etc/hosts - - uses: hoverkraft-tech/compose-action@v0.0.0 + - uses: hoverkraft-tech/compose-action@v1.5.1 with: compose-file: "dev/docker-compose.yml" services: "db" up-flags: "-d" down-flags: "-v" + - name: Install composer and dependencies + uses: php-actions/composer@v6 + - name: Run migrations run: | php src/tools/apply-updates.php - - name: Install composer and dependencies - uses: php-actions/composer@v6 - - name: PHPUnit Tests uses: php-actions/phpunit@v3 env: diff --git a/.gitignore b/.gitignore index d2f64a715e..0288c2aa9d 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,9 @@ src/themes/BaseV1/assets/css/main.css.map .idea .phpunit.result.cache .php-cs-fixer.cache -docker-data \ No newline at end of file +public/assets/ +docker-data/ +src/.phpdoc +.phpunit* +.phpdocs* +.env diff --git a/composer.json b/composer.json index 86c87b46bb..5e75a0eb65 100644 --- a/composer.json +++ b/composer.json @@ -1,23 +1,40 @@ { + "name": "mapasculturais/mapasculturais", + "version": "7.3.45", + "description": " Mapas Culturais é uma plataforma colaborativa que reúne informações sobre agentes, espaços, eventos e projetos culturais, fornecendo ao poder público uma radiografia da área de cultura e ao cidadão um mapa de espaços e eventos culturais da região", + "keywords": ["php", "docker", "gis", "postgres"], + "type": "project", + "license": "AGPL", + "require-dev": { + "phpunit/phpunit": "^10.5", + "squizlabs/php_codesniffer": "3.*", + "vimeo/psalm": "^5.17", + "zircote/swagger-php": "^4.8" + }, "require": { - "acelaya/doctrine-enum-type": "^2.3", + "php": "^7.3 || ^8", + "acelaya/doctrine-enum-type": "^2.5", "akrabat/ip-address-middleware": "^2.1", + "creof/doctrine2-spatial": "^1", "doctrine/annotations": "^2.0", "doctrine/dbal": "^3.6", "doctrine/orm": "2.16.*", "firebase/php-jwt": "^6.4", + "league/csv": "^9.6.2", "michelf/php-markdown": "1.*", "monolog/monolog": "^3.4", "mustache/mustache": "^2.11", + "nyholm/psr7": "^1.4", + "opauth/authentik": "*", + "opauth/logincidadao": "*", "opauth/openid": "*", - "opauth/logincidadao" : "*", - "opauth/authentik" : "*", + "php-curl-class/php-curl-class": "^9.18", "pomo/pomo": "^1.5", "psy/psysh": "^0.11.12", "respect/validation": "^2.2", "sinergi/browser-detector": "^6.1", "slim/psr7": "^1.6", - "slim/slim": "4.*", + "slim/slim": "^4.0", "smottt/wideimage": "*", "symfony/amazon-mailer": "^6.3", "symfony/cache": "^6.2", @@ -29,17 +46,24 @@ "league/csv": "^9.6.2", "symfony/http-foundation": "^7.0", "symfony/routing": "^7.0", - "symfony/console": "^6.4.6" + "symfony/console": "^6.4.6", + "league/csv": "^9.6.2" }, "autoload": { "psr-4": { "App\\": "app/src", "App\\Tests\\": "app/tests", + "MapasCulturaisTests\\": "tests/unit/classes", "MapasCulturais\\": "src/core", "MapasCulturais\\Modules\\": "src/modules", "MapasCulturais\\Themes\\": "src/themes" } }, + "config": { + "preferred-install": "dist", + "sort-packages": true, + "optimize-autoloader": true + }, "repositories": [ { "type": "git", diff --git a/composer.lock b/composer.lock index 2d1b55ac80..51019c3f2f 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": "c34f100b2b05e14e25d227d14ebd32fb", + "content-hash": "f6895b0eff83172b7e2daf5a3c59af49", "packages": [ { "name": "acelaya/doctrine-enum-type", @@ -199,16 +199,16 @@ }, { "name": "async-aws/ses", - "version": "1.7.0", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/async-aws/ses.git", - "reference": "3aed25813b21aeab96a60a658edf1e23531d2011" + "reference": "9bf4873210cfc8b86e4abb18d1d707f9ae247ace" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/async-aws/ses/zipball/3aed25813b21aeab96a60a658edf1e23531d2011", - "reference": "3aed25813b21aeab96a60a658edf1e23531d2011", + "url": "https://api.github.com/repos/async-aws/ses/zipball/9bf4873210cfc8b86e4abb18d1d707f9ae247ace", + "reference": "9bf4873210cfc8b86e4abb18d1d707f9ae247ace", "shasum": "" }, "require": { @@ -219,7 +219,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7-dev" + "dev-master": "1.8-dev" } }, "autoload": { @@ -240,7 +240,7 @@ "ses" ], "support": { - "source": "https://github.com/async-aws/ses/tree/1.7.0" + "source": "https://github.com/async-aws/ses/tree/1.8.0" }, "funding": [ { @@ -252,7 +252,238 @@ "type": "github" } ], - "time": "2023-12-13T20:52:19+00:00" + "time": "2024-05-14T07:34:42+00:00" + }, + { + "name": "creof/doctrine2-spatial", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/creof/doctrine2-spatial.git", + "reference": "58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/creof/doctrine2-spatial/zipball/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd", + "reference": "58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd", + "shasum": "" + }, + "require": { + "creof/geo-parser": "~2.0", + "creof/wkb-parser": "~2.0", + "creof/wkt-parser": "~2.0", + "doctrine/orm": ">=2.3" + }, + "require-dev": { + "phpunit/phpcov": "*", + "phpunit/phpunit": "<5.0", + "satooshi/php-coveralls": "~1.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "CrEOF\\Spatial": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Derek Lambert", + "email": "dlambert@dereklambert.com" + } + ], + "description": "Doctrine2 multi-platform support for spatial types and functions", + "keywords": [ + "database", + "dbal", + "geography", + "geometry", + "gis", + "mysql", + "opengis", + "orm", + "postgis", + "postgresql", + "spatial" + ], + "support": { + "issues": "https://github.com/creof/doctrine2-spatial/issues", + "source": "https://github.com/creof/doctrine2-spatial/tree/master" + }, + "time": "2017-07-13T16:48:25+00:00" + }, + { + "name": "creof/geo-parser", + "version": "2.2.1", + "source": { + "type": "git", + "url": "https://github.com/creof/geo-parser.git", + "reference": "b55553a54c7775576c9ee629847973d0b6d7cbed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/creof/geo-parser/zipball/b55553a54c7775576c9ee629847973d0b6d7cbed", + "reference": "b55553a54c7775576c9ee629847973d0b6d7cbed", + "shasum": "" + }, + "require": { + "doctrine/lexer": ">=1.0", + "ext-spl": "*", + "php": ">=7.1" + }, + "require-dev": { + "codeclimate/php-test-reporter": "dev-master", + "phpunit/phpunit": "~5.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "CrEOF\\Geo\\String": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Derek J. Lambert", + "email": "dlambert@dereklambert.com" + } + ], + "description": "Parser for geography coordinate strings", + "keywords": [ + "coordinate", + "geo", + "geography", + "geometry", + "lexer", + "parser", + "spatial", + "string", + "text" + ], + "support": { + "issues": "https://github.com/creof/geo-parser/issues", + "source": "https://github.com/creof/geo-parser/tree/master" + }, + "time": "2019-08-07T17:45:01+00:00" + }, + { + "name": "creof/wkb-parser", + "version": "v2.4", + "source": { + "type": "git", + "url": "https://github.com/creof/wkb-parser.git", + "reference": "97ac770f241adce3c46e3feb96e0e092531c833d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/creof/wkb-parser/zipball/97ac770f241adce3c46e3feb96e0e092531c833d", + "reference": "97ac770f241adce3c46e3feb96e0e092531c833d", + "shasum": "" + }, + "require": { + "ext-spl": "*", + "php": ">=5.3.3" + }, + "require-dev": { + "codeclimate/php-test-reporter": "dev-master", + "phpunit/phpunit": ">=4.8", + "satooshi/php-coveralls": "~1.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "CrEOF\\Geo\\WKB": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Derek J. Lambert", + "email": "dlambert@dereklambert.com" + } + ], + "description": "Parser for well-known binary (WKB/EWKB) object data", + "keywords": [ + "ewkb", + "geography", + "geometry", + "parser", + "spatial", + "string", + "text", + "wkb" + ], + "support": { + "issues": "https://github.com/creof/wkb-parser/issues", + "source": "https://github.com/creof/wkb-parser/tree/v2.4" + }, + "time": "2022-02-15T22:46:31+00:00" + }, + { + "name": "creof/wkt-parser", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/creof/wkt-parser.git", + "reference": "307a3fdc0b705c7b59b47751a7f7e8e45f98d11e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/creof/wkt-parser/zipball/307a3fdc0b705c7b59b47751a7f7e8e45f98d11e", + "reference": "307a3fdc0b705c7b59b47751a7f7e8e45f98d11e", + "shasum": "" + }, + "require": { + "doctrine/lexer": ">=1.0", + "ext-spl": "*", + "php": ">=5.3.3" + }, + "require-dev": { + "codeclimate/php-test-reporter": "dev-master", + "phpunit/phpunit": ">=4.8" + }, + "type": "library", + "autoload": { + "psr-0": { + "CrEOF\\Geo\\WKT": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Derek J. Lambert", + "email": "dlambert@dereklambert.com" + } + ], + "description": "Parser for well-known text (WKT) object strings", + "keywords": [ + "ewkt", + "geography", + "geometry", + "lexer", + "parser", + "spatial", + "string", + "text", + "wkt" + ], + "support": { + "issues": "https://github.com/creof/wkt-parser/issues", + "source": "https://github.com/creof/wkt-parser/tree/master" + }, + "time": "2015-11-18T21:20:29+00:00" }, { "name": "doctrine/annotations", @@ -602,16 +833,16 @@ }, { "name": "doctrine/dbal", - "version": "3.8.3", + "version": "3.8.4", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "db922ba9436b7b18a23d1653a0b41ff2369ca41c" + "reference": "b05e48a745f722801f55408d0dbd8003b403dbbd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/db922ba9436b7b18a23d1653a0b41ff2369ca41c", - "reference": "db922ba9436b7b18a23d1653a0b41ff2369ca41c", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/b05e48a745f722801f55408d0dbd8003b403dbbd", + "reference": "b05e48a745f722801f55408d0dbd8003b403dbbd", "shasum": "" }, "require": { @@ -695,7 +926,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.8.3" + "source": "https://github.com/doctrine/dbal/tree/3.8.4" }, "funding": [ { @@ -711,7 +942,7 @@ "type": "tidelift" } ], - "time": "2024-03-03T15:55:06+00:00" + "time": "2024-04-25T07:04:44+00:00" }, { "name": "doctrine/deprecations", @@ -762,16 +993,16 @@ }, { "name": "doctrine/event-manager", - "version": "2.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/doctrine/event-manager.git", - "reference": "750671534e0241a7c50ea5b43f67e23eb5c96f32" + "reference": "b680156fa328f1dfd874fd48c7026c41570b9c6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/event-manager/zipball/750671534e0241a7c50ea5b43f67e23eb5c96f32", - "reference": "750671534e0241a7c50ea5b43f67e23eb5c96f32", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/b680156fa328f1dfd874fd48c7026c41570b9c6e", + "reference": "b680156fa328f1dfd874fd48c7026c41570b9c6e", "shasum": "" }, "require": { @@ -781,10 +1012,10 @@ "doctrine/common": "<2.9" }, "require-dev": { - "doctrine/coding-standard": "^10", + "doctrine/coding-standard": "^12", "phpstan/phpstan": "^1.8.8", - "phpunit/phpunit": "^9.5", - "vimeo/psalm": "^4.28" + "phpunit/phpunit": "^10.5", + "vimeo/psalm": "^5.24" }, "type": "library", "autoload": { @@ -833,7 +1064,7 @@ ], "support": { "issues": "https://github.com/doctrine/event-manager/issues", - "source": "https://github.com/doctrine/event-manager/tree/2.0.0" + "source": "https://github.com/doctrine/event-manager/tree/2.0.1" }, "funding": [ { @@ -849,7 +1080,7 @@ "type": "tidelift" } ], - "time": "2022-10-12T20:59:15+00:00" + "time": "2024-05-22T20:47:39+00:00" }, { "name": "doctrine/inflector", @@ -1414,26 +1645,26 @@ }, { "name": "firebase/php-jwt", - "version": "v6.10.0", + "version": "v6.10.1", "source": { "type": "git", "url": "https://github.com/firebase/php-jwt.git", - "reference": "a49db6f0a5033aef5143295342f1c95521b075ff" + "reference": "500501c2ce893c824c801da135d02661199f60c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/firebase/php-jwt/zipball/a49db6f0a5033aef5143295342f1c95521b075ff", - "reference": "a49db6f0a5033aef5143295342f1c95521b075ff", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/500501c2ce893c824c801da135d02661199f60c5", + "reference": "500501c2ce893c824c801da135d02661199f60c5", "shasum": "" }, "require": { - "php": "^7.4||^8.0" + "php": "^8.0" }, "require-dev": { - "guzzlehttp/guzzle": "^6.5||^7.4", + "guzzlehttp/guzzle": "^7.4", "phpspec/prophecy-phpunit": "^2.0", "phpunit/phpunit": "^9.5", - "psr/cache": "^1.0||^2.0", + "psr/cache": "^2.0||^3.0", "psr/http-client": "^1.0", "psr/http-factory": "^1.0" }, @@ -1471,9 +1702,9 @@ ], "support": { "issues": "https://github.com/firebase/php-jwt/issues", - "source": "https://github.com/firebase/php-jwt/tree/v6.10.0" + "source": "https://github.com/firebase/php-jwt/tree/v6.10.1" }, - "time": "2023-12-01T16:26:39+00:00" + "time": "2024-05-18T18:05:11+00:00" }, { "name": "league/csv", @@ -1937,6 +2168,84 @@ }, "time": "2024-03-17T08:10:35+00:00" }, + { + "name": "nyholm/psr7", + "version": "1.8.1", + "source": { + "type": "git", + "url": "https://github.com/Nyholm/psr7.git", + "reference": "aa5fc277a4f5508013d571341ade0c3886d4d00e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Nyholm/psr7/zipball/aa5fc277a4f5508013d571341ade0c3886d4d00e", + "reference": "aa5fc277a4f5508013d571341ade0c3886d4d00e", + "shasum": "" + }, + "require": { + "php": ">=7.2", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 || ^2.0" + }, + "provide": { + "php-http/message-factory-implementation": "1.0", + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "http-interop/http-factory-tests": "^0.9", + "php-http/message-factory": "^1.0", + "php-http/psr7-integration-tests": "^1.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.4", + "symfony/error-handler": "^4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8-dev" + } + }, + "autoload": { + "psr-4": { + "Nyholm\\Psr7\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com" + }, + { + "name": "Martijn van der Ven", + "email": "martijn@vanderven.se" + } + ], + "description": "A fast PHP7 implementation of PSR-7", + "homepage": "https://tnyholm.se", + "keywords": [ + "psr-17", + "psr-7" + ], + "support": { + "issues": "https://github.com/Nyholm/psr7/issues", + "source": "https://github.com/Nyholm/psr7/tree/1.8.1" + }, + "funding": [ + { + "url": "https://github.com/Zegnat", + "type": "github" + }, + { + "url": "https://github.com/nyholm", + "type": "github" + } + ], + "time": "2023-11-13T09:31:12+00:00" + }, { "name": "opauth/authentik", "version": "v1.0.0", @@ -2107,6 +2416,86 @@ }, "time": "2012-06-08T07:00:03+00:00" }, + { + "name": "php-curl-class/php-curl-class", + "version": "9.19.2", + "source": { + "type": "git", + "url": "https://github.com/php-curl-class/php-curl-class.git", + "reference": "c41efeb4ea2dc3cf8f90f8f967b0fcf45a41e294" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-curl-class/php-curl-class/zipball/c41efeb4ea2dc3cf8f90f8f967b0fcf45a41e294", + "reference": "c41efeb4ea2dc3cf8f90f8f967b0fcf45a41e294", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "php": ">=7.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "*", + "ext-gd": "*", + "friendsofphp/php-cs-fixer": "*", + "phpcompatibility/php-compatibility": "dev-develop", + "phpcsstandards/phpcsutils": "@alpha", + "phpunit/phpunit": "*", + "squizlabs/php_codesniffer": "*", + "vimeo/psalm": ">=0.3.63" + }, + "suggest": { + "ext-mbstring": "*" + }, + "type": "library", + "autoload": { + "psr-4": { + "Curl\\": "src/Curl/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Unlicense" + ], + "authors": [ + { + "name": "Zach Borboa" + }, + { + "name": "Contributors", + "homepage": "https://github.com/php-curl-class/php-curl-class/graphs/contributors" + } + ], + "description": "PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs.", + "homepage": "https://github.com/php-curl-class/php-curl-class", + "keywords": [ + "API-Client", + "api", + "class", + "client", + "curl", + "framework", + "http", + "http-client", + "http-proxy", + "json", + "php", + "php-curl", + "php-curl-library", + "proxy", + "requests", + "restful", + "web-scraper", + "web-scraping ", + "web-service", + "xml" + ], + "support": { + "issues": "https://github.com/php-curl-class/php-curl-class/issues", + "source": "https://github.com/php-curl-class/php-curl-class/tree/9.19.2" + }, + "time": "2024-04-09T18:03:13+00:00" + }, { "name": "pomo/pomo", "version": "v1.5.0", @@ -2329,20 +2718,20 @@ }, { "name": "psr/http-factory", - "version": "1.0.2", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-factory.git", - "reference": "e616d01114759c4c489f93b099585439f795fe35" + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", - "reference": "e616d01114759c4c489f93b099585439f795fe35", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", "shasum": "" }, "require": { - "php": ">=7.0.0", + "php": ">=7.1", "psr/http-message": "^1.0 || ^2.0" }, "type": "library", @@ -2366,7 +2755,7 @@ "homepage": "https://www.php-fig.org/" } ], - "description": "Common interfaces for PSR-7 HTTP message factories", + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", "keywords": [ "factory", "http", @@ -2378,9 +2767,9 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-factory/tree/1.0.2" + "source": "https://github.com/php-fig/http-factory" }, - "time": "2023-04-10T20:10:41+00:00" + "time": "2024-04-15T12:06:14+00:00" }, { "name": "psr/http-message", @@ -3136,16 +3525,16 @@ }, { "name": "symfony/amazon-mailer", - "version": "v6.4.3", + "version": "v6.4.7", "source": { "type": "git", "url": "https://github.com/symfony/amazon-mailer.git", - "reference": "0c9294b1cf610a6dd77b6ce6475bd76e1529b788" + "reference": "e750b42f6c08e5b9e9264ad6d65225a59bb0c6c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/amazon-mailer/zipball/0c9294b1cf610a6dd77b6ce6475bd76e1529b788", - "reference": "0c9294b1cf610a6dd77b6ce6475bd76e1529b788", + "url": "https://api.github.com/repos/symfony/amazon-mailer/zipball/e750b42f6c08e5b9e9264ad6d65225a59bb0c6c7", + "reference": "e750b42f6c08e5b9e9264ad6d65225a59bb0c6c7", "shasum": "" }, "require": { @@ -3182,7 +3571,7 @@ "description": "Symfony Amazon Mailer Bridge", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/amazon-mailer/tree/v6.4.3" + "source": "https://github.com/symfony/amazon-mailer/tree/v6.4.7" }, "funding": [ { @@ -3198,20 +3587,20 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:51:35+00:00" + "time": "2024-04-18T09:22:46+00:00" }, { "name": "symfony/cache", - "version": "v6.4.6", + "version": "v6.4.7", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "b59bbf9c093b592d77110f9ee70c74dff89294cb" + "reference": "b9e9b93c9817ec6c789c7943f5e54b57a041c16a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/b59bbf9c093b592d77110f9ee70c74dff89294cb", - "reference": "b59bbf9c093b592d77110f9ee70c74dff89294cb", + "url": "https://api.github.com/repos/symfony/cache/zipball/b9e9b93c9817ec6c789c7943f5e54b57a041c16a", + "reference": "b9e9b93c9817ec6c789c7943f5e54b57a041c16a", "shasum": "" }, "require": { @@ -3278,7 +3667,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v6.4.6" + "source": "https://github.com/symfony/cache/tree/v6.4.7" }, "funding": [ { @@ -3294,20 +3683,20 @@ "type": "tidelift" } ], - "time": "2024-03-27T13:27:42+00:00" + "time": "2024-04-18T09:22:46+00:00" }, { "name": "symfony/cache-contracts", - "version": "v3.4.2", + "version": "v3.5.0", "source": { "type": "git", "url": "https://github.com/symfony/cache-contracts.git", - "reference": "2c9db6509a1b21dad229606897639d3284f54b2a" + "reference": "df6a1a44c890faded49a5fca33c2d5c5fd3c2197" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/2c9db6509a1b21dad229606897639d3284f54b2a", - "reference": "2c9db6509a1b21dad229606897639d3284f54b2a", + "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/df6a1a44c890faded49a5fca33c2d5c5fd3c2197", + "reference": "df6a1a44c890faded49a5fca33c2d5c5fd3c2197", "shasum": "" }, "require": { @@ -3317,7 +3706,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.4-dev" + "dev-main": "3.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -3354,7 +3743,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/cache-contracts/tree/v3.4.2" + "source": "https://github.com/symfony/cache-contracts/tree/v3.5.0" }, "funding": [ { @@ -3370,20 +3759,20 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:51:35+00:00" + "time": "2024-04-18T09:32:20+00:00" }, { "name": "symfony/console", - "version": "v6.4.6", + "version": "v6.4.7", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "a2708a5da5c87d1d0d52937bdeac625df659e11f" + "reference": "a170e64ae10d00ba89e2acbb590dc2e54da8ad8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a2708a5da5c87d1d0d52937bdeac625df659e11f", - "reference": "a2708a5da5c87d1d0d52937bdeac625df659e11f", + "url": "https://api.github.com/repos/symfony/console/zipball/a170e64ae10d00ba89e2acbb590dc2e54da8ad8f", + "reference": "a170e64ae10d00ba89e2acbb590dc2e54da8ad8f", "shasum": "" }, "require": { @@ -3448,7 +3837,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.6" + "source": "https://github.com/symfony/console/tree/v6.4.7" }, "funding": [ { @@ -3464,20 +3853,20 @@ "type": "tidelift" } ], - "time": "2024-03-29T19:07:53+00:00" + "time": "2024-04-18T09:22:46+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.4.0", + "version": "v3.5.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", - "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", "shasum": "" }, "require": { @@ -3486,7 +3875,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.4-dev" + "dev-main": "3.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -3515,7 +3904,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.4.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0" }, "funding": [ { @@ -3531,20 +3920,20 @@ "type": "tidelift" } ], - "time": "2023-05-23T14:45:45+00:00" + "time": "2024-04-18T09:32:20+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v7.0.3", + "version": "v7.0.7", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "834c28d533dd0636f910909d01b9ff45cc094b5e" + "reference": "db2a7fab994d67d92356bb39c367db115d9d30f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/834c28d533dd0636f910909d01b9ff45cc094b5e", - "reference": "834c28d533dd0636f910909d01b9ff45cc094b5e", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/db2a7fab994d67d92356bb39c367db115d9d30f9", + "reference": "db2a7fab994d67d92356bb39c367db115d9d30f9", "shasum": "" }, "require": { @@ -3595,7 +3984,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/v7.0.3" + "source": "https://github.com/symfony/event-dispatcher/tree/v7.0.7" }, "funding": [ { @@ -3611,20 +4000,20 @@ "type": "tidelift" } ], - "time": "2024-01-23T15:02:46+00:00" + "time": "2024-04-18T09:29:19+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v3.4.2", + "version": "v3.5.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "4e64b49bf370ade88e567de29465762e316e4224" + "reference": "8f93aec25d41b72493c6ddff14e916177c9efc50" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/4e64b49bf370ade88e567de29465762e316e4224", - "reference": "4e64b49bf370ade88e567de29465762e316e4224", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/8f93aec25d41b72493c6ddff14e916177c9efc50", + "reference": "8f93aec25d41b72493c6ddff14e916177c9efc50", "shasum": "" }, "require": { @@ -3634,7 +4023,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.4-dev" + "dev-main": "3.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -3671,7 +4060,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.4.2" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.5.0" }, "funding": [ { @@ -3687,20 +4076,20 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:51:35+00:00" + "time": "2024-04-18T09:32:20+00:00" }, { "name": "symfony/http-client", - "version": "v7.0.6", + "version": "v7.0.7", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "6e70473909f46fe5dd3b994a0f1b20ecb6b2f858" + "reference": "6ce3c4c899051b3d7326ea1a1dda3729e29ae6d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/6e70473909f46fe5dd3b994a0f1b20ecb6b2f858", - "reference": "6e70473909f46fe5dd3b994a0f1b20ecb6b2f858", + "url": "https://api.github.com/repos/symfony/http-client/zipball/6ce3c4c899051b3d7326ea1a1dda3729e29ae6d7", + "reference": "6ce3c4c899051b3d7326ea1a1dda3729e29ae6d7", "shasum": "" }, "require": { @@ -3763,7 +4152,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v7.0.6" + "source": "https://github.com/symfony/http-client/tree/v7.0.7" }, "funding": [ { @@ -3779,20 +4168,20 @@ "type": "tidelift" } ], - "time": "2024-04-01T20:49:44+00:00" + "time": "2024-04-18T09:29:19+00:00" }, { "name": "symfony/http-client-contracts", - "version": "v3.4.2", + "version": "v3.5.0", "source": { "type": "git", "url": "https://github.com/symfony/http-client-contracts.git", - "reference": "b6b5c876b3a4ed74460e2c5ac53bbce2f12e2a7e" + "reference": "20414d96f391677bf80078aa55baece78b82647d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/b6b5c876b3a4ed74460e2c5ac53bbce2f12e2a7e", - "reference": "b6b5c876b3a4ed74460e2c5ac53bbce2f12e2a7e", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/20414d96f391677bf80078aa55baece78b82647d", + "reference": "20414d96f391677bf80078aa55baece78b82647d", "shasum": "" }, "require": { @@ -3801,7 +4190,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.4-dev" + "dev-main": "3.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -3841,7 +4230,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/http-client-contracts/tree/v3.4.2" + "source": "https://github.com/symfony/http-client-contracts/tree/v3.5.0" }, "funding": [ { @@ -3857,20 +4246,20 @@ "type": "tidelift" } ], - "time": "2024-04-01T18:51:09+00:00" + "time": "2024-04-18T09:32:20+00:00" }, { "name": "symfony/http-foundation", - "version": "v7.0.6", + "version": "v7.0.7", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "8789625dcf36e5fbf753014678a1e090f1bc759c" + "reference": "0194e064b8bdc29381462f790bab04e1cac8fdc8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/8789625dcf36e5fbf753014678a1e090f1bc759c", - "reference": "8789625dcf36e5fbf753014678a1e090f1bc759c", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/0194e064b8bdc29381462f790bab04e1cac8fdc8", + "reference": "0194e064b8bdc29381462f790bab04e1cac8fdc8", "shasum": "" }, "require": { @@ -3918,7 +4307,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v7.0.6" + "source": "https://github.com/symfony/http-foundation/tree/v7.0.7" }, "funding": [ { @@ -3934,20 +4323,20 @@ "type": "tidelift" } ], - "time": "2024-03-19T11:46:48+00:00" + "time": "2024-04-18T09:29:19+00:00" }, { "name": "symfony/mailchimp-mailer", - "version": "v6.4.3", + "version": "v6.4.7", "source": { "type": "git", "url": "https://github.com/symfony/mailchimp-mailer.git", - "reference": "8fcbf792a553cdb6d246111a0826ba9ef75fafdf" + "reference": "e59de564673708ee9b029d714ec37f93fefb125e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mailchimp-mailer/zipball/8fcbf792a553cdb6d246111a0826ba9ef75fafdf", - "reference": "8fcbf792a553cdb6d246111a0826ba9ef75fafdf", + "url": "https://api.github.com/repos/symfony/mailchimp-mailer/zipball/e59de564673708ee9b029d714ec37f93fefb125e", + "reference": "e59de564673708ee9b029d714ec37f93fefb125e", "shasum": "" }, "require": { @@ -3983,7 +4372,7 @@ "description": "Symfony Mailchimp Mailer Bridge", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailchimp-mailer/tree/v6.4.3" + "source": "https://github.com/symfony/mailchimp-mailer/tree/v6.4.7" }, "funding": [ { @@ -3999,20 +4388,20 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:51:35+00:00" + "time": "2024-04-18T09:22:46+00:00" }, { "name": "symfony/mailer", - "version": "v6.4.6", + "version": "v6.4.7", "source": { "type": "git", "url": "https://github.com/symfony/mailer.git", - "reference": "677f34a6f4b4559e08acf73ae0aec460479e5859" + "reference": "2c446d4e446995bed983c0b5bb9ff837e8de7dbd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mailer/zipball/677f34a6f4b4559e08acf73ae0aec460479e5859", - "reference": "677f34a6f4b4559e08acf73ae0aec460479e5859", + "url": "https://api.github.com/repos/symfony/mailer/zipball/2c446d4e446995bed983c0b5bb9ff837e8de7dbd", + "reference": "2c446d4e446995bed983c0b5bb9ff837e8de7dbd", "shasum": "" }, "require": { @@ -4063,7 +4452,7 @@ "description": "Helps sending emails", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailer/tree/v6.4.6" + "source": "https://github.com/symfony/mailer/tree/v6.4.7" }, "funding": [ { @@ -4079,20 +4468,20 @@ "type": "tidelift" } ], - "time": "2024-03-27T21:14:17+00:00" + "time": "2024-04-18T09:22:46+00:00" }, { "name": "symfony/mailgun-mailer", - "version": "v6.4.4", + "version": "v6.4.7", "source": { "type": "git", "url": "https://github.com/symfony/mailgun-mailer.git", - "reference": "8c018872b40ce050590b6d18cf741db0c8313435" + "reference": "044eede71c3eb5fbe7192042b8c0d04987b5653d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mailgun-mailer/zipball/8c018872b40ce050590b6d18cf741db0c8313435", - "reference": "8c018872b40ce050590b6d18cf741db0c8313435", + "url": "https://api.github.com/repos/symfony/mailgun-mailer/zipball/044eede71c3eb5fbe7192042b8c0d04987b5653d", + "reference": "044eede71c3eb5fbe7192042b8c0d04987b5653d", "shasum": "" }, "require": { @@ -4132,7 +4521,7 @@ "description": "Symfony Mailgun Mailer Bridge", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailgun-mailer/tree/v6.4.4" + "source": "https://github.com/symfony/mailgun-mailer/tree/v6.4.7" }, "funding": [ { @@ -4148,20 +4537,20 @@ "type": "tidelift" } ], - "time": "2024-02-14T06:31:46+00:00" + "time": "2024-04-18T09:22:46+00:00" }, { "name": "symfony/mime", - "version": "v6.4.6", + "version": "v6.4.7", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "14762b86918823cb42e3558cdcca62e58b5227fe" + "reference": "decadcf3865918ecfcbfa90968553994ce935a5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/14762b86918823cb42e3558cdcca62e58b5227fe", - "reference": "14762b86918823cb42e3558cdcca62e58b5227fe", + "url": "https://api.github.com/repos/symfony/mime/zipball/decadcf3865918ecfcbfa90968553994ce935a5e", + "reference": "decadcf3865918ecfcbfa90968553994ce935a5e", "shasum": "" }, "require": { @@ -4217,7 +4606,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v6.4.6" + "source": "https://github.com/symfony/mime/tree/v6.4.7" }, "funding": [ { @@ -4233,7 +4622,7 @@ "type": "tidelift" } ], - "time": "2024-03-21T19:36:20+00:00" + "time": "2024-04-18T09:22:46+00:00" }, { "name": "symfony/polyfill-ctype", @@ -4869,16 +5258,16 @@ }, { "name": "symfony/routing", - "version": "v7.0.6", + "version": "v7.0.7", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "cded64e5bbf9f31786f1055fcc76718fdd77519c" + "reference": "9f82bf7766ccc9c22ab7aeb9bebb98351483fa5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/cded64e5bbf9f31786f1055fcc76718fdd77519c", - "reference": "cded64e5bbf9f31786f1055fcc76718fdd77519c", + "url": "https://api.github.com/repos/symfony/routing/zipball/9f82bf7766ccc9c22ab7aeb9bebb98351483fa5b", + "reference": "9f82bf7766ccc9c22ab7aeb9bebb98351483fa5b", "shasum": "" }, "require": { @@ -4930,7 +5319,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v7.0.6" + "source": "https://github.com/symfony/routing/tree/v7.0.7" }, "funding": [ { @@ -4946,20 +5335,20 @@ "type": "tidelift" } ], - "time": "2024-03-28T21:02:11+00:00" + "time": "2024-04-18T09:29:19+00:00" }, { "name": "symfony/sendgrid-mailer", - "version": "v6.4.3", + "version": "v6.4.7", "source": { "type": "git", "url": "https://github.com/symfony/sendgrid-mailer.git", - "reference": "910a1c8f8a44111b69de1e2539a2243a91eaf9be" + "reference": "deea5b186e31719d212ccc265d05459d4eb8d374" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/sendgrid-mailer/zipball/910a1c8f8a44111b69de1e2539a2243a91eaf9be", - "reference": "910a1c8f8a44111b69de1e2539a2243a91eaf9be", + "url": "https://api.github.com/repos/symfony/sendgrid-mailer/zipball/deea5b186e31719d212ccc265d05459d4eb8d374", + "reference": "deea5b186e31719d212ccc265d05459d4eb8d374", "shasum": "" }, "require": { @@ -5000,7 +5389,7 @@ "description": "Symfony Sendgrid Mailer Bridge", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/sendgrid-mailer/tree/v6.4.3" + "source": "https://github.com/symfony/sendgrid-mailer/tree/v6.4.7" }, "funding": [ { @@ -5016,25 +5405,26 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:51:35+00:00" + "time": "2024-04-18T09:22:46+00:00" }, { "name": "symfony/service-contracts", - "version": "v3.4.2", + "version": "v3.5.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "11bbf19a0fb7b36345861e85c5768844c552906e" + "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/11bbf19a0fb7b36345861e85c5768844c552906e", - "reference": "11bbf19a0fb7b36345861e85c5768844c552906e", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", + "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", "shasum": "" }, "require": { "php": ">=8.1", - "psr/container": "^1.1|^2.0" + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3" }, "conflict": { "ext-psr": "<1.1|>=2" @@ -5042,7 +5432,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.4-dev" + "dev-main": "3.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -5082,7 +5472,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.4.2" + "source": "https://github.com/symfony/service-contracts/tree/v3.5.0" }, "funding": [ { @@ -5098,20 +5488,20 @@ "type": "tidelift" } ], - "time": "2023-12-19T21:51:00+00:00" + "time": "2024-04-18T09:32:20+00:00" }, { "name": "symfony/string", - "version": "v7.0.4", + "version": "v7.0.7", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "f5832521b998b0bec40bee688ad5de98d4cf111b" + "reference": "e405b5424dc2528e02e31ba26b83a79fd4eb8f63" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/f5832521b998b0bec40bee688ad5de98d4cf111b", - "reference": "f5832521b998b0bec40bee688ad5de98d4cf111b", + "url": "https://api.github.com/repos/symfony/string/zipball/e405b5424dc2528e02e31ba26b83a79fd4eb8f63", + "reference": "e405b5424dc2528e02e31ba26b83a79fd4eb8f63", "shasum": "" }, "require": { @@ -5168,7 +5558,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.0.4" + "source": "https://github.com/symfony/string/tree/v7.0.7" }, "funding": [ { @@ -5184,20 +5574,20 @@ "type": "tidelift" } ], - "time": "2024-02-01T13:17:36+00:00" + "time": "2024-04-18T09:29:19+00:00" }, { "name": "symfony/var-dumper", - "version": "v6.4.6", + "version": "v6.4.7", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "95bd2706a97fb875185b51ecaa6112ec184233d4" + "reference": "7a9cd977cd1c5fed3694bee52990866432af07d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/95bd2706a97fb875185b51ecaa6112ec184233d4", - "reference": "95bd2706a97fb875185b51ecaa6112ec184233d4", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/7a9cd977cd1c5fed3694bee52990866432af07d7", + "reference": "7a9cd977cd1c5fed3694bee52990866432af07d7", "shasum": "" }, "require": { @@ -5253,7 +5643,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v6.4.6" + "source": "https://github.com/symfony/var-dumper/tree/v6.4.7" }, "funding": [ { @@ -5269,20 +5659,20 @@ "type": "tidelift" } ], - "time": "2024-03-19T11:56:30+00:00" + "time": "2024-04-18T09:22:46+00:00" }, { "name": "symfony/var-exporter", - "version": "v7.0.6", + "version": "v7.0.7", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "c74c568d2a15a1d407cf40d61ea82bc2d521e27b" + "reference": "cdecc0022e40e90340ba1a59a3d5ccf069777078" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/c74c568d2a15a1d407cf40d61ea82bc2d521e27b", - "reference": "c74c568d2a15a1d407cf40d61ea82bc2d521e27b", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/cdecc0022e40e90340ba1a59a3d5ccf069777078", + "reference": "cdecc0022e40e90340ba1a59a3d5ccf069777078", "shasum": "" }, "require": { @@ -5329,7 +5719,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v7.0.6" + "source": "https://github.com/symfony/var-exporter/tree/v7.0.7" }, "funding": [ { @@ -5345,41 +5735,36 @@ "type": "tidelift" } ], - "time": "2024-03-20T21:25:22+00:00" + "time": "2024-04-18T09:29:19+00:00" } ], "packages-dev": [ { - "name": "composer/pcre", - "version": "3.1.3", + "name": "clue/ndjson-react", + "version": "v1.3.0", "source": { "type": "git", - "url": "https://github.com/composer/pcre.git", - "reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8" + "url": "https://github.com/clue/reactphp-ndjson.git", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/5b16e25a5355f1f3afdfc2f954a0a80aec4826a8", - "reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8", + "url": "https://api.github.com/repos/clue/reactphp-ndjson/zipball/392dc165fce93b5bb5c637b67e59619223c931b0", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0", "shasum": "" }, "require": { - "php": "^7.4 || ^8.0" + "php": ">=5.3", + "react/stream": "^1.2" }, "require-dev": { - "phpstan/phpstan": "^1.3", - "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^5" + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35", + "react/event-loop": "^1.2" }, "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.x-dev" - } - }, "autoload": { "psr-4": { - "Composer\\Pcre\\": "src" + "Clue\\React\\NDJson\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -5388,9 +5773,78 @@ ], "authors": [ { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" + "name": "Christian Lück", + "email": "christian@clue.engineering" + } + ], + "description": "Streaming newline-delimited JSON (NDJSON) parser and encoder for ReactPHP.", + "homepage": "https://github.com/clue/reactphp-ndjson", + "keywords": [ + "NDJSON", + "json", + "jsonlines", + "newline", + "reactphp", + "streaming" + ], + "support": { + "issues": "https://github.com/clue/reactphp-ndjson/issues", + "source": "https://github.com/clue/reactphp-ndjson/tree/v1.3.0" + }, + "funding": [ + { + "url": "https://clue.engineering/support", + "type": "custom" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-12-23T10:58:28+00:00" + }, + { + "name": "composer/pcre", + "version": "3.1.3", + "source": { + "type": "git", + "url": "https://github.com/composer/pcre.git", + "reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/pcre/zipball/5b16e25a5355f1f3afdfc2f954a0a80aec4826a8", + "reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.3", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" } ], "description": "PCRE wrapping library that offers type-safe preg_* replacements.", @@ -5503,16 +5957,16 @@ }, { "name": "composer/xdebug-handler", - "version": "3.0.4", + "version": "3.0.5", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "4f988f8fdf580d53bdb2d1278fe93d1ed5462255" + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/4f988f8fdf580d53bdb2d1278fe93d1ed5462255", - "reference": "4f988f8fdf580d53bdb2d1278fe93d1ed5462255", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/6c1925561632e83d60a44492e0b344cf48ab85ef", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef", "shasum": "" }, "require": { @@ -5549,7 +6003,7 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/3.0.4" + "source": "https://github.com/composer/xdebug-handler/tree/3.0.5" }, "funding": [ { @@ -5565,7 +6019,7 @@ "type": "tidelift" } ], - "time": "2024-03-26T18:29:49+00:00" + "time": "2024-05-06T16:37:16+00:00" }, { "name": "doctrine/data-fixtures", @@ -5651,27 +6105,142 @@ ], "time": "2023-11-24T11:18:31+00:00" }, + { + "name": "evenement/evenement", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/igorw/evenement.git", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/igorw/evenement/zipball/0a16b0d71ab13284339abb99d9d2bd813640efbc", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^9 || ^6" + }, + "type": "library", + "autoload": { + "psr-4": { + "Evenement\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + } + ], + "description": "Événement is a very simple event dispatching library for PHP", + "keywords": [ + "event-dispatcher", + "event-emitter" + ], + "support": { + "issues": "https://github.com/igorw/evenement/issues", + "source": "https://github.com/igorw/evenement/tree/v3.0.2" + }, + "time": "2023-08-08T05:53:35+00:00" + }, + { + "name": "fidry/cpu-core-counter", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/theofidry/cpu-core-counter.git", + "reference": "f92996c4d5c1a696a6a970e20f7c4216200fcc42" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/f92996c4d5c1a696a6a970e20f7c4216200fcc42", + "reference": "f92996c4d5c1a696a6a970e20f7c4216200fcc42", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "fidry/makefile": "^0.2.0", + "fidry/php-cs-fixer-config": "^1.1.2", + "phpstan/extension-installer": "^1.2.0", + "phpstan/phpstan": "^1.9.2", + "phpstan/phpstan-deprecation-rules": "^1.0.0", + "phpstan/phpstan-phpunit": "^1.2.2", + "phpstan/phpstan-strict-rules": "^1.4.4", + "phpunit/phpunit": "^8.5.31 || ^9.5.26", + "webmozarts/strict-phpunit": "^7.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Fidry\\CpuCoreCounter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Théo FIDRY", + "email": "theo.fidry@gmail.com" + } + ], + "description": "Tiny utility to get the number of CPU cores.", + "keywords": [ + "CPU", + "core" + ], + "support": { + "issues": "https://github.com/theofidry/cpu-core-counter/issues", + "source": "https://github.com/theofidry/cpu-core-counter/tree/1.1.0" + }, + "funding": [ + { + "url": "https://github.com/theofidry", + "type": "github" + } + ], + "time": "2024-02-07T09:43:46+00:00" + }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.54.0", + "version": "v3.57.2", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "2aecbc8640d7906c38777b3dcab6f4ca79004d08" + "reference": "22f7f3145606df92b02fb1bd22c30abfce956d3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/2aecbc8640d7906c38777b3dcab6f4ca79004d08", - "reference": "2aecbc8640d7906c38777b3dcab6f4ca79004d08", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/22f7f3145606df92b02fb1bd22c30abfce956d3c", + "reference": "22f7f3145606df92b02fb1bd22c30abfce956d3c", "shasum": "" }, "require": { + "clue/ndjson-react": "^1.0", "composer/semver": "^3.4", "composer/xdebug-handler": "^3.0.3", "ext-filter": "*", "ext-json": "*", "ext-tokenizer": "*", + "fidry/cpu-core-counter": "^1.0", "php": "^7.4 || ^8.0", + "react/child-process": "^0.6.5", + "react/event-loop": "^1.0", + "react/promise": "^2.0 || ^3.0", + "react/socket": "^1.0", + "react/stream": "^1.0", "sebastian/diff": "^4.0 || ^5.0 || ^6.0", "symfony/console": "^5.4 || ^6.0 || ^7.0", "symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0", @@ -5734,7 +6303,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.54.0" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.57.2" }, "funding": [ { @@ -5742,7 +6311,7 @@ "type": "github" } ], - "time": "2024-04-17T08:12:13+00:00" + "time": "2024-05-20T20:41:57+00:00" }, { "name": "myclabs/deep-copy", @@ -6244,16 +6813,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.19", + "version": "10.5.20", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c726f0de022368f6ed103e452a765d3304a996a4" + "reference": "547d314dc24ec1e177720d45c6263fb226cc2ae3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c726f0de022368f6ed103e452a765d3304a996a4", - "reference": "c726f0de022368f6ed103e452a765d3304a996a4", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/547d314dc24ec1e177720d45c6263fb226cc2ae3", + "reference": "547d314dc24ec1e177720d45c6263fb226cc2ae3", "shasum": "" }, "require": { @@ -6325,7 +6894,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.19" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.20" }, "funding": [ { @@ -6341,7 +6910,537 @@ "type": "tidelift" } ], - "time": "2024-04-17T14:06:18+00:00" + "time": "2024-04-24T06:32:35+00:00" + }, + { + "name": "react/cache", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/cache.git", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/cache/zipball/d47c472b64aa5608225f47965a484b75c7817d5b", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/promise": "^3.0 || ^2.0 || ^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, Promise-based cache interface for ReactPHP", + "keywords": [ + "cache", + "caching", + "promise", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/cache/issues", + "source": "https://github.com/reactphp/cache/tree/v1.2.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2022-11-30T15:59:55+00:00" + }, + { + "name": "react/child-process", + "version": "v0.6.5", + "source": { + "type": "git", + "url": "https://github.com/reactphp/child-process.git", + "reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/child-process/zipball/e71eb1aa55f057c7a4a0d08d06b0b0a484bead43", + "reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/event-loop": "^1.2", + "react/stream": "^1.2" + }, + "require-dev": { + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35", + "react/socket": "^1.8", + "sebastian/environment": "^5.0 || ^3.0 || ^2.0 || ^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\ChildProcess\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven library for executing child processes with ReactPHP.", + "keywords": [ + "event-driven", + "process", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/child-process/issues", + "source": "https://github.com/reactphp/child-process/tree/v0.6.5" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-09-16T13:41:56+00:00" + }, + { + "name": "react/dns", + "version": "v1.12.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/dns.git", + "reference": "c134600642fa615b46b41237ef243daa65bb64ec" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/dns/zipball/c134600642fa615b46b41237ef243daa65bb64ec", + "reference": "c134600642fa615b46b41237ef243daa65bb64ec", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/cache": "^1.0 || ^0.6 || ^0.5", + "react/event-loop": "^1.2", + "react/promise": "^3.0 || ^2.7 || ^1.2.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4 || ^3 || ^2", + "react/promise-timer": "^1.9" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Dns\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async DNS resolver for ReactPHP", + "keywords": [ + "async", + "dns", + "dns-resolver", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/dns/issues", + "source": "https://github.com/reactphp/dns/tree/v1.12.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2023-11-29T12:41:06+00:00" + }, + { + "name": "react/event-loop", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/event-loop.git", + "reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/event-loop/zipball/bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", + "reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "suggest": { + "ext-pcntl": "For signal handling support when using the StreamSelectLoop" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\EventLoop\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.", + "keywords": [ + "asynchronous", + "event-loop" + ], + "support": { + "issues": "https://github.com/reactphp/event-loop/issues", + "source": "https://github.com/reactphp/event-loop/tree/v1.5.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2023-11-13T13:48:05+00:00" + }, + { + "name": "react/promise", + "version": "v3.1.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "e563d55d1641de1dea9f5e84f3cccc66d2bfe02c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/e563d55d1641de1dea9f5e84f3cccc66d2bfe02c", + "reference": "e563d55d1641de1dea9f5e84f3cccc66d2bfe02c", + "shasum": "" + }, + "require": { + "php": ">=7.1.0" + }, + "require-dev": { + "phpstan/phpstan": "1.10.39 || 1.4.10", + "phpunit/phpunit": "^9.6 || ^7.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ], + "support": { + "issues": "https://github.com/reactphp/promise/issues", + "source": "https://github.com/reactphp/promise/tree/v3.1.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2023-11-16T16:21:57+00:00" + }, + { + "name": "react/socket", + "version": "v1.15.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/socket.git", + "reference": "216d3aec0b87f04a40ca04f481e6af01bdd1d038" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/socket/zipball/216d3aec0b87f04a40ca04f481e6af01bdd1d038", + "reference": "216d3aec0b87f04a40ca04f481e6af01bdd1d038", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/dns": "^1.11", + "react/event-loop": "^1.2", + "react/promise": "^3 || ^2.6 || ^1.2.1", + "react/stream": "^1.2" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4 || ^3 || ^2", + "react/promise-stream": "^1.4", + "react/promise-timer": "^1.10" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Socket\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP", + "keywords": [ + "Connection", + "Socket", + "async", + "reactphp", + "stream" + ], + "support": { + "issues": "https://github.com/reactphp/socket/issues", + "source": "https://github.com/reactphp/socket/tree/v1.15.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2023-12-15T11:02:10+00:00" + }, + { + "name": "react/stream", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/stream.git", + "reference": "6fbc9672905c7d5a885f2da2fc696f65840f4a66" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/stream/zipball/6fbc9672905c7d5a885f2da2fc696f65840f4a66", + "reference": "6fbc9672905c7d5a885f2da2fc696f65840f4a66", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.8", + "react/event-loop": "^1.2" + }, + "require-dev": { + "clue/stream-filter": "~1.2", + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Stream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven readable and writable streams for non-blocking I/O in ReactPHP", + "keywords": [ + "event-driven", + "io", + "non-blocking", + "pipe", + "reactphp", + "readable", + "stream", + "writable" + ], + "support": { + "issues": "https://github.com/reactphp/stream/issues", + "source": "https://github.com/reactphp/stream/tree/v1.3.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2023-06-16T10:52:11+00:00" }, { "name": "sebastian/cli-parser", @@ -7261,22 +8360,23 @@ }, { "name": "symfony/filesystem", - "version": "v7.0.6", + "version": "v7.0.7", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "408105dff4c104454100730bdfd1a9cdd993f04d" + "reference": "cc168be6fbdcdf3401f50ae863ee3818ed4338f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/408105dff4c104454100730bdfd1a9cdd993f04d", - "reference": "408105dff4c104454100730bdfd1a9cdd993f04d", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/cc168be6fbdcdf3401f50ae863ee3818ed4338f5", + "reference": "cc168be6fbdcdf3401f50ae863ee3818ed4338f5", "shasum": "" }, "require": { "php": ">=8.2", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.8" + "symfony/polyfill-mbstring": "~1.8", + "symfony/process": "^6.4|^7.0" }, "type": "library", "autoload": { @@ -7304,7 +8404,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v7.0.6" + "source": "https://github.com/symfony/filesystem/tree/v7.0.7" }, "funding": [ { @@ -7320,20 +8420,20 @@ "type": "tidelift" } ], - "time": "2024-03-21T19:37:36+00:00" + "time": "2024-04-18T09:29:19+00:00" }, { "name": "symfony/finder", - "version": "v7.0.0", + "version": "v7.0.7", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "6e5688d69f7cfc4ed4a511e96007e06c2d34ce56" + "reference": "4d58f0f4fe95a30d7b538d71197135483560b97c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/6e5688d69f7cfc4ed4a511e96007e06c2d34ce56", - "reference": "6e5688d69f7cfc4ed4a511e96007e06c2d34ce56", + "url": "https://api.github.com/repos/symfony/finder/zipball/4d58f0f4fe95a30d7b538d71197135483560b97c", + "reference": "4d58f0f4fe95a30d7b538d71197135483560b97c", "shasum": "" }, "require": { @@ -7368,7 +8468,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.0.0" + "source": "https://github.com/symfony/finder/tree/v7.0.7" }, "funding": [ { @@ -7384,20 +8484,20 @@ "type": "tidelift" } ], - "time": "2023-10-31T17:59:56+00:00" + "time": "2024-04-28T11:44:19+00:00" }, { "name": "symfony/options-resolver", - "version": "v7.0.0", + "version": "v7.0.7", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "700ff4096e346f54cb628ea650767c8130f1001f" + "reference": "23cc173858776ad451e31f053b1c9f47840b2cfa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/700ff4096e346f54cb628ea650767c8130f1001f", - "reference": "700ff4096e346f54cb628ea650767c8130f1001f", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/23cc173858776ad451e31f053b1c9f47840b2cfa", + "reference": "23cc173858776ad451e31f053b1c9f47840b2cfa", "shasum": "" }, "require": { @@ -7435,7 +8535,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v7.0.0" + "source": "https://github.com/symfony/options-resolver/tree/v7.0.7" }, "funding": [ { @@ -7451,7 +8551,7 @@ "type": "tidelift" } ], - "time": "2023-08-08T10:20:21+00:00" + "time": "2024-04-18T09:29:19+00:00" }, { "name": "symfony/polyfill-php81", @@ -7531,16 +8631,16 @@ }, { "name": "symfony/process", - "version": "v7.0.4", + "version": "v7.0.7", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "0e7727191c3b71ebec6d529fa0e50a01ca5679e9" + "reference": "3839e56b94dd1dbd13235d27504e66baf23faba0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/0e7727191c3b71ebec6d529fa0e50a01ca5679e9", - "reference": "0e7727191c3b71ebec6d529fa0e50a01ca5679e9", + "url": "https://api.github.com/repos/symfony/process/zipball/3839e56b94dd1dbd13235d27504e66baf23faba0", + "reference": "3839e56b94dd1dbd13235d27504e66baf23faba0", "shasum": "" }, "require": { @@ -7572,7 +8672,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.0.4" + "source": "https://github.com/symfony/process/tree/v7.0.7" }, "funding": [ { @@ -7588,20 +8688,20 @@ "type": "tidelift" } ], - "time": "2024-02-22T20:27:20+00:00" + "time": "2024-04-18T09:29:19+00:00" }, { "name": "symfony/stopwatch", - "version": "v7.0.3", + "version": "v7.0.7", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "983900d6fddf2b0cbaacacbbad07610854bd8112" + "reference": "41a7a24aa1dc82adf46a06bc292d1923acfe6b84" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/983900d6fddf2b0cbaacacbbad07610854bd8112", - "reference": "983900d6fddf2b0cbaacacbbad07610854bd8112", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/41a7a24aa1dc82adf46a06bc292d1923acfe6b84", + "reference": "41a7a24aa1dc82adf46a06bc292d1923acfe6b84", "shasum": "" }, "require": { @@ -7634,7 +8734,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v7.0.3" + "source": "https://github.com/symfony/stopwatch/tree/v7.0.7" }, "funding": [ { @@ -7650,7 +8750,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T15:02:46+00:00" + "time": "2024-04-18T09:29:19+00:00" }, { "name": "theseer/tokenizer", @@ -7708,7 +8808,9 @@ "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, - "platform": [], + "platform": { + "php": "^7.3 || ^8" + }, "platform-dev": [], "plugin-api-version": "2.6.0" } diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000000..b8b2cef1c1 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,17 @@ + + + + + tests/unit + + + + tests/integration + + + + + + diff --git a/tests/src/api-queries.json b/tests/api-queries.json similarity index 100% rename from tests/src/api-queries.json rename to tests/api-queries.json diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000000..37f617dd02 --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,101 @@ + 'get', +// 'PATH_INFO' => '/', +// 'SERVER_NAME' => 'local.dev', +// ))); + + +// $config = include __DIR__ . '/../src/protected/application/conf/conf-test.php'; + +// if(isset($_ENV['MAPASCULTURAIS_CONFIG_FILE'])){ +// $config = include __DIR__ . '/../src/protected/application/conf/'. $_ENV['MAPASCULTURAIS_CONFIG_FILE']; +// }else if(isset($_SERVER['MAPASCULTURAIS_CONFIG_FILE'])){ +// $config = include __DIR__ . '/../src/protected/application/conf/' . $_SERVER['MAPASCULTURAIS_CONFIG_FILE']; +// } + + +// $config = require_once("config.php"); + +// require_once(__DIR__ . "/../../src/load-translation.php"); + +// create the App instance +// $app = \MapasCulturais\App::i()->init($config); +// $app->register(); + +// require __DIR__ . '/classes/TestCase.php'; +// require __DIR__ . '/classes/TestFactory.php'; + +/* End of file bootstrap.php */ diff --git a/tests/config.php b/tests/config.php new file mode 100644 index 0000000000..c5734f728d --- /dev/null +++ b/tests/config.php @@ -0,0 +1,50 @@ + '\MapasCulturais\Themes\BaseV2', + 'base.url' => 'http://localhost:8888/', + 'site.url' => 'http://localhost:8888/', + 'app.log.translations' => false, + 'slim.log.level' => 3, + 'slim.log.enabled' => false, + // 'app.log.query' => true, + 'slim.debug' => false, + 'auth.provider' => 'Test', + + 'auth.config' => array( + 'filename' => '/tmp/mapasculturais-tests-authenticated-user.id' + ), + + // 'app.log.query' => true, +// 'app.log.apiDql' => true, + + + 'doctrine.isDev' => false, + + 'userIds' => array( + 'superAdmin' => array(1, 2), + // 'admin' => 2, +// 'staff' => 3, +// 'normal' => 4, + + 'admin' => array(3, 4), + 'staff' => array(5, 6), + 'normal' => array(7, 8), + ), + + // disable cache + 'db.host' => 'db', + + 'app.usePermissionsCache' => false, + 'app.chace' => new \Symfony\Component\Cache\Adapter\ArrayAdapter() + // 'app.cache' => function_exists('apc_store') ? new \Doctrine\Common\Cache\ApcCache() : new \Doctrine\Common\Cache\ArrayCache(), + ) +); diff --git a/tests/docker/config.php b/tests/docker/config.php deleted file mode 100644 index 34a4a2c7ff..0000000000 --- a/tests/docker/config.php +++ /dev/null @@ -1,52 +0,0 @@ - 'SpCultura', - 'base.url' => 'http://localhost:8888/', - 'site.url' => 'http://localhost:8888/', - 'app.log.translations' => false, - 'slim.log.level' => Log::DEBUG, - 'slim.log.enabled' => false, -// 'app.log.query' => true, - 'slim.debug' => false, - 'auth.provider' => 'Test', - - 'auth.config' => array( - 'filename' => '/tmp/mapasculturais-tests-authenticated-user.id' - ), - -// 'app.log.query' => true, -// 'app.log.apiDql' => true, - - - 'doctrine.isDev' => false, - - 'doctrine.database' => array( - 'dbname' => 'mapas', - 'user' => 'mapas', - 'password' => 'mapas', - 'host' => 'db', - - ), - - 'userIds' => array( - 'superAdmin' => array(1,2), -// 'admin' => 2, -// 'staff' => 3, -// 'normal' => 4, - - 'admin' => array(3,4), - 'staff' => array(5,6), - 'normal' => array(7,8), - ), - - // disable cache - - 'app.usePermissionsCache' => false, - 'app.chace' => new \Doctrine\Common\Cache\ArrayCache() -// 'app.cache' => function_exists('apc_store') ? new \Doctrine\Common\Cache\ApcCache() : new \Doctrine\Common\Cache\ArrayCache(), - ) -); diff --git a/tests/src/files/.gitignore b/tests/integration/.gitkeep similarity index 100% rename from tests/src/files/.gitignore rename to tests/integration/.gitkeep diff --git a/tests/src/ModuleAgendaSingleTest.php b/tests/src/ModuleAgendaSingleTest.php deleted file mode 100644 index 2441488ee7..0000000000 --- a/tests/src/ModuleAgendaSingleTest.php +++ /dev/null @@ -1,21 +0,0 @@ -app->repo($class)->findAll(); - foreach($entities as $entity){ - if($entity->status > 0){ - $url = $entity->controller->createUrl('agendaSingle', [$entity->id]) . '?from=1900-01-01&to=2020-12-31'; - $this->assertGet200($url, 'agenda single status code 200: ' . $url); - } - } - - } - } - } -} \ No newline at end of file diff --git a/tests/src/RoutesTest.php b/tests/src/RoutesTest.php deleted file mode 100644 index ddc49b8944..0000000000 --- a/tests/src/RoutesTest.php +++ /dev/null @@ -1,62 +0,0 @@ -user = null; - - $this->assertGet200('/', 'assert that home status code is 200'); - } - - function testPages(){ - $this->user = null; - - $this->assertGet200('/sobre/', 'assert that about page status code is 200'); - $this->assertGet200('/como-usar/', 'assert that about page status code is 200'); - } - - function testSearch(){ - $this->user = null; - - $this->assertGet200('/busca/', 'assert that about page status code is 200'); - } - - function test404(){ - $this->user = null; - - $this->assertGet404('/' . uniqid('404-'), 'assert that code is 404'); - } - - function testEntitiesRoutesWithGuest(){ - $this->user = null; - - foreach($this->entities as $class => $name){ - $entities = $this->app->repo($class)->findAll(); - - $e = $entities[0]; - // foreach($entities as $e){ - $this->assertGet200($e->singleUrl, "assert that the status code of single of {$class} with id {$e->id} is 200 for guest users"); - $this->assertGet403($e->deleteUrl, "assert that the status code of delete url of {$class} with id {$e->id} is 401 for guest users"); - $this->assertGet401($e->editUrl, "assert that the status code of edit url of {$class} with id {$e->id} is 401 for guest users"); - // } - } - } - - function testEntitiesRoutesWithNormalUser(){ - $user = $this->getUser('normal'); - $this->user = $user; - - foreach($this->entities as $class => $name){ - $entities = $user->$name; - - $e = $entities[0]; - // foreach($entities as $e){ - $this->assertGet200($e->singleUrl, "assert that the status code of single of my {$class} with id {$e->id} is 200"); - $this->assertGet200($e->editUrl, "assert that the status code of edit url of my {$class} with id {$e->id} is 200"); - // } - } - } - -} diff --git a/tests/src/bootstrap.php b/tests/src/bootstrap.php deleted file mode 100644 index e8f5ebf45f..0000000000 --- a/tests/src/bootstrap.php +++ /dev/null @@ -1,47 +0,0 @@ - 'get', - 'PATH_INFO' => '/', - 'SERVER_NAME' => 'local.dev', -))); - - -$config = include __DIR__ . '/../src/protected/application/conf/conf-test.php'; - -if(isset($_ENV['MAPASCULTURAIS_CONFIG_FILE'])){ - $config = include __DIR__ . '/../src/protected/application/conf/'. $_ENV['MAPASCULTURAIS_CONFIG_FILE']; -}else if(isset($_SERVER['MAPASCULTURAIS_CONFIG_FILE'])){ - $config = include __DIR__ . '/../src/protected/application/conf/' . $_SERVER['MAPASCULTURAIS_CONFIG_FILE']; -} - -// create the App instance -$app = App::i()->init($config); -$app->register(); - -require __DIR__ . '/classes/TestCase.php'; -require __DIR__ . '/classes/TestFactory.php'; - -/* End of file bootstrap.php */ diff --git a/tests/src/APITest.php b/tests/unit/APITest.php similarity index 79% rename from tests/src/APITest.php rename to tests/unit/APITest.php index 88dbbfdcfe..115037b63d 100644 --- a/tests/src/APITest.php +++ b/tests/unit/APITest.php @@ -1,35 +1,40 @@ api($entity, $_params); return $rs->find(); } - - function apiFindOne($entity, $_params){ + + function apiFindOne($entity, $_params) + { $rs = $this->api($entity, $_params); return $rs->findOne(); } - - function apiCount($entity, $_params){ + + function apiCount($entity, $_params) + { $rs = $this->api($entity, $_params); return $rs->count(); } - function testFindOneMethod() { - $simplify = function($entity, $props){ + function testFindOneMethod() + { + $simplify = function ($entity, $props) { return (array) $entity->simplify($props); }; @@ -37,7 +42,7 @@ function testFindOneMethod() { 'id' => $simplify, 'id,singleUrl,editUrl,deleteUrl,destroyUrl,endereco,En_CEP' => $simplify, - 'id,name,user.id' => function($entity){ + 'id,name,user.id' => function ($entity) { $user = $entity->ownerUser; return [ 'id' => $entity->id, @@ -45,7 +50,7 @@ function testFindOneMethod() { 'user' => $user->id ]; }, - 'id,name,owner' => function($entity){ + 'id,name,owner' => function ($entity) { return [ 'id' => $entity->id, 'name' => $entity->name, @@ -54,19 +59,22 @@ function testFindOneMethod() { }, ]; - foreach([null,'superAdmin','admin','normal'] as $user){ + foreach ([null, 'superAdmin', 'admin', 'normal'] as $user) { $this->user = $user; // agente nao tem owner, tem parent... - foreach(['Space', 'Project', 'Event'] as $class){ + foreach (['Space', 'Project', 'Event'] as $class) { $entities = $this->app->repo($class)->findAll(); - foreach($entities as $entity){ - if($entity->status < 1) continue; + foreach ($entities as $entity) { + if ($entity->status < 1) + continue; - foreach($cps as $props => $proc){ + foreach ($cps as $props => $proc) { $response = $this->apiFindOne($class, "@select={$props}&id=EQ({$entity->id})"); $_entity = $proc($entity, $props); + $_entity['@entityType'] = strtolower($class); + $this->assertEquals($_entity, $response, "asserting {$class} api findOne to \$user"); } @@ -75,7 +83,8 @@ function testFindOneMethod() { } } - function testQuerySintax(){ + function testQuerySintax() + { $this->user = 'admin'; $s1 = 'id,name,owner'; @@ -83,7 +92,7 @@ function testQuerySintax(){ $s3 = 'id,name,owner.{id}'; $entities = $this->app->repo('Event')->findAll(); - foreach($entities as $entity){ + foreach ($entities as $entity) { $r1 = $this->apiFind('event', "id=EQ($entity->id)&@select=$s1"); $r2 = $this->apiFind('event', "id=EQ($entity->id)&@select=$s2"); $r3 = $this->apiFind('event', "id=EQ($entity->id)&@select=$s3"); @@ -93,14 +102,15 @@ function testQuerySintax(){ } } - function testSelectWildcard(){ + function testSelectWildcard() + { $occurrences = $this->apiFindOne('event', "id=EQ(3)&@limit=1&@select=id,name,occurrences.{*}"); $spaces = $this->apiFindOne('event', "id=EQ(3)&@limit=1&@select=id,name,occurrences.{space.*}"); $occ_space = $this->apiFindOne('event', "id=EQ(3)&@limit=1&@select=id,name,occurrences.{*, space.*}"); $expected = $occurrences; - foreach($expected['occurrences'] as $i => &$occ){ + foreach ($expected['occurrences'] as $i => &$occ) { $occ['space'] = $spaces['occurrences'][$i]['space']; } @@ -108,7 +118,8 @@ function testSelectWildcard(){ } - function testJsonOutput(){ + function testJsonOutput() + { $event_id = 522; $s1 = 'id,name,user.{id,email,profile.{id,name,singleUrl,endereco,spaces.{id,name,singleUrl,endereco}}}'; @@ -124,7 +135,8 @@ function testJsonOutput(){ } - function testEventsOfProject(){ + function testEventsOfProject() + { $this->resetTransactions(); // assert that users WITHOUT control of a project CANNOT create events to this project $user1 = $this->getUser('normal', 0); @@ -164,10 +176,11 @@ function testEventsOfProject(){ ], $r1[0], 'verify the returned event'); } - function testSelectPropertiesOrder() { + function testSelectPropertiesOrder() + { $r1 = $this->apiFindOne('agent', "@select=id,name,location,shortDescription"); $r2 = $this->apiFindOne('agent', "@select=id,shortDescription,name,location"); - + $this->assertEquals(json_encode($r1), json_encode($r2), "Certificando que o resultado da api é o mesmo independente da ordem das propriedades no @select"); } } diff --git a/tests/unit/AgendaSingleTest.php b/tests/unit/AgendaSingleTest.php new file mode 100644 index 0000000000..be449eeebc --- /dev/null +++ b/tests/unit/AgendaSingleTest.php @@ -0,0 +1,22 @@ +app->repo($class)->findAll(); + foreach ($entities as $entity) { + if ($entity->status > 0) { + $url = $entity->controller->createUrl('agendaSingle', [$entity->id]) . '?from=1900-01-01&to=2020-12-31'; + $this->assertGet200($url, 'agenda single status code 200: ' . $url); + } + } + + } + } + } +} \ No newline at end of file diff --git a/tests/src/AgentTest.php b/tests/unit/AgentTest.php similarity index 83% rename from tests/src/AgentTest.php rename to tests/unit/AgentTest.php index fde3e3dd6e..75592520e2 100644 --- a/tests/src/AgentTest.php +++ b/tests/unit/AgentTest.php @@ -1,75 +1,77 @@ getUser('normal'); $this->user = $user; $agent1 = $user->profile; - + $agent2 = $this->getNewEntity('Agent'); $agent2->user = $user; $agent2->save(true); - + $this->assertTrue($agent1->isUserProfile, 'Asserting that the agent 1 is the user profile before change the the user profile to agent 2'); $this->assertFalse($agent2->isUserProfile, 'Asserting that the agent 2 is not the user profile before change the the user profile to agent 2'); - + $agent2->setAsUserProfile(); - + $this->app->em->refresh($agent1); $this->app->em->refresh($agent2); - + $this->assertFalse($agent1->isUserProfile, 'Asserting that the agent 2 is not the user profile after change the the user profile to agent 2'); $this->assertTrue($agent2->isUserProfile, 'Asserting that the agent 2 is the user profile after change the the user profile to agent 2'); $agent1->setAsUserProfile(); - + $this->app->em->refresh($agent1); $this->app->em->refresh($agent2); - + $this->assertTrue($agent1->isUserProfile, 'Asserting that the agent 2 is the user profile after change the the user profile back to agent 1'); $this->assertFalse($agent2->isUserProfile, 'Asserting that the agent 2 is not the user profile after change the the user profile back to agent 1'); } - - function testParent(){ + + function testParent() + { $this->user = 'normal'; - + $profile = $this->app->user->profile; - + $dest = $this->getNewEntity('Agent'); - + $a1 = $this->getNewEntity('Agent'); $a2 = $this->getNewEntity('Agent'); $a3 = $this->getNewEntity('Agent'); - + $a1->save(true); $a2->save(true); $a3->save(true); - + $dest->save(true); - + $dest->owner = $a1; - $dest->save(true); + $dest->save(true); $dest->refresh(); $this->assertEquals($dest->owner->id, $a1->id); - + $dest->owner = $a2; - $dest->save(true); + $dest->save(true); $dest->refresh(); $this->assertEquals($dest->owner->id, $a2->id); - + $dest->owner = $a3; - $dest->save(true); + $dest->save(true); $dest->refresh(); $this->assertEquals($dest->owner->id, $a3->id); - + // repetindo mesmo agente $dest->owner = $a3; - $dest->save(true); + $dest->save(true); $dest->refresh(); $this->assertEquals($dest->owner->id, $a3->id); - + } } \ No newline at end of file diff --git a/tests/src/AuthTest.php b/tests/unit/AuthTest.php similarity index 86% rename from tests/src/AuthTest.php rename to tests/unit/AuthTest.php index 26e4aea21d..bb0464cff6 100644 --- a/tests/src/AuthTest.php +++ b/tests/unit/AuthTest.php @@ -1,12 +1,15 @@ user = null; $app = $this->app; @@ -18,7 +21,7 @@ function testAuthentication(){ // superadmin $this->user = 'superAdmin'; - + $this->assertTrue($app->auth->isUserAuthenticated(), 'Asserting that the user is authenticated.'); $this->assertFalse($app->user->is('guest'), 'Asserting that the user is not guest.'); $this->assertTrue($app->user->is('admin'), 'Asserting that the user is admin.'); @@ -31,33 +34,38 @@ function testAuthentication(){ $this->assertTrue($app->user->is('guest'), 'Asserting that the user is guest.'); } - function testSuperAdminAuthentication(){ + function testSuperAdminAuthentication() + { $this->user = 'superAdmin'; $this->assertTrue($this->app->user->is('superAdmin'), 'Asserting that the user is super admin.'); } - function testAdminAuthentication(){ + function testAdminAuthentication() + { $this->user = 'admin'; $this->assertTrue($this->app->user->is('admin'), 'Asserting that the user is admin.'); $this->assertFalse($this->app->user->is('superAdmin'), 'Asserting that the user is not super admin.'); } - function testNormalAuthentication(){ + function testNormalAuthentication() + { $this->user = 'normal'; $this->assertFalse($this->app->user->is('guest'), 'Asserting that the user is not guest.'); $this->assertFalse($this->app->user->is('admin'), 'Asserting that the user is not admin.'); $this->assertFalse($this->app->user->is('superAdmin'), 'Asserting that the user is not super admin.'); } - function testRequireAuthentication(){ + function testRequireAuthentication() + { $this->user = null; $app = $this->app; $this->assertEquals('200', $app->response->status(), 'Asserting response status code is 200'); - try{ + try { $app->auth->requireAuthentication(); - } catch (\Exception $e){} + } catch (\Exception $e) { + } $this->assertEquals('401', $app->response->status(), 'Asserting response status code is 401'); @@ -65,9 +73,10 @@ function testRequireAuthentication(){ $app->response->status(200); $this->assertEquals('200', $app->response->status(), 'Asserting response status code is 200'); - try{ + try { $app->controller("space")->requireAuthentication(); - } catch (\Exception $e){} + } catch (\Exception $e) { + } $this->assertEquals('401', $app->response->status(), 'Asserting response status code is 401'); diff --git a/tests/src/CreateEntitiesForDoctrineProxyTest.php b/tests/unit/CreateEntitiesForDoctrineProxyTest.php similarity index 87% rename from tests/src/CreateEntitiesForDoctrineProxyTest.php rename to tests/unit/CreateEntitiesForDoctrineProxyTest.php index 4d0dc4a872..f4b5644070 100644 --- a/tests/src/CreateEntitiesForDoctrineProxyTest.php +++ b/tests/unit/CreateEntitiesForDoctrineProxyTest.php @@ -1,6 +1,6 @@ authUid = 'fakes'; + $user->authProvider = 3; $user->email = 'user@doamain.com'; $user->save(true); - $userFound = $app->repo('User')->findOneBy(array('email'=>'user@doamain.com')); + $userFound = $app->repo('User')->findOneBy(array('email' => 'user@doamain.com')); $this->assertEquals($userFound->email, 'user@doamain.com'); $this->assertEquals($userFound->authUid, 'fakes'); @@ -33,7 +36,7 @@ function testAll() { $agent->name = 'Nameless'; $agent->save(true); - $agentFound = $app->repo('Agent')->findOneBy(array('id'=>$agent->id)); + $agentFound = $app->repo('Agent')->findOneBy(array('id' => $agent->id)); $this->assertEquals($agentFound->name, 'Nameless'); $this->assertEquals($agentFound->user->id, $user->id); @@ -63,13 +66,14 @@ function testAll() { $event->setProjectId($project->id); $event->save(true); - $eventFound = $app->repo('Event')->findOneBy(array('id'=>$event->id)); + $eventFound = $app->repo('Event')->findOneBy(array('id' => $event->id)); $this->assertEquals($eventFound->project->id, $project->id); } - function testURLs(){ + function testURLs() + { $app = \MapasCulturais\App::i(); $urls = [ 'api/agent/find/?&@select=id,name,location&@order=name%20ASC', @@ -86,9 +90,8 @@ function testURLs(){ 'api/project/find/?&@select=id,singleUrl,name,type,shortDescription,terms,registrationFrom,registrationTo&@files=(avatar.avatarBig):url&@page=1&@limit=10&@order=name%20ASC' ]; - foreach($urls as $url){ - $this->assertNotEmpty(file_get_contents($app->config['site.url'].$url)); + foreach ($urls as $url) { + $this->assertNotEmpty(file_get_contents($app->config['site.url'] . $url)); } } } -*/ \ No newline at end of file diff --git a/tests/src/DoctrineFunctionTest.php b/tests/unit/DoctrineFunctionTest.php similarity index 69% rename from tests/src/DoctrineFunctionTest.php rename to tests/unit/DoctrineFunctionTest.php index 32b2164a60..bdcda50e12 100644 --- a/tests/src/DoctrineFunctionTest.php +++ b/tests/unit/DoctrineFunctionTest.php @@ -1,34 +1,41 @@ app->em->createQuery("SELECT string_agg(a.name,'".DELIMITER."') as aggregate FROM MapasCulturais\Entities\Agent a"); + $query1 = $this->app->em->createQuery("SELECT string_agg(a.name,'" . DELIMITER . "') as aggregate FROM MapasCulturais\Entities\Agent a"); $result1 = $query1->getResult(); $query2 = $this->app->em->createQuery("SELECT a.name FROM MapasCulturais\Entities\Agent a"); $result2 = $query2->getResult(); $r2 = []; - foreach($result2 as $item){ $r2[] = $item['name']; } + foreach ($result2 as $item) { + $r2[] = $item['name']; + } $this->assertEquals($result1[0]['aggregate'], join($r2, DELIMITER)); } - function testStringUnaccent(){ + function testStringUnaccent() + { $string1 = 'áéíóúÁÉÍÓÚãĩõũÃĨÕŨâêîôûÂÊÎÔÛäëïöüÄËÏÖÜñÑ'; $string2 = 'aeiouAEIOUaiouAIOUaeiouAEIOUaeiouAEIOUnN'; //unaccented to be matched //doesn't work with ẽẼ, but, it doesn't seem to be used, so I think it's negligible. - $query = $this->app->em->createQuery('SELECT unaccent(\''.$string1.'\') unaccentedString1 FROM MapasCulturais\Entities\Agent a')->setMaxResults(1); + $query = $this->app->em->createQuery('SELECT unaccent(\'' . $string1 . '\') unaccentedString1 FROM MapasCulturais\Entities\Agent a')->setMaxResults(1); $result = $query->getResult(); $this->assertEquals($result[0]['unaccentedString1'], $string2); } - function NOTCOMPLETE_DISABLED_testEventOccurrence(){ + function NOTCOMPLETE_DISABLED_testEventOccurrence() + { $date_from = '2014-08-01'; $date_to = '2014-08-07'; $dql = " @@ -44,12 +51,14 @@ function NOTCOMPLETE_DISABLED_testEventOccurrence(){ ORDER BY eo.starts_on, eo.starts_at"; $query = $this->app->em->createQuery($dql)->setMaxResults(1); - $query->setParameters(array( - 'date_from' => $date_from, - 'date_to' => $date_to - )); + $query->setParameters( + array( + 'date_from' => $date_from, + 'date_to' => $date_to + ) + ); $result = $query->getResult(); - var_dump($result); + // var_dump($result); } } diff --git a/tests/src/EntityTest.php b/tests/unit/EntityTests.php similarity index 90% rename from tests/src/EntityTest.php rename to tests/unit/EntityTests.php index 200a679818..89118e932b 100644 --- a/tests/src/EntityTest.php +++ b/tests/unit/EntityTests.php @@ -1,12 +1,12 @@ assertEmpty($entity->validationErrors, print_r($entity->validationErrors, true)); } - function testDirectCircularReference() { + function testDirectCircularReference() + { $entities = ['Agent', 'Space', 'Project']; foreach ($entities as $class) { @@ -54,7 +55,8 @@ function testDirectCircularReference() { } } - function testIndirectCircularReference() { + function testIndirectCircularReference() + { $entities = ['Agent', 'Space', 'Project']; foreach ($entities as $class) { $this->user = 'normal'; @@ -78,7 +80,8 @@ function testIndirectCircularReference() { } } - function testParentType() { + function testParentType() + { $entities = ['Space', 'Project']; foreach ($entities as $class) { $this->user = 'normal'; @@ -93,7 +96,8 @@ function testParentType() { } } - function testParentIsNotChild() { + function testParentIsNotChild() + { $entities = ['Space', 'Project']; foreach ($entities as $class) { $this->user = 'normal'; @@ -108,15 +112,16 @@ function testParentIsNotChild() { } } - function testUpdateTimestamp(){ + function testUpdateTimestamp() + { $classes = ['Space', 'Project', 'Event', 'Agent']; - + $this->user = 'admin'; - foreach($classes as $class){ + foreach ($classes as $class) { $entities = $this->app->repo($class)->findAll(); - - foreach($entities as $entity){ + + foreach ($entities as $entity) { $timestamp = $entity->updateTimestamp; $entity->name = $entity->name . ' changed'; diff --git a/tests/src/EventTest.php b/tests/unit/EventTest.php similarity index 87% rename from tests/src/EventTest.php rename to tests/unit/EventTest.php index efd7c8a082..28cfa0c0e1 100644 --- a/tests/src/EventTest.php +++ b/tests/unit/EventTest.php @@ -1,5 +1,5 @@ factory->autoPersist = true; } - function testEvent(){ + function testEvent() + { $this->user = 1; $event = $this->factory->createEvent(); @@ -57,12 +60,13 @@ function testEvent(){ $events = $this->app->repo('Event')->findBy(array('name' => $event->name)); - $this->assertEquals(1,count($events)); + $this->assertEquals(1, count($events)); } - function createQuery($date1, $date2) { + function createQuery($date1, $date2) + { $rsm = new \Doctrine\ORM\Query\ResultSetMapping(); - $rsm->addEntityResult('MapasCulturais\Entities\EventOccurrence','e'); + $rsm->addEntityResult('MapasCulturais\Entities\EventOccurrence', 'e'); $rsm->addFieldResult('e', 'id', 'id'); @@ -71,7 +75,8 @@ function createQuery($date1, $date2) { return $this->app->em->createNativeQuery($strNativeQuery, $rsm); } - function testEventOccurrence_single(){ + function testEventOccurrence_single() + { $this->resetTransactions(); $this->user = 1; @@ -92,7 +97,8 @@ function testEventOccurrence_single(){ $this->assertEmpty($occurrence3); } - function testEventOccurrence_daily(){ + function testEventOccurrence_daily() + { $this->resetTransactions(); $this->user = 1; @@ -104,7 +110,7 @@ function testEventOccurrence_daily(){ $this->assertEmpty($occurrence->validationErrors, print_r($occurrence->validationErrors, true)); $occurrence->save(true); - for ($i=2; $i <= 9 ; $i++) { + for ($i = 2; $i <= 9; $i++) { $date = '1950-01-0' . $i; $query = $this->createQuery($date, $date); $occurrences = $query->getArrayResult(); @@ -122,17 +128,18 @@ function testEventOccurrence_daily(){ $this->assertEquals(0, count($occurrences)); } - function testEventOccurrence_weekly(){ + function testEventOccurrence_weekly() + { $this->resetTransactions(); $this->user = 1; $event = $this->factory->createEvent(); $space = $this->factory->createSpace(); - $occurrence = $this->factory->createWeeklyEventOccurrence('1950-01-02 12:00', 180, '1950-11-01', [1,3], $space, $event); + $occurrence = $this->factory->createWeeklyEventOccurrence('1950-01-02 12:00', 180, '1950-11-01', [1, 3], $space, $event); $this->assertEmpty($occurrence->validationErrors, print_r($occurrence->validationErrors, true)); - + $date = '1950-01-02'; $query = $this->createQuery($date, $date); $occurrences = $query->getArrayResult(); @@ -142,7 +149,7 @@ function testEventOccurrence_weekly(){ $query = $this->createQuery($date, $date); $occurrences = $query->getArrayResult(); $this->assertEquals(1, count($occurrences)); - + $date = '1950-01-16'; $query = $this->createQuery($date, $date); $occurrences = $query->getArrayResult(); @@ -158,7 +165,8 @@ function testEventOccurrence_weekly(){ } - function testEventRules(){ + function testEventRules() + { $this->resetTransactions(); $this->user = 1; @@ -166,7 +174,7 @@ function testEventRules(){ $space = $this->factory->createSpace(); $occurrence = new EventOccurrence; - + $occurrence->event = $event; $occurrence->space = $space; @@ -180,21 +188,23 @@ function testEventRules(){ $this->assertEquals(2, count($occurrence->recurrences)); } - function getEventRule(){ + function getEventRule() + { return (object) [ - "spaceId" => "31", - "startsAt" => "12:31", - "duration" => "00h01", + "spaceId" => "31", + "startsAt" => "12:31", + "duration" => "00h01", "frequency" => "weekly", - "startsOn" => "2014-02-10", - "until" => "2014-02-19", - "day" => (object) [ "1" => "on", "3" => "on" ], - "monthly" => "week", + "startsOn" => "2014-02-10", + "until" => "2014-02-19", + "day" => (object) ["1" => "on", "3" => "on"], + "monthly" => "week", "description" => "test description" ]; } - function testEventAttendance(){ + function testEventAttendance() + { $this->resetTransactions(); $this->user = $this->getUser('normal', 0); @@ -204,13 +214,13 @@ function testEventAttendance(){ $event_occurrence_1 = $this->factory->createDailyEventOccurrence('1950-01-01 12:00', 120, '1950-02-22', $space, $event); - $event_occurrence_2 = $this->factory->createWeeklyEventOccurrence('1950-01-10 18:00', 30, '1950-01-31', [1,3,5], $space, $event); - + $event_occurrence_2 = $this->factory->createWeeklyEventOccurrence('1950-01-10 18:00', 30, '1950-01-31', [1, 3, 5], $space, $event); + $this->user = $this->getUser('normal', 1); $event_controller = $this->app->controller('event'); - $occurrences = $event_controller->apiFindOccurrences (['@from' => '1950-01-05', '@to' => '1950-01-31', '@limit'=>3]); + $occurrences = $event_controller->apiFindOccurrences(['@from' => '1950-01-05', '@to' => '1950-01-31', '@limit' => 3]); $oc1 = (object) $occurrences[1]; diff --git a/tests/src/FilesTest.php b/tests/unit/FilesTest.php similarity index 75% rename from tests/src/FilesTest.php rename to tests/unit/FilesTest.php index 658acbc221..48efc58462 100644 --- a/tests/src/FilesTest.php +++ b/tests/unit/FilesTest.php @@ -1,5 +1,5 @@ assertGet200('/api/agent/find?@select=id,name&@files=(avatar.galleryFull):url', 'assert that thumbnail is created without error (/api/agent/find?@select=id,name&@files=(avatar.galleryFull):url)'); } } \ No newline at end of file diff --git a/tests/src/HooksTest.php b/tests/unit/HooksTest.php similarity index 68% rename from tests/src/HooksTest.php rename to tests/unit/HooksTest.php index 541068b4a4..8c7080d059 100644 --- a/tests/src/HooksTest.php +++ b/tests/unit/HooksTest.php @@ -1,28 +1,30 @@ app; $result = []; - $app->hook('test hook order', function() use(&$result){ + $app->hook('test hook order', function () use (&$result) { $result[] = 4; }, 11); - $app->hook('test hook order', function() use(&$result){ + $app->hook('test hook order', function () use (&$result) { $result[] = 1; }, 10); - $app->hook('test hook order', function() use(&$result){ + $app->hook('test hook order', function () use (&$result) { $result[] = 2; }, 10); - $app->hook('test hook order', function() use(&$result){ + $app->hook('test hook order', function () use (&$result) { $result[] = 3; }, 10); - $app->hook('test hook order', function() use(&$result){ + $app->hook('test hook order', function () use (&$result) { $result[] = 0; }, 9); @@ -35,9 +37,10 @@ function testHookOrder(){ $this->assertEquals(4, $result[4]); } - function testHookWildcard() { + function testHookWildcard() + { $app = $this->app; - + $hooks = [ 'field_<<*>>', '<>', @@ -45,8 +48,8 @@ function testHookWildcard() { ]; $result = []; - foreach($hooks as &$hook) { - $app->hook($hook, function() use($hook, &$result) { + foreach ($hooks as &$hook) { + $app->hook($hook, function () use ($hook, &$result) { $result[] = $hook; }); } diff --git a/tests/src/MetadataTest.php b/tests/unit/MetadataTests.php similarity index 84% rename from tests/src/MetadataTest.php rename to tests/unit/MetadataTests.php index 9f626d5f39..9a0575ce86 100644 --- a/tests/src/MetadataTest.php +++ b/tests/unit/MetadataTests.php @@ -1,13 +1,15 @@ registerEntityType($type); @@ -18,7 +20,7 @@ function testValidations(){ 'validations' => array( 'required' => 'required error message' ), - 'validValues' => array('Value','Loren'), + 'validValues' => array('Value', 'Loren'), 'invalidValues' => array(null, '') ), @@ -46,7 +48,7 @@ function testValidations(){ 'validations' => array( 'v::url()' => 'error message' ), - 'validValues' => array(null, '', 'http://www.test.com', 'http://www.testing-tests.com', 'http://www.test.com/', 'https://www.test.com/', 'http://www.test.com/ok', 'https://testing.com/ok.test', 'http://test.com/ok.php', 'http://a.very.long.domain.name.com/ok.jpg?with=get%20params', 'https://www.test.com/ok' ), + 'validValues' => array(null, '', 'http://www.test.com', 'http://www.testing-tests.com', 'http://www.test.com/', 'https://www.test.com/', 'http://www.test.com/ok', 'https://testing.com/ok.test', 'http://test.com/ok.php', 'http://a.very.long.domain.name.com/ok.jpg?with=get%20params', 'https://www.test.com/ok'), 'invalidValues' => array('htts:///222 asd.com', 'asdasd', 'www.test.com') ), @@ -56,7 +58,7 @@ function testValidations(){ 'required' => 'required error message', 'v::url()' => 'error message' ), - 'validValues' => array('http://www.test.com', 'http://www.testing-tests.com', 'http://www.test.com/', 'https://www.test.com/', 'http://www.test.com/ok', 'https://testing.com/ok.test', 'http://test.com/ok.php', 'http://a.very.long.domain.name.com/ok.jpg?with=get%20params', 'https://www.test.com/ok' ), + 'validValues' => array('http://www.test.com', 'http://www.testing-tests.com', 'http://www.test.com/', 'https://www.test.com/', 'http://www.test.com/ok', 'https://testing.com/ok.test', 'http://test.com/ok.php', 'http://a.very.long.domain.name.com/ok.jpg?with=get%20params', 'https://www.test.com/ok'), 'invalidValues' => array(null, '', 'htts:///222 asd.com', 'asdasd', 'www.test.com') ), @@ -71,7 +73,7 @@ function testValidations(){ ) ); - foreach($metas as $meta_key => $config){ + foreach ($metas as $meta_key => $config) { $definition = new MapasCulturais\Definitions\Metadata($meta_key, $config); $app->unregisterEntityMetadata('MapasCulturais\Entities\Agent', $meta_key); $app->registerMetadata($definition, 'MapasCulturais\Entities\Agent', $type->id); @@ -82,15 +84,15 @@ function testValidations(){ $agent->terms['area'][] = 'Cinema'; - for($i = 1; $i <= 2; $i++){ + for ($i = 1; $i <= 2; $i++) { - foreach($config['validValues'] as $val){ + foreach ($config['validValues'] as $val) { $agent->$meta_key = $val; $errors = $agent->getValidationErrors(); $this->assertArrayNotHasKey($meta_key, $errors, print_r(array('type' => "assertArrayNotHasKey", 'KEY' => $meta_key, 'VALID VALUE' => $val, 'errors' => $errors), true)); } - foreach($config['invalidValues'] as $val){ + foreach ($config['invalidValues'] as $val) { $agent->$meta_key = $val; $errors = $agent->getValidationErrors(); $this->assertArrayHasKey($meta_key, $errors, print_r(array('type' => "assertArrayNotHasKey", 'KEY' => $meta_key, 'INVALID VALUE' => $val, 'errors' => $errors), true)); @@ -100,8 +102,9 @@ function testValidations(){ } } - - function testGetMetadata(){ + + function testGetMetadata() + { // testa se o getter funciona para todos os roles // guest user @@ -109,34 +112,35 @@ function testGetMetadata(){ $this->user = null; $event = $this->app->repo('Event')->find(522); $this->assertEquals('Livre', $event->classificacaoEtaria); - + // normal user $this->app->em->clear(); $this->user = 'normal'; $event = $this->app->repo('Event')->find(522); $this->assertEquals('Livre', $event->classificacaoEtaria); - + // admin user $this->app->em->clear(); $this->user = 'admin'; $event = $this->app->repo('Event')->find(522); $this->assertEquals('Livre', $event->classificacaoEtaria); - + } - function testRequiredMetadata() { + function testRequiredMetadata() + { $types = [ - 'number' => [0,0.5,1], - 'integer' => [0,1], - 'json' => [(object) [], [], 'test', '1', 1], - 'boolean' => [true, false,1,0, '1', '0'], - 'string' => ['teste', 333], + 'number' => [0, 0.5, 1], + 'integer' => [0, 1], + 'json' => [(object) [], [], 'test', '1', 1], + 'boolean' => [true, false, 1, 0, '1', '0'], + 'string' => ['teste', 333], 'text' => ['teste', 333] ]; - - foreach($types as $type => $valid_values) { + + foreach ($types as $type => $valid_values) { $field_name = "required_{$type}"; - + $this->registerAgentMetadata($field_name, [ 'type' => $type, 'label' => "Campo do tipo '$type' para testar valores nulos obrigatórios", @@ -150,12 +154,12 @@ function testRequiredMetadata() { $agent = $this->getNewEntity('Agent'); - foreach($types as $type => $valid_values) { + foreach ($types as $type => $valid_values) { $field_name = "required_{$type}"; $errors = $agent->validationErrors[$field_name] ?? []; $this->assertContains('campo obrigatório', $errors, "Campo do tipo $type não preenchido deve retornar erro de validação"); - foreach($valid_values as $value) { + foreach ($valid_values as $value) { $agent->$field_name = $value; $errors = $agent->validationErrors[$field_name] ?? []; $this->assertNotContains('campo obrigatório', $errors, "Campo do tipo $type não deve retornar erro de validação quando preenchido com valor válido: " . print_r($value, true)); @@ -163,21 +167,22 @@ function testRequiredMetadata() { } } - function testNullValues() { + function testNullValues() + { $app = App::i(); $types = [ - 'number' => 1.5, - 'integer' => 1, - 'json' => (object) [], - 'boolean' => true, - 'string' => 'teste', + 'number' => 1.5, + 'integer' => 1, + 'json' => (object) [], + 'boolean' => true, + 'string' => 'teste', 'text' => 'teste' ]; - - foreach($types as $type => $valid_value) { + + foreach ($types as $type => $valid_value) { $field_name = "optional_{$type}"; - + $this->registerAgentMetadata($field_name, [ 'type' => $type, 'label' => "Campo do tipo '$type' para testar valores nulos" @@ -188,14 +193,14 @@ function testNullValues() { $agent = $this->getNewEntity('Agent'); - foreach($types as $type => $valid_value) { + foreach ($types as $type => $valid_value) { $field_name = "optional_{$type}"; $this->assertNull($agent->$field_name, "campo opcional do tipo $type deveria ser nulo antes de ser definido"); } // assegurando que é possível deixar o campo nulo após salvar um valor válido - foreach($types as $type => $valid_value) { + foreach ($types as $type => $valid_value) { $field_name = "optional_{$type}"; $agent->$field_name = $valid_value; @@ -205,10 +210,10 @@ function testNullValues() { $agent_id = $agent->id; $app->em->clear(); - + $agent = $app->repo('Agent')->find($agent_id); - - foreach($types as $type => $valid_value) { + + foreach ($types as $type => $valid_value) { $field_name = "optional_{$type}"; $this->assertEquals($valid_value, $agent->$field_name, 'O valor do campo salvo deve ser igual ao definido'); @@ -220,7 +225,7 @@ function testNullValues() { $agent = $app->repo('Agent')->find($agent_id); - foreach($types as $type => $valid_value) { + foreach ($types as $type => $valid_value) { $field_name = "optional_{$type}"; $this->assertNull($agent->$field_name, "campo opcional do tipo $type deveria ser nulo após ser definido como null"); diff --git a/tests/src/PermissionsTest.php b/tests/unit/PermissionsTest.php similarity index 81% rename from tests/src/PermissionsTest.php rename to tests/unit/PermissionsTest.php index 2a1458699c..380f66531a 100644 --- a/tests/src/PermissionsTest.php +++ b/tests/unit/PermissionsTest.php @@ -1,27 +1,31 @@ app->em->createQuery("SELECT e FROM $classname e WHERE e.status > 0 $where")->setMaxResults(1)->getOneOrNullResult(); - else if($_class === 'Agent') + else if ($_class === 'Agent') return $this->app->em->createQuery("SELECT e FROM $classname e JOIN e.user u WHERE e.status > 0 $where")->setMaxResults(1)->getOneOrNullResult(); else return $this->app->em->createQuery("SELECT e FROM $classname e JOIN e.owner a JOIN a.user u WHERE e.status > 0 $where")->setMaxResults(1)->getOneOrNullResult(); } - function testCanUserCreate(){ + function testCanUserCreate() + { $this->app->disableWorkflow(); $this->resetTransactions(); $app = MapasCulturais\App::i(); @@ -31,11 +35,11 @@ function testCanUserCreate(){ */ $this->user = null; - foreach($this->entities as $class => $plural){ - if($class === 'Agent') + foreach ($this->entities as $class => $plural) { + if ($class === 'Agent') continue; - $this->assertPermissionDenied(function() use ($class){ + $this->assertPermissionDenied(function () use ($class) { $entity = $this->getNewEntity($class); $entity->save(true); }, "Asserting that the guest user CANNOT create $plural."); @@ -47,8 +51,8 @@ function testCanUserCreate(){ $this->user = 'superAdmin'; - foreach($this->entities as $class => $plural){ - $this->assertPermissionGranted(function() use ($class){ + foreach ($this->entities as $class => $plural) { + $this->assertPermissionGranted(function () use ($class) { $entity = $this->getNewEntity($class); $entity->save(true); }, "Asserting that a super admin user CAN create $plural."); @@ -62,8 +66,8 @@ function testCanUserCreate(){ $another_user = $this->getRandomEntity('User', 'e.id != ' . $app->user->id); - foreach($this->entities as $class => $plural){ - $this->assertPermissionDenied(function() use ($class, $another_user){ + foreach ($this->entities as $class => $plural) { + $this->assertPermissionDenied(function () use ($class, $another_user) { $entity = $this->getNewEntity($class); $entity->owner = $another_user->profile; @@ -78,8 +82,8 @@ function testCanUserCreate(){ */ $this->user = 'superAdmin'; - foreach($this->entities as $class => $plural){ - $this->assertPermissionGranted(function() use ($class, $another_user){ + foreach ($this->entities as $class => $plural) { + $this->assertPermissionGranted(function () use ($class, $another_user) { $entity = $this->getNewEntity($class); $entity->owner = $another_user->profile; @@ -97,8 +101,8 @@ function testCanUserCreate(){ $this->user = 'normal'; - foreach($this->entities as $class => $plural){ - $this->assertPermissionDenied(function() use ($class, $owner){ + foreach ($this->entities as $class => $plural) { + $this->assertPermissionDenied(function () use ($class, $owner) { $entity = $this->getNewEntity($class, null, $owner); $entity->save(true); }, "Asserting that a user CANNOT create $plural owned by a not published agent"); @@ -108,7 +112,8 @@ function testCanUserCreate(){ } - function testCanUserModify(){ + function testCanUserModify() + { $this->app->disableWorkflow(); $this->resetTransactions(); /* @@ -117,8 +122,8 @@ function testCanUserModify(){ $this->user = null; - foreach($this->entities as $class => $plural){ - $this->assertPermissionDenied(function() use ($class){ + foreach ($this->entities as $class => $plural) { + $this->assertPermissionDenied(function () use ($class) { $entity = $this->getRandomEntity($class); $entity->shortDescription = "modificado " . uniqid(); $entity->save(true); @@ -126,13 +131,13 @@ function testCanUserModify(){ } - foreach(['normal'] as $role){ + foreach (['normal'] as $role) { $this->user = $role; /* * Asserting thar normal users cannot modify entities of other user */ - foreach($this->entities as $class => $plural){ - $this->assertPermissionDenied(function() use ($class){ + foreach ($this->entities as $class => $plural) { + $this->assertPermissionDenied(function () use ($class) { $entity = $this->getRandomEntity($class, "u.id != " . $this->app->user->id); $entity->shortDescription = "modificado " . uniqid(); $entity->save(true); @@ -143,8 +148,8 @@ function testCanUserModify(){ /* * Asserting thar normal users can modify their own entities */ - foreach($this->entities as $class => $plural){ - $this->assertPermissionGranted(function() use ($class){ + foreach ($this->entities as $class => $plural) { + $this->assertPermissionGranted(function () use ($class) { $entity = $this->getRandomEntity($class, "u.id = " . $this->app->user->id); $entity->shortDescription = "modificado " . uniqid(); $entity->save(true); @@ -152,13 +157,13 @@ function testCanUserModify(){ } } - foreach(['admin', 'superAdmin'] as $role){ + foreach (['admin', 'superAdmin'] as $role) { $this->user = $role; /* * Asserting thar admin and super admin users can modify entities of other user */ - foreach($this->entities as $class => $plural){ - $this->assertPermissionGranted(function() use ($class){ + foreach ($this->entities as $class => $plural) { + $this->assertPermissionGranted(function () use ($class) { $entity = $this->getRandomEntity($class, "u.id != " . $this->app->user->id); $entity->shortDescription = "modificado " . uniqid(); $entity->save(true); @@ -179,7 +184,8 @@ function testCanUserModify(){ // $this->app->enableWorkflow(); // } - function testAgentRelationsPermissions(){ + function testAgentRelationsPermissions() + { $this->app->disableWorkflow(); $this->resetTransactions(); // create agent relation without control @@ -194,14 +200,20 @@ function testAgentRelationsPermissions(){ $GROUP = 'group 1'; - $user1 = function (){ return $this->getUser('admin', 0); }; - $user2 = function (){ return $this->getUser('normal', 0); }; - $user3 = function (){ return $this->getUser('normal', 1); }; + $user1 = function () { + return $this->getUser('admin', 0); + }; + $user2 = function () { + return $this->getUser('normal', 0); + }; + $user3 = function () { + return $this->getUser('normal', 1); + }; /* * Asserting that owner user and a related agent with control can modify an entity */ - foreach($this->entities as $class => $plural){ + foreach ($this->entities as $class => $plural) { $this->resetTransactions(); $entities = $class == 'Agent' ? $user1()->$plural : $user1()->profile->$plural; @@ -241,8 +253,8 @@ function testAgentRelationsPermissions(){ $new_agent2->save(true); $new_agent3->save(true); - foreach($this->entities as $class => $plural){ - if($class == 'Agent') + foreach ($this->entities as $class => $plural) { + if ($class == 'Agent') continue; $entities = $user1()->$plural; @@ -250,7 +262,7 @@ function testAgentRelationsPermissions(){ $this->user = 'admin'; - $this->assertPermissionGranted(function() use($entity){ + $this->assertPermissionGranted(function () use ($entity) { $old_owner = $entity->owner; $entity->owner = $this->app->user->profile; $entity->save(true); @@ -261,19 +273,19 @@ function testAgentRelationsPermissions(){ }, "Asserting that an admin user CAN modify the $class owner"); $this->user = $user1(); - $this->assertPermissionGranted(function() use($entity, $new_agent1){ + $this->assertPermissionGranted(function () use ($entity, $new_agent1) { $entity->owner = $new_agent1; $entity->save(true); }, "Asserting that the user CAN modify his own $class owner before the relation is created."); $this->user = $user2(); - $this->assertPermissionDenied(function() use($entity, $new_agent2){ + $this->assertPermissionDenied(function () use ($entity, $new_agent2) { $entity->owner = $new_agent2; $entity->save(true); }, "Asserting that the user 2 CANNOT modify the $class owner before the relation is created."); $this->user = $user3(); - $this->assertPermissionDenied(function() use($entity, $new_agent3){ + $this->assertPermissionDenied(function () use ($entity, $new_agent3) { $entity->owner = $new_agent3; $entity->save(true); }, "Asserting that the user 3 CANNOT modify the $class owner before the relation is created."); @@ -285,19 +297,19 @@ function testAgentRelationsPermissions(){ // create the realation with control $entity->createAgentRelation($user2()->profile, $GROUP, true, true); - $this->assertPermissionGranted(function() use($entity, $new_agent1){ + $this->assertPermissionGranted(function () use ($entity, $new_agent1) { $entity->owner = $new_agent1; $entity->save(true); }, "Asserting that the user CAN modify his own $class owner before the relation is created."); $this->user = $user2(); - $this->assertPermissionDenied(function() use($entity, $new_agent2){ + $this->assertPermissionDenied(function () use ($entity, $new_agent2) { $entity->owner = $new_agent2; $entity->save(true); }, "Asserting that the user 2, now with control, CANNOT modify the $class owner AFTER the relation is created."); $this->user = $user3(); - $this->assertPermissionDenied(function() use($entity, $new_agent3){ + $this->assertPermissionDenied(function () use ($entity, $new_agent3) { $entity->owner = $new_agent3; $entity->save(true); }, "Asserting that the user 3 CANNOT modify the $class owner after the relation is created."); @@ -309,13 +321,14 @@ function testAgentRelationsPermissions(){ * Asserting that only the owner user can remove an entity */ - foreach($this->entities as $class => $plural){ + foreach ($this->entities as $class => $plural) { $this->user = $user1(); - if($class == 'Agent'){ - $entity = $this->getNewEntity($class);; + if ($class == 'Agent') { + $entity = $this->getNewEntity($class); + ; $entity->save(true); - }else{ + } else { $entities = $user1()->$plural; $entity = $entities[0]; } @@ -341,24 +354,24 @@ function testAgentRelationsPermissions(){ /* * Asserting that user with control can create spaces, projects and events owned by the controlled agent. */ - foreach($this->entities as $class => $plural){ - if($class == 'Agent') + foreach ($this->entities as $class => $plural) { + if ($class == 'Agent') continue; - $this->assertPermissionGranted(function() use($user1, $class){ + $this->assertPermissionGranted(function () use ($user1, $class) { $this->user = $user1(); $entity = $this->getNewEntity($class, $user1()); $entity->save(true); }, "Asserting that user CAN create $plural owned by his own agent before the relation is created"); - $this->assertPermissionDenied(function() use($user1, $user2, $class){ + $this->assertPermissionDenied(function () use ($user1, $user2, $class) { $this->user = $user2(); $entity = $this->getNewEntity($class); $entity->owner = $user1()->profile; $entity->save(true); }, "Asserting that user 2 CANNOT create $plural owned by user 1 before the relation is created"); - $this->assertPermissionDenied(function() use($user1, $user3, $class){ + $this->assertPermissionDenied(function () use ($user1, $user3, $class) { $this->user = $user3(); $entity = $this->getNewEntity($class); $entity->owner = $user1()->profile; @@ -371,20 +384,20 @@ function testAgentRelationsPermissions(){ $agent->createAgentRelation($user2()->profile, $GROUP, true, true); - $this->assertPermissionGranted(function() use($user1, $class){ + $this->assertPermissionGranted(function () use ($user1, $class) { $this->user = $user1(); $entity = $this->getNewEntity($class, $user1()); $entity->save(true); }, "Asserting that user CAN create $plural owned by his own agent after the relation is created"); - $this->assertPermissionGranted(function() use($user1, $user2, $class){ + $this->assertPermissionGranted(function () use ($user1, $user2, $class) { $this->user = $user2(); $entity = $this->getNewEntity($class); $entity->owner = $user1()->profile; $entity->save(true); }, "Asserting that user 2, now with control, CAN create $plural owned by user 1 after the relation is created"); - $this->assertPermissionDenied(function() use($user1, $user3, $class){ + $this->assertPermissionDenied(function () use ($user1, $user3, $class) { $this->user = $user3(); $entity = $this->getNewEntity($class); $entity->owner = $user1()->profile; @@ -396,12 +409,12 @@ function testAgentRelationsPermissions(){ /* * Asserting that user with control can remove spaces, projects and events owned by the controlled agent. */ - foreach($this->entities as $class => $plural){ - if($class == 'Agent') + foreach ($this->entities as $class => $plural) { + if ($class == 'Agent') continue; - $this->assertPermissionGranted(function() use($user1, $plural){ + $this->assertPermissionGranted(function () use ($user1, $plural) { $this->user = $user1(); $entities = $user1()->$plural; @@ -412,7 +425,7 @@ function testAgentRelationsPermissions(){ $this->resetTransactions(); - $this->assertPermissionDenied(function() use($user1, $user2, $plural){ + $this->assertPermissionDenied(function () use ($user1, $user2, $plural) { $this->user = $user2(); $entities = $user1()->$plural; @@ -423,7 +436,7 @@ function testAgentRelationsPermissions(){ $this->resetTransactions(); - $this->assertPermissionDenied(function() use($user1, $user3, $plural){ + $this->assertPermissionDenied(function () use ($user1, $user3, $plural) { $this->user = $user3(); $entities = $user1()->$plural; @@ -436,7 +449,7 @@ function testAgentRelationsPermissions(){ $this->user = $user1(); $user1()->profile->createAgentRelation($user2()->profile, $GROUP, true, true); - $this->assertPermissionGranted(function() use($user1, $plural){ + $this->assertPermissionGranted(function () use ($user1, $plural) { $this->user = $user1(); $entities = $user1()->$plural; @@ -449,7 +462,7 @@ function testAgentRelationsPermissions(){ $this->user = $user1(); $user1()->profile->createAgentRelation($user2()->profile, $GROUP, true, true); - $this->assertPermissionGranted(function() use($user1, $user2, $user3, $plural){ + $this->assertPermissionGranted(function () use ($user1, $user2, $user3, $plural) { $this->user = $user2(); $entities = $user1()->profile->$plural; @@ -462,7 +475,7 @@ function testAgentRelationsPermissions(){ $this->user = $user1(); $user1()->profile->createAgentRelation($user2()->profile, $GROUP, true, true); - $this->assertPermissionDenied(function() use($user1, $user3, $plural){ + $this->assertPermissionDenied(function () use ($user1, $user3, $plural) { $this->user = $user3(); $entities = $user1()->profile->$plural; @@ -478,13 +491,13 @@ function testAgentRelationsPermissions(){ * Asserting that an user with control can create agent relations */ - foreach($this->entities as $class => $plural){ + foreach ($this->entities as $class => $plural) { $this->resetTransactions(); $this->user = $user1(); - if($class === 'Agent'){ + if ($class === 'Agent') { $entity = $user1()->profile; - }else{ + } else { $entities = $user1()->profile->$plural; $entity = $entities[0]; } @@ -492,7 +505,7 @@ function testAgentRelationsPermissions(){ $entity->createAgentRelation($user2()->profile, $GROUP, true, true); $this->user = $user2(); - $this->assertPermissionGranted(function() use ($entity, $user2, $GROUP){ + $this->assertPermissionGranted(function () use ($entity, $user2, $GROUP) { $entity->createAgentRelation($user2()->profile, $GROUP, false, true); }, "Asserting that user CAN create agent relations with $plural that he has control"); @@ -503,13 +516,13 @@ function testAgentRelationsPermissions(){ * Asserting that an user with control can remove agent relations of agents without control */ - foreach($this->entities as $class => $plural){ + foreach ($this->entities as $class => $plural) { $this->resetTransactions(); $this->user = $user1(); - if($class === 'Agent'){ + if ($class === 'Agent') { $entity = $user1()->profile; - }else{ + } else { $entities = $user1()->profile->$plural; $entity = $entities[0]; } @@ -519,7 +532,7 @@ function testAgentRelationsPermissions(){ $entity->createAgentRelation($user3()->profile, $GROUP, false, true); $this->user = $user2(); - $this->assertPermissionGranted(function() use ($entity, $user3, $GROUP){ + $this->assertPermissionGranted(function () use ($entity, $user3, $GROUP) { $entity->removeAgentRelation($user3()->profile, $GROUP, false, true); }, "Asserting that user CAN remove agent relations with $plural that he has control"); @@ -530,13 +543,13 @@ function testAgentRelationsPermissions(){ * Asserting that an user with control CANNOT remove agent relations of agents with control */ - foreach($this->entities as $class => $plural){ + foreach ($this->entities as $class => $plural) { $this->resetTransactions(); $this->user = $user1(); - if($class === 'Agent'){ + if ($class === 'Agent') { $entity = $user1()->profile; - }else{ + } else { $entities = $user1()->profile->$plural; $entity = $entities[0]; } @@ -546,7 +559,7 @@ function testAgentRelationsPermissions(){ $entity->createAgentRelation($user3()->profile, $GROUP, true, true); $this->user = $user2(); - $this->assertPermissionDenied(function() use ($entity, $user3, $GROUP){ + $this->assertPermissionDenied(function () use ($entity, $user3, $GROUP) { $entity->removeAgentRelation($user3()->profile, $GROUP, false, true); }, "Asserting that user CANNOT remove agent relations with $plural that he has control"); @@ -556,13 +569,13 @@ function testAgentRelationsPermissions(){ * Asserting that an user with control cannot give control to a related agent */ - foreach($this->entities as $class => $plural){ + foreach ($this->entities as $class => $plural) { $this->resetTransactions(); $this->user = $user1(); - if($class === 'Agent'){ + if ($class === 'Agent') { $entity = $user1()->profile; - }else{ + } else { $entities = $user1()->profile->$plural; $entity = $entities[0]; } @@ -572,7 +585,7 @@ function testAgentRelationsPermissions(){ $entity->createAgentRelation($user3()->profile, $GROUP, false, true); $this->user = $user2(); - $this->assertPermissionDenied(function() use ($entity, $user3){ + $this->assertPermissionDenied(function () use ($entity, $user3) { $entity->setRelatedAgentControl($user3()->profile, true); }, "Asserting that user CANNOT give control to other related agent in $plural that he has control"); @@ -582,13 +595,13 @@ function testAgentRelationsPermissions(){ * Asserting that an user with control cannot remove control of a related agent */ - foreach($this->entities as $class => $plural){ + foreach ($this->entities as $class => $plural) { $this->resetTransactions(); $this->user = $user1(); - if($class === 'Agent'){ + if ($class === 'Agent') { $entity = $user1()->profile; - }else{ + } else { $entities = $user1()->profile->$plural; $entity = $entities[0]; } @@ -598,7 +611,7 @@ function testAgentRelationsPermissions(){ $entity->createAgentRelation($user3()->profile, $GROUP, true, true); $this->user = $user2(); - $this->assertPermissionDenied(function() use ($entity, $user3){ + $this->assertPermissionDenied(function () use ($entity, $user3) { $entity->setRelatedAgentControl($user3()->profile, false); }, "Asserting that user CANNOT remove control of other related agent in $plural that he has control"); @@ -609,7 +622,7 @@ function testAgentRelationsPermissions(){ * Asserting that an user with control over a space or project can control children spaces or projects */ - foreach(array('Space' => 'spaces', 'Project' => 'projects') as $class => $plural){ + foreach (array('Space' => 'spaces', 'Project' => 'projects') as $class => $plural) { $this->resetTransactions(); $this->user = $user1(); @@ -641,8 +654,8 @@ function testAgentRelationsPermissions(){ * Asserting that an user with control over an agent CONTROL and CAN REMOVE spaces, events and projects of the controlled agent */ - foreach($this->entities as $class => $plural){ - if($class === 'Agent') + foreach ($this->entities as $class => $plural) { + if ($class === 'Agent') continue; $this->resetTransactions(); @@ -660,7 +673,7 @@ function testAgentRelationsPermissions(){ $this->assertTrue($entity->userHasControl($user2()), "Asserting that an user with control over the owner agent CAN CONTROL $plural of this controlled agent"); $this->assertTrue($entity->canUser('modify'), "Asserting that an user with control over the owner agent CAN modify $plural of this controlled agent"); $this->assertTrue($entity->canUser('createAgentRelation'), "Asserting that an user with control over the owner agent CAN create agent relations to $plural of this controlled agent"); - if($class != 'Event') + if ($class != 'Event') $this->assertTrue($childEntity->canUser('createChild'), "Asserting that an user with control over the owner agent CAN create children for $plural of this controlled agent"); // somente quem controla o owner pode remover. quem controla o parent não. @@ -672,7 +685,8 @@ function testAgentRelationsPermissions(){ $this->app->enableWorkflow(); } - function testEventOccurrencePermissions(){ + function testEventOccurrencePermissions() + { $this->app->disableWorkflow(); $this->resetTransactions(); @@ -698,7 +712,7 @@ function testEventOccurrencePermissions(){ $event->owner = $user0->profile; $event->save(); - $this->assertPermissionDenied(function() use($event, $space, $rule){ + $this->assertPermissionDenied(function () use ($event, $space, $rule) { $occ = new \MapasCulturais\Entities\EventOccurrence; $occ->event = $event; @@ -716,7 +730,7 @@ function testEventOccurrencePermissions(){ $this->user = $user0; - $this->assertPermissionGranted(function() use($event, $space, $rule){ + $this->assertPermissionGranted(function () use ($event, $space, $rule) { $occ = new \MapasCulturais\Entities\EventOccurrence; $occ->event = $event; @@ -740,7 +754,7 @@ function testEventOccurrencePermissions(){ $event->save(); - $this->assertPermissionGranted(function() use($event, $public_space, $rule){ + $this->assertPermissionGranted(function () use ($event, $public_space, $rule) { $occ = new \MapasCulturais\Entities\EventOccurrence; $occ->event = $event; @@ -753,7 +767,8 @@ function testEventOccurrencePermissions(){ $this->app->enableWorkflow(); } - function testProjectEventCreation(){ + function testProjectEventCreation() + { $this->app->disableWorkflow(); $this->resetTransactions(); // assert that users WITHOUT control of a project CANNOT create events to this project @@ -764,7 +779,7 @@ function testProjectEventCreation(){ $this->user = $user1; - $this->assertPermissionDenied(function() use($project){ + $this->assertPermissionDenied(function () use ($project) { $event = $this->getNewEntity('Event'); $event->project = $project; $event->save(); @@ -778,28 +793,28 @@ function testProjectEventCreation(){ $this->user = $user1; - $this->assertPermissionGranted(function() use($project){ + $this->assertPermissionGranted(function () use ($project) { $event = $this->getNewEntity('Event'); $event->project = $project; $event->save(); }, 'Asserting that users WITH control of a project CAN create events related to this project'); - + // assert that users with control of a project CAN view draft events related to this project $event_1 = $this->getNewEntity('Event'); $event_1->project = $project; $event_1->status = \MapasCulturais\Entities\Event::STATUS_DRAFT; $event_1->save(); - + $event_2 = $this->getNewEntity('Event'); $event_2->status = \MapasCulturais\Entities\Event::STATUS_DRAFT; $event_2->save(); - + $this->user = $user2; - + $this->assertTrue($event_1->canUser('view'), 'assert that users with control of a project CAN view draft events related to this project'); $this->assertFalse($event_2->canUser('view'), 'assert that users with control of a project CANNOT view draft events not related to this project'); - + $this->app->enableWorkflow(); } @@ -813,7 +828,8 @@ function testProjectEventCreation(){ // $this->app->enableWorkflow(); // } - function testCanUserAddRemoveRole(){ + function testCanUserAddRemoveRole() + { $this->app->disableWorkflow(); $this->resetTransactions(); $roles = ['admin', 'superAdmin']; @@ -823,15 +839,15 @@ function testCanUserAddRemoveRole(){ */ $this->user = null; - foreach($roles as $role){ - $this->assertPermissionDenied(function() use($role){ + foreach ($roles as $role) { + $this->assertPermissionDenied(function () use ($role) { $user = $this->getUser('normal', 1); $user->addRole($role); }, "Asserting that guest user CANNOT add the role $role to a user"); } - foreach($roles as $role){ - $this->assertPermissionDenied(function() use($role){ + foreach ($roles as $role) { + $this->assertPermissionDenied(function () use ($role) { $user = $this->getUser($role, 1); $user->removeRole($role); }, "Asserting that guest user CANNOT remove the role $role of a user"); @@ -843,15 +859,15 @@ function testCanUserAddRemoveRole(){ */ $this->user = 'normal'; - foreach($roles as $role){ - $this->assertPermissionDenied(function() use($role){ + foreach ($roles as $role) { + $this->assertPermissionDenied(function () use ($role) { $user = $this->getUser('normal', 1); $user->addRole($role); }, "Asserting that normal user CANNOT add the role $role to a user"); } - foreach($roles as $role){ - $this->assertPermissionDenied(function() use($role){ + foreach ($roles as $role) { + $this->assertPermissionDenied(function () use ($role) { $user = $this->getUser($role, 1); $user->removeRole($role); }, "Asserting that normal user CANNOT remove the role $role of a user"); @@ -862,17 +878,17 @@ function testCanUserAddRemoveRole(){ */ $this->user = 'superAdmin'; - foreach($roles as $role){ - $this->assertPermissionGranted(function() use($role){ + foreach ($roles as $role) { + $this->assertPermissionGranted(function () use ($role) { $user = $this->getUser('normal', 1); $user->addRole($role); }, "Asserting that super admin user CAN add the role $role to a user"); } - foreach($roles as $role){ + foreach ($roles as $role) { $this->resetTransactions(); - $this->assertPermissionGranted(function() use($role){ + $this->assertPermissionGranted(function () use ($role) { $user = $this->getUser($role, 1); $user->removeRole($role); }, "Asserting that super admin user CAN remove the role $role of a user"); @@ -880,9 +896,10 @@ function testCanUserAddRemoveRole(){ $this->app->enableWorkflow(); } - function testSoftDeleteDestroy(){ - foreach(['normal', 'admin'] as $role){ - foreach ($this->entities as $class => $plural){ + function testSoftDeleteDestroy() + { + foreach (['normal', 'admin'] as $role) { + foreach ($this->entities as $class => $plural) { $this->resetTransactions(); $user = $this->getUser($role, 1); $this->user = $user; @@ -890,14 +907,14 @@ function testSoftDeleteDestroy(){ $entity = $this->getNewEntity($class); $entity->owner = $profile; $entity->save(true); - $this->assertPermissionDenied(function() use($entity){ + $this->assertPermissionDenied(function () use ($entity) { $entity->destroy(true); }, "Asserting that a $role user CANNOT destroy his own $plural"); } } - foreach ($this->entities as $class => $plural){ + foreach ($this->entities as $class => $plural) { $this->resetTransactions(); $user = $this->getUser('superAdmin', 1); $this->user = $user; @@ -905,14 +922,14 @@ function testSoftDeleteDestroy(){ $entity = $this->getNewEntity($class); $entity->owner = $profile; $entity->save(true); - $this->assertPermissionGranted(function() use($entity){ + $this->assertPermissionGranted(function () use ($entity) { $entity->destroy(true); }, "Asserting that a Super Admin user CAN destroy his own $plural"); } - foreach(['normal', 'admin'] as $role){ - foreach ($this->entities as $class => $plural){ + foreach (['normal', 'admin'] as $role) { + foreach ($this->entities as $class => $plural) { $this->resetTransactions(); $user = $this->getUser('normal', 0); @@ -924,14 +941,14 @@ function testSoftDeleteDestroy(){ $this->user = $this->getUser($role, 1); - $this->assertPermissionDenied(function() use($entity){ + $this->assertPermissionDenied(function () use ($entity) { $entity->destroy(true); }, "Asserting that a $role user CANNOT destroy other user $plural"); } } - foreach ($this->entities as $class => $plural){ + foreach ($this->entities as $class => $plural) { $this->resetTransactions(); $user = $this->getUser('normal', 0); @@ -943,7 +960,7 @@ function testSoftDeleteDestroy(){ $this->user = $this->getUser('superAdmin', 1); - $this->assertPermissionGranted(function() use($entity){ + $this->assertPermissionGranted(function () use ($entity) { $entity->destroy(true); }, "Asserting that a Super Admin user CAN destroy other user $plural"); diff --git a/tests/src/ProjectTest.php b/tests/unit/ProjectTests.php similarity index 91% rename from tests/src/ProjectTest.php rename to tests/unit/ProjectTests.php index 48cab9efd2..58d73952d7 100644 --- a/tests/src/ProjectTest.php +++ b/tests/unit/ProjectTests.php @@ -1,34 +1,37 @@ startsOn = date('Y-m-d', time() + 3600 * 24); $project->endsOn = date('Y-m-d H:i', time() + 3600 * 48); $this->assertFalse($project->isRegistrationOpen(), 'isRegistrationOpen() de um projeto no com datas no futuro deve ser false'); - + $project->startsOn = date('Y-m-d', time() - 3600 * 48); $project->endsOn = date('Y-m-d H:i', time() - 3600 * 24); $this->assertFalse($project->isRegistrationOpen(), 'isRegistrationOpen() de um projeto no com datas no passado deve ser false'); - + $project->startsOn = date('Y-m-d', time() - 3600 * 48); $project->endsOn = date('Y-m-d H:i', time() - 3600); $this->assertFalse($project->isRegistrationOpen(), 'isRegistrationOpen() de um projeto no com datas no passado deve ser false'); - + $project->startsOn = date('Y-m-d', time() - 3600 * 48); $project->endsOn = date('Y-m-d H:i', time() + 3600 * 48); $this->assertTrue($project->isRegistrationOpen(), 'isRegistrationOpen() de um projeto com data inicial no passado e data final no futuro deve ser true'); - + $project->startsOn = date('Y-m-d', time() - 3600 * 48); $project->endsOn = date('Y-m-d H:i', time() + 3600); $this->assertTrue($project->isRegistrationOpen(), 'isRegistrationOpen() de um projeto com data inicial no passado e data final no futuro deve ser true'); } - function testDatesValidations(){ + function testDatesValidations() + { $project = new Project; $project->name = "Test1"; $project->shortDescription = "A short description"; diff --git a/tests/unit/RoutesTest.php b/tests/unit/RoutesTest.php new file mode 100644 index 0000000000..a808832417 --- /dev/null +++ b/tests/unit/RoutesTest.php @@ -0,0 +1,69 @@ +user = null; + + $this->assertGet200('/', 'assert that home status code is 200'); + } + + function testPages() + { + $this->user = null; + + $this->assertGet200('/sobre/', 'assert that about page status code is 200'); + $this->assertGet200('/como-usar/', 'assert that about page status code is 200'); + } + + function testSearch() + { + $this->user = null; + + $this->assertGet200('/busca/', 'assert that about page status code is 200'); + } + + function test404() + { + $this->user = null; + + $this->assertGet404('/' . uniqid('404-'), 'assert that code is 404'); + } + + function testEntitiesRoutesWithGuest() + { + $this->user = null; + + foreach ($this->entities as $class => $name) { + $entities = $this->app->repo($class)->findAll(); + + $e = $entities[0]; + // foreach($entities as $e){ + $this->assertGet200($e->singleUrl, "assert that the status code of single of {$class} with id {$e->id} is 200 for guest users"); + $this->assertGet403($e->deleteUrl, "assert that the status code of delete url of {$class} with id {$e->id} is 401 for guest users"); + $this->assertGet401($e->editUrl, "assert that the status code of edit url of {$class} with id {$e->id} is 401 for guest users"); + // } + } + } + + function testEntitiesRoutesWithNormalUser() + { + $user = $this->getUser('normal'); + $this->user = $user; + + foreach ($this->entities as $class => $name) { + $entities = $user->$name; + + $e = $entities[0]; + // foreach($entities as $e){ + $this->assertGet200($e->singleUrl, "assert that the status code of single of my {$class} with id {$e->id} is 200"); + $this->assertGet200($e->editUrl, "assert that the status code of edit url of my {$class} with id {$e->id} is 200"); + // } + } + } + +} diff --git a/tests/src/SealTest.php b/tests/unit/SealTest.php similarity index 81% rename from tests/src/SealTest.php rename to tests/unit/SealTest.php index 621decac6b..26b94ddcfc 100644 --- a/tests/src/SealTest.php +++ b/tests/unit/SealTest.php @@ -1,48 +1,50 @@ resetTransactions(); $app = $this->app; $this->user = 'admin'; $exception = null; - - try{ - // pega um agente sem selo + + try { + // pega um agente sem selo $agent = $app->repo('Agent')->find(2); - + $seal = $app->repo('Seal')->find(1); // e tenta atribuir um selo - + $agent->createSealRelation($seal); - + } catch (Exception $ex) { $exception = $ex; } - + $this->assertNull($exception); } - - function testSealRelationPermissions(){ + + function testSealRelationPermissions() + { $this->resetTransactions(); $app = $this->app; - + // verifica que o guest user não pode atribuir selos $this->user = null; - $this->assertPermissionDenied(function() use($app){ + $this->assertPermissionDenied(function () use ($app) { // pega um agente sem selo $agent = $app->repo('Agent')->find(2); $seal = $app->repo('Seal')->find(1); // e tenta atribuir um selo $agent->createSealRelation($seal); - }); - + }); + // verifica que o admin user pode atribuir selos $this->user = 'admin'; - $this->assertPermissionGranted(function() use($app){ + $this->assertPermissionGranted(function () use ($app) { // pega um agente sem selo $agent = $app->repo('Agent')->find(2); $seal = $app->repo('Seal')->find(1); @@ -50,17 +52,17 @@ function testSealRelationPermissions(){ // e tenta atribuir um selo $agent->createSealRelation($seal); }); - + // testa se um usuário com controle de um selo pode atribuir selos $this->resetTransactions(); $this->user = 'admin'; - + $normal_user = $this->getUser('normal'); $seal = $app->repo('Seal')->find(1); $seal->createAgentRelation($normal_user->profile, 'admin', true); $this->user = $normal_user; - $this->assertAuthorizationRequestCreated(function() use($app){ + $this->assertAuthorizationRequestCreated(function () use ($app) { // pega um espaço sem selo $space = $app->repo('Space')->find(2); $seal = $app->repo('Seal')->find(1); @@ -75,7 +77,8 @@ function testSealRelationPermissions(){ * * @return void */ - function testSealRelationExpirationDate(){ + function testSealRelationExpirationDate() + { $this->resetTransactions(); //admin cria o seal relation espaço/selo diff --git a/tests/src/TaxonomiesTest.php b/tests/unit/TaxonomiesTests.php similarity index 79% rename from tests/src/TaxonomiesTest.php rename to tests/unit/TaxonomiesTests.php index 2cd48fdaec..9df52b6d10 100644 --- a/tests/src/TaxonomiesTest.php +++ b/tests/unit/TaxonomiesTests.php @@ -1,11 +1,13 @@ 'Test Taxonomy 1', @@ -14,106 +16,109 @@ protected function _registerTaxonomy(){ $id = 10; - foreach ($taxonomies as $slug => $description){ + foreach ($taxonomies as $slug => $description) { $id++; $def = new \MapasCulturais\Definitions\Taxonomy($id, $slug, $description); $app->registerTaxonomy('MapasCulturais\Entities\Agent', $def); } } - - function _getAgentById($id){ + + function _getAgentById($id) + { $app = App::i(); $app->em->clear(); return $app->repo('Agent')->find($id); } - - function testPersistence(){ + + function testPersistence() + { $this->_registerTaxonomy(); $this->user = 'normal'; - + $terms_1 = [ 'test_1' => ['test 1', 'test 2', 'test 3'], 'tag' => ['tag 1', 'tag 2'], - 'not_registered' => ['not 1', 'not 2'] + 'not_registered' => ['not 1', 'not 2'] ]; - + $terms_2 = [ 'test_1' => ['test 2', 'test 3', 'test 4'], 'test_2' => ['test 21', 'test 22', 'test 23'], 'tag' => ['tag 2', 'tag 3'], - 'not_registered' => ['not 1', 'not 2'] + 'not_registered' => ['not 1', 'not 2'] ]; - + $terms_3 = [ 'test_1' => ['test 2', 'test 3', 'test 4'] ]; - + $agent = $this->getNewEntity('Agent'); - + $agent->terms = $terms_1; $agent->save(true); - + $agent = $this->_getAgentById($agent->id); - + $this->assertEquals($terms_1['test_1'], $agent->terms['test_1'], 'Asserting that registered taxonomy terms was saved'); $this->assertEquals($terms_1['tag'], $agent->terms['tag'], 'Asserting that registered taxonomy terms was saved'); - + $agent->terms = $terms_2; $agent->save(true); - + $agent = $this->_getAgentById($agent->id); - + $this->assertEquals($terms_2['test_1'], $agent->terms['test_1'], 'Asserting that registered taxonomy terms was saved'); $this->assertEquals($terms_2['tag'], $agent->terms['tag'], 'Asserting that registered taxonomy terms was saved'); - + } - - function testNotRegisteredTaxonomies(){ + + function testNotRegisteredTaxonomies() + { $this->_registerTaxonomy(); $this->user = 'normal'; - + $app = App::i(); $conn = $app->em->getConnection(); - + $terms_1 = [ 'test_1' => ['test 1', 'test 2', 'test 3'], 'tag' => ['tag 1', 'tag 2'], - 'not_registered' => ['not 1', 'not 2'] + 'not_registered' => ['not 1', 'not 2'] ]; - + $terms_2 = [ 'test_1' => ['test 2', 'test 3', 'test 4'], 'test_2' => ['test 21', 'test 22', 'test 23'], 'tag' => ['tag 2', 'tag 3'], - 'not_registered' => ['not 1', 'not 2'] + 'not_registered' => ['not 1', 'not 2'] ]; - - + + $agent = $this->getNewEntity('Agent'); - + $agent->terms = $terms_1; - + $agent->save(true); - + $agent = $this->_getAgentById($agent->id); - + $this->assertArrayNotHasKey('not_registered', $agent->terms, 'Asserting that not registered taxonomy terms was not saved'); - - + + $conn->executeQuery("INSERT INTO term(id,taxonomy,term) VALUES (10000,'not_registered','not registered 1')"); $conn->executeQuery("INSERT INTO term(id,taxonomy,term) VALUES (10001,'not_registered','not registered 2')"); - + $conn->executeQuery("INSERT INTO term_relation(term_id,object_type,object_id) VALUES (10000,'MapasCulturais\Entities\Agent',{$agent->id})"); $conn->executeQuery("INSERT INTO term_relation(term_id,object_type,object_id) VALUES (10001,'MapasCulturais\Entities\Agent',{$agent->id})"); - + $agent = $this->_getAgentById($agent->id); $agent->terms = $terms_2; $agent->save(true); - + $agent = $this->_getAgentById($agent->id); $trs = $conn->fetchAll('SELECT * FROM term_relation WHERE term_id IN (10000,10001)'); - - $this->assertEquals(2,count($trs), 'Asserting that not registered taxonomy terms was not deleted after save terms'); - + + $this->assertEquals(2, count($trs), 'Asserting that not registered taxonomy terms was not deleted after save terms'); + } } \ No newline at end of file diff --git a/tests/src/WorkflowTest.php b/tests/unit/WorkflowTest.php similarity index 76% rename from tests/src/WorkflowTest.php rename to tests/unit/WorkflowTest.php index 7022a3f4ac..1fa4284f39 100644 --- a/tests/src/WorkflowTest.php +++ b/tests/unit/WorkflowTest.php @@ -1,9 +1,11 @@ assertTrue($this->app->isWorkflowEnabled(), 'Asserting that workflow is enabled by default.'); $this->app->disableWorkflow(); @@ -14,20 +16,21 @@ function testEnableAndDisableWorkflow(){ } - function testAuthorityRequestCreation(){ + function testAuthorityRequestCreation() + { $this->app->enableWorkflow(); // asserting that the request authority is created when user tries to TAKE ownership of an entity - foreach($this->entities as $class => $e){ + foreach ($this->entities as $class => $e) { $this->resetTransactions(); - $user1 = $this->getUser('normal',0); - $user2 = $this->getUser('normal',1); + $user1 = $this->getUser('normal', 0); + $user2 = $this->getUser('normal', 1); $entities = $user1->$e; $entity = $entities[0]; - $this->assertAuthorizationRequestCreated(function() use($user2, $entity){ + $this->assertAuthorizationRequestCreated(function () use ($user2, $entity) { $this->user = $user2; $entity->owner = $user2->profile; $entity->save(); @@ -35,48 +38,48 @@ function testAuthorityRequestCreation(){ } // asserting that the request authority is created when user tries to TAKE ownership of an entity to another user agent that he has control - foreach($this->entities as $class => $e){ + foreach ($this->entities as $class => $e) { $this->resetTransactions(); - - + + $admin = $this->getUser('admin'); $this->user = $admin; - + $newAgent = $this->getNewEntity('Agent', $admin); $newAgent->owner = $admin->profile; $newAgent->save(true); - - $user1 = $this->getUser('normal',0); - $user2 = $this->getUser('normal',1); - + + $user1 = $this->getUser('normal', 0); + $user2 = $this->getUser('normal', 1); + $newAgent->createAgentRelation($user2->profile, 'CONTROL', true, true, true); - + $this->user = $user2; - + $this->app->em->refresh($newAgent); - + $entities = $user1->$e; $entity = $entities[0]; - - - $this->assertAuthorizationRequestCreated(function() use($newAgent, $entity){ + + + $this->assertAuthorizationRequestCreated(function () use ($newAgent, $entity) { $entity->owner = $newAgent; $entity->save(); }, "Asserting that AuthorityRequest is created when an user tries to take ownership of a {$class}. to another user agent that he has control"); - + } // asserting that the request authority is created when user tries to GIVE ownership of an entity - foreach($this->entities as $class => $e){ + foreach ($this->entities as $class => $e) { $this->resetTransactions(); - $user1 = $this->getUser('normal',0); - $user2 = $this->getUser('normal',1); + $user1 = $this->getUser('normal', 0); + $user2 = $this->getUser('normal', 1); $entities = $user1->$e; $entity = $entities[0]; - $this->assertAuthorizationRequestCreated(function() use($user1, $user2, $entity){ + $this->assertAuthorizationRequestCreated(function () use ($user1, $user2, $entity) { $this->user = $user1; $entity->owner = $user2->profile; $entity->save(); @@ -84,17 +87,17 @@ function testAuthorityRequestCreation(){ } // asserting that a user CANNOT create authority requests to another user - foreach($this->entities as $class => $e){ + foreach ($this->entities as $class => $e) { $this->resetTransactions(); - $user1 = $this->getUser('admin',0); - $user2 = $this->getUser('normal',1); - $user3 = $this->getUser('normal',0); + $user1 = $this->getUser('admin', 0); + $user2 = $this->getUser('normal', 1); + $user3 = $this->getUser('normal', 0); $entities = $user1->$e; $entity = $entities[0]; - $this->assertPermissionDenied(function() use($user2, $user3, $entity){ + $this->assertPermissionDenied(function () use ($user2, $user3, $entity) { $this->user = $user3; $entity->owner = $user2->profile; @@ -104,15 +107,16 @@ function testAuthorityRequestCreation(){ } } - function testAuthorityRequestAprove(){ + function testAuthorityRequestAprove() + { $this->app->enableWorkflow(); // asserting that authority workflow works - foreach($this->entities as $class => $e){ + foreach ($this->entities as $class => $e) { $this->resetTransactions(); - $user1 = $this->getUser('normal',0); - $user2 = $this->getUser('normal',1); + $user1 = $this->getUser('normal', 0); + $user2 = $this->getUser('normal', 1); $this->user = $user1; @@ -124,7 +128,7 @@ function testAuthorityRequestAprove(){ $request = null; // create the request - try{ + try { $entity->owner = $user2->profile; $entity->save(); @@ -136,14 +140,14 @@ function testAuthorityRequestAprove(){ $this->assertInstanceOf('MapasCulturais\Entities\RequestChangeOwnership', $request, "asserting that the request was created"); - $this->assertEquals ($user1->id, $entity->ownerUser->id, "Asserting that BEFORE the request is approved, de owner was NOT changed"); + $this->assertEquals($user1->id, $entity->ownerUser->id, "Asserting that BEFORE the request is approved, de owner was NOT changed"); $this->user = $user2; $this->assertFalse($entity->canUser('remove'), "Asserting that the user that will receive the $class CANNOT remove it BEFORE the request is approved"); $this->assertFalse($entity->canUser('modify'), "Asserting that the user that will receive the $class CANNOT modify it BEFORE the request is approved"); - $this->assertPermissionGranted(function() use($request){ + $this->assertPermissionGranted(function () use ($request) { $request->approve(); }, 'Asserting that the user that was requested CAN approve the request'); @@ -171,7 +175,7 @@ function testAuthorityRequestAprove(){ // Who can Approve: users that control the ORIGIN entity owner agent // Who can Reject: users that can create or approve the request -// function testRequestChangeOwnershipRequest(){ + // function testRequestChangeOwnershipRequest(){ // $this->app->enableWorkflow(); // } @@ -211,9 +215,9 @@ function testAuthorityRequestAprove(){ // $this->app->enableWorkflow(); // } - -// RequestEventOccurrence, -// RequestEventProject + // RequestEventOccurrence, + + // RequestEventProject } diff --git a/tests/src/classes/TestCase.php b/tests/unit/classes/TestCase.php similarity index 72% rename from tests/src/classes/TestCase.php rename to tests/unit/classes/TestCase.php index e8d77a01aa..bec81becaf 100644 --- a/tests/src/classes/TestCase.php +++ b/tests/unit/classes/TestCase.php @@ -1,10 +1,16 @@ init($config); -abstract class MapasCulturais_TestCase extends \PHPUnit\Framework\TestCase +abstract class TestCase extends \PHPUnit\Framework\TestCase { /** * @@ -22,13 +28,14 @@ abstract class MapasCulturais_TestCase extends \PHPUnit\Framework\TestCase /** * Test Factory * - * @var MapasCulturais_TestFactory + * @var TestFactory */ protected $factory; - public function __construct($name = NULL, array $data = array(), $dataName = '') { + public function __construct($name = NULL, array $data = array(), $dataName = '') + { $this->app = App::i(); - $this->factory = new MapasCulturais_TestFactory($this->app); + $this->factory = new TestFactory($this->app); $this->backupGlobals = false; $this->backupStaticAttributes = false; @@ -36,12 +43,13 @@ public function __construct($name = NULL, array $data = array(), $dataName = '') parent::__construct($name, $data, $dataName); } - public function __set($name, $value) { - if($name === 'user'){ - if(is_object($value) && $value instanceof Entities\User) + public function __set($name, $value) + { + if ($name === 'user') { + if (is_object($value) && $value instanceof Entities\User) $this->app->auth->authenticatedUser = $value; else - $this->setUserId ($value); + $this->setUserId($value); } } @@ -51,10 +59,11 @@ public function __set($name, $value) { * @param mixed $user * @return \MapasCulturais\Entity */ - function getNewEntity($class, $user = null, $owner = null){ + function getNewEntity($class, $user = null, $owner = null) + { $app = $this->app; - if(!is_null($user)){ + if (!is_null($user)) { $_user = $app->user->is('guest') ? null : $app->user; $this->user = $user; } @@ -65,52 +74,59 @@ function getNewEntity($class, $user = null, $owner = null){ $type = array_shift($_types); $entity = new $classname; - $entity->name = "Test $class " . uniqid(); + $entity->name = "Test $class " . uniqid(); $entity->type = $type; $entity->shortDescription = 'A litle short description'; - if($owner){ + if ($owner) { $entity->owner = $owner; - } else if($app->user->is('guest') && $user && $classname::usesOwnerAgent()){ + } else if ($app->user->is('guest') && $user && $classname::usesOwnerAgent()) { $entity->owner = $user->profile; } - if(!is_null($user)){ + if (!is_null($user)) { $this->user = $_user; } return $entity; } - - function assertStatus($method, $status, $url, $message){ + + function assertStatus($method, $status, $url, $message) + { $c = $this->$method($url); $this->assertEquals($status, $c->http_status_code, $message); return $c; } - function assertGet200($url, $message){ + function assertGet200($url, $message) + { return $this->assertStatus('get', 200, $url, $message); } - function assertGet401($url, $message){ + function assertGet401($url, $message) + { return $this->assertStatus('get', 401, $url, $message); } - function assertGet403($url, $message){ + function assertGet403($url, $message) + { return $this->assertStatus('get', 403, $url, $message); } - function assertGet404($url, $message){ + function assertGet404($url, $message) + { return $this->assertStatus('get', 404, $url, $message); } - function assertGet503($url, $message){ + function assertGet503($url, $message) + { return $this->assertStatus('get', 503, $url, $message); } - - function assertPermissionDenied($callable, $msg = ''){ + + function assertPermissionDenied($callable, $msg = '') + { $exception = null; - try{ + try { $callable = \Closure::bind($callable, $this); $callable(); } catch (\Exception $ex) { @@ -121,9 +137,10 @@ function assertPermissionDenied($callable, $msg = ''){ } - function assertPermissionGranted($callable, $msg = ''){ + function assertPermissionGranted($callable, $msg = '') + { $exception = null; - try{ + try { $callable = \Closure::bind($callable, $this); $callable(); } catch (\Exception $ex) { @@ -134,26 +151,28 @@ function assertPermissionGranted($callable, $msg = ''){ $this->assertEmpty($exception, $msg); } - function assertAuthorizationRequestCreated($callable, $msg = ''){ + function assertAuthorizationRequestCreated($callable, $msg = '') + { $exception = null; - try{ + try { $callable = \Closure::bind($callable, $this); $callable(); - }catch (\MapasCulturais\Exceptions\WorkflowRequest $ex) { + } catch (\MapasCulturais\Exceptions\WorkflowRequest $ex) { $exception = $ex; - }catch(\Exception $ex){ + } catch (\Exception $ex) { $exception = $ex; } - if(is_object($exception) && substr(get_class($exception),0,9) === 'Doctrine\\'){ + if (is_object($exception) && substr(get_class($exception), 0, 9) === 'Doctrine\\') { throw $exception; } $this->assertInstanceOf('MapasCulturais\Exceptions\WorkflowRequest', $exception, $msg); } - public function setUserId($user_id = null){ - if(!is_null($user_id)) + public function setUserId($user_id = null) + { + if (!is_null($user_id)) $this->app->auth->authenticatedUser = $this->getUser($user_id); else $this->app->auth->logout(); @@ -165,12 +184,13 @@ public function setUserId($user_id = null){ * @param type $index * @return MapasCulturais\Entities\User */ - public function getUser($user_id = null, $index = 0){ - if($user_id instanceof Entities\User){ + public function getUser($user_id = null, $index = 0) + { + if ($user_id instanceof Entities\User) { return $user_id; - }else if(key_exists($user_id, $this->app->config['userIds'])){ + } else if (key_exists($user_id, $this->app->config['userIds'])) { return $this->app->repo('User')->find($this->app->config['userIds'][$user_id][$index]); - }else{ + } else { return $this->app->repo('User')->find($user_id); } } @@ -191,7 +211,8 @@ protected function tearDown(): void parent::tearDown(); } - function resetTransactions(){ + function resetTransactions() + { $this->app->em->rollback(); $this->app->em->clear(); $this->app->em->beginTransaction(); @@ -199,11 +220,12 @@ function resetTransactions(){ // Abstract way to make a request to SlimPHP, this allows us to mock the // slim environment - public function request($method, $path, $options = array()) { + public function request($method, $path, $options = array()) + { $baseUrl = 'http://localhost:8888'; - if(strpos($path, $baseUrl) !== 0){ + if (strpos($path, $baseUrl) !== 0) { $url = $baseUrl . $path; - }else{ + } else { $url = $path; } @@ -246,4 +268,4 @@ public function head($path, $options = array()) return $this->request('HEAD', $path, $options); } -} \ No newline at end of file +} diff --git a/tests/src/Entity.inc.TestEntities.php b/tests/unit/classes/TestEntity.php similarity index 86% rename from tests/src/Entity.inc.TestEntities.php rename to tests/unit/classes/TestEntity.php index 98b0759bf0..cc32f5f414 100644 --- a/tests/src/Entity.inc.TestEntities.php +++ b/tests/unit/classes/TestEntity.php @@ -1,4 +1,5 @@ [ 'v::brPhone()' => "Não é um telefone válido" diff --git a/tests/src/classes/TestFactory.php b/tests/unit/classes/TestFactory.php similarity index 76% rename from tests/src/classes/TestFactory.php rename to tests/unit/classes/TestFactory.php index 92acfa548e..b9c7cc2490 100644 --- a/tests/src/classes/TestFactory.php +++ b/tests/unit/classes/TestFactory.php @@ -1,8 +1,10 @@ 0, 'Space' => 0, @@ -21,19 +23,21 @@ class MapasCulturais_TestFactory{ public $autoPersist = false; - function __construct(MapasCulturais\App $app) { + function __construct(\MapasCulturais\App $app) + { $this->app = $app; } - - function getEntityProperties($entity, $props = []){ + + function getEntityProperties($entity, $props = []) + { $result = []; $entity_num = $this->entitiesCount[$entity]; - foreach($props as $prop){ - if($prop == 'owner') { - if($this->app->auth->isUserAuthenticated()){ + foreach ($props as $prop) { + if ($prop == 'owner') { + if ($this->app->auth->isUserAuthenticated()) { $result[$prop] = $this->app->user->profile; } - } elseif($prop == 'type') { + } elseif ($prop == 'type') { $_types = $this->app->getRegisteredEntityTypes("MapasCulturais\\Entities\\{$entity}"); $result[$prop] = array_shift($_types); } else { @@ -44,31 +48,34 @@ function getEntityProperties($entity, $props = []){ return $result; } - function createEntity($class, $properties = []){ - if(!class_exists($class) && class_exists('MapasCulturais\\Entities\\' . $class)){ + function createEntity($class, $properties = []) + { + if (!class_exists($class) && class_exists('MapasCulturais\\Entities\\' . $class)) { $class = 'MapasCulturais\\Entities\\' . $class; } $entity = new $class; - foreach($properties as $prop => $val){ + foreach ($properties as $prop => $val) { $entity->$prop = $val; } $count_key = str_replace('MapasCulturais\\Entities\\', '', $class); - if(!isset($this->entitiesCount[$count_key])) $this->entitiesCount[$count_key] = 0; - + if (!isset($this->entitiesCount[$count_key])) + $this->entitiesCount[$count_key] = 0; + $this->entitiesCount[$count_key]++; - if($this->autoPersist){ + if ($this->autoPersist) { $entity->save(true); } return $entity; } - function createAgent($properties = []){ + function createAgent($properties = []) + { $class = 'Agent'; $properties = $properties + $this->getEntityProperties($class, ['name', 'type', 'shortDescription']); @@ -77,7 +84,8 @@ function createAgent($properties = []){ return $entity; } - function createSpace($properties = []){ + function createSpace($properties = []) + { $class = 'Space'; $properties = $properties + $this->getEntityProperties($class, ['name', 'type', 'shortDescription', 'owner']); @@ -86,7 +94,8 @@ function createSpace($properties = []){ return $entity; } - function createProject($properties = []){ + function createProject($properties = []) + { $class = 'Project'; $properties = $properties + $this->getEntityProperties($class, ['name', 'type', 'shortDescription', 'owner']); @@ -95,7 +104,8 @@ function createProject($properties = []){ return $entity; } - function createEvent($properties = []){ + function createEvent($properties = []) + { $class = 'Event'; $properties = $properties + $this->getEntityProperties($class, ['name', 'type', 'shortDescription', 'owner']); @@ -104,21 +114,23 @@ function createEvent($properties = []){ return $entity; } - function parseEvent($event = null){ - if( is_null($event) ){ + function parseEvent($event = null) + { + if (is_null($event)) { $event = $this->createEvent(); - } else if( is_array($event) ){ + } else if (is_array($event)) { $event = $this->createEvent($event); - } else if(!$event instanceof Entities\Event ){ + } else if (!$event instanceof Entities\Event) { throw new \Exception('Invalid argument event'); } return $event; } - function parseDate($date, $format = 'Y-m-d') { + function parseDate($date, $format = 'Y-m-d') + { $d = DateTime::createFromFormat($format, $date); - if($d && $d->format($format) === $date){ + if ($d && $d->format($format) === $date) { return $d; } else { return null; @@ -135,43 +147,44 @@ function parseDate($date, $format = 'Y-m-d') { * @param string $frequency * @return void */ - function createEventOccurrence($event, Entities\Space $space, string $starts, int $duration, string $frequency, $until = null, $weekdays = null){ + function createEventOccurrence($event, Entities\Space $space, string $starts, int $duration, string $frequency, $until = null, $weekdays = null) + { $starts = $this->parseDate($starts, 'Y-m-d H:i'); - if(!$starts){ + if (!$starts) { throw new \Exception('Invalid date format for argument $starts'); } - - if($duration < 0){ + + if ($duration < 0) { throw new \Exception('Duration must be a positive integer'); } - + $endsAt = clone $starts; - if($duration){ + if ($duration) { $endsAt->add(new \DateInterval("PT{$duration}M")); } $rule = [ - "spaceId" => $space->id, - "startsOn" => $starts->format('Y-m-d'), - "startsAt" => $starts->format('H:i'), - "duration" => $duration, + "spaceId" => $space->id, + "startsOn" => $starts->format('Y-m-d'), + "startsAt" => $starts->format('H:i'), + "duration" => $duration, "frequency" => $frequency, "description" => "description of event occurrence" ]; - if($until) { + if ($until) { $rule['until'] = $until; } - if($frequency == 'weekly'){ - if($weekdays){ + if ($frequency == 'weekly') { + if ($weekdays) { $object = []; - foreach($weekdays as $day){ + foreach ($weekdays as $day) { $object["$day"] = 'on'; } - $rule["day"] = (object) $object; + $rule["day"] = (object) $object; } } @@ -184,7 +197,7 @@ function createEventOccurrence($event, Entities\Space $space, string $starts, in return $event_occurrence; } - /** + /** * Cria um evento ou occorrência única para o evento informado. * * @param string $starts ex: 2019-04-23 22:00 @@ -193,7 +206,8 @@ function createEventOccurrence($event, Entities\Space $space, string $starts, in * @param array|Entities\Event $event * @return MapasCulturais\Entities\Event */ - function createSingleEventOccurrence(string $starts, int $duration, Entities\Space $space, $event = null){ + function createSingleEventOccurrence(string $starts, int $duration, Entities\Space $space, $event = null) + { $event_occurrence = $this->createEventOccurrence($event, $space, $starts, $duration, 'once'); return $event_occurrence; @@ -209,14 +223,15 @@ function createSingleEventOccurrence(string $starts, int $duration, Entities\Spa * @param array|Entities\Event $event * @return MapasCulturais\Entities\Event */ - function createDailyEventOccurrence(string $starts, int $duration, string $until, Entities\Space $space, $event = null){ - + function createDailyEventOccurrence(string $starts, int $duration, string $until, Entities\Space $space, $event = null) + { + $until = $this->parseDate($until, 'Y-m-d'); - - if(!$until){ + + if (!$until) { throw new \Exception('Invalid date format for argument $until'); } - + $event_occurrence = $this->createEventOccurrence($event, $space, $starts, $duration, 'daily', $until); $event_occurrence->setUntil($until); @@ -236,14 +251,15 @@ function createDailyEventOccurrence(string $starts, int $duration, string $until * @param array|Entities\Event $event * @return MapasCulturais\Entities\Event */ - function createWeeklyEventOccurrence(string $starts, int $duration, string $until, array $weekdays, Entities\Space $space, $event = null){ - + function createWeeklyEventOccurrence(string $starts, int $duration, string $until, array $weekdays, Entities\Space $space, $event = null) + { + $until = $this->parseDate($until, 'Y-m-d'); - - if(!$until){ + + if (!$until) { throw new \Exception('Invalid date format for argument $until'); } - + $event_occurrence = $this->createEventOccurrence($event, $space, $starts, $duration, 'weekly', $until, $weekdays); $event_occurrence->setUntil($until); diff --git a/tests/unit/files/.gitignore b/tests/unit/files/.gitignore new file mode 100644 index 0000000000..e69de29bb2