3 Commits

Author SHA1 Message Date
1d9def792a chore: implement basic tests
All checks were successful
Build Test / build (pull_request) Successful in 13s
PHP Tests / test (pull_request) Successful in 53s
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
2026-02-11 01:40:28 -05:00
b7ca700c9f Merge pull request 'fix(deps): update dependency pinia to v3' (#16) from renovate/pinia-3.x into main
Reviewed-on: #16
2026-02-11 06:16:59 +00:00
a5fd01ed17 fix(deps): update dependency pinia to v3
All checks were successful
Build Test / build (pull_request) Successful in 16s
2026-02-11 06:14:57 +00:00
8 changed files with 75 additions and 212 deletions

View 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

1
.gitignore vendored
View File

@@ -16,6 +16,7 @@ node_modules/
/vendor/
coverage/
phpunit.xml.cache
.phpunit.cache
.phpunit.result.cache
.php-cs-fixer.cache
.phpstan.cache

58
package-lock.json generated
View File

@@ -18,7 +18,7 @@
"@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",
@@ -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": {

View File

@@ -26,7 +26,7 @@
"@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
tests/php/BaseTest.php Normal file
View 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));
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}