From 6f377ea251bd3c3e8b0167475db0131cec5c7017 Mon Sep 17 00:00:00 2001 From: fds2610-bot Date: Thu, 23 Jul 2026 17:54:30 +0200 Subject: [PATCH] =?UTF-8?q?V.2.2:=20Unit-Tests=20f=C3=BCr=20wichtige=20Fun?= =?UTF-8?q?ktionen,=20automatisch=20gepr=C3=BCft=20bei=20Update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extrahiert die wichtigste DB-/netzwerkfreie Geschäftslogik (Monatsnavigation, Admin-/Aktien-Rollenprüfung, Aktien-GuV-Berechnung, OpenFIGI-/Alpha-Vantage- Antwortauswertung, Eingabevalidierung, CSV-Export, Migrations-Logik) nach html/lib/fscash.php und deckt sie mit 31 PHPUnit-Tests ab. update.sh installiert Composer-Abhängigkeiten bei Bedarf und führt die Tests jetzt vor jedem Deploy aus - bei Fehlschlag wird nichts kopiert oder migriert. Co-Authored-By: Claude Sonnet 5 --- .gitignore | 2 + README.md | 27 +- composer.json | 20 + composer.lock | 1673 +++++++++++++++++++++++++++++++++ html/aktien.php | 35 +- html/dashboard.php | 17 +- html/get_symbol.php | 24 +- html/lib/fscash.php | 216 +++++ html/rep-month.php | 28 +- html/rep-person.php | 26 +- html/save_symbol.php | 3 +- html/search_symbol.php | 12 +- html/update_kurse.php | 5 +- migrations/run_migrations.php | 8 +- phpunit.xml | 13 + tests/FscashTest.php | 307 ++++++ tests/run.sh | 19 + update.sh | 25 +- 18 files changed, 2339 insertions(+), 121 deletions(-) create mode 100644 composer.json create mode 100644 composer.lock create mode 100644 html/lib/fscash.php create mode 100644 phpunit.xml create mode 100644 tests/FscashTest.php create mode 100755 tests/run.sh diff --git a/.gitignore b/.gitignore index f4296b5..2f03b5e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,6 @@ config.php html/.Trash-1000 Dockerfile docker-compose.yml +vendor/ +.phpunit.result.cache diff --git a/README.md b/README.md index d37cf13..54a8ac4 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,15 @@ Dokumentiere Ausgaben on-the-go als Webapp - [ ] Zusammenfassen von mehreren Einträgen zu einer Aktie - [ ] Prüfen ob APIKEYS leer sind und ggfs die Aktualisierung ausblenden +## V.2.2 + +- [X] Unit-Tests (PHPUnit) für die wichtigsten Funktionen, gebündelt in `html/lib/fscash.php`: Monatsnavigation, Admin-/Aktien-Rollenprüfung, Aktien-GuV-Berechnung, OpenFIGI-/Alpha-Vantage-Antwortauswertung, Eingabevalidierung, CSV-Export und Migrations-Logik (siehe Abschnitt "Tests" unten). +- [X] `update.sh` führt die Tests jetzt automatisch vor jedem Deploy aus (inkl. `composer install`, falls nötig) und bricht bei Fehlschlag ab, bevor irgendetwas kopiert oder migriert wird. + ## V.2.1 - [X] `update.sh` zum Deployen auf einen Zielserver: prüft PHP-Syntax, kopiert den aktuellen git-Stand ins Webroot (ohne die produktive `config.php` zu überschreiben) und wendet danach ausstehende Datenbank-Migrationen an. - [X] neues Verzeichnis `migrations/` mit versioniertem Migrationssystem: nummerierte `.sql`-Dateien werden über eine `schema_migrations`-Tabelle nachverfolgt und jeweils nur einmal angewendet (siehe `migrations/README.md` für die Konvention). -- [X] Platzhalter in `update.sh` für einen automatischen Testlauf, sobald Tests existieren. ## V.2.0 @@ -107,3 +111,24 @@ Ausserdem solltet Ihr User registrieren und ggfs. die Kategorien anpassen. Das sollte alles sein. Bitte erstellt ein Bug-Ticket, wenn ich etwas übersehen habe. Gerne könnt Ihr auch Pull-Requests erstellen. +# Tests + +Die wichtigsten, DB- und netzwerkfreien Funktionen liegen gebündelt in `html/lib/fscash.php` +(Monatsnavigation, Rollenprüfung, Aktien-GuV-Berechnung, Auswertung der OpenFIGI-/Alpha-Vantage-Antworten, +Eingabevalidierung, CSV-Export, Migrations-Logik) und werden über PHPUnit in `tests/FscashTest.php` geprüft. + +Einmalig Abhängigkeiten installieren: + +``` +composer install +``` + +Tests lokal ausführen: + +``` +bash tests/run.sh +``` + +`update.sh` führt diesen Schritt automatisch vor jedem Deploy aus (inkl. `composer install`, falls `vendor/` +noch fehlt) und bricht bei einem Testfehlschlag ab, bevor irgendetwas kopiert oder migriert wird. + diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..cb59a47 --- /dev/null +++ b/composer.json @@ -0,0 +1,20 @@ +{ + "name": "fds/fscash", + "description": "FSCash - Haushaltsausgaben & Aktiendepot", + "type": "project", + "license": "proprietary", + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.5" + }, + "autoload-dev": { + "files": [ + "html/lib/fscash.php" + ] + }, + "scripts": { + "test": "phpunit" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..ba10feb --- /dev/null +++ b/composer.lock @@ -0,0 +1,1673 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "ccf9fbb9f78124aa7a92e61ae25f7c28", + "packages": [], + "packages-dev": [ + { + "name": "myclabs/deep-copy", + "version": "1.13.4", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a", + "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3 <3.2.2" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "type": "library", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.13.4" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2025-08-01T08:46:24+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v5.8.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/044a6a392ff8ad0d61f14370a5fbbd0a0107152f", + "reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-tokenizer": "*", + "php": ">=7.4" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v5.8.0" + }, + "time": "2026-07-04T14:30:18+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "54750ef60c58e43759730615a392c31c80e23176" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "10.1.16", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "7e308268858ed6baedc8704a304727d20bc07c77" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/7e308268858ed6baedc8704a304727d20bc07c77", + "reference": "7e308268858ed6baedc8704a304727d20bc07c77", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^4.19.1 || ^5.1.0", + "php": ">=8.1", + "phpunit/php-file-iterator": "^4.1.0", + "phpunit/php-text-template": "^3.0.1", + "sebastian/code-unit-reverse-lookup": "^3.0.0", + "sebastian/complexity": "^3.2.0", + "sebastian/environment": "^6.1.0", + "sebastian/lines-of-code": "^2.0.2", + "sebastian/version": "^4.0.1", + "theseer/tokenizer": "^1.2.3" + }, + "require-dev": { + "phpunit/phpunit": "^10.1" + }, + "suggest": { + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "10.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.16" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-08-22T04:31:57+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "4.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a95037b6d9e608ba092da1b23931e537cadc3c3c", + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.1.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-08-31T06:24:48+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "4.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^10.0" + }, + "suggest": { + "ext-pcntl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/4.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:56:09+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/0c7b06ff49e3d5072f057eb1fa59258bf287a748", + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-08-31T14:07:24+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "6.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/e2a2d67966e740530f4a3343fe2e030ffdc1161d", + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/6.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:57:52+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "10.5.64", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "0e8c1d19cea35ad97d4887f363d07c78e30fbf06" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0e8c1d19cea35ad97d4887f363d07c78e30fbf06", + "reference": "0e8c1d19cea35ad97d4887f363d07c78e30fbf06", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-filter": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.13.4", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", + "php": ">=8.1", + "phpunit/php-code-coverage": "^10.1.16", + "phpunit/php-file-iterator": "^4.1.0", + "phpunit/php-invoker": "^4.0.0", + "phpunit/php-text-template": "^3.0.1", + "phpunit/php-timer": "^6.0.0", + "sebastian/cli-parser": "^2.0.1", + "sebastian/code-unit": "^2.0.0", + "sebastian/comparator": "^5.0.5", + "sebastian/diff": "^5.1.1", + "sebastian/environment": "^6.1.0", + "sebastian/exporter": "^5.1.4", + "sebastian/global-state": "^6.0.2", + "sebastian/object-enumerator": "^5.0.0", + "sebastian/recursion-context": "^5.0.1", + "sebastian/type": "^4.0.0", + "sebastian/version": "^4.0.1" + }, + "suggest": { + "ext-soap": "To be able to generate mocks based on WSDL files" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "10.5-dev" + } + }, + "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "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.64" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsoring.html", + "type": "other" + } + ], + "time": "2026-07-06T14:50:35+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/c34583b87e7b7a8055bf6c450c2c77ce32a24084", + "reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T07:12:49+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/a81fee9eef0b7a76af11d121767abc44c104e503", + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/2.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:58:43+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/3.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:59:15+00:00" + }, + { + "name": "sebastian/comparator", + "version": "5.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "55dfef806eb7dfeb6e7a6935601fef866f8ca48d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55dfef806eb7dfeb6e7a6935601fef866f8ca48d", + "reference": "55dfef806eb7dfeb6e7a6935601fef866f8ca48d", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/diff": "^5.0", + "sebastian/exporter": "^5.0" + }, + "require-dev": { + "phpunit/phpunit": "^10.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/comparator", + "type": "tidelift" + } + ], + "time": "2026-01-24T09:25:16+00:00" + }, + { + "name": "sebastian/complexity", + "version": "3.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "68ff824baeae169ec9f2137158ee529584553799" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68ff824baeae169ec9f2137158ee529584553799", + "reference": "68ff824baeae169ec9f2137158ee529584553799", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/3.2.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-12-21T08:37:17+00:00" + }, + { + "name": "sebastian/diff", + "version": "5.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/c41e007b4b62af48218231d6c2275e4c9b975b2e", + "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0", + "symfony/process": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/5.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T07:15:17+00:00" + }, + { + "name": "sebastian/environment", + "version": "6.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "8074dbcd93529b357029f5cc5058fd3e43666984" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/8074dbcd93529b357029f5cc5058fd3e43666984", + "reference": "8074dbcd93529b357029f5cc5058fd3e43666984", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "https://github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/6.1.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-23T08:47:14+00:00" + }, + { + "name": "sebastian/exporter", + "version": "5.1.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "0735b90f4da94969541dac1da743446e276defa6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/0735b90f4da94969541dac1da743446e276defa6", + "reference": "0735b90f4da94969541dac1da743446e276defa6", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/recursion-context": "^5.0" + }, + "require-dev": { + "phpunit/phpunit": "^10.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "https://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/exporter", + "type": "tidelift" + } + ], + "time": "2025-09-24T06:09:11+00:00" + }, + { + "name": "sebastian/global-state", + "version": "6.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/987bafff24ecc4c9ac418cab1145b96dd6e9cbd9", + "reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "https://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T07:19:19+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/856e7f6a75a84e339195d48c556f23be2ebf75d0", + "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-12-21T08:38:20+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "5.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/202d0e344a580d7f7d04b3fafce6933e59dae906", + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/5.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T07:08:32+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/24ed13d98130f0e7122df55d06c5c4942a577957", + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/3.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T07:06:18+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "5.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "47e34210757a2f37a97dcd207d032e1b01e64c7a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/47e34210757a2f37a97dcd207d032e1b01e64c7a", + "reference": "47e34210757a2f37a97dcd207d032e1b01e64c7a", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "https://github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "security": "https://github.com/sebastianbergmann/recursion-context/security/policy", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/5.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/recursion-context", + "type": "tidelift" + } + ], + "time": "2025-08-10T07:50:56+00:00" + }, + { + "name": "sebastian/type", + "version": "4.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/462699a16464c3944eefc02ebdd77882bd3925bf", + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/4.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T07:10:45+00:00" + }, + { + "name": "sebastian/version", + "version": "4.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c51fa83a5d8f43f1402e3f32a005e6262244ef17", + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/4.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-07T11:34:05+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "b7489ce515e168639d17feec34b8847c326b0b3c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b7489ce515e168639d17feec34b8847c326b0b3c", + "reference": "b7489ce515e168639d17feec34b8847c326b0b3c", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.3.1" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2025-11-17T20:03:58+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": {}, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=8.1" + }, + "platform-dev": {}, + "plugin-api-version": "2.9.0" +} diff --git a/html/aktien.php b/html/aktien.php index cb252b6..bfec0a6 100644 --- a/html/aktien.php +++ b/html/aktien.php @@ -1,5 +1,6 @@ 12) { - $month = 1; - $year++; -} +['month' => $month, 'year' => $year] = fscash_normalize_month_year($month, $year); // Daten abrufen $sql="SELECT @@ -115,24 +110,18 @@ foreach ($entries as $entry): $kaufpreis = (float)$entry['kaufpreis']; $anzahl = (float)$entry['anzahl']; -$kaufSumme = $kaufpreis * $anzahl; - $kurs = isset($entry['kurs']) ? (float)$entry['kurs'] : 0; $kursdatum = $entry['kursdatum']; -$aktuellerWert = $anzahl * $kurs; -$guv = $aktuellerWert - $kaufSumme; +$guvData = fscash_aktie_guv($kaufpreis, $anzahl, $kurs); +$kaufSumme = $guvData['kaufSumme']; +$aktuellerWert = $guvData['aktuellerWert']; +$guv = $guvData['guv']; +$guvClass = $guvData['guvClass']; + $sumKaufSumme += $kaufSumme; $sumAktuellerWert += $aktuellerWert; $sumGuV += $guv; - -$guvClass = ''; -if ($guv > 0) { - $guvClass = 'guv-positive'; -} elseif ($guv < 0) { - $guvClass = 'guv-negative'; -} - ?> diff --git a/html/dashboard.php b/html/dashboard.php index 8a89440..123e0b1 100644 --- a/html/dashboard.php +++ b/html/dashboard.php @@ -1,5 +1,6 @@ 12) { - $month = 1; - $year++; -} +['month' => $month, 'year' => $year] = fscash_normalize_month_year($month, $year); // Daten abrufen $sql="WITH user_names AS ( diff --git a/html/get_symbol.php b/html/get_symbol.php index 76ccec8..0418611 100644 --- a/html/get_symbol.php +++ b/html/get_symbol.php @@ -1,5 +1,7 @@ 12) die + * Jahresgrenze überschritten wird. + * + * @return array{month:int,year:int} + */ +function fscash_normalize_month_year(int $month, int $year): array +{ + if ($month < 1) { + $month = 12; + $year--; + } elseif ($month > 12) { + $month = 1; + $year++; + } + + return ['month' => $month, 'year' => $year]; +} + +/** + * Ermittelt anhand der konfigurierten ID-Listen, ob ein Benutzer Admin- bzw. + * Aktien-Rechte hat. + * + * @param int[] $adminIds + * @param int[] $aktienIds + * @return array{is_admin:bool,is_aktien:bool} + */ +function fscash_user_roles(int $userId, array $adminIds, array $aktienIds): array +{ + return [ + 'is_admin' => in_array($userId, $adminIds, true), + 'is_aktien' => in_array($userId, $aktienIds, true), + ]; +} + +/** + * Berechnet Kaufsumme, aktuellen Wert, Gewinn/Verlust (GuV) und die + * zugehörige CSS-Klasse für einen Aktien-Eintrag. + * + * @return array{kaufSumme:float,aktuellerWert:float,guv:float,guvClass:string} + */ +function fscash_aktie_guv(float $kaufpreis, float $anzahl, float $kurs): array +{ + $kaufSumme = $kaufpreis * $anzahl; + $aktuellerWert = $anzahl * $kurs; + $guv = $aktuellerWert - $kaufSumme; + + $guvClass = ''; + if ($guv > 0) { + $guvClass = 'guv-positive'; + } elseif ($guv < 0) { + $guvClass = 'guv-negative'; + } + + return [ + 'kaufSumme' => $kaufSumme, + 'aktuellerWert' => $aktuellerWert, + 'guv' => $guv, + 'guvClass' => $guvClass, + ]; +} + +/** + * Wählt aus den von der OpenFIGI-API gelieferten Mapping-Einträgen das + * passende Symbol aus. Bevorzugt wird ein Eintrag an der Deutschen Börse + * Xetra (XETR), ansonsten wird der erste Eintrag verwendet. + * + * @param array $figiEntries Der "data"-Teil der OpenFIGI-Antwort. + */ +function fscash_select_figi_symbol(array $figiEntries): ?string +{ + if (empty($figiEntries)) { + return null; + } + + $symbolEntry = null; + foreach ($figiEntries as $entry) { + if (isset($entry['exchCode']) && $entry['exchCode'] === 'XETR') { + $symbolEntry = $entry; + break; + } + } + + if ($symbolEntry === null) { + $symbolEntry = $figiEntries[0]; + } + + if (isset($symbolEntry['ticker']) && !empty($symbolEntry['ticker'])) { + $exchange = $symbolEntry['exchCode'] ?? ''; + return $exchange ? "{$symbolEntry['ticker']}.{$exchange}" : $symbolEntry['ticker']; + } + + return null; +} + +/** + * Ermittelt die im Personenreport ausgewählten Kategorie-IDs: die per + * Request übergebenen, sofern vorhanden, sonst alle verfügbaren. + * + * @param int[] $allCategoryIds Alle in der DB vorhandenen Kategorie-IDs. + * @param mixed $requestedCategoryIds Roher Wert aus $_GET['categories'] (oder null, falls nicht gesetzt). + * @return array + */ +function fscash_resolve_selected_categories(array $allCategoryIds, $requestedCategoryIds): array +{ + if (is_array($requestedCategoryIds) && $requestedCategoryIds !== []) { + return $requestedCategoryIds; + } + + return $allCategoryIds; +} + +/** + * Extrahiert den aktuellen Kurs aus einer Alpha-Vantage GLOBAL_QUOTE-Antwort. + * + * @param array $alphaVantageResponse + */ +function fscash_extract_quote_price(array $alphaVantageResponse): ?float +{ + $price = $alphaVantageResponse['Global Quote']['05. price'] ?? null; + + if ($price === null || $price === '') { + return null; + } + + return (float)$price; +} + +/** + * Wandelt die Alpha-Vantage SYMBOL_SEARCH-Antwort in die vom Frontend + * erwartete, vereinfachte Liste (symbol/name/region) um. + * + * @param array $alphaVantageResponse + * @return array + */ +function fscash_map_symbol_search_results(array $alphaVantageResponse): array +{ + $matches = $alphaVantageResponse['bestMatches'] ?? []; + + $result = []; + foreach ($matches as $match) { + $result[] = [ + 'symbol' => $match['1. symbol'] ?? '', + 'name' => $match['2. name'] ?? '', + 'region' => $match['4. region'] ?? '', + ]; + } + + return $result; +} + +/** + * Prüft, ob die per JSON-Body übermittelten Daten zum Speichern eines + * Aktien-Symbols gültig sind (id und symbol müssen "truthy" sein). + * + * @param mixed $id + * @param mixed $symbol + */ +function fscash_is_valid_symbol_payload($id, $symbol): bool +{ + return (bool)$id && (bool)$symbol; +} + +/** + * Baut aus einem DB-Eintrag des Monatsreports die Zeile für den CSV-Export. + * + * @param array $entry + * @return array + */ +function fscash_format_report_month_csv_row(array $entry): array +{ + return [ + (string)($entry['id'] ?? ''), + (string)($entry['datum'] ?? ''), + (string)($entry['benutzer_name'] ?? ''), + (string)($entry['kategorie_id'] ?? ''), + (string)($entry['kategorie_name'] ?? ''), + (string)($entry['betreff'] ?? ''), + number_format((float)($entry['betrag'] ?? 0), 2, ',', '.'), + (string)($entry['zahlweise'] ?? $entry['zahlungsmethode'] ?? ''), + ]; +} + +/** + * Ermittelt aus allen verfügbaren Migrations-Dateien diejenigen, die laut + * schema_migrations-Tabelle noch nicht angewendet wurden. Die Rückgabe ist + * alphabetisch/numerisch sortiert, damit Migrationen in der richtigen + * Reihenfolge angewendet werden. + * + * @param string[] $availableFiles Absolute oder relative Pfade der *.sql-Dateien. + * @param string[] $appliedFilenames Basenamen der bereits angewendeten Migrationen. + * @return string[] Pfade der noch ausstehenden Migrationen, sortiert. + */ +function fscash_pending_migrations(array $availableFiles, array $appliedFilenames): array +{ + $files = $availableFiles; + sort($files, SORT_STRING); + + return array_values(array_filter( + $files, + fn(string $f): bool => !in_array(basename($f), $appliedFilenames, true) + )); +} diff --git a/html/rep-month.php b/html/rep-month.php index ede26bc..0fed0ab 100644 --- a/html/rep-month.php +++ b/html/rep-month.php @@ -1,16 +1,17 @@ 12) { - $month = 1; - $year++; -} +['month' => $month, 'year' => $year] = fscash_normalize_month_year($month, $year); // Daten für die Summen-Tabelle abrufen $sql_sum = " @@ -94,16 +89,7 @@ if (isset($_GET['export']) && $_GET['export'] === 'csv') { $output = fopen('php://output', 'w'); fputcsv($output, ['ID', 'Datum', 'Benutzer', 'Kat-ID', 'Kategorie', 'Betreff', 'Betrag', 'Zahlungsmethode'], ';'); foreach ($entries_csv as $entry) { - fputcsv($output, [ - $entry['id'] ?? '', - $entry['datum'] ?? '', - $entry['benutzer_name'] ?? '', - $entry['kategorie_id'] ?? '', - $entry['kategorie_name'] ?? '', - $entry['betreff'] ?? '', - number_format($entry['betrag'], 2, ',', '.'), - $entry['zahlungsmethode'] ?? '' - ], ';'); + fputcsv($output, fscash_format_report_month_csv_row($entry), ';'); } fclose($output); exit; diff --git a/html/rep-person.php b/html/rep-person.php index d1aba93..d775e05 100644 --- a/html/rep-person.php +++ b/html/rep-person.php @@ -1,16 +1,17 @@ 12) { - $month = 1; - $year++; -} +['month' => $month, 'year' => $year] = fscash_normalize_month_year($month, $year); // Kategorien aus der Datenbank abrufen $categoryStmt = $pdo->query("SELECT category_id, name FROM categories ORDER BY name"); $categories = $categoryStmt->fetchAll(); // Standardmäßig alle Kategorien auswählen, falls keine Auswahl getroffen wurde -if (array_key_exists('categories', $_GET) && $_GET['categories'] !== []) { - $selectedCategories = $_GET['categories']; -} else { - $selectedCategories = array_column($categories, 'category_id'); -} +$selectedCategories = fscash_resolve_selected_categories( + array_column($categories, 'category_id'), + $_GET['categories'] ?? null +); // Daten abrufen für den ausgewählten Monat und die ausgewählten Kategorien diff --git a/html/save_symbol.php b/html/save_symbol.php index 09267b9..cda1204 100644 --- a/html/save_symbol.php +++ b/html/save_symbol.php @@ -1,5 +1,6 @@ false, 'message' => 'Ungültige Eingabedaten.' diff --git a/html/search_symbol.php b/html/search_symbol.php index d4c7954..2dc199c 100644 --- a/html/search_symbol.php +++ b/html/search_symbol.php @@ -1,5 +1,6 @@ $match['1. symbol'], - 'name' => $match['2. name'], - 'region' => $match['4. region'] - ]; -} +$result = fscash_map_symbol_search_results($data ?? []); echo json_encode($result); diff --git a/html/update_kurse.php b/html/update_kurse.php index a4325c3..34c1460 100644 --- a/html/update_kurse.php +++ b/html/update_kurse.php @@ -1,6 +1,7 @@ exec( $applied = $pdo->query("SELECT filename FROM schema_migrations")->fetchAll(PDO::FETCH_COLUMN); $files = glob($migrationsDir . '/*.sql') ?: []; -sort($files, SORT_STRING); -$pending = array_values(array_filter( - $files, - fn(string $f): bool => !in_array(basename($f), $applied, true) -)); +$pending = fscash_pending_migrations($files, $applied); if (empty($pending)) { echo "Keine neuen Migrationen.\n"; diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..e8fc033 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,13 @@ + + + + + tests + + + diff --git a/tests/FscashTest.php b/tests/FscashTest.php new file mode 100644 index 0000000..6e1c530 --- /dev/null +++ b/tests/FscashTest.php @@ -0,0 +1,307 @@ +assertSame( + ['month' => 6, 'year' => 2026], + fscash_normalize_month_year(6, 2026) + ); + } + + public function testNormalizeMonthYearSpringtBeiUnterschreitungInsVorjahr(): void + { + $this->assertSame( + ['month' => 12, 'year' => 2025], + fscash_normalize_month_year(0, 2026) + ); + } + + public function testNormalizeMonthYearSpringtBeiUeberschreitungInsFolgejahr(): void + { + $this->assertSame( + ['month' => 1, 'year' => 2027], + fscash_normalize_month_year(13, 2026) + ); + } + + public function testNormalizeMonthYearGrenzwerteBleibenUnveraendert(): void + { + $this->assertSame(['month' => 1, 'year' => 2026], fscash_normalize_month_year(1, 2026)); + $this->assertSame(['month' => 12, 'year' => 2026], fscash_normalize_month_year(12, 2026)); + } + + // --- fscash_user_roles -------------------------------------------- + + public function testUserRolesErkenntAdminUndAktienUser(): void + { + $this->assertSame( + ['is_admin' => true, 'is_aktien' => true], + fscash_user_roles(1, [1, 2], [1, 2]) + ); + } + + public function testUserRolesErkenntNormalenUserOhneRechte(): void + { + $this->assertSame( + ['is_admin' => false, 'is_aktien' => false], + fscash_user_roles(99, [1, 2], [1, 2]) + ); + } + + public function testUserRolesVergleichtStriktTypisiert(): void + { + // "1" (string) darf ein int 1 in der Liste nicht faelschlich matchen, + // da fscash_user_roles ausschliesslich mit int-typisierten IDs arbeitet + // und in_array(..., true) strikt vergleicht. + $this->assertSame( + ['is_admin' => true, 'is_aktien' => false], + fscash_user_roles(2, [1, 2], [1]) + ); + } + + // --- fscash_aktie_guv ------------------------------------------------ + + public function testAktieGuvBerechnetGewinn(): void + { + $result = fscash_aktie_guv(100.0, 10.0, 120.0); + + $this->assertSame(1000.0, $result['kaufSumme']); + $this->assertSame(1200.0, $result['aktuellerWert']); + $this->assertSame(200.0, $result['guv']); + $this->assertSame('guv-positive', $result['guvClass']); + } + + public function testAktieGuvBerechnetVerlust(): void + { + $result = fscash_aktie_guv(100.0, 10.0, 80.0); + + $this->assertSame(-200.0, $result['guv']); + $this->assertSame('guv-negative', $result['guvClass']); + } + + public function testAktieGuvBeiGleichbleibendemKursOhneKlasse(): void + { + $result = fscash_aktie_guv(50.0, 4.0, 50.0); + + $this->assertSame(0.0, $result['guv']); + $this->assertSame('', $result['guvClass']); + } + + public function testAktieGuvOhneKursErgibtNegativenGuvGleichKaufsumme(): void + { + // kurs = 0 (noch keine Kursaktualisierung erfolgt) + $result = fscash_aktie_guv(100.0, 3.0, 0.0); + + $this->assertSame(300.0, $result['kaufSumme']); + $this->assertSame(0.0, $result['aktuellerWert']); + $this->assertSame(-300.0, $result['guv']); + $this->assertSame('guv-negative', $result['guvClass']); + } + + // --- fscash_select_figi_symbol -------------------------------------- + + public function testSelectFigiSymbolBevorzugtXetraEintrag(): void + { + $entries = [ + ['ticker' => 'FOO', 'exchCode' => 'US'], + ['ticker' => 'BAR', 'exchCode' => 'XETR'], + ]; + + $this->assertSame('BAR.XETR', fscash_select_figi_symbol($entries)); + } + + public function testSelectFigiSymbolNimmtErstenEintragOhneXetra(): void + { + $entries = [ + ['ticker' => 'FOO', 'exchCode' => 'US'], + ['ticker' => 'BAZ', 'exchCode' => 'LSE'], + ]; + + $this->assertSame('FOO.US', fscash_select_figi_symbol($entries)); + } + + public function testSelectFigiSymbolOhneExchCode(): void + { + $entries = [ + ['ticker' => 'FOO'], + ]; + + $this->assertSame('FOO', fscash_select_figi_symbol($entries)); + } + + public function testSelectFigiSymbolBeiLeeremTickerLiefertNull(): void + { + $entries = [ + ['ticker' => '', 'exchCode' => 'US'], + ]; + + $this->assertNull(fscash_select_figi_symbol($entries)); + } + + public function testSelectFigiSymbolBeiLeererListeLiefertNull(): void + { + $this->assertNull(fscash_select_figi_symbol([])); + } + + // --- fscash_resolve_selected_categories ------------------------------ + + public function testResolveSelectedCategoriesMitAuswahl(): void + { + $this->assertSame( + [2, 3], + fscash_resolve_selected_categories([1, 2, 3, 4], [2, 3]) + ); + } + + public function testResolveSelectedCategoriesOhneAuswahlLiefertAlle(): void + { + $this->assertSame( + [1, 2, 3, 4], + fscash_resolve_selected_categories([1, 2, 3, 4], null) + ); + } + + public function testResolveSelectedCategoriesBeiLeeremArrayLiefertAlle(): void + { + // Ein leeres categories[]-Array (z.B. alle Haken entfernt) fällt + // bewusst auf "alle Kategorien" zurück, siehe rep-person.php. + $this->assertSame( + [1, 2, 3, 4], + fscash_resolve_selected_categories([1, 2, 3, 4], []) + ); + } + + // --- fscash_extract_quote_price -------------------------------------- + + public function testExtractQuotePriceLiestPreisAus(): void + { + $response = ['Global Quote' => ['05. price' => '123.4500']]; + + $this->assertSame(123.45, fscash_extract_quote_price($response)); + } + + public function testExtractQuotePriceBeiFehlendemFeldLiefertNull(): void + { + $this->assertNull(fscash_extract_quote_price(['Global Quote' => []])); + $this->assertNull(fscash_extract_quote_price([])); + } + + public function testExtractQuotePriceBeiLeeremStringLiefertNull(): void + { + $this->assertNull(fscash_extract_quote_price(['Global Quote' => ['05. price' => '']])); + } + + // --- fscash_map_symbol_search_results --------------------------------- + + public function testMapSymbolSearchResultsWandeltAlphaVantageFormatUm(): void + { + $response = [ + 'bestMatches' => [ + ['1. symbol' => 'SAP.DE', '2. name' => 'SAP SE', '4. region' => 'Frankfurt'], + ], + ]; + + $this->assertSame( + [['symbol' => 'SAP.DE', 'name' => 'SAP SE', 'region' => 'Frankfurt']], + fscash_map_symbol_search_results($response) + ); + } + + public function testMapSymbolSearchResultsOhneTrefferLiefertLeeresArray(): void + { + $this->assertSame([], fscash_map_symbol_search_results([])); + $this->assertSame([], fscash_map_symbol_search_results(['bestMatches' => []])); + } + + // --- fscash_is_valid_symbol_payload ----------------------------------- + + public function testIsValidSymbolPayloadMitGueltigenWerten(): void + { + $this->assertTrue(fscash_is_valid_symbol_payload(42, 'SAP.DE')); + $this->assertTrue(fscash_is_valid_symbol_payload('42', 'SAP.DE')); + } + + public function testIsValidSymbolPayloadOhneIdOderSymbolIstUngueltig(): void + { + $this->assertFalse(fscash_is_valid_symbol_payload(null, 'SAP.DE')); + $this->assertFalse(fscash_is_valid_symbol_payload(42, null)); + $this->assertFalse(fscash_is_valid_symbol_payload(0, 'SAP.DE')); + $this->assertFalse(fscash_is_valid_symbol_payload(42, '')); + } + + // --- fscash_format_report_month_csv_row -------------------------------- + + public function testFormatReportMonthCsvRow(): void + { + $entry = [ + 'id' => 5, + 'datum' => '2026-07-01', + 'benutzer_name' => 'Alice', + 'kategorie_id' => 3, + 'kategorie_name' => 'Einkaufen', + 'betreff' => 'Wocheneinkauf', + 'betrag' => 1234.5, + 'zahlungsmethode' => 'Karte', + ]; + + $this->assertSame( + ['5', '2026-07-01', 'Alice', '3', 'Einkaufen', 'Wocheneinkauf', '1.234,50', 'Karte'], + fscash_format_report_month_csv_row($entry) + ); + } + + public function testFormatReportMonthCsvRowMitFehlendenFeldern(): void + { + $this->assertSame( + ['', '', '', '', '', '', '0,00', ''], + fscash_format_report_month_csv_row([]) + ); + } + + // --- fscash_pending_migrations ------------------------------------------ + + public function testPendingMigrationsFiltertBereitsAngewendete(): void + { + $available = ['/m/0002_add_col.sql', '/m/0001_init.sql', '/m/0003_index.sql']; + $applied = ['0001_init.sql']; + + $this->assertSame( + ['/m/0002_add_col.sql', '/m/0003_index.sql'], + fscash_pending_migrations($available, $applied) + ); + } + + public function testPendingMigrationsSortiertNumerischAlsString(): void + { + $available = ['/m/0010_b.sql', '/m/0002_a.sql']; + + $this->assertSame( + ['/m/0002_a.sql', '/m/0010_b.sql'], + fscash_pending_migrations($available, []) + ); + } + + public function testPendingMigrationsBeiAllenAngewendetLiefertLeeresArray(): void + { + $available = ['/m/0001_init.sql']; + $applied = ['0001_init.sql']; + + $this->assertSame([], fscash_pending_migrations($available, $applied)); + } +} diff --git a/tests/run.sh b/tests/run.sh new file mode 100755 index 0000000..7fc9179 --- /dev/null +++ b/tests/run.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# +# Führt die PHPUnit-Testsuite aus. Wird von update.sh vor jedem Deploy +# automatisch aufgerufen (siehe README/migrations für die Gesamt-Pipeline). +# +# Voraussetzung: `composer install` wurde im Projektverzeichnis ausgeführt +# (vendor/bin/phpunit muss existieren). + +set -euo pipefail + +PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$PROJECT_DIR" + +if [ ! -x vendor/bin/phpunit ]; then + echo "FEHLER: vendor/bin/phpunit fehlt - bitte zuerst 'composer install' ausführen." >&2 + exit 1 +fi + +vendor/bin/phpunit --colors=never diff --git a/update.sh b/update.sh index 591b420..4512a80 100755 --- a/update.sh +++ b/update.sh @@ -40,7 +40,20 @@ while IFS= read -r -d '' file; do php -l "$file" >/dev/null || fail "Syntaxfehler in $file - es wird nichts kopiert." done < <(find html -name '*.php' -print0) -# --- 4. Dateien kopieren, config.php bleibt unangetastet --- +# --- 4. Unit-Tests: müssen grün sein, bevor irgendetwas deployt wird --- +if [ -f tests/run.sh ]; then + if [ ! -x vendor/bin/phpunit ]; then + command -v composer >/dev/null 2>&1 || fail "composer ist nicht installiert - wird für die Tests benötigt." + log "Installiere Test-Abhängigkeiten (composer install)..." + composer install --no-interaction --no-progress + fi + log "Führe Tests aus..." + bash tests/run.sh || fail "Tests fehlgeschlagen - es wird nichts deployt. Siehe Ausgabe oben." +else + log "Noch keine Tests vorhanden - werden später ergänzt." +fi + +# --- 5. Dateien kopieren, config.php bleibt unangetastet --- log "Kopiere Dateien nach $WEBROOT..." config_backup="" if [ -f "$CONFIG_FILE" ]; then @@ -55,18 +68,10 @@ if [ -n "$config_backup" ]; then rm -f "$config_backup" fi -# --- 5. Datenbank-Migrationen --- +# --- 6. Datenbank-Migrationen --- if [ -d migrations ] && [ -f migrations/run_migrations.php ]; then log "Wende Datenbank-Migrationen an..." php migrations/run_migrations.php "$CONFIG_FILE" fi -# --- 6. Tests --- -if [ -f tests/run.sh ]; then - log "Führe Tests aus..." - bash tests/run.sh -else - log "Noch keine Tests vorhanden - werden später ergänzt." -fi - log "Update abgeschlossen."