Compare commits
19 Commits
91352a8381
...
chore/impl
| Author | SHA1 | Date | |
|---|---|---|---|
| 1d9def792a | |||
| b7ca700c9f | |||
| a5fd01ed17 | |||
| 3ac0db52d7 | |||
| 033a02ec42 | |||
| 852a1bc2cd | |||
| 4b0de4440d | |||
| 08df85dd9d | |||
| df67cb7143 | |||
| 67cb0577c8 | |||
| f5bcf1328f | |||
| 02a03d0265 | |||
| c9b02d68fb | |||
| 725b2b3ffe | |||
| 3415423a6e | |||
| f2f0ee2303 | |||
| 8bd991d6e6 | |||
| 8da2651352 | |||
| ee613d6de4 |
24
.gitea/workflows/php-tests.yml
Normal file
24
.gitea/workflows/php-tests.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
name: PHP Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6.0.2
|
||||
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.5'
|
||||
tools: composer:v2
|
||||
extensions: ctype, iconv, mongodb
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --prefer-dist --no-progress
|
||||
|
||||
- name: Run tests
|
||||
run: composer test
|
||||
@@ -18,6 +18,12 @@ jobs:
|
||||
node-version: 24
|
||||
cache: npm
|
||||
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.5'
|
||||
tools: composer:v2
|
||||
|
||||
- name: Install Renovate
|
||||
run: npm install -g renovate
|
||||
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -16,6 +16,7 @@ node_modules/
|
||||
/vendor/
|
||||
coverage/
|
||||
phpunit.xml.cache
|
||||
.phpunit.cache
|
||||
.phpunit.result.cache
|
||||
.php-cs-fixer.cache
|
||||
.phpstan.cache
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"mongodb/mongodb": "^2.1",
|
||||
"php-di/php-di": "*",
|
||||
"phpseclib/phpseclib": "^3.0",
|
||||
"symfony/console": "^7.0"
|
||||
"symfony/console": "^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^11.0"
|
||||
|
||||
66
composer.lock
generated
66
composer.lock
generated
@@ -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": "2798ba3263d47fe84e91ee7dfd47e310",
|
||||
"content-hash": "accd125174ac14ce0fb36ba84345d856",
|
||||
"packages": [
|
||||
{
|
||||
"name": "laravel/serializable-closure",
|
||||
@@ -393,16 +393,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpseclib/phpseclib",
|
||||
"version": "3.0.48",
|
||||
"version": "3.0.49",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpseclib/phpseclib.git",
|
||||
"reference": "64065a5679c50acb886e82c07aa139b0f757bb89"
|
||||
"reference": "6233a1e12584754e6b5daa69fe1289b47775c1b9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/64065a5679c50acb886e82c07aa139b0f757bb89",
|
||||
"reference": "64065a5679c50acb886e82c07aa139b0f757bb89",
|
||||
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/6233a1e12584754e6b5daa69fe1289b47775c1b9",
|
||||
"reference": "6233a1e12584754e6b5daa69fe1289b47775c1b9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -483,7 +483,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/phpseclib/phpseclib/issues",
|
||||
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.48"
|
||||
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.49"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -499,7 +499,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2025-12-15T11:51:42+00:00"
|
||||
"time": "2026-01-27T09:17:28+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/container",
|
||||
@@ -606,47 +606,39 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v7.4.3",
|
||||
"version": "v8.0.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "732a9ca6cd9dfd940c639062d5edbde2f6727fb6"
|
||||
"reference": "ace03c4cf9805080ff40cbeec69fca180c339a3b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/732a9ca6cd9dfd940c639062d5edbde2f6727fb6",
|
||||
"reference": "732a9ca6cd9dfd940c639062d5edbde2f6727fb6",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/ace03c4cf9805080ff40cbeec69fca180c339a3b",
|
||||
"reference": "ace03c4cf9805080ff40cbeec69fca180c339a3b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"symfony/deprecation-contracts": "^2.5|^3",
|
||||
"symfony/polyfill-mbstring": "~1.0",
|
||||
"php": ">=8.4",
|
||||
"symfony/polyfill-mbstring": "^1.0",
|
||||
"symfony/service-contracts": "^2.5|^3",
|
||||
"symfony/string": "^7.2|^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/dependency-injection": "<6.4",
|
||||
"symfony/dotenv": "<6.4",
|
||||
"symfony/event-dispatcher": "<6.4",
|
||||
"symfony/lock": "<6.4",
|
||||
"symfony/process": "<6.4"
|
||||
"symfony/string": "^7.4|^8.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/log-implementation": "1.0|2.0|3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/log": "^1|^2|^3",
|
||||
"symfony/config": "^6.4|^7.0|^8.0",
|
||||
"symfony/dependency-injection": "^6.4|^7.0|^8.0",
|
||||
"symfony/event-dispatcher": "^6.4|^7.0|^8.0",
|
||||
"symfony/http-foundation": "^6.4|^7.0|^8.0",
|
||||
"symfony/http-kernel": "^6.4|^7.0|^8.0",
|
||||
"symfony/lock": "^6.4|^7.0|^8.0",
|
||||
"symfony/messenger": "^6.4|^7.0|^8.0",
|
||||
"symfony/process": "^6.4|^7.0|^8.0",
|
||||
"symfony/stopwatch": "^6.4|^7.0|^8.0",
|
||||
"symfony/var-dumper": "^6.4|^7.0|^8.0"
|
||||
"symfony/config": "^7.4|^8.0",
|
||||
"symfony/dependency-injection": "^7.4|^8.0",
|
||||
"symfony/event-dispatcher": "^7.4|^8.0",
|
||||
"symfony/http-foundation": "^7.4|^8.0",
|
||||
"symfony/http-kernel": "^7.4|^8.0",
|
||||
"symfony/lock": "^7.4|^8.0",
|
||||
"symfony/messenger": "^7.4|^8.0",
|
||||
"symfony/process": "^7.4|^8.0",
|
||||
"symfony/stopwatch": "^7.4|^8.0",
|
||||
"symfony/var-dumper": "^7.4|^8.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
@@ -680,7 +672,7 @@
|
||||
"terminal"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/console/tree/v7.4.3"
|
||||
"source": "https://github.com/symfony/console/tree/v8.0.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -700,7 +692,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2025-12-23T14:50:43+00:00"
|
||||
"time": "2026-01-13T13:06:50+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/deprecation-contracts",
|
||||
@@ -3135,7 +3127,7 @@
|
||||
],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"stability-flags": {},
|
||||
"prefer-stable": true,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
@@ -3143,6 +3135,6 @@
|
||||
"ext-ctype": "*",
|
||||
"ext-iconv": "*"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.3.0"
|
||||
"platform-dev": {},
|
||||
"plugin-api-version": "2.9.0"
|
||||
}
|
||||
|
||||
92
package-lock.json
generated
92
package-lock.json
generated
@@ -14,11 +14,11 @@
|
||||
"@fontsource/public-sans": "5.1.1",
|
||||
"@fontsource/roboto": "5.1.0",
|
||||
"@mdi/font": "7.4.47",
|
||||
"@tsconfig/node20": "20.1.4",
|
||||
"@tsconfig/node24": "24.0.0",
|
||||
"@typescript-eslint/parser": "^8.18.2",
|
||||
"@vue/compiler-sfc": "^3.5.16",
|
||||
"dompurify": "^3.3.1",
|
||||
"pinia": "2.3.0",
|
||||
"pinia": "3.0.4",
|
||||
"vee-validate": "^4.15.1",
|
||||
"vite-plugin-vuetify": "2.0.4",
|
||||
"vue": "3.5.13",
|
||||
@@ -29,7 +29,7 @@
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.17.0",
|
||||
"@types/dompurify": "^3.0.5",
|
||||
"@types/node": "22.10.2",
|
||||
"@types/node": "24.10.13",
|
||||
"@vitejs/plugin-vue": "5.2.1",
|
||||
"@vue/eslint-config-prettier": "10.1.0",
|
||||
"@vue/tsconfig": "0.7.0",
|
||||
@@ -38,7 +38,7 @@
|
||||
"prettier": "3.4.2",
|
||||
"sass": "1.77.1",
|
||||
"sass-loader": "16.0.4",
|
||||
"typescript": "5.7.2",
|
||||
"typescript": "5.9.3",
|
||||
"typescript-eslint": "^8.18.2",
|
||||
"vite": "6.0.6",
|
||||
"vite-plugin-static-copy": "^3.1.2",
|
||||
@@ -1123,10 +1123,10 @@
|
||||
"win32"
|
||||
]
|
||||
},
|
||||
"node_modules/@tsconfig/node20": {
|
||||
"version": "20.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node20/-/node20-20.1.4.tgz",
|
||||
"integrity": "sha512-sqgsT69YFeLWf5NtJ4Xq/xAF8p4ZQHlmGW74Nu2tD4+g5fAsposc4ZfaaPixVu4y01BEiDCWLRDCvDM5JOsRxg==",
|
||||
"node_modules/@tsconfig/node24": {
|
||||
"version": "24.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node24/-/node24-24.0.0.tgz",
|
||||
"integrity": "sha512-3/6Cr4dELEAucgPIr6ufY7yBYMi4ttZFOewABADNZ+bm4DUZl4dup2VBcBeP1ejj3QblrWVWux/1XcRv/ZVikA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/dompurify": {
|
||||
@@ -1176,13 +1176,13 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "22.10.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.2.tgz",
|
||||
"integrity": "sha512-Xxr6BBRCAOQixvonOye19wnzyDiUtTeqldOOmj3CkeblonbccA12PFwlufvRdrpjXxqnmUaeiU5EOA+7s5diUQ==",
|
||||
"version": "24.10.13",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.13.tgz",
|
||||
"integrity": "sha512-oH72nZRfDv9lADUBSo104Aq7gPHpQZc4BTx38r9xf9pg5LfP6EzSyH2n7qFmmxRQXh7YlUXODcYsg6PuTDSxGg==",
|
||||
"devOptional": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"undici-types": "~6.20.0"
|
||||
"undici-types": "~7.16.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/trusted-types": {
|
||||
@@ -1528,12 +1528,12 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@vue/devtools-kit": {
|
||||
"version": "7.7.7",
|
||||
"resolved": "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.7.7.tgz",
|
||||
"integrity": "sha512-wgoZtxcTta65cnZ1Q6MbAfePVFxfM+gq0saaeytoph7nEa7yMXoi6sCPy4ufO111B9msnw0VOWjPEFCXuAKRHA==",
|
||||
"version": "7.7.9",
|
||||
"resolved": "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.7.9.tgz",
|
||||
"integrity": "sha512-PyQ6odHSgiDVd4hnTP+aDk2X4gl2HmLDfiyEnn3/oV+ckFDuswRs4IbBT7vacMuGdwY/XemxBoh302ctbsptuA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vue/devtools-shared": "^7.7.7",
|
||||
"@vue/devtools-shared": "^7.7.9",
|
||||
"birpc": "^2.3.0",
|
||||
"hookable": "^5.5.3",
|
||||
"mitt": "^3.0.1",
|
||||
@@ -1543,9 +1543,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/devtools-shared": {
|
||||
"version": "7.7.7",
|
||||
"resolved": "https://registry.npmjs.org/@vue/devtools-shared/-/devtools-shared-7.7.7.tgz",
|
||||
"integrity": "sha512-+udSj47aRl5aKb0memBvcUG9koarqnxNM5yjuREvqwK6T3ap4mn3Zqqc17QrBFTqSMjr3HK1cvStEZpMDpfdyw==",
|
||||
"version": "7.7.9",
|
||||
"resolved": "https://registry.npmjs.org/@vue/devtools-shared/-/devtools-shared-7.7.9.tgz",
|
||||
"integrity": "sha512-iWAb0v2WYf0QWmxCGy0seZNDPdO3Sp5+u78ORnyeonS6MT4PC7VPrryX2BpMJrwlDeaZ6BD4vP4XKjK0SZqaeA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"rfdc": "^1.4.1"
|
||||
@@ -3782,20 +3782,19 @@
|
||||
}
|
||||
},
|
||||
"node_modules/pinia": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/pinia/-/pinia-2.3.0.tgz",
|
||||
"integrity": "sha512-ohZj3jla0LL0OH5PlLTDMzqKiVw2XARmC1XYLdLWIPBMdhDW/123ZWr4zVAhtJm+aoSkFa13pYXskAvAscIkhQ==",
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/pinia/-/pinia-3.0.4.tgz",
|
||||
"integrity": "sha512-l7pqLUFTI/+ESXn6k3nu30ZIzW5E2WZF/LaHJEpoq6ElcLD+wduZoB2kBN19du6K/4FDpPMazY2wJr+IndBtQw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vue/devtools-api": "^6.6.3",
|
||||
"vue-demi": "^0.14.10"
|
||||
"@vue/devtools-api": "^7.7.7"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/posva"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": ">=4.4.4",
|
||||
"vue": "^2.7.0 || ^3.5.11"
|
||||
"typescript": ">=4.5.0",
|
||||
"vue": "^3.5.11"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"typescript": {
|
||||
@@ -3803,30 +3802,13 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/pinia/node_modules/vue-demi": {
|
||||
"version": "0.14.10",
|
||||
"resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.10.tgz",
|
||||
"integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==",
|
||||
"hasInstallScript": true,
|
||||
"node_modules/pinia/node_modules/@vue/devtools-api": {
|
||||
"version": "7.7.9",
|
||||
"resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-7.7.9.tgz",
|
||||
"integrity": "sha512-kIE8wvwlcZ6TJTbNeU2HQNtaxLx3a84aotTITUuL/4bzfPxzajGBOoqjMhwZJ8L9qFYDU/lAYMEEm11dnZOD6g==",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"vue-demi-fix": "bin/vue-demi-fix.js",
|
||||
"vue-demi-switch": "bin/vue-demi-switch.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/antfu"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@vue/composition-api": "^1.0.0-rc.1",
|
||||
"vue": "^3.0.0-0 || ^2.6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@vue/composition-api": {
|
||||
"optional": true
|
||||
}
|
||||
"dependencies": {
|
||||
"@vue/devtools-kit": "^7.7.9"
|
||||
}
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
@@ -4591,9 +4573,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.7.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz",
|
||||
"integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==",
|
||||
"version": "5.9.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
|
||||
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
@@ -4628,9 +4610,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz",
|
||||
"integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==",
|
||||
"version": "7.16.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz",
|
||||
"integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==",
|
||||
"devOptional": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
"@fontsource/public-sans": "5.1.1",
|
||||
"@fontsource/roboto": "5.1.0",
|
||||
"@mdi/font": "7.4.47",
|
||||
"@tsconfig/node20": "20.1.4",
|
||||
"@tsconfig/node24": "24.0.0",
|
||||
"@typescript-eslint/parser": "^8.18.2",
|
||||
"@vue/compiler-sfc": "^3.5.16",
|
||||
"dompurify": "^3.3.1",
|
||||
"pinia": "2.3.0",
|
||||
"pinia": "3.0.4",
|
||||
"vee-validate": "^4.15.1",
|
||||
"vite-plugin-vuetify": "2.0.4",
|
||||
"vue": "3.5.13",
|
||||
@@ -37,7 +37,7 @@
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.17.0",
|
||||
"@types/dompurify": "^3.0.5",
|
||||
"@types/node": "22.10.2",
|
||||
"@types/node": "24.10.13",
|
||||
"@vitejs/plugin-vue": "5.2.1",
|
||||
"@vue/eslint-config-prettier": "10.1.0",
|
||||
"@vue/tsconfig": "0.7.0",
|
||||
@@ -46,7 +46,7 @@
|
||||
"prettier": "3.4.2",
|
||||
"sass": "1.77.1",
|
||||
"sass-loader": "16.0.4",
|
||||
"typescript": "5.7.2",
|
||||
"typescript": "5.9.3",
|
||||
"typescript-eslint": "^8.18.2",
|
||||
"vite": "6.0.6",
|
||||
"vite-plugin-static-copy": "^3.1.2",
|
||||
|
||||
29
tests/php/BaseTest.php
Normal file
29
tests/php/BaseTest.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace KTXT;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class BaseTest extends TestCase
|
||||
{
|
||||
public function testBasicAssertion(): void
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
public function testArrayOperations(): void
|
||||
{
|
||||
$array = ['foo' => 'bar'];
|
||||
|
||||
$this->assertArrayHasKey('foo', $array);
|
||||
$this->assertEquals('bar', $array['foo']);
|
||||
}
|
||||
|
||||
public function testStringOperations(): void
|
||||
{
|
||||
$string = 'Hello, World!';
|
||||
|
||||
$this->assertStringContainsString('World', $string);
|
||||
$this->assertEquals(13, strlen($string));
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace KTXF\Json;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Test for JsonSerializableObject base functionality
|
||||
*/
|
||||
class JsonSerializableObjectTest extends TestCase
|
||||
{
|
||||
public function testJsonSerializeReturnsObjectVars(): void
|
||||
{
|
||||
$testObject = new class extends JsonSerializableObject {
|
||||
public string $publicProperty = 'test';
|
||||
private string $privateProperty = 'private';
|
||||
protected string $protectedProperty = 'protected';
|
||||
};
|
||||
|
||||
$serialized = $testObject->jsonSerialize();
|
||||
|
||||
$this->assertIsArray($serialized);
|
||||
$this->assertArrayHasKey('publicProperty', $serialized);
|
||||
$this->assertEquals('test', $serialized['publicProperty']);
|
||||
$this->assertArrayHasKey('protectedProperty', $serialized); // get_object_vars includes protected
|
||||
$this->assertEquals('protected', $serialized['protectedProperty']);
|
||||
$this->assertArrayNotHasKey('privateProperty', $serialized); // but not private
|
||||
}
|
||||
|
||||
public function testJsonDeserializeSetsProperties(): void
|
||||
{
|
||||
$testObject = new class extends JsonSerializableObject {
|
||||
public string $name = '';
|
||||
public int $age = 0;
|
||||
};
|
||||
|
||||
$data = [
|
||||
'name' => 'John Doe',
|
||||
'age' => 30,
|
||||
'nonexistent' => 'ignored'
|
||||
];
|
||||
|
||||
$result = $testObject->jsonDeserialize($data);
|
||||
|
||||
$this->assertSame($testObject, $result);
|
||||
$this->assertEquals('John Doe', $testObject->name);
|
||||
$this->assertEquals(30, $testObject->age);
|
||||
$this->assertObjectNotHasProperty('nonexistent', $testObject);
|
||||
}
|
||||
|
||||
public function testJsonDeserializeHandlesJsonString(): void
|
||||
{
|
||||
$testObject = new class extends JsonSerializableObject {
|
||||
public string $message = '';
|
||||
};
|
||||
|
||||
$jsonString = '{"message": "Hello World"}';
|
||||
$testObject->jsonDeserialize($jsonString);
|
||||
|
||||
$this->assertEquals('Hello World', $testObject->message);
|
||||
}
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Test for IndividualObject JsonSerializable functionality
|
||||
*/
|
||||
class IndividualObjectTest extends TestCase
|
||||
{
|
||||
public function testJsonSerialization(): void
|
||||
{
|
||||
// Create an IndividualObject instance
|
||||
$individual = new IndividualObject();
|
||||
|
||||
// Set some basic properties
|
||||
$individual->urid = 'test-urid-123';
|
||||
$individual->label = 'Test Individual';
|
||||
$individual->language = 'en';
|
||||
|
||||
// Set name
|
||||
$individual->names->First = 'John';
|
||||
$individual->names->Last = 'Doe';
|
||||
$individual->names->Prefix = 'Mr.';
|
||||
|
||||
// Add an alias
|
||||
$alias = new IndividualAliasObject();
|
||||
$alias->label = 'Johnny';
|
||||
$individual->names->Aliases[] = $alias;
|
||||
|
||||
// Serialize to JSON
|
||||
$json = json_encode($individual);
|
||||
|
||||
// Verify JSON structure
|
||||
$this->assertJson($json);
|
||||
|
||||
$data = json_decode($json, true);
|
||||
$this->assertEquals('individual', $data['type']);
|
||||
$this->assertEquals(1, $data['version']);
|
||||
$this->assertEquals('test-urid-123', $data['urid']);
|
||||
$this->assertEquals('Test Individual', $data['label']);
|
||||
$this->assertEquals('en', $data['language']);
|
||||
$this->assertEquals('John', $data['names']['First']);
|
||||
$this->assertEquals('Doe', $data['names']['Last']);
|
||||
$this->assertEquals('Mr.', $data['names']['Prefix']);
|
||||
$this->assertCount(1, $data['names']['Aliases']);
|
||||
$this->assertEquals('Johnny', $data['names']['Aliases'][0]['label']);
|
||||
}
|
||||
|
||||
public function testJsonDeserialization(): void
|
||||
{
|
||||
$jsonData = [
|
||||
'type' => 'individual',
|
||||
'version' => 1,
|
||||
'urid' => 'test-urid-456',
|
||||
'label' => 'Deserialized Individual',
|
||||
'language' => 'fr',
|
||||
'names' => [
|
||||
'First' => 'Jane',
|
||||
'Last' => 'Smith',
|
||||
'Prefix' => 'Ms.',
|
||||
'Aliases' => [
|
||||
['label' => 'Janie']
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
$individual = new IndividualObject();
|
||||
$individual->jsonDeserialize($jsonData);
|
||||
|
||||
$this->assertEquals('test-urid-456', $individual->urid);
|
||||
$this->assertEquals('Deserialized Individual', $individual->label);
|
||||
$this->assertEquals('fr', $individual->language);
|
||||
$this->assertEquals('Jane', $individual->names->First);
|
||||
$this->assertEquals('Smith', $individual->names->Last);
|
||||
$this->assertEquals('Ms.', $individual->names->Prefix);
|
||||
$this->assertCount(1, $individual->names->Aliases);
|
||||
$this->assertEquals('Janie', $individual->names->Aliases[0]->label);
|
||||
}
|
||||
|
||||
public function testJsonRoundTrip(): void
|
||||
{
|
||||
// Create original object
|
||||
$original = new IndividualObject();
|
||||
$original->urid = 'round-trip-urid';
|
||||
$original->label = 'Round Trip Test';
|
||||
$original->names->First = 'Alice';
|
||||
$original->names->Last = 'Wonderland';
|
||||
|
||||
// Serialize and deserialize
|
||||
$json = json_encode($original);
|
||||
$deserialized = new IndividualObject();
|
||||
$deserialized->jsonDeserialize($json);
|
||||
|
||||
// Verify round-trip integrity
|
||||
$this->assertEquals($original->urid, $deserialized->urid);
|
||||
$this->assertEquals($original->label, $deserialized->label);
|
||||
$this->assertEquals($original->names->First, $deserialized->names->First);
|
||||
$this->assertEquals($original->names->Last, $deserialized->names->Last);
|
||||
|
||||
// Verify JSON representations are identical
|
||||
$originalJson = json_encode($original);
|
||||
$deserializedJson = json_encode($deserialized);
|
||||
$this->assertJsonStringEqualsJsonString($originalJson, $deserializedJson);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user