From ddbbf8692fd5dcb091377f29f06d6b9e04e028c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Purga=C5=82?= Date: Mon, 24 Feb 2025 03:10:35 +0100 Subject: [PATCH 1/7] add blt --- .env.behat | 71 +++ composer.json | 19 +- composer.lock | 1138 +++++++++++++++++++++++++++++++++++++++--------- config/blt.php | 24 + 4 files changed, 1036 insertions(+), 216 deletions(-) create mode 100644 .env.behat create mode 100644 config/blt.php diff --git a/.env.behat b/.env.behat new file mode 100644 index 0000000..a80b1ab --- /dev/null +++ b/.env.behat @@ -0,0 +1,71 @@ +APP_NAME=community-with-legends +VITE_APP_NAME=community-with-legends +APP_ENV=local +APP_KEY=base64:sCsJw8z+d/4ymp0OvzSip2h4Vp2hZZhpV2uOxgTqP94= +APP_DEBUG=true +APP_URL=http://api.community-with-legends.mmr.localhost + +APP_LOCALE=en +APP_FALLBACK_LOCALE=en +APP_FAKER_LOCALE=en_US + +APP_MAINTENANCE_DRIVER=file +APP_MAINTENANCE_STORE=database + +BCRYPT_ROUNDS=12 + +LOG_CHANNEL=stack +LOG_DEPRECATIONS_CHANNEL=null +LOG_LEVEL=debug + +DB_CONNECTION=pgsql +DB_HOST=community-with-legends-db-dev +DB_PORT=5432 +DB_DATABASE=community-with-legends +DB_USERNAME=community-with-legends +DB_PASSWORD=password +DB_ROOT_PASSWORD=example + +SESSION_DRIVER=redis +SESSION_LIFETIME=120 +SESSION_ENCRYPT=false +SESSION_PATH=/ +SESSION_DOMAIN=null + +BROADCAST_CONNECTION=log +FILESYSTEM_DISK=local +QUEUE_CONNECTION=redis + +CACHE_STORE=redis +CACHE_PREFIX= + +MEMCACHED_HOST=127.0.0.1 + +REDIS_CLIENT=phpredis +REDIS_HOST=community-with-legends-redis-dev +REDIS_PASSWORD=null +REDIS_PORT=6379 + +MAIL_MAILER=smtp +MAIL_HOST=mailpit +MAIL_PORT=1025 +MAIL_USERNAME=null +MAIL_PASSWORD=null +MAIL_ENCRYPTION=null +MAIL_FROM_ADDRESS="hello@example.com" +MAIL_FROM_NAME="${APP_NAME}" + +AWS_ACCESS_KEY_ID= +AWS_SECRET_ACCESS_KEY= +AWS_DEFAULT_REGION=us-east-1 +AWS_BUCKET= +AWS_USE_PATH_STYLE_ENDPOINT=false + +# DOCKER +DOCKER_APP_HOST_PORT=63861 +DOCKER_DATABASE_HOST_PORT=63863 +DOCKER_MAILPIT_DASHBOARD_HOST_PORT=63864 +DOCKER_REDIS_HOST_PORT=63862 +DOCKER_INSTALL_XDEBUG=true + +DOCKER_HOST_USER_ID=1000 diff --git a/composer.json b/composer.json index 7acbe02..dbe346d 100644 --- a/composer.json +++ b/composer.json @@ -1,17 +1,23 @@ { - "name": "blumilksoftware/community-with-legends", + "name": "mmr/community-with-legends", "type": "project", "description": "community-with-legends project.", "keywords": ["framework", "laravel"], "license": "MIT", + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/MRR-Group/blt" + } + ], "require": { "php": "^8.3.4", "ext-pdo": "*", "guzzlehttp/guzzle": "^7.9.2", - "inertiajs/inertia-laravel": "^1.3.1", - "laravel/framework": "^11.34.2", - "laravel/sanctum": "^4.0.5", - "laravel/tinker": "^2.10.0" + "laravel/framework": "^11.43.2", + "laravel/sanctum": "^4.0.8", + "laravel/tinker": "^2.10.1", + "spatie/laravel-permission": "^6.15" }, "require-dev": { "blumilksoftware/codestyle": "^v3.3.0", @@ -20,7 +26,8 @@ "nunomaduro/collision": "^8.5.0", "nunomaduro/larastan": "^3.1.0", "phpunit/phpunit": "^11.4.4", - "spatie/laravel-ignition": "^2.9.0" + "spatie/laravel-ignition": "^2.9.0", + "blumilksoftware/blt": "^v0.1.1" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 12e11d7..44c6742 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": "677e4812e2584d1324ec47894a919313", + "content-hash": "ccd6d6cb1ce4afe33b7f3f448ad43839", "packages": [ { "name": "brick/math", @@ -1054,82 +1054,6 @@ ], "time": "2025-02-03T10:55:03+00:00" }, - { - "name": "inertiajs/inertia-laravel", - "version": "v1.3.2", - "source": { - "type": "git", - "url": "https://github.com/inertiajs/inertia-laravel.git", - "reference": "7e6a030ffab315099782a4844a2175455f511c68" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/inertiajs/inertia-laravel/zipball/7e6a030ffab315099782a4844a2175455f511c68", - "reference": "7e6a030ffab315099782a4844a2175455f511c68", - "shasum": "" - }, - "require": { - "ext-json": "*", - "laravel/framework": "^8.74|^9.0|^10.0|^11.0", - "php": "^7.3|~8.0.0|~8.1.0|~8.2.0|~8.3.0|~8.4.0", - "symfony/console": "^5.3|^6.0|^7.0" - }, - "require-dev": { - "mockery/mockery": "^1.3.3", - "orchestra/testbench": "^6.45|^7.44|^8.25|^9.3", - "phpunit/phpunit": "^8.0|^9.5.8|^10.4", - "roave/security-advisories": "dev-master" - }, - "suggest": { - "ext-pcntl": "Recommended when running the Inertia SSR server via the `inertia:start-ssr` artisan command." - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "Inertia\\ServiceProvider" - ] - }, - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "files": [ - "./helpers.php" - ], - "psr-4": { - "Inertia\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jonathan Reinink", - "email": "jonathan@reinink.ca", - "homepage": "https://reinink.ca" - } - ], - "description": "The Laravel adapter for Inertia.js.", - "keywords": [ - "inertia", - "laravel" - ], - "support": { - "issues": "https://github.com/inertiajs/inertia-laravel/issues", - "source": "https://github.com/inertiajs/inertia-laravel/tree/v1.3.2" - }, - "funding": [ - { - "url": "https://github.com/reinink", - "type": "github" - } - ], - "time": "2024-12-05T14:52:50+00:00" - }, { "name": "laravel/framework", "version": "v11.43.2", @@ -3439,6 +3363,89 @@ ], "time": "2024-04-27T21:32:50+00:00" }, + { + "name": "spatie/laravel-permission", + "version": "6.15.0", + "source": { + "type": "git", + "url": "https://github.com/spatie/laravel-permission.git", + "reference": "86074fcfd127f9fa7bcdf550b7c938e3beb0d65f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/laravel-permission/zipball/86074fcfd127f9fa7bcdf550b7c938e3beb0d65f", + "reference": "86074fcfd127f9fa7bcdf550b7c938e3beb0d65f", + "shasum": "" + }, + "require": { + "illuminate/auth": "^8.12|^9.0|^10.0|^11.0|^12.0", + "illuminate/container": "^8.12|^9.0|^10.0|^11.0|^12.0", + "illuminate/contracts": "^8.12|^9.0|^10.0|^11.0|^12.0", + "illuminate/database": "^8.12|^9.0|^10.0|^11.0|^12.0", + "php": "^8.0" + }, + "require-dev": { + "laravel/passport": "^11.0|^12.0", + "laravel/pint": "^1.0", + "orchestra/testbench": "^6.23|^7.0|^8.0|^9.0|^10.0", + "phpunit/phpunit": "^9.4|^10.1|^11.5" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Spatie\\Permission\\PermissionServiceProvider" + ] + }, + "branch-alias": { + "dev-main": "6.x-dev", + "dev-master": "6.x-dev" + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Spatie\\Permission\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "Permission handling for Laravel 8.0 and up", + "homepage": "https://github.com/spatie/laravel-permission", + "keywords": [ + "acl", + "laravel", + "permission", + "permissions", + "rbac", + "roles", + "security", + "spatie" + ], + "support": { + "issues": "https://github.com/spatie/laravel-permission/issues", + "source": "https://github.com/spatie/laravel-permission/tree/6.15.0" + }, + "funding": [ + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2025-02-17T19:18:01+00:00" + }, { "name": "symfony/clock", "version": "v7.2.0", @@ -5941,36 +5948,62 @@ ], "packages-dev": [ { - "name": "blumilksoftware/codestyle", - "version": "v3.3", + "name": "behat/behat", + "version": "v3.19.0", "source": { "type": "git", - "url": "https://github.com/blumilksoftware/codestyle.git", - "reference": "aecc480cd600c91da459999685e54ba0f9821507" + "url": "https://github.com/Behat/Behat.git", + "reference": "6cf82375a88145e33e10a34b211a3f914cbd02ee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/blumilksoftware/codestyle/zipball/aecc480cd600c91da459999685e54ba0f9821507", - "reference": "aecc480cd600c91da459999685e54ba0f9821507", + "url": "https://api.github.com/repos/Behat/Behat/zipball/6cf82375a88145e33e10a34b211a3f914cbd02ee", + "reference": "6cf82375a88145e33e10a34b211a3f914cbd02ee", "shasum": "" }, "require": { - "friendsofphp/php-cs-fixer": "^3.59", - "kubawerlos/php-cs-fixer-custom-fixers": "^3.21", - "php": "^8.1" + "behat/gherkin": "^4.10.0", + "behat/transliterator": "^1.5", + "composer-runtime-api": "^2.2", + "composer/xdebug-handler": "^3.0", + "ext-mbstring": "*", + "php": "8.1.* || 8.2.* || 8.3.* || 8.4.* ", + "psr/container": "^1.0 || ^2.0", + "symfony/config": "^5.4 || ^6.4 || ^7.0", + "symfony/console": "^5.4 || ^6.4 || ^7.0", + "symfony/dependency-injection": "^5.4 || ^6.4 || ^7.0", + "symfony/event-dispatcher": "^5.4 || ^6.4 || ^7.0", + "symfony/translation": "^5.4 || ^6.4 || ^7.0", + "symfony/yaml": "^5.4 || ^6.4 || ^7.0" }, "require-dev": { - "jetbrains/phpstorm-attributes": "^1.1", - "phpunit/phpunit": "^10.0|^11.2", - "symfony/console": "^6.0|^7.0" + "friendsofphp/php-cs-fixer": "^3.68", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^9.6", + "sebastian/diff": "^4.0", + "symfony/polyfill-php84": "^1.31", + "symfony/process": "^5.4 || ^6.4 || ^7.0" + }, + "suggest": { + "ext-dom": "Needed to output test results in JUnit format." }, "bin": [ - "bin/codestyle" + "bin/behat" ], "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, "autoload": { "psr-4": { - "Blumilk\\Codestyle\\": "src/" + "Behat\\Hook\\": "src/Behat/Hook/", + "Behat\\Step\\": "src/Behat/Step/", + "Behat\\Behat\\": "src/Behat/Behat/", + "Behat\\Config\\": "src/Behat/Config/", + "Behat\\Testwork\\": "src/Behat/Testwork/", + "Behat\\Transformation\\": "src/Behat/Transformation/" } }, "notification-url": "https://packagist.org/downloads/", @@ -5979,43 +6012,67 @@ ], "authors": [ { - "name": "Krzysztof Rewak", - "email": "krzysztof.rewak@blumilk.pl" + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" } ], - "description": "Blumilk codestyle configurator", + "description": "Scenario-oriented BDD framework for PHP", + "homepage": "https://behat.org/", + "keywords": [ + "Agile", + "BDD", + "ScenarioBDD", + "Scrum", + "StoryBDD", + "User story", + "business", + "development", + "documentation", + "examples", + "symfony", + "testing" + ], "support": { - "issues": "https://github.com/blumilksoftware/codestyle/issues", - "source": "https://github.com/blumilksoftware/codestyle/tree/v3.3" + "issues": "https://github.com/Behat/Behat/issues", + "source": "https://github.com/Behat/Behat/tree/v3.19.0" }, - "time": "2024-08-02T05:18:46+00:00" + "time": "2025-02-13T09:07:11+00:00" }, { - "name": "clue/ndjson-react", - "version": "v1.3.0", + "name": "behat/gherkin", + "version": "v4.11.0", "source": { "type": "git", - "url": "https://github.com/clue/reactphp-ndjson.git", - "reference": "392dc165fce93b5bb5c637b67e59619223c931b0" + "url": "https://github.com/Behat/Gherkin.git", + "reference": "32821a17b12620951e755b5d49328a6421a5b5b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/clue/reactphp-ndjson/zipball/392dc165fce93b5bb5c637b67e59619223c931b0", - "reference": "392dc165fce93b5bb5c637b67e59619223c931b0", + "url": "https://api.github.com/repos/Behat/Gherkin/zipball/32821a17b12620951e755b5d49328a6421a5b5b5", + "reference": "32821a17b12620951e755b5d49328a6421a5b5b5", "shasum": "" }, "require": { - "php": ">=5.3", - "react/stream": "^1.2" + "php": "8.1.* || 8.2.* || 8.3.* || 8.4.*" }, "require-dev": { - "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35", - "react/event-loop": "^1.2" + "cucumber/cucumber": "dev-gherkin-24.1.0", + "phpunit/phpunit": "^9.6", + "symfony/yaml": "^5.4 || ^6.4 || ^7.0" + }, + "suggest": { + "symfony/yaml": "If you want to parse features, represented in YAML files" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, "autoload": { - "psr-4": { - "Clue\\React\\NDJson\\": "src/" + "psr-0": { + "Behat\\Gherkin": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -6024,150 +6081,374 @@ ], "authors": [ { - "name": "Christian Lück", - "email": "christian@clue.engineering" + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" } ], - "description": "Streaming newline-delimited JSON (NDJSON) parser and encoder for ReactPHP.", - "homepage": "https://github.com/clue/reactphp-ndjson", + "description": "Gherkin DSL parser for PHP", + "homepage": "http://behat.org/", "keywords": [ - "NDJSON", - "json", - "jsonlines", - "newline", - "reactphp", - "streaming" + "BDD", + "Behat", + "Cucumber", + "DSL", + "gherkin", + "parser" ], "support": { - "issues": "https://github.com/clue/reactphp-ndjson/issues", - "source": "https://github.com/clue/reactphp-ndjson/tree/v1.3.0" + "issues": "https://github.com/Behat/Gherkin/issues", + "source": "https://github.com/Behat/Gherkin/tree/v4.11.0" }, - "funding": [ - { - "url": "https://clue.engineering/support", - "type": "custom" - }, - { - "url": "https://github.com/clue", - "type": "github" - } - ], - "time": "2022-12-23T10:58:28+00:00" + "time": "2024-12-06T10:07:25+00:00" }, { - "name": "composer/pcre", - "version": "3.3.2", + "name": "behat/transliterator", + "version": "v1.5.0", "source": { "type": "git", - "url": "https://github.com/composer/pcre.git", - "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e" + "url": "https://github.com/Behat/Transliterator.git", + "reference": "baac5873bac3749887d28ab68e2f74db3a4408af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e", - "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "url": "https://api.github.com/repos/Behat/Transliterator/zipball/baac5873bac3749887d28ab68e2f74db3a4408af", + "reference": "baac5873bac3749887d28ab68e2f74db3a4408af", "shasum": "" }, "require": { - "php": "^7.4 || ^8.0" - }, - "conflict": { - "phpstan/phpstan": "<1.11.10" + "php": ">=7.2" }, "require-dev": { - "phpstan/phpstan": "^1.12 || ^2", - "phpstan/phpstan-strict-rules": "^1 || ^2", - "phpunit/phpunit": "^8 || ^9" + "chuyskywalker/rolling-curl": "^3.1", + "php-yaoi/php-yaoi": "^1.0", + "phpunit/phpunit": "^8.5.25 || ^9.5.19" }, "type": "library", "extra": { - "phpstan": { - "includes": [ - "extension.neon" - ] - }, "branch-alias": { - "dev-main": "3.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { "psr-4": { - "Composer\\Pcre\\": "src" + "Behat\\Transliterator\\": "src/Behat/Transliterator" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "Artistic-1.0" ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "description": "String transliterator", "keywords": [ - "PCRE", - "preg", - "regex", - "regular expression" + "i18n", + "slug", + "transliterator" ], "support": { - "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.3.2" + "issues": "https://github.com/Behat/Transliterator/issues", + "source": "https://github.com/Behat/Transliterator/tree/v1.5.0" }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2024-11-12T16:29:46+00:00" + "time": "2022-03-30T09:27:43+00:00" }, { - "name": "composer/semver", - "version": "3.4.3", + "name": "blumilksoftware/blt", + "version": "v0.1.1", "source": { "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12" + "url": "https://github.com/MRR-Group/blt.git", + "reference": "778b9f933941a6b576638968ba65530aa1ce7a60" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", - "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", + "url": "https://api.github.com/repos/MRR-Group/blt/zipball/778b9f933941a6b576638968ba65530aa1ce7a60", + "reference": "778b9f933941a6b576638968ba65530aa1ce7a60", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" + "behat/behat": "^3.19", + "illuminate/console": "^10.0|^11.0|^11.43", + "illuminate/contracts": "^10.0|11.0|^11.43", + "illuminate/routing": "^10.0|^11.0|^11.43", + "illuminate/support": "^10.0|11.0|^11.43", + "illuminate/testing": "^10.0|^11.0|^11.43", + "php": "^8.3", + "phpunit/phpunit": "^10.1|^11.0.1|^11.4.4", + "symfony/css-selector": "^6.2|^7.1", + "symfony/dom-crawler": "^6.2|^7.1" }, "require-dev": { - "phpstan/phpstan": "^1.11", - "symfony/phpunit-bridge": "^3 || ^7" + "blumilksoftware/codestyle": "^3.3.0", + "illuminate/http": "^10.0|11.0", + "symfony/http-foundation": "^6.2|^7.1" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "3.x-dev" + "laravel": { + "providers": [ + "Blumilk\\BLT\\BLTServiceProvider" + ] } }, "autoload": { "psr-4": { - "Composer\\Semver\\": "src" + "Blumilk\\BLT\\": "src/" } }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" + "scripts": { + "cs": [ + "./vendor/bin/php-cs-fixer fix --dry-run --diff --config codestyle.php" + ], + "csf": [ + "./vendor/bin/php-cs-fixer fix --diff --config codestyle.php" + ], + "test": [ + "./vendor/bin/phpunit tests" + ] + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Krzysztof Rewak", + "email": "krzysztof.rewak@blumilk.pl" + } + ], + "description": "Behat + Laravel toolbox", + "support": { + "source": "https://github.com/MRR-Group/blt/tree/v0.1.1" + }, + "time": "2025-02-24T01:58:21+00:00" + }, + { + "name": "blumilksoftware/codestyle", + "version": "v3.3", + "source": { + "type": "git", + "url": "https://github.com/blumilksoftware/codestyle.git", + "reference": "aecc480cd600c91da459999685e54ba0f9821507" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/blumilksoftware/codestyle/zipball/aecc480cd600c91da459999685e54ba0f9821507", + "reference": "aecc480cd600c91da459999685e54ba0f9821507", + "shasum": "" + }, + "require": { + "friendsofphp/php-cs-fixer": "^3.59", + "kubawerlos/php-cs-fixer-custom-fixers": "^3.21", + "php": "^8.1" + }, + "require-dev": { + "jetbrains/phpstorm-attributes": "^1.1", + "phpunit/phpunit": "^10.0|^11.2", + "symfony/console": "^6.0|^7.0" + }, + "bin": [ + "bin/codestyle" + ], + "type": "library", + "autoload": { + "psr-4": { + "Blumilk\\Codestyle\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Krzysztof Rewak", + "email": "krzysztof.rewak@blumilk.pl" + } + ], + "description": "Blumilk codestyle configurator", + "support": { + "issues": "https://github.com/blumilksoftware/codestyle/issues", + "source": "https://github.com/blumilksoftware/codestyle/tree/v3.3" + }, + "time": "2024-08-02T05:18:46+00:00" + }, + { + "name": "clue/ndjson-react", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/clue/reactphp-ndjson.git", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/clue/reactphp-ndjson/zipball/392dc165fce93b5bb5c637b67e59619223c931b0", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "react/stream": "^1.2" + }, + "require-dev": { + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35", + "react/event-loop": "^1.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Clue\\React\\NDJson\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "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.3.2", + "source": { + "type": "git", + "url": "https://github.com/composer/pcre.git", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "conflict": { + "phpstan/phpstan": "<1.11.10" + }, + "require-dev": { + "phpstan/phpstan": "^1.12 || ^2", + "phpstan/phpstan-strict-rules": "^1 || ^2", + "phpunit/phpunit": "^8 || ^9" + }, + "type": "library", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + }, + "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.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.3.2" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2024-11-12T16:29:46+00:00" + }, + { + "name": "composer/semver", + "version": "3.4.3", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", + "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.11", + "symfony/phpunit-bridge": "^3 || ^7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" ], "authors": [ { @@ -6723,25 +7004,92 @@ "time": "2025-02-15T09:15:56+00:00" }, { - "name": "mockery/mockery", - "version": "1.6.12", + "name": "masterminds/html5", + "version": "2.9.0", "source": { "type": "git", - "url": "https://github.com/mockery/mockery.git", - "reference": "1f4efdd7d3beafe9807b08156dfcb176d18f1699" + "url": "https://github.com/Masterminds/html5-php.git", + "reference": "f5ac2c0b0a2eefca70b2ce32a5809992227e75a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/1f4efdd7d3beafe9807b08156dfcb176d18f1699", - "reference": "1f4efdd7d3beafe9807b08156dfcb176d18f1699", + "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/f5ac2c0b0a2eefca70b2ce32a5809992227e75a6", + "reference": "f5ac2c0b0a2eefca70b2ce32a5809992227e75a6", "shasum": "" }, "require": { - "hamcrest/hamcrest-php": "^2.0.1", - "lib-pcre": ">=7.0", - "php": ">=7.3" + "ext-dom": "*", + "php": ">=5.3.0" }, - "conflict": { + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8 || ^9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Masterminds\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Matt Butcher", + "email": "technosophos@gmail.com" + }, + { + "name": "Matt Farina", + "email": "matt@mattfarina.com" + }, + { + "name": "Asmir Mustafic", + "email": "goetas@gmail.com" + } + ], + "description": "An HTML5 parser and serializer.", + "homepage": "http://masterminds.github.io/html5-php", + "keywords": [ + "HTML5", + "dom", + "html", + "parser", + "querypath", + "serializer", + "xml" + ], + "support": { + "issues": "https://github.com/Masterminds/html5-php/issues", + "source": "https://github.com/Masterminds/html5-php/tree/2.9.0" + }, + "time": "2024-03-31T07:05:07+00:00" + }, + { + "name": "mockery/mockery", + "version": "1.6.12", + "source": { + "type": "git", + "url": "https://github.com/mockery/mockery.git", + "reference": "1f4efdd7d3beafe9807b08156dfcb176d18f1699" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mockery/mockery/zipball/1f4efdd7d3beafe9807b08156dfcb176d18f1699", + "reference": "1f4efdd7d3beafe9807b08156dfcb176d18f1699", + "shasum": "" + }, + "require": { + "hamcrest/hamcrest-php": "^2.0.1", + "lib-pcre": ">=7.0", + "php": ">=7.3" + }, + "conflict": { "phpunit/phpunit": "<8.0" }, "require-dev": { @@ -9630,6 +9978,228 @@ ], "time": "2024-10-20T05:08:20+00:00" }, + { + "name": "symfony/config", + "version": "v7.2.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/config.git", + "reference": "7716594aaae91d9141be080240172a92ecca4d44" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/config/zipball/7716594aaae91d9141be080240172a92ecca4d44", + "reference": "7716594aaae91d9141be080240172a92ecca4d44", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/filesystem": "^7.1", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/finder": "<6.4", + "symfony/service-contracts": "<2.5" + }, + "require-dev": { + "symfony/event-dispatcher": "^6.4|^7.0", + "symfony/finder": "^6.4|^7.0", + "symfony/messenger": "^6.4|^7.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/yaml": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Config\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/config/tree/v7.2.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-01-22T12:07:01+00:00" + }, + { + "name": "symfony/dependency-injection", + "version": "v7.2.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/dependency-injection.git", + "reference": "1d321c4bc3fe926fd4c38999a4c9af4f5d61ddfc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/1d321c4bc3fe926fd4c38999a4c9af4f5d61ddfc", + "reference": "1d321c4bc3fe926fd4c38999a4c9af4f5d61ddfc", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/service-contracts": "^3.5", + "symfony/var-exporter": "^6.4|^7.0" + }, + "conflict": { + "ext-psr": "<1.1|>=2", + "symfony/config": "<6.4", + "symfony/finder": "<6.4", + "symfony/yaml": "<6.4" + }, + "provide": { + "psr/container-implementation": "1.1|2.0", + "symfony/service-implementation": "1.1|2.0|3.0" + }, + "require-dev": { + "symfony/config": "^6.4|^7.0", + "symfony/expression-language": "^6.4|^7.0", + "symfony/yaml": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\DependencyInjection\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Allows you to standardize and centralize the way objects are constructed in your application", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/dependency-injection/tree/v7.2.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-01-17T10:56:55+00:00" + }, + { + "name": "symfony/dom-crawler", + "version": "v7.2.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/dom-crawler.git", + "reference": "700a880e5089280c7cf3ca1ccf9d9de6630f5d25" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/700a880e5089280c7cf3ca1ccf9d9de6630f5d25", + "reference": "700a880e5089280c7cf3ca1ccf9d9de6630f5d25", + "shasum": "" + }, + "require": { + "masterminds/html5": "^2.6", + "php": ">=8.2", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.0" + }, + "require-dev": { + "symfony/css-selector": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\DomCrawler\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Eases DOM navigation for HTML and XML documents", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/dom-crawler/tree/v7.2.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-01-27T11:08:17+00:00" + }, { "name": "symfony/filesystem", "version": "v7.2.0", @@ -9901,6 +10471,154 @@ ], "time": "2024-12-18T14:28:33+00:00" }, + { + "name": "symfony/var-exporter", + "version": "v7.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-exporter.git", + "reference": "1a6a89f95a46af0f142874c9d650a6358d13070d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/1a6a89f95a46af0f142874c9d650a6358d13070d", + "reference": "1a6a89f95a46af0f142874c9d650a6358d13070d", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "symfony/property-access": "^6.4|^7.0", + "symfony/serializer": "^6.4|^7.0", + "symfony/var-dumper": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\VarExporter\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Allows exporting any serializable PHP data structure to plain PHP code", + "homepage": "https://symfony.com", + "keywords": [ + "clone", + "construct", + "export", + "hydrate", + "instantiate", + "lazy-loading", + "proxy", + "serialize" + ], + "support": { + "source": "https://github.com/symfony/var-exporter/tree/v7.2.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-10-18T07:58:17+00:00" + }, + { + "name": "symfony/yaml", + "version": "v7.2.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "ac238f173df0c9c1120f862d0f599e17535a87ec" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/ac238f173df0c9c1120f862d0f599e17535a87ec", + "reference": "ac238f173df0c9c1120f862d0f599e17535a87ec", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "symfony/console": "<6.4" + }, + "require-dev": { + "symfony/console": "^6.4|^7.0" + }, + "bin": [ + "Resources/bin/yaml-lint" + ], + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Loads and dumps YAML files", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/yaml/tree/v7.2.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-01-07T12:55:42+00:00" + }, { "name": "theseer/tokenizer", "version": "1.2.3", @@ -9954,13 +10672,13 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": true, "prefer-lowest": false, "platform": { "php": "^8.3.4", "ext-pdo": "*" }, - "platform-dev": [], - "plugin-api-version": "2.3.0" + "platform-dev": {}, + "plugin-api-version": "2.6.0" } diff --git a/config/blt.php b/config/blt.php new file mode 100644 index 0000000..dd28ca0 --- /dev/null +++ b/config/blt.php @@ -0,0 +1,24 @@ + [ + "default" => "App\\", + "types" => [ + "user" => "App\Models\User", + "role" => "Spatie\Permission\Models\Role", + ], + ], + "helpers" => [ + "array" => ArrayHelper::class, + "boolean" => BooleanHelper::class, + "class" => ClassHelper::class, + "nullable" => NullableHelper::class, + ], +]; From edf7a38b6acac5dfd4b5a2941b09497b40620442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Purga=C5=82?= Date: Mon, 24 Feb 2025 03:44:25 +0100 Subject: [PATCH 2/7] ignore .php-cs-fixer.cache --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 94071de..993310e 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ google-credentials.json .composer /public/build/ supervisord.pid +.php-cs-fixer.cache From 2fadfeba7bd55dfb3733f15c602f5f707bcd6d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Purga=C5=82?= Date: Mon, 24 Feb 2025 04:11:42 +0100 Subject: [PATCH 3/7] add roles --- app/Enums/Role.php | 34 ++++ app/Models/User.php | 2 + config/blt.php | 3 +- config/permission.php | 59 +++++++ database/factories/UserFactory.php | 30 +++- ..._02_24_020829_create_permission_tables.php | 145 ++++++++++++++++++ database/seeders/DatabaseSeeder.php | 7 + database/seeders/PermissionsSeeder.php | 28 ++++ database/seeders/RoleSeeder.php | 20 +++ features/bootstrap/FeatureContext.php | 22 +++ 10 files changed, 348 insertions(+), 2 deletions(-) create mode 100644 app/Enums/Role.php create mode 100644 config/permission.php create mode 100644 database/migrations/2025_02_24_020829_create_permission_tables.php create mode 100644 database/seeders/PermissionsSeeder.php create mode 100644 database/seeders/RoleSeeder.php create mode 100644 features/bootstrap/FeatureContext.php diff --git a/app/Enums/Role.php b/app/Enums/Role.php new file mode 100644 index 0000000..053d9d0 --- /dev/null +++ b/app/Enums/Role.php @@ -0,0 +1,34 @@ +map( + fn(Role $enum): array => [ + "label" => $enum->label(), + "value" => $enum->value, + ], + )->toArray(); + } + + public function label(): string + { + return __($this->value); + } + + public function permissions(): array + { + return config("permission.permission_roles")[$this->value]; + } +} diff --git a/app/Models/User.php b/app/Models/User.php index 042a1ad..f29a1eb 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -9,6 +9,7 @@ use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use Laravel\Sanctum\HasApiTokens; +use Spatie\Permission\Traits\HasRoles; /** * @property string $name @@ -23,6 +24,7 @@ class User extends Authenticatable use HasApiTokens; use HasFactory; use Notifiable; + use HasRoles; protected $fillable = [ "name", diff --git a/config/blt.php b/config/blt.php index dd28ca0..9cb4d0f 100644 --- a/config/blt.php +++ b/config/blt.php @@ -6,13 +6,14 @@ use Blumilk\BLT\Helpers\BooleanHelper; use Blumilk\BLT\Helpers\ClassHelper; use Blumilk\BLT\Helpers\NullableHelper; +use Spatie\Permission\Models\Role; return [ "namespaces" => [ "default" => "App\\", "types" => [ "user" => "App\Models\User", - "role" => "Spatie\Permission\Models\Role", + "role" => Role::class, ], ], "helpers" => [ diff --git a/config/permission.php b/config/permission.php new file mode 100644 index 0000000..acfd7b0 --- /dev/null +++ b/config/permission.php @@ -0,0 +1,59 @@ + [ + "permission" => Permission::class, + "role" => Spatie\Permission\Models\Role::class, + ], + + "table_names" => [ + "roles" => "roles", + "permissions" => "permissions", + "model_has_permissions" => "model_has_permissions", + "model_has_roles" => "model_has_roles", + "role_has_permissions" => "role_has_permissions", + ], + + "column_names" => [ + "role_pivot_key" => null, + "permission_pivot_key" => null, + "model_morph_key" => "model_id", + "team_foreign_key" => "team_id", + ], + + "register_permission_check_method" => true, + "register_octane_reset_listener" => false, + "events_enabled" => false, + "teams" => false, + "team_resolver" => DefaultTeamResolver::class, + "use_passport_client_credentials" => false, + "display_permission_in_exception" => false, + "display_role_in_exception" => false, + "enable_wildcard_permission" => false, + + "cache" => [ + "expiration_time" => DateInterval::createFromDateString("24 hours"), + "key" => "spatie.permission.cache", + "store" => "default", + ], + "permissions" => [ + "manageUsers", + "manageModerators", + ], + "permission_roles" => [ + Role::Administrator->value => [ + "manageUsers", + "manageModerators", + ], + Role::Moderator->value => [ + "manageUsers", + ], + Role::User->value => [], + ], +]; diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 690dfb1..9e978f8 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -4,8 +4,10 @@ namespace Database\Factories; +use CommunityWithLegends\Enums\Role; use CommunityWithLegends\Models\User; use Illuminate\Database\Eloquent\Factories\Factory; +use Illuminate\Support\Facades\Hash; use Illuminate\Support\Str; /** @@ -13,21 +15,47 @@ */ class UserFactory extends Factory { + protected $model = User::class; + public function definition(): array { return [ "name" => fake()->name(), "email" => fake()->unique()->safeEmail(), "email_verified_at" => now(), - "password" => "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi", + "password" => Hash::make("password"), "remember_token" => Str::random(10), ]; } + public function configure(): static + { + return $this->afterCreating(function (User $user): void { + $user->assignRole(Role::User); + $user->syncPermissions(Role::User->permissions()); + }); + } + public function unverified(): static { return $this->state(fn(array $attributes): array => [ "email_verified_at" => null, ]); } + + public function admin(): static + { + return $this->afterCreating(function (User $user): void { + $user->assignRole(Role::Administrator); + $user->syncPermissions(Role::Administrator->permissions()); + }); + } + + public function moderator(): static + { + return $this->afterCreating(function (User $user): void { + $user->assignRole(Role::Moderator); + $user->syncPermissions(Role::Moderator->permissions()); + }); + } } diff --git a/database/migrations/2025_02_24_020829_create_permission_tables.php b/database/migrations/2025_02_24_020829_create_permission_tables.php new file mode 100644 index 0000000..49670ce --- /dev/null +++ b/database/migrations/2025_02_24_020829_create_permission_tables.php @@ -0,0 +1,145 @@ +bigIncrements("id"); // permission id + $table->string("name"); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format) + $table->string("guard_name"); // For MyISAM use string('guard_name', 25); + $table->timestamps(); + + $table->unique(["name", "guard_name"]); + }); + + Schema::create($tableNames["roles"], static function (Blueprint $table) use ($teams, $columnNames): void { + $table->bigIncrements("id"); // role id + + if ($teams || config("permission.testing")) { // permission.testing is a fix for sqlite testing + $table->unsignedBigInteger($columnNames["team_foreign_key"])->nullable(); + $table->index($columnNames["team_foreign_key"], "roles_team_foreign_key_index"); + } + $table->string("name"); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format) + $table->string("guard_name"); // For MyISAM use string('guard_name', 25); + $table->timestamps(); + + if ($teams || config("permission.testing")) { + $table->unique([$columnNames["team_foreign_key"], "name", "guard_name"]); + } else { + $table->unique(["name", "guard_name"]); + } + }); + + Schema::create($tableNames["model_has_permissions"], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotPermission, $teams): void { + $table->unsignedBigInteger($pivotPermission); + + $table->string("model_type"); + $table->unsignedBigInteger($columnNames["model_morph_key"]); + $table->index([$columnNames["model_morph_key"], "model_type"], "model_has_permissions_model_id_model_type_index"); + + $table->foreign($pivotPermission) + ->references("id") // permission id + ->on($tableNames["permissions"]) + ->onDelete("cascade"); + + if ($teams) { + $table->unsignedBigInteger($columnNames["team_foreign_key"]); + $table->index($columnNames["team_foreign_key"], "model_has_permissions_team_foreign_key_index"); + + $table->primary( + [$columnNames["team_foreign_key"], $pivotPermission, $columnNames["model_morph_key"], "model_type"], + "model_has_permissions_permission_model_type_primary", + ); + } else { + $table->primary( + [$pivotPermission, $columnNames["model_morph_key"], "model_type"], + "model_has_permissions_permission_model_type_primary", + ); + } + }); + + Schema::create($tableNames["model_has_roles"], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotRole, $teams): void { + $table->unsignedBigInteger($pivotRole); + + $table->string("model_type"); + $table->unsignedBigInteger($columnNames["model_morph_key"]); + $table->index([$columnNames["model_morph_key"], "model_type"], "model_has_roles_model_id_model_type_index"); + + $table->foreign($pivotRole) + ->references("id") // role id + ->on($tableNames["roles"]) + ->onDelete("cascade"); + + if ($teams) { + $table->unsignedBigInteger($columnNames["team_foreign_key"]); + $table->index($columnNames["team_foreign_key"], "model_has_roles_team_foreign_key_index"); + + $table->primary( + [$columnNames["team_foreign_key"], $pivotRole, $columnNames["model_morph_key"], "model_type"], + "model_has_roles_role_model_type_primary", + ); + } else { + $table->primary( + [$pivotRole, $columnNames["model_morph_key"], "model_type"], + "model_has_roles_role_model_type_primary", + ); + } + }); + + Schema::create($tableNames["role_has_permissions"], static function (Blueprint $table) use ($tableNames, $pivotRole, $pivotPermission): void { + $table->unsignedBigInteger($pivotPermission); + $table->unsignedBigInteger($pivotRole); + + $table->foreign($pivotPermission) + ->references("id") // permission id + ->on($tableNames["permissions"]) + ->onDelete("cascade"); + + $table->foreign($pivotRole) + ->references("id") // role id + ->on($tableNames["roles"]) + ->onDelete("cascade"); + + $table->primary([$pivotPermission, $pivotRole], "role_has_permissions_permission_id_role_id_primary"); + }); + + app("cache") + ->store(config("permission.cache.store") !== "default" ? config("permission.cache.store") : null) + ->forget(config("permission.cache.key")); + } + + public function down(): void + { + $tableNames = config("permission.table_names"); + + if (empty($tableNames)) { + throw new Exception("Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually."); + } + + Schema::drop($tableNames["role_has_permissions"]); + Schema::drop($tableNames["model_has_roles"]); + Schema::drop($tableNames["model_has_permissions"]); + Schema::drop($tableNames["roles"]); + Schema::drop($tableNames["permissions"]); + } +}; diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index de85323..8801225 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -4,11 +4,18 @@ namespace Database\Seeders; +use CommunityWithLegends\Models\User; use Illuminate\Database\Seeder; class DatabaseSeeder extends Seeder { public function run(): void { + $this->call(RoleSeeder::class); + $this->call(PermissionsSeeder::class); + + User::factory([ + "email" => "admin@cwl.com", + ])->admin()->create(); } } diff --git a/database/seeders/PermissionsSeeder.php b/database/seeders/PermissionsSeeder.php new file mode 100644 index 0000000..15072db --- /dev/null +++ b/database/seeders/PermissionsSeeder.php @@ -0,0 +1,28 @@ +name, $configPermissions, strict: true)) { + $permission->delete(); + } + } + } +} diff --git a/database/seeders/RoleSeeder.php b/database/seeders/RoleSeeder.php new file mode 100644 index 0000000..c646af3 --- /dev/null +++ b/database/seeders/RoleSeeder.php @@ -0,0 +1,20 @@ +firstOrCreate(["name" => $role["label"]]); + } + } +} diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php new file mode 100644 index 0000000..fcde4c1 --- /dev/null +++ b/features/bootstrap/FeatureContext.php @@ -0,0 +1,22 @@ + Date: Mon, 24 Feb 2025 04:15:33 +0100 Subject: [PATCH 4/7] add activitylog --- composer.json | 1 + composer.lock | 153 +++++++++++++++++- ...02_24_031506_create_activity_log_table.php | 27 ++++ ...add_event_column_to_activity_log_table.php | 22 +++ ...atch_uuid_column_to_activity_log_table.php | 22 +++ 5 files changed, 224 insertions(+), 1 deletion(-) create mode 100644 database/migrations/2025_02_24_031506_create_activity_log_table.php create mode 100644 database/migrations/2025_02_24_031507_add_event_column_to_activity_log_table.php create mode 100644 database/migrations/2025_02_24_031508_add_batch_uuid_column_to_activity_log_table.php diff --git a/composer.json b/composer.json index dbe346d..52955b3 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,7 @@ "laravel/framework": "^11.43.2", "laravel/sanctum": "^4.0.8", "laravel/tinker": "^2.10.1", + "spatie/laravel-activitylog": "^4.10", "spatie/laravel-permission": "^6.15" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 44c6742..67929ef 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": "ccd6d6cb1ce4afe33b7f3f448ad43839", + "content-hash": "a28bd21d188796cfc8e1520b708d1c48", "packages": [ { "name": "brick/math", @@ -3363,6 +3363,157 @@ ], "time": "2024-04-27T21:32:50+00:00" }, + { + "name": "spatie/laravel-activitylog", + "version": "4.10.1", + "source": { + "type": "git", + "url": "https://github.com/spatie/laravel-activitylog.git", + "reference": "466f30f7245fe3a6e328ad5e6812bd43b4bddea5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/laravel-activitylog/zipball/466f30f7245fe3a6e328ad5e6812bd43b4bddea5", + "reference": "466f30f7245fe3a6e328ad5e6812bd43b4bddea5", + "shasum": "" + }, + "require": { + "illuminate/config": "^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0", + "illuminate/database": "^8.69 || ^9.27 || ^10.0 || ^11.0 || ^12.0", + "illuminate/support": "^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0", + "php": "^8.1", + "spatie/laravel-package-tools": "^1.6.3" + }, + "require-dev": { + "ext-json": "*", + "orchestra/testbench": "^6.23 || ^7.0 || ^8.0 || ^9.0 || ^10.0", + "pestphp/pest": "^1.20 || ^2.0 || ^3.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Spatie\\Activitylog\\ActivitylogServiceProvider" + ] + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Spatie\\Activitylog\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + }, + { + "name": "Sebastian De Deyne", + "email": "sebastian@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + }, + { + "name": "Tom Witkowski", + "email": "dev.gummibeer@gmail.com", + "homepage": "https://gummibeer.de", + "role": "Developer" + } + ], + "description": "A very simple activity logger to monitor the users of your website or application", + "homepage": "https://github.com/spatie/activitylog", + "keywords": [ + "activity", + "laravel", + "log", + "spatie", + "user" + ], + "support": { + "issues": "https://github.com/spatie/laravel-activitylog/issues", + "source": "https://github.com/spatie/laravel-activitylog/tree/4.10.1" + }, + "funding": [ + { + "url": "https://spatie.be/open-source/support-us", + "type": "custom" + }, + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2025-02-10T15:38:25+00:00" + }, + { + "name": "spatie/laravel-package-tools", + "version": "1.19.0", + "source": { + "type": "git", + "url": "https://github.com/spatie/laravel-package-tools.git", + "reference": "1c9c30ac6a6576b8d15c6c37b6cf23d748df2faa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/1c9c30ac6a6576b8d15c6c37b6cf23d748df2faa", + "reference": "1c9c30ac6a6576b8d15c6c37b6cf23d748df2faa", + "shasum": "" + }, + "require": { + "illuminate/contracts": "^9.28|^10.0|^11.0|^12.0", + "php": "^8.0" + }, + "require-dev": { + "mockery/mockery": "^1.5", + "orchestra/testbench": "^7.7|^8.0|^9.0|^10.0", + "pestphp/pest": "^1.23|^2.1|^3.1", + "phpunit/phpunit": "^9.5.24|^10.5|^11.5", + "spatie/pest-plugin-test-time": "^1.1|^2.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spatie\\LaravelPackageTools\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "role": "Developer" + } + ], + "description": "Tools for creating Laravel packages", + "homepage": "https://github.com/spatie/laravel-package-tools", + "keywords": [ + "laravel-package-tools", + "spatie" + ], + "support": { + "issues": "https://github.com/spatie/laravel-package-tools/issues", + "source": "https://github.com/spatie/laravel-package-tools/tree/1.19.0" + }, + "funding": [ + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2025-02-06T14:58:20+00:00" + }, { "name": "spatie/laravel-permission", "version": "6.15.0", diff --git a/database/migrations/2025_02_24_031506_create_activity_log_table.php b/database/migrations/2025_02_24_031506_create_activity_log_table.php new file mode 100644 index 0000000..7c05bc8 --- /dev/null +++ b/database/migrations/2025_02_24_031506_create_activity_log_table.php @@ -0,0 +1,27 @@ +create(config('activitylog.table_name'), function (Blueprint $table) { + $table->bigIncrements('id'); + $table->string('log_name')->nullable(); + $table->text('description'); + $table->nullableMorphs('subject', 'subject'); + $table->nullableMorphs('causer', 'causer'); + $table->json('properties')->nullable(); + $table->timestamps(); + $table->index('log_name'); + }); + } + + public function down() + { + Schema::connection(config('activitylog.database_connection'))->dropIfExists(config('activitylog.table_name')); + } +} diff --git a/database/migrations/2025_02_24_031507_add_event_column_to_activity_log_table.php b/database/migrations/2025_02_24_031507_add_event_column_to_activity_log_table.php new file mode 100644 index 0000000..7b797fd --- /dev/null +++ b/database/migrations/2025_02_24_031507_add_event_column_to_activity_log_table.php @@ -0,0 +1,22 @@ +table(config('activitylog.table_name'), function (Blueprint $table) { + $table->string('event')->nullable()->after('subject_type'); + }); + } + + public function down() + { + Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) { + $table->dropColumn('event'); + }); + } +} diff --git a/database/migrations/2025_02_24_031508_add_batch_uuid_column_to_activity_log_table.php b/database/migrations/2025_02_24_031508_add_batch_uuid_column_to_activity_log_table.php new file mode 100644 index 0000000..8f7db66 --- /dev/null +++ b/database/migrations/2025_02_24_031508_add_batch_uuid_column_to_activity_log_table.php @@ -0,0 +1,22 @@ +table(config('activitylog.table_name'), function (Blueprint $table) { + $table->uuid('batch_uuid')->nullable()->after('properties'); + }); + } + + public function down() + { + Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) { + $table->dropColumn('batch_uuid'); + }); + } +} From 0271ee94bfeaa9e6b399236b6cc56a770d79b156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Purga=C5=82?= Date: Mon, 24 Feb 2025 05:02:08 +0100 Subject: [PATCH 5/7] add activitylog --- config/activitylog.php | 16 +++++++++++ ...02_24_031506_create_activity_log_table.php | 28 ++++++++++--------- ...add_event_column_to_activity_log_table.php | 18 ++++++------ ...atch_uuid_column_to_activity_log_table.php | 18 ++++++------ tests/Feature/ExampleTest.php | 17 ----------- 5 files changed, 51 insertions(+), 46 deletions(-) create mode 100644 config/activitylog.php delete mode 100644 tests/Feature/ExampleTest.php diff --git a/config/activitylog.php b/config/activitylog.php new file mode 100644 index 0000000..fcaa79e --- /dev/null +++ b/config/activitylog.php @@ -0,0 +1,16 @@ + env("ACTIVITY_LOGGER_ENABLED", true), + "delete_records_older_than_days" => 365, + "default_log_name" => "default", + "default_auth_driver" => null, + "subject_returns_soft_deleted_models" => false, + "activity_model" => Activity::class, + "table_name" => env("ACTIVITY_LOGGER_TABLE_NAME", "activity_log"), + "database_connection" => env("ACTIVITY_LOGGER_DB_CONNECTION"), +]; diff --git a/database/migrations/2025_02_24_031506_create_activity_log_table.php b/database/migrations/2025_02_24_031506_create_activity_log_table.php index 7c05bc8..d07e03c 100644 --- a/database/migrations/2025_02_24_031506_create_activity_log_table.php +++ b/database/migrations/2025_02_24_031506_create_activity_log_table.php @@ -1,27 +1,29 @@ create(config('activitylog.table_name'), function (Blueprint $table) { - $table->bigIncrements('id'); - $table->string('log_name')->nullable(); - $table->text('description'); - $table->nullableMorphs('subject', 'subject'); - $table->nullableMorphs('causer', 'causer'); - $table->json('properties')->nullable(); + Schema::connection(config("activitylog.database_connection"))->create(config("activitylog.table_name"), function (Blueprint $table): void { + $table->bigIncrements("id"); + $table->string("log_name")->nullable(); + $table->text("description"); + $table->nullableMorphs("subject", "subject"); + $table->nullableMorphs("causer", "causer"); + $table->json("properties")->nullable(); $table->timestamps(); - $table->index('log_name'); + $table->index("log_name"); }); } - public function down() + public function down(): void { - Schema::connection(config('activitylog.database_connection'))->dropIfExists(config('activitylog.table_name')); + Schema::connection(config("activitylog.database_connection"))->dropIfExists(config("activitylog.table_name")); } } diff --git a/database/migrations/2025_02_24_031507_add_event_column_to_activity_log_table.php b/database/migrations/2025_02_24_031507_add_event_column_to_activity_log_table.php index 7b797fd..6209159 100644 --- a/database/migrations/2025_02_24_031507_add_event_column_to_activity_log_table.php +++ b/database/migrations/2025_02_24_031507_add_event_column_to_activity_log_table.php @@ -1,22 +1,24 @@ table(config('activitylog.table_name'), function (Blueprint $table) { - $table->string('event')->nullable()->after('subject_type'); + Schema::connection(config("activitylog.database_connection"))->table(config("activitylog.table_name"), function (Blueprint $table): void { + $table->string("event")->nullable()->after("subject_type"); }); } - public function down() + public function down(): void { - Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) { - $table->dropColumn('event'); + Schema::connection(config("activitylog.database_connection"))->table(config("activitylog.table_name"), function (Blueprint $table): void { + $table->dropColumn("event"); }); } } diff --git a/database/migrations/2025_02_24_031508_add_batch_uuid_column_to_activity_log_table.php b/database/migrations/2025_02_24_031508_add_batch_uuid_column_to_activity_log_table.php index 8f7db66..d01a23e 100644 --- a/database/migrations/2025_02_24_031508_add_batch_uuid_column_to_activity_log_table.php +++ b/database/migrations/2025_02_24_031508_add_batch_uuid_column_to_activity_log_table.php @@ -1,22 +1,24 @@ table(config('activitylog.table_name'), function (Blueprint $table) { - $table->uuid('batch_uuid')->nullable()->after('properties'); + Schema::connection(config("activitylog.database_connection"))->table(config("activitylog.table_name"), function (Blueprint $table): void { + $table->uuid("batch_uuid")->nullable()->after("properties"); }); } - public function down() + public function down(): void { - Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) { - $table->dropColumn('batch_uuid'); + Schema::connection(config("activitylog.database_connection"))->table(config("activitylog.table_name"), function (Blueprint $table): void { + $table->dropColumn("batch_uuid"); }); } } diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php deleted file mode 100644 index 55a42c3..0000000 --- a/tests/Feature/ExampleTest.php +++ /dev/null @@ -1,17 +0,0 @@ -get("/"); - - $response->assertStatus(200); - } -} From a1e8f9423d451b84409400b449f37de293030ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Purga=C5=82?= Date: Mon, 24 Feb 2025 05:02:34 +0100 Subject: [PATCH 6/7] create Example behat test --- composer.json | 5 +++-- composer.lock | 10 +++++----- features/ExampleTest.feature | 5 +++++ features/bootstrap/FeatureContext.php | 16 +++++----------- routes/web.php | 6 ++++-- 5 files changed, 22 insertions(+), 20 deletions(-) create mode 100644 features/ExampleTest.feature diff --git a/composer.json b/composer.json index 52955b3..81625f7 100644 --- a/composer.json +++ b/composer.json @@ -21,14 +21,15 @@ "spatie/laravel-permission": "^6.15" }, "require-dev": { + "behat/behat": "^3.19", + "blumilksoftware/blt": "^v0.1.1", "blumilksoftware/codestyle": "^v3.3.0", "fakerphp/faker": "^1.24.1", "mockery/mockery": "^1.6.12", "nunomaduro/collision": "^8.5.0", "nunomaduro/larastan": "^3.1.0", "phpunit/phpunit": "^11.4.4", - "spatie/laravel-ignition": "^2.9.0", - "blumilksoftware/blt": "^v0.1.1" + "spatie/laravel-ignition": "^2.9.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 67929ef..4d4b234 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": "a28bd21d188796cfc8e1520b708d1c48", + "content-hash": "a6722513b8df501831e7cfb02d3ff5aa", "packages": [ { "name": "brick/math", @@ -6308,12 +6308,12 @@ "source": { "type": "git", "url": "https://github.com/MRR-Group/blt.git", - "reference": "778b9f933941a6b576638968ba65530aa1ce7a60" + "reference": "b7341631674c50c7acdaa7606f5e70d1111aa548" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/MRR-Group/blt/zipball/778b9f933941a6b576638968ba65530aa1ce7a60", - "reference": "778b9f933941a6b576638968ba65530aa1ce7a60", + "url": "https://api.github.com/repos/MRR-Group/blt/zipball/b7341631674c50c7acdaa7606f5e70d1111aa548", + "reference": "b7341631674c50c7acdaa7606f5e70d1111aa548", "shasum": "" }, "require": { @@ -6370,7 +6370,7 @@ "support": { "source": "https://github.com/MRR-Group/blt/tree/v0.1.1" }, - "time": "2025-02-24T01:58:21+00:00" + "time": "2025-02-24T03:54:45+00:00" }, { "name": "blumilksoftware/codestyle", diff --git a/features/ExampleTest.feature b/features/ExampleTest.feature new file mode 100644 index 0000000..929c351 --- /dev/null +++ b/features/ExampleTest.feature @@ -0,0 +1,5 @@ +Feature: Example test + Scenario: User can access to root page + Given a user is requesting "/" using GET method + When a request is sent + Then the response should have status 200 and contain JSON with key "message" and value "Welcome" diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php index fcde4c1..f9488ae 100644 --- a/features/bootstrap/FeatureContext.php +++ b/features/bootstrap/FeatureContext.php @@ -3,20 +3,14 @@ use Behat\Behat\Context\Context; use Behat\Gherkin\Node\PyStringNode; use Behat\Gherkin\Node\TableNode; +use Blumilk\BLT\Bootstrapping\LaravelBootstrapper; +use Blumilk\BLT\Features\Toolbox; -/** - * Defines application features from the specific context. - */ -class FeatureContext implements Context +class FeatureContext extends Toolbox implements Context { - /** - * Initializes context. - * - * Every scenario gets its own context instance. - * You can also pass arbitrary arguments to the - * context constructor through behat.yml. - */ public function __construct() { + $bootstrapper = new LaravelBootstrapper(); + $bootstrapper->boot(); } } diff --git a/routes/web.php b/routes/web.php index 2301789..023c58f 100644 --- a/routes/web.php +++ b/routes/web.php @@ -2,7 +2,9 @@ declare(strict_types=1); +use Illuminate\Http\JsonResponse; use Illuminate\Support\Facades\Route; -use Inertia\Response; -Route::get("/", fn(): Response => inertia("Welcome")); +Route::get("/", fn(): JsonResponse => response()->json([ + "message" => "Welcome", +])); From d60abbd73541b2d7829608a7b20b5a64a52541ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Purga=C5=82?= Date: Mon, 24 Feb 2025 05:09:43 +0100 Subject: [PATCH 7/7] add behat to makefile --- Makefile | 1 + composer.json | 1 + phpunit.xml | 3 --- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c48f655..1627017 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,7 @@ shell-root: test: @docker compose --file ${DOCKER_COMPOSE_FILE} exec --user "${CURRENT_USER_ID}:${CURRENT_USER_GROUP_ID}" ${DOCKER_COMPOSE_APP_CONTAINER} composer test + @docker compose --file ${DOCKER_COMPOSE_FILE} exec --user "${CURRENT_USER_ID}:${CURRENT_USER_GROUP_ID}" ${DOCKER_COMPOSE_APP_CONTAINER} composer test-features fix: @docker compose --file ${DOCKER_COMPOSE_FILE} exec --user "${CURRENT_USER_ID}:${CURRENT_USER_GROUP_ID}" ${DOCKER_COMPOSE_APP_CONTAINER} bash -c 'composer csf' diff --git a/composer.json b/composer.json index 81625f7..5946916 100644 --- a/composer.json +++ b/composer.json @@ -61,6 +61,7 @@ "@putenv XDEBUG_MODE=off", "@php artisan test" ], + "test-features": "./vendor/bin/behat", "analyse": "./vendor/bin/phpstan analyse", "cs": "./vendor/bin/php-cs-fixer fix --dry-run --diff --config codestyle.php", "csf": "./vendor/bin/php-cs-fixer fix --diff --config codestyle.php" diff --git a/phpunit.xml b/phpunit.xml index 79fe019..ddd3a76 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -8,9 +8,6 @@ ./tests/Unit - - ./tests/Feature -